From 6deb6beb78eb0aea9b8fbe76468660ecc545b8ad Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Wed, 4 May 2016 06:14:29 +0000 Subject: [PATCH 1/3] Test for PSR2 coding standards --- .travis.yml | 2 ++ composer.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 20bf180..50845db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,5 @@ install: script: - ./vendor/bin/phpunit -c ./phpunit.xml --coverage-text --strict + - ./vendor/bin/phpcs --standard=PSR2 src + - ./vendor/bin/phpcs --standard=PSR2 tests diff --git a/composer.json b/composer.json index fbaf816..5080058 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.*" }, "autoload": { "psr-4": { From fbe9ee0a4068a16a431b85008c78925e5961c76e Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Wed, 4 May 2016 06:43:18 +0000 Subject: [PATCH 2/3] Also test PHP7 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 50845db..2ccaea0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ +sudo: false language: php php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm install: @@ -14,3 +16,6 @@ script: - ./vendor/bin/phpunit -c ./phpunit.xml --coverage-text --strict - ./vendor/bin/phpcs --standard=PSR2 src - ./vendor/bin/phpcs --standard=PSR2 tests + +matrix: + fast_finish: true From 4882dcce64fc0c683d8208dc073438ddff719ee9 Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Wed, 4 May 2016 06:44:13 +0000 Subject: [PATCH 3/3] Boolean should be compared strictly --- src/AbstractEnum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AbstractEnum.php b/src/AbstractEnum.php index 3829ca2..5272ce6 100644 --- a/src/AbstractEnum.php +++ b/src/AbstractEnum.php @@ -67,7 +67,7 @@ public static function exists($value) */ public static function assertExists($value) { - if (static::exists($value) == false) { + if (static::exists($value) === false) { $class = substr(strrchr(get_called_class(), '\\'), 1); throw new \InvalidArgumentException(sprintf('"%s" is not a valid %s value.', $value, $class)); }