From ab9e8d7a556b0e5a7b9528e53a263c7aa8cbed5f Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:32:41 +0100 Subject: [PATCH 01/14] add editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e15c22a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*.{css,html,js,json,latte,neon,php,twig,xml,yaml,yml}] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 From 070697e366b69d2521e8b4d2bfb4c564570df3b5 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:32:52 +0100 Subject: [PATCH 02/14] travis: drop PHP 7.1, add PHP 7.4 --- .travis.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56f3376..cc8e48e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ language: php -sudo: false - php: - - 7.1 - 7.2 - 7.3 + - '7.4snapshot' install: # install composer dependencies @@ -14,12 +12,16 @@ install: script: # run tests - vendor/bin/phpunit --coverage-clover coverage.xml + # turn off XDebug - phpenv config-rm xdebug.ini || return 0 + # check coding standard (defined in composer.json "scripts" section) - composer check-cs + # check with phpstan (defined in composer.json "scripts" section) - composer phpstan + # run PHP_CodeSniffer with ruleset - vendor/bin/phpcs src tests -sp --standard=src/ObjectCalisthenics/ruleset.xml --extensions=php @@ -31,5 +33,5 @@ after_script: # do not send success notifications, they have no value notifications: - email: - on_success: never + email: + on_success: never From 8f51c2bcb7fb8424ece75c7780eb30f63dca2a8b Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:33:01 +0100 Subject: [PATCH 03/14] composer: update deps, require PHP 7.2 --- composer.json | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 1977d32..73e5154 100644 --- a/composer.json +++ b/composer.json @@ -4,18 +4,18 @@ "license": "MIT", "type": "phpcodesniffer-standard", "require": { - "php": "^7.1", - "squizlabs/php_codesniffer": "^3.4", - "nette/utils": "^2.5|^3.0", - "slevomat/coding-standard": "^5.0" + "php": "^7.2", + "squizlabs/php_codesniffer": "^3.5", + "nette/utils": "^3.0", + "slevomat/coding-standard": "^5.0.4" }, "require-dev": { - "phpunit/phpunit": "^7.5|^8.0", - "phpstan/phpstan": "^0.11.4", - "symplify/easy-coding-standard-tester": "^5.4", - "symplify/coding-standard": "^5.4", - "symplify/changelog-linker": "^5.4", - "tracy/tracy": "^2.5" + "phpunit/phpunit": "^8.4", + "phpstan/phpstan": "^0.11.19", + "symplify/easy-coding-standard-tester": "^6.1", + "symplify/coding-standard": "^6.1", + "symplify/changelog-linker": "^6.1", + "tracy/tracy": "^2.7" }, "autoload": { "psr-4": { @@ -33,10 +33,5 @@ "check-cs": "ecs check src tests", "fix-cs": "ecs check src tests --fix", "changelog": "changelog-linker dump-merges --in-categories" - }, - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } } } From 183a13e3b509b8b4680dc6eeb5c1b4baa48c0348 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:40:18 +0100 Subject: [PATCH 04/14] travis: move to jobs --- .travis.yml | 69 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc8e48e..c67f780 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +os: linux language: php php: @@ -5,31 +6,63 @@ php: - 7.3 - '7.4snapshot' +before_install: + # turn off XDebug + - phpenv config-rm xdebug.ini || return 0 + install: - # install composer dependencies - - composer install + - composer install --no-progress + +jobs: + include: + - + stage: test + name: ECS + php: 7.3 + script: + - composer check-cs + + - + name: PHPStan + php: 7.3 + script: + - composer phpstan -script: - # run tests - - vendor/bin/phpunit --coverage-clover coverage.xml + - + name: Rector + php: 7.3 + script: + - vendor/bin/rector process src tests --dry-run --config rector-ci.yaml - # turn off XDebug - - phpenv config-rm xdebug.ini || return 0 + - + name: 'Unit Tests' + script: + - vendor/bin/phpunit - # check coding standard (defined in composer.json "scripts" section) - - composer check-cs + - + name: 'Run PHP_CodeSniffer' + php: 7.3 + script: + - vendor/bin/phpcs src tests -sp --standard=src/ObjectCalisthenics/ruleset.xml --extensions=php - # check with phpstan (defined in composer.json "scripts" section) - - composer phpstan + - + stage: coverage + name: 'Test Coverage' + if: branch = master AND type = push + before_install: + - echo "keep xdebug" + script: + - vendor/bin/phpunit --coverage-clover coverage.xml + # upload coverage.xml file to Coveralls to analyze it + - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar + - php php-coveralls.phar --verbose - # run PHP_CodeSniffer with ruleset - - vendor/bin/phpcs src tests -sp --standard=src/ObjectCalisthenics/ruleset.xml --extensions=php +matrix: + fast_finish: true -after_script: - # upload coverage.xml file to Coveralls to analyze it - - | - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - php php-coveralls.phar --verbose +cache: + directories: + - $HOME/.composer/cache # do not send success notifications, they have no value notifications: From 2d7f3c2a4949fe984ca1899bf9ec66f0ed89b716 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:40:28 +0100 Subject: [PATCH 05/14] rename ecs.yml to ecs.yaml --- ecs.yml => ecs.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename ecs.yml => ecs.yaml (84%) diff --git a/ecs.yml b/ecs.yaml similarity index 84% rename from ecs.yml rename to ecs.yaml index ca4dc7f..1853e11 100644 --- a/ecs.yml +++ b/ecs.yaml @@ -1,10 +1,10 @@ imports: - - { resource: 'vendor/symplify/easy-coding-standard/config/symfony.yml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/php70.yml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/php71.yml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/sets/symfony.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/sets/php70.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/sets/php71.yaml' } # custom - - { resource: 'vendor/symplify/easy-coding-standard/config/common.yml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/symplify.yml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/sets/common.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/sets/symplify.yaml' } - { resource: 'config/object-calisthenics.yml' } services: From a3deca17bf76e05e5039c910c7688fa92b90d3be Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:40:33 +0100 Subject: [PATCH 06/14] init rector --- composer.json | 3 ++- rector-ci.yaml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 rector-ci.yaml diff --git a/composer.json b/composer.json index 73e5154..042301e 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "symplify/easy-coding-standard-tester": "^6.1", "symplify/coding-standard": "^6.1", "symplify/changelog-linker": "^6.1", - "tracy/tracy": "^2.7" + "tracy/tracy": "^2.7", + "rector/rector": "^0.5.21" }, "autoload": { "psr-4": { diff --git a/rector-ci.yaml b/rector-ci.yaml new file mode 100644 index 0000000..fd751cb --- /dev/null +++ b/rector-ci.yaml @@ -0,0 +1,3 @@ +parameters: + sets: + - 'dead-code' From ae41ee2697a6cae11150f603c235b704e4df5c3b Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 02:42:42 +0100 Subject: [PATCH 07/14] add Symplify PHPStan extensions --- composer.json | 5 +++-- ecs.yaml | 11 ++++++----- phpstan.neon | 8 +++++++- .../CodeAnalysis/OneObjectOperatorPerLineSniff.php | 2 +- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 042301e..de7fa27 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "symplify/coding-standard": "^6.1", "symplify/changelog-linker": "^6.1", "tracy/tracy": "^2.7", - "rector/rector": "^0.5.21" + "rector/rector": "^0.5.21", + "symplify/phpstan-extensions": "^6.1" }, "autoload": { "psr-4": { @@ -30,7 +31,7 @@ }, "scripts": { "complete-check": ["@phpstan", "@check-cs", "phpunit"], - "phpstan": "phpstan analyze src --level max", + "phpstan": "phpstan analyze src tests --error-format symplify", "check-cs": "ecs check src tests", "fix-cs": "ecs check src tests --fix", "changelog": "changelog-linker dump-merges --in-categories" diff --git a/ecs.yaml b/ecs.yaml index 1853e11..9e78524 100644 --- a/ecs.yaml +++ b/ecs.yaml @@ -1,10 +1,11 @@ imports: - - { resource: 'vendor/symplify/easy-coding-standard/config/sets/symfony.yaml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/sets/php70.yaml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/sets/php71.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/symfony.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/php70.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/php71.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/psr12.yaml' } # custom - - { resource: 'vendor/symplify/easy-coding-standard/config/sets/common.yaml' } - - { resource: 'vendor/symplify/easy-coding-standard/config/sets/symplify.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/common.yaml' } + - { resource: 'vendor/symplify/easy-coding-standard/config/set/symplify.yaml' } - { resource: 'config/object-calisthenics.yml' } services: diff --git a/phpstan.neon b/phpstan.neon index 01a855a..40eb0f7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,11 @@ +includes: + - 'vendor/symplify/phpstan-extensions/config/config.neon' + parameters: + # to allow installing with various phsptan versions without reporting old errors here + reportUnmatchedIgnoredErrors: false + level: max + autoload_files: - %currentWorkingDirectory%/tests/bootstrap.php - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php @@ -7,5 +14,4 @@ parameters: ignoreErrors: # false float positive - - '#Parameter \#1 \$start of method ObjectCalisthenics\\Sniffs\\CodeAnalysis\\OneObjectOperatorPerLineSniff::ignoreWhitespace\(\) expects int, float\|int given#' - '#Method ObjectCalisthenics\\Sniffs\\Metrics\\MaxNestingLevelSniff::subtractFunctionNestingLevel\(\) should return int but returns float\|int#' diff --git a/src/ObjectCalisthenics/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniff.php b/src/ObjectCalisthenics/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniff.php index d7a5010..1c1ca4f 100644 --- a/src/ObjectCalisthenics/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniff.php +++ b/src/ObjectCalisthenics/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniff.php @@ -186,7 +186,7 @@ private function isInFluentInterfaceMode(): bool */ private function computeLastCallOfAnyFrom(array $methods): int { - $calls = array_filter($this->callerTokens, function (array $token) use ($methods) { + $calls = array_filter($this->callerTokens, function (array $token) use ($methods): bool { return in_array($token['token']['content'], $methods, true); }); if (count($calls) > 0) { From 0da89581744d8c634fbc15731d0319cf5ce88d2b Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:02:51 +0100 Subject: [PATCH 08/14] static fixes --- tests/FileFactory.php | 24 +++---------------- .../FunctionLengthSniffTest.php | 2 +- .../NoSetter/ConfiguredTest.php | 4 ++-- .../NoSetter/NoSetterSniffTest.php | 4 ++-- .../NoSetter/{config.yml => config.yaml} | 0 ...ipping-config.yml => skipping-config.yaml} | 0 6 files changed, 8 insertions(+), 26 deletions(-) rename tests/Sniffs/NamingConventions/NoSetter/{config.yml => config.yaml} (100%) rename tests/Sniffs/NamingConventions/NoSetter/{skipping-config.yml => skipping-config.yaml} (100%) diff --git a/tests/FileFactory.php b/tests/FileFactory.php index 367af86..a771e48 100644 --- a/tests/FileFactory.php +++ b/tests/FileFactory.php @@ -2,6 +2,7 @@ namespace ObjectCalisthenics\Tests; +use Nette\Utils\FileSystem; use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Ruleset; @@ -30,29 +31,10 @@ public function createFile(string $filePath): File $ruleset = new Ruleset($config); $file = new File($filePath, $ruleset, $config); - $file->setContent(file_get_contents($filePath)); + $fileContent = FileSystem::read($filePath); + $file->setContent($fileContent); $file->parse(); return $file; } - - public function createFileWithSniffClass(string $filePath, string $sniffClass): File - { - $config = new Config; - $ruleset = $this->createRulesetWithConfigAndSniffClass($sniffClass, $config); - - $file = new File($filePath, $ruleset, $config); - $file->setContent(file_get_contents($filePath)); - $file->parse(); - - return $file; - } - - private function createRulesetWithConfigAndSniffClass(string $sniffClass, Config $config): Ruleset - { - $config->sniffs = [$sniffClass]; - $config->standards = ['ObjectCalisthenics']; - - return new Ruleset($config); - } } diff --git a/tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php b/tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php index fca2065..68b989a 100644 --- a/tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php +++ b/tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php @@ -1,6 +1,6 @@ Date: Sun, 10 Nov 2019 14:06:36 +0100 Subject: [PATCH 09/14] enable dead-code set --- .travis.yml | 4 ++-- rector-ci.yaml | 3 +++ .../Sniffs/Metrics/MaxNestingLevelSniff.php | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c67f780..217e63d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ os: linux language: php php: - - 7.2 - - 7.3 + - '7.2' + - '7.3' - '7.4snapshot' before_install: diff --git a/rector-ci.yaml b/rector-ci.yaml index fd751cb..ea5ccbc 100644 --- a/rector-ci.yaml +++ b/rector-ci.yaml @@ -1,3 +1,6 @@ parameters: sets: - 'dead-code' + + autoload_paths: + - 'tests/bootstrap.php' diff --git a/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php b/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php index 67b328d..0473228 100644 --- a/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php +++ b/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php @@ -79,8 +79,6 @@ public function process(File $file, $position): void */ private function iterateTokens(int $start, int $end, array $tokens): void { - $this->currentPtr = $start + 1; - // Find the maximum nesting level of any token in the function. for ($this->currentPtr = ($start + 1); $this->currentPtr < $end; ++$this->currentPtr) { $nestedToken = $tokens[$this->currentPtr]; From 9358b11bf3d38a7fe2af64ef34832987ce600054 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:07:13 +0100 Subject: [PATCH 10/14] add code-quality set --- rector-ci.yaml | 1 + .../Helper/Structure/StructureMetrics.php | 2 +- .../Sniffs/Classes/ForbiddenPublicPropertySniff.php | 5 +---- .../Sniffs/Metrics/MaxNestingLevelSniff.php | 2 +- .../NamingConventions/ElementNameMinimalLengthSniff.php | 6 +----- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/rector-ci.yaml b/rector-ci.yaml index ea5ccbc..fed3371 100644 --- a/rector-ci.yaml +++ b/rector-ci.yaml @@ -1,6 +1,7 @@ parameters: sets: - 'dead-code' + - 'code-quality' autoload_paths: - 'tests/bootstrap.php' diff --git a/src/ObjectCalisthenics/Helper/Structure/StructureMetrics.php b/src/ObjectCalisthenics/Helper/Structure/StructureMetrics.php index 49cc153..f1ebc6a 100644 --- a/src/ObjectCalisthenics/Helper/Structure/StructureMetrics.php +++ b/src/ObjectCalisthenics/Helper/Structure/StructureMetrics.php @@ -12,7 +12,7 @@ public static function getStructureLengthInLines(File $file, int $position): int $token = $tokens[$position]; // Skip function without body. - if (isset($token['scope_opener']) === false) { + if (! isset($token['scope_opener'])) { return 0; } diff --git a/src/ObjectCalisthenics/Sniffs/Classes/ForbiddenPublicPropertySniff.php b/src/ObjectCalisthenics/Sniffs/Classes/ForbiddenPublicPropertySniff.php index 5a69fd5..220dfdc 100644 --- a/src/ObjectCalisthenics/Sniffs/Classes/ForbiddenPublicPropertySniff.php +++ b/src/ObjectCalisthenics/Sniffs/Classes/ForbiddenPublicPropertySniff.php @@ -49,11 +49,8 @@ private function isSniffClass(File $file, int $position): bool $classNameTokenPosition = $file->findNext(T_STRING, $classTokenPosition); $classNameToken = $file->getTokens()[$classNameTokenPosition]; - if (Strings::endsWith($classNameToken['content'], 'Sniff')) { - return true; - } - return false; + return Strings::endsWith($classNameToken['content'], 'Sniff'); } /** diff --git a/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php b/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php index 0473228..35de16c 100644 --- a/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php +++ b/src/ObjectCalisthenics/Sniffs/Metrics/MaxNestingLevelSniff.php @@ -64,7 +64,7 @@ public function process(File $file, $position): void $token = $tokens[$position]; // Ignore abstract methods. - if (isset($token['scope_opener']) === false) { + if (! isset($token['scope_opener'])) { return; } diff --git a/src/ObjectCalisthenics/Sniffs/NamingConventions/ElementNameMinimalLengthSniff.php b/src/ObjectCalisthenics/Sniffs/NamingConventions/ElementNameMinimalLengthSniff.php index 944fc02..29ac528 100644 --- a/src/ObjectCalisthenics/Sniffs/NamingConventions/ElementNameMinimalLengthSniff.php +++ b/src/ObjectCalisthenics/Sniffs/NamingConventions/ElementNameMinimalLengthSniff.php @@ -54,11 +54,7 @@ private function shouldBeSkipped(int $elementNameLength, string $elementName): b return true; } - if ($this->isShortNameAllowed($elementName)) { - return true; - } - - return false; + return $this->isShortNameAllowed($elementName); } private function isShortNameAllowed(string $variableName): bool From 05c915b4599f588b521d749be143a86988b8a0f0 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:07:54 +0100 Subject: [PATCH 11/14] add coding style --- rector-ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/rector-ci.yaml b/rector-ci.yaml index fed3371..f7c2dd9 100644 --- a/rector-ci.yaml +++ b/rector-ci.yaml @@ -2,6 +2,7 @@ parameters: sets: - 'dead-code' - 'code-quality' + - 'coding-style' autoload_paths: - 'tests/bootstrap.php' From 46340f32cd48f47314d5fe70e5b798e36eea5878 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:09:24 +0100 Subject: [PATCH 12/14] allow PHP 7.4 to fail --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 217e63d..0a0de9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,9 @@ jobs: - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - php php-coveralls.phar --verbose + allow_failures: + - php: '7.4snapshot' + matrix: fast_finish: true From ad4166f70fcd22d7bfeed8ec37bd6c3db846d45a Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:13:04 +0100 Subject: [PATCH 13/14] cleanup phsptan.neon config [skip ci] --- phpstan.neon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 40eb0f7..4470aef 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,10 +7,7 @@ parameters: level: max autoload_files: - - %currentWorkingDirectory%/tests/bootstrap.php - - %currentWorkingDirectory%/vendor/squizlabs/php_codesniffer/autoload.php - excludes_analyse: - - **/ObjectCalisthenics/Helper/Slevomat/** + - 'tests/bootstrap.php' ignoreErrors: # false float positive From 9c21cf95c4cd41069db51356a0b27401632b2496 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 10 Nov 2019 14:15:36 +0100 Subject: [PATCH 14/14] README cleanup [skip ci] --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 973ae91..4ace5d4 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,6 @@ If you know what you want, jump right to the specific rule: - [7. Keep Your Classes Small](#7-keep-your-classes-small) - [9. Do not Use Getters and Setters](#9-do-not-use-getters-and-setters) - - ## How to quickly check 1 rule? In [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) @@ -97,7 +95,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.Metrics.MaxNestingLevel In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff: ~ ``` @@ -161,7 +159,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.ControlStructures.NoElse In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\ControlStructures\NoElseSniff: ~ ``` @@ -194,7 +192,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.CodeAnalysis.OneObjectOperatorP In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\CodeAnalysis\OneObjectOperatorPerLineSniff: ~ ``` @@ -261,7 +259,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.NamingConventions.ElementNameMi In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff: ~ ``` @@ -285,7 +283,7 @@ In PHP_CodeSniffer: In ECS: ```yaml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\NamingConventions\ElementNameMinimalLengthSniff: minLength: 3 @@ -386,7 +384,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.Files.ClassTraitAndInterfaceLen In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff: ~ ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff: ~ @@ -427,7 +425,7 @@ In PHP_CodeSniffer: In ECS: ```yaml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff: maxLength: 200 @@ -493,7 +491,7 @@ vendor/bin/phpcs ... --sniffs=ObjectCalisthenics.Classes.ForbiddenPublicProperty In ECS: ```yml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff: ~ ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff: ~ @@ -517,7 +515,7 @@ In PHP_CodeSniffer: In ECS: ```yaml -# ecs.yml +# ecs.yaml services: ObjectCalisthenics\Sniffs\NamingConventions\NoSetterSniff: allowedClasses: