From ece436340da403e0631fdef1e4aaa56bc7cb31a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20My=C5=A1iak?= Date: Thu, 23 May 2024 12:04:08 +0200 Subject: [PATCH] =?UTF-8?q?feat(refactor):=20Support=20php=208.1=20and=208?= =?UTF-8?q?.2=20with=20reorganized=20structure=20fo=E2=80=A6=20(#4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(refactor): Support php 8.1 and 8.2 with reorganized structure for better maintaining. * fix(refactor): Lock dependencies. * fix(refactor): Fixed relative path. * fix(refactor): Correct rule SlevomatCodingStandard.TypeHints.DeclareStrictTypes. * resolved few comments and added few more. * feat(refactor): Incorporated feedback. * fix(rule): Fixed SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature. IncludedMethodPatterns require regexp parameter. --------- Co-authored-by: Tomas Mihalicka --- .github/workflows /php-ci.yml | 1 - composer.json | 19 +- composer.lock | 414 +++++++------- docker-compose.yml | 25 +- docker/{php => php7.4}/Dockerfile | 0 docker/php8.1/Dockerfile | 12 + docker/php8.2/Dockerfile | 12 + phpcbf.sh | 3 - phpcs.ruleset.81.non-ddd.xml | 14 + phpcs.ruleset.81.xml | 508 ++++++++++++++++++ phpcs.ruleset.82.xml | 6 + src/Example/Hardware.php | 16 - .../{ => Php74}/Common/EntityManager.php | 2 +- .../{ => Php74}/Common/EntityRepository.php | 2 +- src/Example/{ => Php74}/Common/HardwareId.php | 2 +- .../{ => Php74}/Common/SerialNumber.php | 2 +- src/Example/{ => Php74}/Common/ServiceTag.php | 2 +- src/Example/Php74/Hardware.php | 17 + src/Example/{ => Php74}/HardwareEntity.php | 8 +- .../{ => Php74}/HardwareRepository.php | 6 +- .../{ => Php74}/Traits/SerialNumberHaving.php | 4 +- .../{ => Php74}/Traits/ServiceTagHaving.php | 4 +- src/Example/Php81/Bar.php | 13 + src/Example/Php81/Foo.php | 22 + src/Example/Php82/Bar.php | 13 + src/Example/Php82/Foo.php | 22 + src/phpcs.ruleset.81.xml | 5 + src/phpcs.ruleset.82.xml | 5 + src/phpcs.ruleset.xml | 2 +- 29 files changed, 921 insertions(+), 240 deletions(-) rename docker/{php => php7.4}/Dockerfile (100%) create mode 100644 docker/php8.1/Dockerfile create mode 100644 docker/php8.2/Dockerfile delete mode 100755 phpcbf.sh create mode 100644 phpcs.ruleset.81.non-ddd.xml create mode 100644 phpcs.ruleset.81.xml create mode 100644 phpcs.ruleset.82.xml delete mode 100644 src/Example/Hardware.php rename src/Example/{ => Php74}/Common/EntityManager.php (75%) rename src/Example/{ => Php74}/Common/EntityRepository.php (73%) rename src/Example/{ => Php74}/Common/HardwareId.php (65%) rename src/Example/{ => Php74}/Common/SerialNumber.php (65%) rename src/Example/{ => Php74}/Common/ServiceTag.php (65%) create mode 100644 src/Example/Php74/Hardware.php rename src/Example/{ => Php74}/HardwareEntity.php (73%) rename src/Example/{ => Php74}/HardwareRepository.php (76%) rename src/Example/{ => Php74}/Traits/SerialNumberHaving.php (57%) rename src/Example/{ => Php74}/Traits/ServiceTagHaving.php (56%) create mode 100644 src/Example/Php81/Bar.php create mode 100644 src/Example/Php81/Foo.php create mode 100644 src/Example/Php82/Bar.php create mode 100644 src/Example/Php82/Foo.php create mode 100644 src/phpcs.ruleset.81.xml create mode 100644 src/phpcs.ruleset.82.xml diff --git a/ .github/workflows /php-ci.yml b/ .github/workflows /php-ci.yml index f9b3ab2..64653ec 100644 --- a/ .github/workflows /php-ci.yml +++ b/ .github/workflows /php-ci.yml @@ -8,7 +8,6 @@ on: jobs: build: - runs-on: ubuntu-latest steps: diff --git a/composer.json b/composer.json index 550f65a..1c57437 100644 --- a/composer.json +++ b/composer.json @@ -11,10 +11,10 @@ } ], "require": { - "php": ">=7.2", - "phpcompatibility/php-compatibility": "^9.3", - "slevomat/coding-standard": "^7.0.9", - "squizlabs/php_codesniffer": "^3.5" + "php": "~7.4.0|^8.1", + "phpcompatibility/php-compatibility": "^9.3.5", + "slevomat/coding-standard": "^8.12.1", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { "madewithlove/license-checker": "^0.10.0" @@ -25,9 +25,18 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "scripts": { + "phpcs7.4": "phpcs --standard=src/phpcs.ruleset.xml --extensions=php --tab-width=4 -sp --colors src/Example/Php74", + "phpcs8.1": "phpcs --standard=src/phpcs.ruleset.81.xml src/Example/Php81", + "phpcs8.2": "phpcs --standard=src/phpcs.ruleset.82.xml src/Example/Php82", + "phpcbf7.4": "phpcbf --standard=src/phpcs.ruleset.xml --extensions=php --tab-width=4 -sp src/Example/Php74", + "phpcbf8.1": "phpcbf --standard=src/phpcs.ruleset.81.xml src/Example/Php81", + "phpcbf8.2": "phpcbf --standard=src/phpcs.ruleset.82.xml src/Example/Php82", "lic-check": "license-checker check" } } diff --git a/composer.lock b/composer.lock index 2cf5a4d..6af588b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,39 +4,42 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ee8f63660f76a449a6c11cff0adc2da2", + "content-hash": "dd5f288543848e118b3292ca08434bf4", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -49,6 +52,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -60,6 +67,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -71,10 +79,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2020-12-07T18:04:37+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -140,35 +148,31 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "0.5.5", + "version": "1.20.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c" + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c", - "reference": "ea0b17460ec38e20d7eb64e7ec49b5d44af5d28c", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.87", - "phpstan/phpstan-strict-rules": "^0.12.5", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", "symfony/process": "^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5-dev" - } - }, "autoload": { "psr-4": { "PHPStan\\PhpDocParser\\": [ @@ -183,48 +187,48 @@ "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.5" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" }, - "time": "2021-06-11T13:24:46+00:00" + "time": "2023-05-02T09:19:37+00:00" }, { "name": "slevomat/coding-standard", - "version": "7.0.13", + "version": "8.12.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9" + "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/122a9bf9a4a2195f74100f47dfb8375982f43cc9", - "reference": "122a9bf9a4a2195f74100f47dfb8375982f43cc9", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", + "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "php": "^7.1 || ^8.0", - "phpstan/phpdoc-parser": "0.5.1 - 0.5.5", - "squizlabs/php_codesniffer": "^3.6.0" + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": ">=1.20.0 <1.21.0", + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phing/phing": "2.16.4", - "php-parallel-lint/php-parallel-lint": "1.3.0", - "phpstan/phpstan": "0.12.93", - "phpstan/phpstan-deprecation-rules": "0.12.6", - "phpstan/phpstan-phpunit": "0.12.21", - "phpstan/phpstan-strict-rules": "0.12.10", - "phpunit/phpunit": "7.5.20|8.5.5|9.5.7" + "phing/phing": "2.17.4", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.10.15", + "phpstan/phpstan-deprecation-rules": "1.1.3", + "phpstan/phpstan-phpunit": "1.3.11", + "phpstan/phpstan-strict-rules": "1.5.1", + "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.1.3" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { "psr-4": { - "SlevomatCodingStandard\\": "SlevomatCodingStandard" + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" } }, "notification-url": "https://packagist.org/downloads/", @@ -232,9 +236,13 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.0.13" + "source": "https://github.com/slevomat/coding-standard/tree/8.12.1" }, "funding": [ { @@ -246,20 +254,20 @@ "type": "tidelift" } ], - "time": "2021-07-29T14:30:22+00:00" + "time": "2023-05-15T21:42:25+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "3.7.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", + "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", "shasum": "" }, "require": { @@ -295,14 +303,15 @@ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "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" + "time": "2023-02-22T23:07:41+00:00" } ], "packages-dev": [ @@ -357,22 +366,27 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -399,32 +413,32 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "symfony/console", - "version": "v5.3.6", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2" + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/51b71afd6d2dc8f5063199357b9880cea8d8bfe2", - "reference": "51b71afd6d2dc8f5063199357b9880cea8d8bfe2", + "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { "psr/log": ">=3", @@ -439,12 +453,12 @@ }, "require-dev": { "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -479,12 +493,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.6" + "source": "https://github.com/symfony/console/tree/v5.4.24" }, "funding": [ { @@ -500,29 +514,29 @@ "type": "tidelift" } ], - "time": "2021-07-27T19:10:22+00:00" + "time": "2023-05-26T05:13:16+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -551,7 +565,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -567,32 +581,35 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -600,12 +617,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -630,7 +647,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -646,20 +663,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -671,7 +688,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -679,12 +696,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -711,7 +728,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -727,20 +744,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -752,7 +769,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -760,12 +777,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -795,7 +812,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -811,32 +828,35 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -844,12 +864,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -875,7 +895,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -891,20 +911,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -913,7 +933,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -921,12 +941,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -954,7 +974,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -970,20 +990,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -992,7 +1012,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1000,12 +1020,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1037,7 +1057,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -1053,20 +1073,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", - "version": "v5.3.4", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030" + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d16634ee55b895bd85ec714dadc58e4428ecf030", - "reference": "d16634ee55b895bd85ec714dadc58e4428ecf030", + "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", "shasum": "" }, "require": { @@ -1099,7 +1119,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.4" + "source": "https://github.com/symfony/process/tree/v5.4.24" }, "funding": [ { @@ -1115,33 +1135,33 @@ "type": "tidelift" } ], - "time": "2021-07-23T15:54:19+00:00" + "time": "2023-05-17T11:26:05+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=8.1", + "psr/container": "^2.0" }, - "suggest": { - "symfony/service-implementation": "" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -1151,7 +1171,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1178,7 +1201,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -1194,44 +1217,47 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "v5.3.3", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -1261,7 +1287,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.3" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -1277,32 +1303,32 @@ "type": "tidelift" } ], - "time": "2021-06-27T11:44:38+00:00" + "time": "2023-03-21T21:06:29+00:00" }, { "name": "symfony/yaml", - "version": "v5.3.6", + "version": "v5.4.23", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7" + "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", - "reference": "4500fe63dc9c6ffc32d3b1cb0448c329f9c814b7", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b", + "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-ctype": "~1.8" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<4.4" + "symfony/console": "<5.3" }, "require-dev": { - "symfony/console": "^4.4|^5.0" + "symfony/console": "^5.3|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -1336,7 +1362,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.3.6" + "source": "https://github.com/symfony/yaml/tree/v5.4.23" }, "funding": [ { @@ -1352,7 +1378,7 @@ "type": "tidelift" } ], - "time": "2021-07-29T06:20:01+00:00" + "time": "2023-04-23T19:33:36+00:00" } ], "aliases": [], @@ -1361,8 +1387,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.2" + "php": "~7.4.0|^8.1" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.6.0" } diff --git a/docker-compose.yml b/docker-compose.yml index f4dc245..3fe0b54 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,27 @@ version: '3.5' services: - # PHP - coding-standards-php7: - container_name: coding-standards-php7 - build: ./docker/php + coding-standards-php7.4: + container_name: coding-standards-php7.4 + build: ./docker/php7.4 + volumes: + - .:/srv/www:delegated + - ~/.ssh:/var/www/.ssh + environment: + - COMPOSER_MEMORY_LIMIT=-1 + + coding-standards-php8.1: + container_name: coding-standards-php8.1 + build: ./docker/php8.1 + volumes: + - .:/srv/www:delegated + - ~/.ssh:/var/www/.ssh + environment: + - COMPOSER_MEMORY_LIMIT=-1 + + coding-standards-php8.2: + container_name: coding-standards-php8.2 + build: ./docker/php8.2 volumes: - .:/srv/www:delegated - ~/.ssh:/var/www/.ssh diff --git a/docker/php/Dockerfile b/docker/php7.4/Dockerfile similarity index 100% rename from docker/php/Dockerfile rename to docker/php7.4/Dockerfile diff --git a/docker/php8.1/Dockerfile b/docker/php8.1/Dockerfile new file mode 100644 index 0000000..12b3040 --- /dev/null +++ b/docker/php8.1/Dockerfile @@ -0,0 +1,12 @@ +FROM php:8.1-fpm + +RUN apt-get update && apt-get install -y git-core zlib1g-dev libzip-dev zip unzip +RUN docker-php-ext-install zip + +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ + php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \ + php composer-setup.php && \ + mv composer.phar /usr/local/bin/composer && \ + unlink composer-setup.php + +WORKDIR /srv/www diff --git a/docker/php8.2/Dockerfile b/docker/php8.2/Dockerfile new file mode 100644 index 0000000..baa18d2 --- /dev/null +++ b/docker/php8.2/Dockerfile @@ -0,0 +1,12 @@ +FROM php:8.2-fpm + +RUN apt-get update && apt-get install -y git-core zlib1g-dev libzip-dev zip unzip +RUN docker-php-ext-install zip + +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ + php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \ + php composer-setup.php && \ + mv composer.phar /usr/local/bin/composer && \ + unlink composer-setup.php + +WORKDIR /srv/www diff --git a/phpcbf.sh b/phpcbf.sh deleted file mode 100755 index e250eda..0000000 --- a/phpcbf.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./vendor/bin/phpcbf --standard=src/phpcs.ruleset.xml --extensions=php --tab-width=4 -sp src diff --git a/phpcs.ruleset.81.non-ddd.xml b/phpcs.ruleset.81.non-ddd.xml new file mode 100644 index 0000000..b116544 --- /dev/null +++ b/phpcs.ruleset.81.non-ddd.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/phpcs.ruleset.81.xml b/phpcs.ruleset.81.xml new file mode 100644 index 0000000..3b8c26b --- /dev/null +++ b/phpcs.ruleset.81.xml @@ -0,0 +1,508 @@ + + + + + PixelFederation ruleset for PHP 8.1. + + + + + + + + + + + tests/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpcs.ruleset.82.xml b/phpcs.ruleset.82.xml new file mode 100644 index 0000000..73829a9 --- /dev/null +++ b/phpcs.ruleset.82.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Example/Hardware.php b/src/Example/Hardware.php deleted file mode 100644 index 507a378..0000000 --- a/src/Example/Hardware.php +++ /dev/null @@ -1,16 +0,0 @@ - - */ - -declare(strict_types=1); - -namespace PixelFederation\CodingStandards\Example; - -use PixelFederation\CodingStandards\Example\Common\HardwareId; - -interface Hardware extends Traits\SerialNumberHaving, Traits\ServiceTagHaving -{ - public function getId(): HardwareId; -} diff --git a/src/Example/Common/EntityManager.php b/src/Example/Php74/Common/EntityManager.php similarity index 75% rename from src/Example/Common/EntityManager.php rename to src/Example/Php74/Common/EntityManager.php index e51c2fa..9748dc7 100644 --- a/src/Example/Common/EntityManager.php +++ b/src/Example/Php74/Common/EntityManager.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Common; +namespace PixelFederation\CodingStandards\Example\Php74\Common; interface EntityManager { diff --git a/src/Example/Common/EntityRepository.php b/src/Example/Php74/Common/EntityRepository.php similarity index 73% rename from src/Example/Common/EntityRepository.php rename to src/Example/Php74/Common/EntityRepository.php index d166c7c..cb618d7 100644 --- a/src/Example/Common/EntityRepository.php +++ b/src/Example/Php74/Common/EntityRepository.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Common; +namespace PixelFederation\CodingStandards\Example\Php74\Common; interface EntityRepository { diff --git a/src/Example/Common/HardwareId.php b/src/Example/Php74/Common/HardwareId.php similarity index 65% rename from src/Example/Common/HardwareId.php rename to src/Example/Php74/Common/HardwareId.php index caf673f..acdea77 100644 --- a/src/Example/Common/HardwareId.php +++ b/src/Example/Php74/Common/HardwareId.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Common; +namespace PixelFederation\CodingStandards\Example\Php74\Common; interface HardwareId { diff --git a/src/Example/Common/SerialNumber.php b/src/Example/Php74/Common/SerialNumber.php similarity index 65% rename from src/Example/Common/SerialNumber.php rename to src/Example/Php74/Common/SerialNumber.php index 3152ad2..9f6eb31 100644 --- a/src/Example/Common/SerialNumber.php +++ b/src/Example/Php74/Common/SerialNumber.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Common; +namespace PixelFederation\CodingStandards\Example\Php74\Common; final class SerialNumber { diff --git a/src/Example/Common/ServiceTag.php b/src/Example/Php74/Common/ServiceTag.php similarity index 65% rename from src/Example/Common/ServiceTag.php rename to src/Example/Php74/Common/ServiceTag.php index 2e92188..d64a596 100644 --- a/src/Example/Common/ServiceTag.php +++ b/src/Example/Php74/Common/ServiceTag.php @@ -6,7 +6,7 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Common; +namespace PixelFederation\CodingStandards\Example\Php74\Common; final class ServiceTag { diff --git a/src/Example/Php74/Hardware.php b/src/Example/Php74/Hardware.php new file mode 100644 index 0000000..08ffde0 --- /dev/null +++ b/src/Example/Php74/Hardware.php @@ -0,0 +1,17 @@ + + */ + +declare(strict_types=1); + +namespace PixelFederation\CodingStandards\Example\Php74; + +use PixelFederation\CodingStandards\Example\Php74; +use PixelFederation\CodingStandards\Example\Php74\Common\HardwareId; + +interface Hardware extends Php74\Traits\SerialNumberHaving, Php74\Traits\ServiceTagHaving +{ + public function getId(): HardwareId; +} diff --git a/src/Example/HardwareEntity.php b/src/Example/Php74/HardwareEntity.php similarity index 73% rename from src/Example/HardwareEntity.php rename to src/Example/Php74/HardwareEntity.php index 4974fb0..cac3ab1 100644 --- a/src/Example/HardwareEntity.php +++ b/src/Example/Php74/HardwareEntity.php @@ -6,11 +6,11 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example; +namespace PixelFederation\CodingStandards\Example\Php74; -use PixelFederation\CodingStandards\Example\Common\HardwareId; -use PixelFederation\CodingStandards\Example\Common\SerialNumber; -use PixelFederation\CodingStandards\Example\Common\ServiceTag; +use PixelFederation\CodingStandards\Example\Php74\Common\HardwareId; +use PixelFederation\CodingStandards\Example\Php74\Common\SerialNumber; +use PixelFederation\CodingStandards\Example\Php74\Common\ServiceTag; final class HardwareEntity implements Hardware { diff --git a/src/Example/HardwareRepository.php b/src/Example/Php74/HardwareRepository.php similarity index 76% rename from src/Example/HardwareRepository.php rename to src/Example/Php74/HardwareRepository.php index 1006ca5..29b8bb9 100644 --- a/src/Example/HardwareRepository.php +++ b/src/Example/Php74/HardwareRepository.php @@ -6,10 +6,10 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example; +namespace PixelFederation\CodingStandards\Example\Php74; -use PixelFederation\CodingStandards\Example\Common\EntityManager; -use PixelFederation\CodingStandards\Example\Common\HardwareId; +use PixelFederation\CodingStandards\Example\Php74\Common\EntityManager; +use PixelFederation\CodingStandards\Example\Php74\Common\HardwareId; final class HardwareRepository { diff --git a/src/Example/Traits/SerialNumberHaving.php b/src/Example/Php74/Traits/SerialNumberHaving.php similarity index 57% rename from src/Example/Traits/SerialNumberHaving.php rename to src/Example/Php74/Traits/SerialNumberHaving.php index 87cd3b3..9c4fab0 100644 --- a/src/Example/Traits/SerialNumberHaving.php +++ b/src/Example/Php74/Traits/SerialNumberHaving.php @@ -6,9 +6,9 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Traits; +namespace PixelFederation\CodingStandards\Example\Php74\Traits; -use PixelFederation\CodingStandards\Example\Common\SerialNumber; +use PixelFederation\CodingStandards\Example\Php74\Common\SerialNumber; interface SerialNumberHaving { diff --git a/src/Example/Traits/ServiceTagHaving.php b/src/Example/Php74/Traits/ServiceTagHaving.php similarity index 56% rename from src/Example/Traits/ServiceTagHaving.php rename to src/Example/Php74/Traits/ServiceTagHaving.php index 7f7bb1c..a8036cb 100644 --- a/src/Example/Traits/ServiceTagHaving.php +++ b/src/Example/Php74/Traits/ServiceTagHaving.php @@ -6,9 +6,9 @@ declare(strict_types=1); -namespace PixelFederation\CodingStandards\Example\Traits; +namespace PixelFederation\CodingStandards\Example\Php74\Traits; -use PixelFederation\CodingStandards\Example\Common\ServiceTag; +use PixelFederation\CodingStandards\Example\Php74\Common\ServiceTag; interface ServiceTagHaving { diff --git a/src/Example/Php81/Bar.php b/src/Example/Php81/Bar.php new file mode 100644 index 0000000..546638b --- /dev/null +++ b/src/Example/Php81/Bar.php @@ -0,0 +1,13 @@ +bar->width * $this->bar->height; + } +} + +$bar = new Bar(1, 2); +$foo = new Foo($bar); + +print $foo->baz(); diff --git a/src/Example/Php82/Bar.php b/src/Example/Php82/Bar.php new file mode 100644 index 0000000..59af4b1 --- /dev/null +++ b/src/Example/Php82/Bar.php @@ -0,0 +1,13 @@ +bar->width * $this->bar->height; + } +} + +$bar = new Bar(1, 2); +$foo = new Foo($bar); + +print $foo->baz(); diff --git a/src/phpcs.ruleset.81.xml b/src/phpcs.ruleset.81.xml new file mode 100644 index 0000000..bbf1c50 --- /dev/null +++ b/src/phpcs.ruleset.81.xml @@ -0,0 +1,5 @@ + + + PixelFederation example rule set for PHP 8.1. + + diff --git a/src/phpcs.ruleset.82.xml b/src/phpcs.ruleset.82.xml new file mode 100644 index 0000000..a475473 --- /dev/null +++ b/src/phpcs.ruleset.82.xml @@ -0,0 +1,5 @@ + + + PixelFederation example rule set for PHP 8.2. + + diff --git a/src/phpcs.ruleset.xml b/src/phpcs.ruleset.xml index 6d6c6b2..e75f841 100644 --- a/src/phpcs.ruleset.xml +++ b/src/phpcs.ruleset.xml @@ -1,6 +1,6 @@ - PixelFederation example rule set. + PixelFederation example rule set for PHP 7.4.