From 6b6fd537565c1bfd28b5e9f23fb1a8ed7e15a12f Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:09:24 +0200 Subject: [PATCH 1/9] gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e598dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea/* +vendor/* +!vendor/.htaccess +vendor-bin/*/vendor \ No newline at end of file From be76c54cd4e914f71a929a442b3019ad7e12b385 Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:09:38 +0200 Subject: [PATCH 2/9] composer bump --- composer.json | 6 +- composer.lock | 309 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 composer.lock diff --git a/composer.json b/composer.json index 09de44c..18d0589 100644 --- a/composer.json +++ b/composer.json @@ -7,14 +7,14 @@ "prefer-stable": true, "require": { "php": ">=7.4", - "squizlabs/php_codesniffer": "~3.5.3", - "slevomat/coding-standard": "~6.3.8" + "squizlabs/php_codesniffer": "~3.6.0", + "slevomat/coding-standard": "~7.0.8" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.2" }, "scripts": { - "codestyle": "phpcs --standard=vendor-bin/phpcs/vendor/infinityloop-dev/coding-standard/InfinityloopCodingStandard/ruleset.xml --extensions=php InfinityloopCodingStandard" + "codestyle": "phpcs --standard=InfinityloopCodingStandard --extensions=php" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..8bb6465 --- /dev/null +++ b/composer.lock @@ -0,0 +1,309 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "bcfba8164d7b1490e7594d6789560110", + "packages": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.1", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", + "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2020-12-07T18:04:37+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.5.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "e352d065af1ae9b41c12d1dfd309e90f7b1f55c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e352d065af1ae9b41c12d1dfd309e90f7b1f55c9", + "reference": "e352d065af1ae9b41c12d1dfd309e90f7b1f55c9", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.60", + "phpstan/phpstan-strict-rules": "^0.12.5", + "phpunit/phpunit": "^7.5.20", + "symfony/process": "^5.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.5-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/0.5.4" + }, + "time": "2021-04-03T14:46:19+00:00" + }, + { + "name": "slevomat/coding-standard", + "version": "7.0.8", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "48141737f9e5ed701ef8bcea2027e701b50bd932" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/48141737f9e5ed701ef8bcea2027e701b50bd932", + "reference": "48141737f9e5ed701ef8bcea2027e701b50bd932", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "php": "^7.1 || ^8.0", + "phpstan/phpdoc-parser": "0.5.1 - 0.5.4", + "squizlabs/php_codesniffer": "^3.6.0" + }, + "require-dev": { + "phing/phing": "2.16.4", + "php-parallel-lint/php-parallel-lint": "1.3.0", + "phpstan/phpstan": "0.12.86", + "phpstan/phpstan-deprecation-rules": "0.12.6", + "phpstan/phpstan-phpunit": "0.12.18", + "phpstan/phpstan-strict-rules": "0.12.9", + "phpunit/phpunit": "7.5.20|8.5.5|9.5.4" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/7.0.8" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2021-05-10T08:51:20+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.6.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2021-04-09T00:54:41+00:00" + } + ], + "packages-dev": [ + { + "name": "bamarni/composer-bin-plugin", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/bamarni/composer-bin-plugin.git", + "reference": "9329fb0fbe29e0e1b2db8f4639a193e4f5406225" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/9329fb0fbe29e0e1b2db8f4639a193e4f5406225", + "reference": "9329fb0fbe29e0e1b2db8f4639a193e4f5406225", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": "^5.5.9 || ^7.0 || ^8.0" + }, + "require-dev": { + "composer/composer": "^1.0 || ^2.0", + "symfony/console": "^2.5 || ^3.0 || ^4.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Bamarni\\Composer\\Bin\\Plugin" + }, + "autoload": { + "psr-4": { + "Bamarni\\Composer\\Bin\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "No conflicts for your bin dependencies", + "keywords": [ + "composer", + "conflict", + "dependency", + "executable", + "isolation", + "tool" + ], + "support": { + "issues": "https://github.com/bamarni/composer-bin-plugin/issues", + "source": "https://github.com/bamarni/composer-bin-plugin/tree/master" + }, + "time": "2020-05-03T08:27:20+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": ">=7.4" + }, + "platform-dev": [], + "plugin-api-version": "2.0.0" +} From e8cd1beb3452e7501c7c6c6369ac8ee0d7e9817a Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:44:31 +0200 Subject: [PATCH 3/9] php 8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 18d0589..802fa70 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=7.4", + "php": "^8.0", "squizlabs/php_codesniffer": "~3.6.0", "slevomat/coding-standard": "~7.0.8" }, From a18c73c4e8c1ac79b3078503b9dabfb52bb0d0f6 Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:44:51 +0200 Subject: [PATCH 4/9] ruleset.xml --- InfinityloopCodingStandard/ruleset.xml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/InfinityloopCodingStandard/ruleset.xml b/InfinityloopCodingStandard/ruleset.xml index 16fb5d3..0ee092a 100644 --- a/InfinityloopCodingStandard/ruleset.xml +++ b/InfinityloopCodingStandard/ruleset.xml @@ -8,10 +8,6 @@ - ./../../../../../../app - ./../../../../../../bin - ./../../../../../../tests - ./../../../../../../www */tests/*/data/* */vendor/* */vendor-bin/* @@ -255,7 +251,6 @@ - @@ -423,17 +418,6 @@ - - - - - - - - - - - @@ -484,7 +468,7 @@ - + From c1537286058cd1dfb4f6a4bac9f2f094ce0d105f Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:45:05 +0200 Subject: [PATCH 5/9] phpcs --- .../Sniffs/Classes/FinalClassVisibilitySniff.php | 5 +---- .../ControlStructures/SwitchCommentSpacingSniff.php | 8 +------- .../Namespaces/UseDoesNotStartWithBackslashSniff.php | 10 +++++----- .../Sniffs/WhiteSpace/MemberVarSpacingSniff.php | 1 + 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/InfinityloopCodingStandard/Sniffs/Classes/FinalClassVisibilitySniff.php b/InfinityloopCodingStandard/Sniffs/Classes/FinalClassVisibilitySniff.php index 6b2f56b..5040f86 100644 --- a/InfinityloopCodingStandard/Sniffs/Classes/FinalClassVisibilitySniff.php +++ b/InfinityloopCodingStandard/Sniffs/Classes/FinalClassVisibilitySniff.php @@ -72,10 +72,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $variablePointer $phpcsFile->fixer->endChangeset(); } - /** - * @return int|bool|null - */ - private function findVisibilityPointer(\PHP_CodeSniffer\Files\File $phpcsFile, $variablePointer) + private function findVisibilityPointer(\PHP_CodeSniffer\Files\File $phpcsFile, $variablePointer) : int|bool|null { $visibilityPointer = $phpcsFile->findPrevious([\T_PUBLIC, \T_PROTECTED, \T_PRIVATE], $variablePointer); diff --git a/InfinityloopCodingStandard/Sniffs/ControlStructures/SwitchCommentSpacingSniff.php b/InfinityloopCodingStandard/Sniffs/ControlStructures/SwitchCommentSpacingSniff.php index 3e88747..8f79cc9 100644 --- a/InfinityloopCodingStandard/Sniffs/ControlStructures/SwitchCommentSpacingSniff.php +++ b/InfinityloopCodingStandard/Sniffs/ControlStructures/SwitchCommentSpacingSniff.php @@ -127,13 +127,7 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) : voi } } - /** - * @param \PHP_CodeSniffer\Files\File $phpcsFile - * @param int|bool|null $stackPtr - * @param int|null $end - * @return bool|int - */ - private function findNextCase(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, ?int $end = null) + private function findNextCase(\PHP_CodeSniffer\Files\File $phpcsFile, int|bool|null $stackPtr, ?int $end = null) : bool|int { $tokens = $phpcsFile->getTokens(); diff --git a/InfinityloopCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php b/InfinityloopCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php index 1a7bcd7..056e64d 100644 --- a/InfinityloopCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php +++ b/InfinityloopCodingStandard/Sniffs/Namespaces/UseDoesNotStartWithBackslashSniff.php @@ -31,28 +31,28 @@ public function process(\PHP_CodeSniffer\Files\File $phpcsFile, $usePointer) : v $tokens = $phpcsFile->getTokens(); $nextTokenPointer = TokenHelper::findNextEffective($phpcsFile, $usePointer + 1); \assert(\is_int($nextTokenPointer)); - + if ($tokens[$nextTokenPointer]['code'] === \T_STRING && ($tokens[$nextTokenPointer]['content'] === 'function' || $tokens[$nextTokenPointer]['content'] === 'const') ) { $nextTokenPointer = TokenHelper::findNextEffective($phpcsFile, $nextTokenPointer + 1); \assert(\is_int($nextTokenPointer)); } - + if ($tokens[$nextTokenPointer]['code'] === \T_NS_SEPARATOR) { return; } - + $fix = $phpcsFile->addFixableError( 'Use statement must start with a backslash.', $nextTokenPointer, self::CODE_DOES_NOT_START_WITH_BACKSLASH, ); - + if (!$fix) { return; } - + $phpcsFile->fixer->beginChangeset(); $phpcsFile->fixer->addContentBefore($nextTokenPointer, '\\'); $phpcsFile->fixer->endChangeset(); diff --git a/InfinityloopCodingStandard/Sniffs/WhiteSpace/MemberVarSpacingSniff.php b/InfinityloopCodingStandard/Sniffs/WhiteSpace/MemberVarSpacingSniff.php index 41f6507..8cfe4e9 100644 --- a/InfinityloopCodingStandard/Sniffs/WhiteSpace/MemberVarSpacingSniff.php +++ b/InfinityloopCodingStandard/Sniffs/WhiteSpace/MemberVarSpacingSniff.php @@ -14,6 +14,7 @@ class MemberVarSpacingSniff extends \PHP_CodeSniffer\Sniffs\AbstractVariableSnif * @return int|void */ //@phpcs:ignore Squiz.Commenting.FunctionComment.ScalarTypeHintMissing + //@phpcs:ignore SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint protected function processMemberVar(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); From ae959c8e661f1e2e44c95196547c6949ed1b7418 Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:47:04 +0200 Subject: [PATCH 6/9] bump --- composer.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.lock b/composer.lock index 8bb6465..15249ff 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bcfba8164d7b1490e7594d6789560110", + "content-hash": "863c5ce60d03502971ee2ea7d1f7e381", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -302,7 +302,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": "^8.0" }, "platform-dev": [], "plugin-api-version": "2.0.0" From efb56a56c711883ceb6e848547e831f4671803f3 Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:48:37 +0200 Subject: [PATCH 7/9] workflow php8 --- .github/workflows/php.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index a122d6a..1f2e7f5 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '7.4' + php-version: '8.0' env: update: true From 00152f11009f8d1d5ec420c4aa5b96b77bf5297b Mon Sep 17 00:00:00 2001 From: Vossik Date: Tue, 18 May 2021 22:50:05 +0200 Subject: [PATCH 8/9] fixed phpcs command --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 802fa70..f5327f2 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "bamarni/composer-bin-plugin": "^1.2" }, "scripts": { - "codestyle": "phpcs --standard=InfinityloopCodingStandard --extensions=php" + "codestyle": "phpcs --standard=InfinityloopCodingStandard --extensions=php InfinityloopCodingStandard" }, "autoload": { "psr-4": { From e8267fd62f9ba09ac655fbd9f22fe708cdb514b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pel=C3=AD=C5=A1ek?= Date: Tue, 18 May 2021 21:19:19 +0000 Subject: [PATCH 9/9] Update .gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0e598dc..3e417a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ .idea/* vendor/* -!vendor/.htaccess -vendor-bin/*/vendor \ No newline at end of file