From e1af4d0ac0332471d2cc52f569e6db613db770d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Dec 2018 20:08:22 +0100 Subject: [PATCH 1/3] make classes final --- .travis.yml | 15 ++++++++++++++- composer.json | 8 +++++--- infection.json | 19 +++++++++++++++++++ src/Json.php | 2 +- tests/JsonTest.php | 2 +- 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 infection.json diff --git a/.travis.yml b/.travis.yml index 95ceb79..d618b12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ php: - 7.1 - 7.2 - 7.3 - - nightly os: linux @@ -27,6 +26,7 @@ stages: - static code analysis - test - test with coverage + - infection before_install: - stty cols 130 @@ -67,6 +67,7 @@ jobs: env: COMPOSER_FLAGS="" script: - composer validate + - composer normalize --dry-run - stage: static code analysis php: 7.1 @@ -89,5 +90,17 @@ jobs: - COMPOSER_FLAGS="" script: vendor/bin/phpstan analyse -l max -c phpstan.neon --autoload-file=vendor/autoload.php --memory-limit=768M --no-progress src tests + - stage: infection + php: 7.1 + env: + - COVERAGE=yes + - COMPOSER_FLAGS="" + before_install: + - stty cols 120 + - echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - travis_retry composer self-update + script: vendor/bin/infection --min-covered-msi=95 --min-msi=95 + notifications: email: false diff --git a/composer.json b/composer.json index 15e97d1..c6b6e8a 100644 --- a/composer.json +++ b/composer.json @@ -19,19 +19,21 @@ } ], "require": { - "ext-json": "*", "php": "^7.1", + "ext-json": "*", "daverandom/exceptional-json": "^1.0.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.13", + "infection/infection": "^0.11.2", + "localheinz/composer-normalize": "^1.0.0", + "localheinz/phpstan-rules": "^0.4", "pepakriz/phpstan-exception-rules": "^0.3", "phpstan/phpstan": "^0.10", - "phpstan/phpstan-beberlei-assert": "^0.10", "phpstan/phpstan-deprecation-rules": "^0.10", "phpstan/phpstan-phpunit": "^0.10", "phpstan/phpstan-strict-rules": "^0.10", - "phpunit/phpunit": "^7.3", + "phpunit/phpunit": "^7.4", "squizlabs/php_codesniffer": "^3.3" }, "autoload": { diff --git a/infection.json b/infection.json new file mode 100644 index 0000000..1bfa682 --- /dev/null +++ b/infection.json @@ -0,0 +1,19 @@ +{ + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "phpUnit": { + "configDir": ".", + "customPath": "vendor/phpunit/phpunit/phpunit" + }, + "mutators": { + "@default": true + }, + "logs": { + "text": "infection-log.log", + "debug": "infection-debug.log" + } +} \ No newline at end of file diff --git a/src/Json.php b/src/Json.php index 3fc48c2..e963631 100644 --- a/src/Json.php +++ b/src/Json.php @@ -11,7 +11,7 @@ declare(strict_types = 1); namespace JsonClass; -class Json +final class Json { /** * Returns the JSON representation of a value. diff --git a/tests/JsonTest.php b/tests/JsonTest.php index dd318da..32eb225 100644 --- a/tests/JsonTest.php +++ b/tests/JsonTest.php @@ -22,7 +22,7 @@ use JsonClass\Json; use PHPUnit\Framework\TestCase; -class JsonTest extends TestCase +final class JsonTest extends TestCase { /** * @var Json From 789333a571ab550847a7b00eae8666a465aa485b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Dec 2018 20:14:56 +0100 Subject: [PATCH 2/3] update phpstan config --- phpstan.neon | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index ae67777..533db5f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,16 +3,17 @@ parameters: - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/src/Util/Tokens.php includes: - - vendor/phpstan/phpstan-strict-rules/rules.neon - - vendor/phpstan/phpstan-phpunit/extension.neon - - vendor/phpstan/phpstan-phpunit/rules.neon - - vendor/pepakriz/phpstan-exception-rules/extension.neon - - vendor/phpstan/phpstan-deprecation-rules/rules.neon - - vendor/phpstan/phpstan-beberlei-assert/extension.neon + - vendor/phpstan/phpstan-strict-rules/rules.neon + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/phpstan/phpstan-phpunit/rules.neon + - vendor/pepakriz/phpstan-exception-rules/extension.neon + - vendor/phpstan/phpstan-deprecation-rules/rules.neon + - vendor/phpstan/phpstan-beberlei-assert/extension.neon + - vendor/localheinz/phpstan-rules/rules.neon parameters: - exceptionRules: - reportUnusedCatchesOfUncheckedExceptions: false - uncheckedExceptions: [] + exceptionRules: + reportUnusedCatchesOfUncheckedExceptions: false + uncheckedExceptions: [] excludes_analyse: - */tests/*/data/* ignoreErrors: From 332a4ddfd707ac968010d2dfc91f2d6363a8850f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Dec 2018 20:48:31 +0100 Subject: [PATCH 3/3] remove infection --- .travis.yml | 13 ------------- composer.json | 1 - infection.json | 19 ------------------- 3 files changed, 33 deletions(-) delete mode 100644 infection.json diff --git a/.travis.yml b/.travis.yml index d618b12..ae934a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,6 @@ stages: - static code analysis - test - test with coverage - - infection before_install: - stty cols 130 @@ -90,17 +89,5 @@ jobs: - COMPOSER_FLAGS="" script: vendor/bin/phpstan analyse -l max -c phpstan.neon --autoload-file=vendor/autoload.php --memory-limit=768M --no-progress src tests - - stage: infection - php: 7.1 - env: - - COVERAGE=yes - - COMPOSER_FLAGS="" - before_install: - - stty cols 120 - - echo 'opcache.enable=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo 'opcache.enable_cli=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - travis_retry composer self-update - script: vendor/bin/infection --min-covered-msi=95 --min-msi=95 - notifications: email: false diff --git a/composer.json b/composer.json index c6b6e8a..32d9ffb 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.13", - "infection/infection": "^0.11.2", "localheinz/composer-normalize": "^1.0.0", "localheinz/phpstan-rules": "^0.4", "pepakriz/phpstan-exception-rules": "^0.3", diff --git a/infection.json b/infection.json deleted file mode 100644 index 1bfa682..0000000 --- a/infection.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "timeout": 10, - "source": { - "directories": [ - "src" - ] - }, - "phpUnit": { - "configDir": ".", - "customPath": "vendor/phpunit/phpunit/phpunit" - }, - "mutators": { - "@default": true - }, - "logs": { - "text": "infection-log.log", - "debug": "infection-debug.log" - } -} \ No newline at end of file