diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fff6890..4f762b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,10 +49,3 @@ jobs: - name: PHP-CS-Fixer if: matrix.php-versions == '8.1' run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr - - # https://github.com/marketplace/actions/setup-php-action#phpunit - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: PHPUnit - run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index 8279d3f..68f53fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ vendor dist -.phpunit.result.cache .php-cs-fixer .php-cs-fixer.cache diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0cf73..c884230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Removed +- Iss #16: All custom fixers have been moved to the [separate repository](https://github.com/erickskrauch/php-cs-fixer-custom-fixers) ## [0.5.0] - 2023-04-08 ### Added diff --git a/LICENSE b/LICENSE index 6cbfe8f..4f6d1cb 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 Ely.by (http://ely.by) + Copyright 2023 Ely.by (https://ely.by) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 04f1f49..bb2dff2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Ely.by PHP-CS-Fixer rules Set of PHP-CS-Fixer rules used in development of Ely.by PHP projects. It's suited for PHP 7.4 and above. -You can use it as a ready-made set of rules or [just some of them](#using-our-fixers). [![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] @@ -169,167 +168,11 @@ class Foo extends Bar implements FooInterface { ): void {} ``` -## Using our fixers - -First of all, you must install Ely.by PHP-CS-Fixer package as described in the [installation chapter](#installation). -After that you can enable our custom fixers with `registerCustomFixers` method: - -```php -registerCustomFixers(new \Ely\CS\Fixers()); -``` - -And then you'll be able to use our custom rules. - -### `Ely/align_multiline_parameters` - -Forces aligned or not aligned multiline function parameters: - -```diff ---- Original -+++ New -@@ @@ - function foo( - string $string, -- int $index = 0, -- $arg = 'no type', -+ int $index = 0, -+ $arg = 'no type', - ): void {} -``` - -**Configuration:** - -* `variables` - when set to `true`, forces variables alignment. On `false` forces strictly no alignment. - You can set it to `null` to disable touching of variables. **Default**: `true`. - -* `defaults` - when set to `true`, forces defaults alignment. On `false` forces strictly no alignment. - You can set it to `null` to disable touching of defaults. **Default**: `false`. - -### `Ely/blank_line_around_class_body` - -Ensure that a class body contains one blank line after its definition and before its end: - -```diff ---- Original -+++ New -@@ @@ - foo(); - return 'okay'; - } -``` - -### `Ely/line_break_after_statements` - -Ensures that there is one blank line above the next statements: `if`, `switch`, `for`, `foreach`, `while` -and `do-while`. - -```diff ---- Original -+++ New -@@ @@ - =3,<3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2022-03-03T13:19:32+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.15.1", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" - }, - "time": "2022-09-04T07:30:47+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "php-cs-fixer/phpunit-constraint-isidenticalstring", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/phpunit-constraint-isidenticalstring.git", - "reference": "2bd63d705ff5db3892da10f4df768abaffa8c1e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/phpunit-constraint-isidenticalstring/zipball/2bd63d705ff5db3892da10f4df768abaffa8c1e2", - "reference": "2bd63d705ff5db3892da10f4df768abaffa8c1e2", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0 || ^8.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0", - "phpunitgoodpractices/polyfill": "^1.4" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", - "symfony/phpunit-bridge": "^3.2.2 || ^4.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Constraint/IsIdenticalString.php" - ], - "psr-4": { - "PhpCsFixer\\PhpunitConstraintIsIdenticalString\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "Constraint for testing strings considering not-same line endings.", - "support": { - "issues": "https://github.com/PHP-CS-Fixer/phpunit-constraint-isidenticalstring/issues", - "source": "https://github.com/PHP-CS-Fixer/phpunit-constraint-isidenticalstring/tree/v1.2.0" - }, - "time": "2020-10-20T01:38:06+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" - }, - "time": "2022-03-15T21:29:03+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, - { - "name": "phpspec/prophecy-phpunit", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8", - "phpspec/prophecy": "^1.3", - "phpunit/phpunit": "^9.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\PhpUnit\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - } - ], - "description": "Integrating the Prophecy mocking library in PHPUnit test cases", - "homepage": "http://phpspec.net", - "keywords": [ - "phpunit", - "prophecy" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1" - }, - "time": "2020-07-09T08:33:42+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.17", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-08-30T12:24:04+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.5.24", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "reference": "d0aa6097bef9fd42458a9b3c49da32c6ce6129c5", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.1", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.5-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.24" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-08-30T07:42:16+00:00" - }, - { - "name": "phpunitgoodpractices/polyfill", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/PHPUnitGoodPractices/polyfill.git", - "reference": "625622fc35e922c04f28e448b43d85972be95040" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPUnitGoodPractices/polyfill/zipball/625622fc35e922c04f28e448b43d85972be95040", - "reference": "625622fc35e922c04f28e448b43d85972be95040", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0 || ^8.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2", - "php-coveralls/php-coveralls": "^2.4" - }, - "type": "library", - "autoload": { - "files": [ - "src/aliases.php" - ], - "psr-4": { - "PHPUnitGoodPractices\\Polyfill\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "Lacking future-compat polyfills for PHPUnit.", - "support": { - "issues": "https://github.com/PHPUnitGoodPractices/polyfill/issues", - "source": "https://github.com/PHPUnitGoodPractices/polyfill/tree/v1.6.0" - }, - "time": "2022-08-29T17:28:48+00:00" - }, - { - "name": "phpunitgoodpractices/traits", - "version": "v1.9.2", - "source": { - "type": "git", - "url": "https://github.com/PHPUnitGoodPractices/Traits.git", - "reference": "067b87ddc903231f07f89161f10f1ab8b393a6a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPUnitGoodPractices/Traits/zipball/067b87ddc903231f07f89161f10f1ab8b393a6a1", - "reference": "067b87ddc903231f07f89161f10f1ab8b393a6a1", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0 || ^8.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ~8.5 || ~9.4" - }, - "require-dev": { - "phpspec/prophecy": "^1.10", - "phpunitgoodpractices/polyfill": "^1.1", - "sanmai/phpunit-legacy-adapter": "^6.1 || ^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPUnitGoodPractices\\Traits\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "description": "Highly opinionated PHPUnit good practices enforcer.", - "support": { - "issues": "https://github.com/PHPUnitGoodPractices/Traits/issues", - "source": "https://github.com/PHPUnitGoodPractices/Traits/tree/v1.9.2" - }, - "time": "2022-08-29T18:04:47+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T12:41:17+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-04-03T09:37:03+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-14T06:03:37+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-02-14T08:28:10+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:17:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" - }, - { - "name": "sebastian/type", - "version": "3.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2022-09-12T14:47:03+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "symfony/phpunit-bridge", - "version": "v6.1.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/75c2fa71d049c1f48e39d208c0cefba97e66335a", - "reference": "75c2fa71d049c1f48e39d208c0cefba97e66335a", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "conflict": { - "phpunit/phpunit": "<7.5|9.1.2" - }, - "require-dev": { - "symfony/deprecation-contracts": "^2.1|^3.0", - "symfony/error-handler": "^5.4|^6.0" - }, - "suggest": { - "symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" - }, - "bin": [ - "bin/simple-phpunit" - ], - "type": "symfony-bridge", - "extra": { - "thanks": { - "name": "phpunit/phpunit", - "url": "https://github.com/sebastianbergmann/phpunit" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Bridge\\PhpUnit\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides utilities for PHPUnit, especially user deprecation notices management", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v6.1.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-07-28T13:40:41+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.11.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", - "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "php": "^7.2 || ^8.0" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.11.0" - }, - "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "erickskrauch/php-cs-fixer-custom-fixers": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index c071f0a..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - ./tests - - - - - - ./src - - - - - - - - diff --git a/src/Config.php b/src/Config.php index 5d3277a..c6ede62 100644 --- a/src/Config.php +++ b/src/Config.php @@ -3,17 +3,17 @@ declare(strict_types=1); namespace Ely\CS; -use Ely\CS\Fixers as ElyFixers; +use ErickSkrauch\PhpCsFixer\Fixers as ErickSkrauchFixers; use PhpCsFixer\Config as PhpCsFixerConfig; use PhpCsFixer\ConfigInterface as PhpCsFixerConfigInterface; use PhpCsFixerCustomFixers\Fixers as KubawerlosFixers; -class Config { +final class Config { public static function create(array $overwrittenRules = []): PhpCsFixerConfigInterface { return (new PhpCsFixerConfig()) ->setRiskyAllowed(true) - ->registerCustomFixers(new ElyFixers()) + ->registerCustomFixers(new ErickSkrauchFixers()) ->registerCustomFixers(new KubawerlosFixers()) ->setRules(Rules::create($overwrittenRules)); } diff --git a/src/Fixer/AbstractFixer.php b/src/Fixer/AbstractFixer.php deleted file mode 100644 index 31988b7..0000000 --- a/src/Fixer/AbstractFixer.php +++ /dev/null @@ -1,15 +0,0 @@ -parameterModifiers = [ - CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PUBLIC, - CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PROTECTED, - CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PRIVATE, - ]; - if (defined('T_READONLY')) { - $this->parameterModifiers[] = T_READONLY; - } - } - - public function getDefinition(): FixerDefinitionInterface { - return new FixerDefinition( - 'Aligns parameters in multiline function declaration.', - [ - new CodeSample( - ' false, self::C_DEFAULTS => false], - ), - ], - ); - } - - public function isCandidate(Tokens $tokens): bool { - return $tokens->isAnyTokenKindsFound([T_FUNCTION, T_FN]); - } - - /** - * Must run after StatementIndentationFixer, MethodArgumentSpaceFixer - */ - public function getPriority(): int { - return -10; - } - - protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { - return new FixerConfigurationResolver([ - (new FixerOptionBuilder(self::C_VARIABLES, 'on null no value alignment, on bool forces alignment')) - ->setAllowedTypes(['bool', 'null']) - ->setDefault(true) - ->getOption(), - (new FixerOptionBuilder(self::C_DEFAULTS, 'on null no value alignment, on bool forces alignment')) - ->setAllowedTypes(['bool', 'null']) - ->setDefault(null) - ->getOption(), - ]); - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - // There is nothing to do - if ($this->configuration[self::C_VARIABLES] === null && $this->configuration[self::C_DEFAULTS] === null) { - return; - } - - $tokensAnalyzer = new TokensAnalyzer($tokens); - $functionsAnalyzer = new FunctionsAnalyzer(); - /** @var \PhpCsFixer\Tokenizer\Token $functionToken */ - foreach ($tokens as $i => $functionToken) { - if (!$functionToken->isGivenKind([T_FUNCTION, T_FN])) { - continue; - } - - $openBraceIndex = $tokens->getNextTokenOfKind($i, ['(']); - $isMultiline = $tokensAnalyzer->isBlockMultiline($tokens, $openBraceIndex); - if (!$isMultiline) { - continue; - } - - /** @var \PhpCsFixer\Tokenizer\Analyzer\Analysis\ArgumentAnalysis[] $arguments */ - $arguments = $functionsAnalyzer->getFunctionArguments($tokens, $i); - if (empty($arguments)) { - continue; - } - - $longestType = 0; - $longestVariableName = 0; - $hasAtLeastOneTypedArgument = false; - foreach ($arguments as $argument) { - $typeAnalysis = $argument->getTypeAnalysis(); - if ($typeAnalysis) { - $hasAtLeastOneTypedArgument = true; - $typeLength = $this->getFullTypeLength($tokens, $typeAnalysis->getStartIndex()); - if ($typeLength > $longestType) { - $longestType = $typeLength; - } - } - - $variableNameLength = strlen($argument->getName()); - if ($variableNameLength > $longestVariableName) { - $longestVariableName = $variableNameLength; - } - } - - $argsIndent = WhitespacesAnalyzer::detectIndent($tokens, $i) . $this->whitespacesConfig->getIndent(); - foreach ($arguments as $argument) { - if ($this->configuration[self::C_VARIABLES] !== null) { - $whitespaceIndex = $argument->getNameIndex() - 1; - if ($this->configuration[self::C_VARIABLES] === true) { - $typeLen = 0; - if ($argument->getTypeAnalysis() !== null) { - $typeLen = $this->getFullTypeLength($tokens, $argument->getTypeAnalysis()->getStartIndex()); - } - - $appendix = str_repeat(' ', $longestType - $typeLen + (int)$hasAtLeastOneTypedArgument); - if ($argument->hasTypeAnalysis()) { - $whitespaceToken = $appendix; - } else { - $whitespaceToken = $this->whitespacesConfig->getLineEnding() . $argsIndent . $appendix; - } - } else { - if ($argument->hasTypeAnalysis()) { - $whitespaceToken = ' '; - } else { - $whitespaceToken = $this->whitespacesConfig->getLineEnding() . $argsIndent; - } - } - - $tokens->ensureWhitespaceAtIndex($whitespaceIndex, 0, $whitespaceToken); - } - - if ($this->configuration[self::C_DEFAULTS] !== null) { - // Can't use $argument->hasDefault() because it's null when it's default for a type (e.g. 0 for int) - /** @var \PhpCsFixer\Tokenizer\Token $equalToken */ - $equalToken = $tokens[$tokens->getNextMeaningfulToken($argument->getNameIndex())]; - if ($equalToken->getContent() === '=') { - $nameLen = strlen($argument->getName()); - $whitespaceIndex = $argument->getNameIndex() + 1; - if ($this->configuration[self::C_DEFAULTS] === true) { - $tokens->ensureWhitespaceAtIndex($whitespaceIndex, 0, str_repeat(' ', $longestVariableName - $nameLen + 1)); - } else { - $tokens->ensureWhitespaceAtIndex($whitespaceIndex, 0, ' '); - } - } - } - } - } - } - - private function getFullTypeLength(Tokens $tokens, int $typeIndex): int { - /** @var \PhpCsFixer\Tokenizer\Token $typeToken */ - $typeToken = $tokens[$typeIndex]; - $typeLength = strlen($typeToken->getContent()); - - /** @var \PhpCsFixer\Tokenizer\Token $possiblyReadonlyToken */ - $possiblyReadonlyToken = $tokens[$typeIndex - 2]; - if ($possiblyReadonlyToken->isGivenKind($this->parameterModifiers)) { - /** @var \PhpCsFixer\Tokenizer\Token $whitespaceToken */ - $whitespaceToken = $tokens[$typeIndex - 1]; - $typeLength += strlen($possiblyReadonlyToken->getContent() . $whitespaceToken->getContent()); - } - - /** @var \PhpCsFixer\Tokenizer\Token $possiblyPromotionToken */ - $possiblyPromotionToken = $tokens[$typeIndex - 4]; - if ($possiblyPromotionToken->isGivenKind($this->parameterModifiers)) { - /** @var \PhpCsFixer\Tokenizer\Token $whitespaceToken */ - $whitespaceToken = $tokens[$typeIndex - 3]; - $typeLength += strlen($possiblyPromotionToken->getContent() . $whitespaceToken->getContent()); - } - - return $typeLength; - } - -} diff --git a/src/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixer.php b/src/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixer.php deleted file mode 100644 index 967b7fd..0000000 --- a/src/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixer.php +++ /dev/null @@ -1,107 +0,0 @@ - - */ -final class RemoveClassNameMethodUsagesFixer extends AbstractFixer { - - public function getDefinition(): FixerDefinitionInterface { - return new FixerDefinition( - 'Converts Yii2 `BaseObject::className()` method usage into `::class` keyword.', - [ - new CodeSample( - 'isTokenKindFound(T_STRING); - } - - public function isRisky(): bool { - return true; - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - for ($index = $tokens->count() - 4; $index > 0; --$index) { - $candidate = $this->getReplaceCandidate($tokens, $index); - if ($candidate === null) { - continue; - } - - $this->fixClassNameMethodUsage( - $tokens, - $index, - $candidate[0], // brace open - $candidate[1], // brace close - ); - } - } - - private function getReplaceCandidate(Tokens $tokens, int $index): ?array { - if (!$tokens[$index]->isGivenKind(T_STRING)) { - return null; - } - - $braceOpenIndex = $tokens->getNextMeaningfulToken($index); - if (!$tokens[$braceOpenIndex]->equals('(')) { - return null; - } - - $braceCloseIndex = $tokens->getNextMeaningfulToken($braceOpenIndex); - if (!$tokens[$braceCloseIndex]->equals(')')) { - return null; - } - - $doubleColon = $tokens->getPrevMeaningfulToken($index); - if (!$tokens[$doubleColon]->isGivenKind([T_DOUBLE_COLON])) { - return null; - } - - $methodName = $tokens[$index]->getContent(); - if ($methodName !== 'className') { - return null; - } - - return [ - $braceOpenIndex, - $braceCloseIndex, - ]; - } - - private function fixClassNameMethodUsage( - Tokens $tokens, - int $index, - int $braceOpenIndex, - int $braceCloseIndex - ): void { - $tokens->clearTokenAndMergeSurroundingWhitespace($braceCloseIndex); - $tokens->clearTokenAndMergeSurroundingWhitespace($braceOpenIndex); - $tokens->clearAt($index); - $tokens->insertAt($index, new Token([CT::T_CLASS_CONSTANT, 'class'])); - } - -} diff --git a/src/Fixer/Whitespace/BlankLineAroundClassBodyFixer.php b/src/Fixer/Whitespace/BlankLineAroundClassBodyFixer.php deleted file mode 100644 index 86feed5..0000000 --- a/src/Fixer/Whitespace/BlankLineAroundClassBodyFixer.php +++ /dev/null @@ -1,144 +0,0 @@ - false], - ), - new CodeSample( - ' true], - ), - ], - ); - } - - public function isCandidate(Tokens $tokens): bool { - return $tokens->isAnyTokenKindsFound(Token::getClassyTokenKinds()); - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - $analyzer = new TokensAnalyzer($tokens); - /** @var Token $token */ - foreach ($tokens as $index => $token) { - if (!$token->isClassy()) { - continue; - } - - $countLines = $this->configuration[self::C_BLANK_LINES_COUNT]; - if (!$this->configuration[self::C_APPLY_TO_ANONYMOUS_CLASSES] && $analyzer->isAnonymousClass($index)) { - $countLines = 0; - } - - $startBraceIndex = $tokens->getNextTokenOfKind($index, ['{']); - /** @var Token $nextAfterBraceToken */ - $nextAfterBraceToken = $tokens[$startBraceIndex + 1]; - if ($nextAfterBraceToken->isWhitespace()) { - $nextStatementIndex = $tokens->getNextMeaningfulToken($startBraceIndex); - /** @var Token $nextStatementToken */ - $nextStatementToken = $tokens[$nextStatementIndex]; - // Traits should be placed right after a class opening brace - if ($nextStatementToken->getContent() !== 'use') { - $this->ensureBlankLines($tokens, $startBraceIndex + 1, $countLines); - } - } - - $endBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $startBraceIndex); - if ($tokens[$endBraceIndex - 1]->isWhitespace()) { - $this->ensureBlankLines($tokens, $endBraceIndex - 1, $countLines); - } - } - } - - protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { - return new FixerConfigurationResolver([ - (new FixerOptionBuilder(self::C_BLANK_LINES_COUNT, 'adjusts the number of blank lines.')) - ->setAllowedTypes(['int']) - ->setDefault(1) - ->getOption(), - (new FixerOptionBuilder(self::C_APPLY_TO_ANONYMOUS_CLASSES, 'whether this fixer should be applied to anonymous classes.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - ]); - } - - private function ensureBlankLines(Tokens $tokens, int $index, int $countLines): void { - $content = $tokens[$index]->getContent(); - // Apply fix only when the lines count doesn't equal to expected - // Don't check for \r\n sequence since it's still contains \n part - if (substr_count($content, "\n") === $countLines + 1) { - return; - } - - // Use regexp to extract contents between line breaks - Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches); - $lines = $matches[0]; - $eol = $this->whitespacesConfig->getLineEnding(); - $tokens->ensureWhitespaceAtIndex($index, 0, str_repeat($eol, $countLines + 1) . end($lines)); - } - -} diff --git a/src/Fixer/Whitespace/BlankLineBeforeReturnFixer.php b/src/Fixer/Whitespace/BlankLineBeforeReturnFixer.php deleted file mode 100644 index 92ea801..0000000 --- a/src/Fixer/Whitespace/BlankLineBeforeReturnFixer.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @author Andreas Möller - * @author SpacePossum - */ -final class BlankLineBeforeReturnFixer extends AbstractFixer implements WhitespacesAwareFixerInterface { - - public function getDefinition(): FixerDefinitionInterface { - return new FixerDefinition( - 'An empty line feed should precede a return statement.', - [new CodeSample("isTokenKindFound(T_RETURN); - } - - public function getPriority(): int { - // should be run after NoUselessReturnFixer, ClassDefinitionFixer and BracesFixer - return -26; - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - for ($index = 0, $limit = $tokens->count(); $index < $limit; ++$index) { - $token = $tokens[$index]; - if (!$token->isGivenKind(T_RETURN)) { - continue; - } - - $eol = $this->whitespacesConfig->getLineEnding(); - - $prevNonWhitespaceToken = $tokens[$tokens->getPrevNonWhitespace($index)]; - if (!$prevNonWhitespaceToken->equalsAny([';', '}'])) { - continue; - } - - $prevIndex = $index - 1; - $prevToken = $tokens[$prevIndex]; - if ($prevToken->isWhitespace()) { - $countParts = substr_count($prevToken->getContent(), "\n"); - if ($countParts === 0) { - $tokens[$prevIndex] = new Token([T_WHITESPACE, rtrim($prevToken->getContent(), " \t") . $eol . $eol]); - } elseif ($countParts === 1) { - $backwardIndex = $prevIndex; - do { - if (--$backwardIndex < 0) { - break; - } - - /** @var Token $backwardToken */ - $backwardToken = $tokens[$backwardIndex]; - /** @var Token $nextToken */ - $nextToken = $tokens[$backwardIndex + 1]; - // Exclude string interpolation: "str {$var}" - if ($backwardToken->getContent() === '{' && !$nextToken->isGivenKind(T_VARIABLE)) { - break; - } - - if ($backwardToken->isWhitespace()) { - $countParts += substr_count($backwardToken->getContent(), "\n"); - } - } while ($countParts < 3); - - if ($countParts !== 2) { - $tokens[$prevIndex] = new Token([T_WHITESPACE, $eol . $prevToken->getContent()]); - } - } - } else { - $tokens->insertSlices([$index => new Token([T_WHITESPACE, $eol . $eol])]); - ++$index; - ++$limit; - } - } - } - -} diff --git a/src/Fixer/Whitespace/LineBreakAfterStatementsFixer.php b/src/Fixer/Whitespace/LineBreakAfterStatementsFixer.php deleted file mode 100644 index db75d0b..0000000 --- a/src/Fixer/Whitespace/LineBreakAfterStatementsFixer.php +++ /dev/null @@ -1,170 +0,0 @@ - - */ -final class LineBreakAfterStatementsFixer extends AbstractFixer implements WhitespacesAwareFixerInterface { - - /** - * There is no 'do', 'cause the processing of the 'while' also includes do {} while (); construction - */ - private const STATEMENTS = [ - T_IF, - T_SWITCH, - T_FOR, - T_FOREACH, - T_WHILE, - ]; - - public function getDefinition(): FixerDefinitionInterface { - return new FixerDefinition( - 'Ensures that there is one blank line above the control statements.', - [ - new CodeSample( - 'isAnyTokenKindsFound(self::STATEMENTS); - } - - public function getPriority(): int { - // for the best result should be run after the BracesFixer - return -26; - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - foreach ($tokens as $index => $token) { - if (!$token->isGivenKind(self::STATEMENTS)) { - continue; - } - - $endStatementIndex = $this->findStatementEnd($tokens, $index); - $nextStatementIndex = $tokens->getNextMeaningfulToken($endStatementIndex); - if ($nextStatementIndex === null) { - continue; - } - - if ($tokens[$nextStatementIndex]->equals('}')) { - $this->fixBlankLines($tokens, $endStatementIndex + 1, 0); - continue; - } - - $this->fixBlankLines($tokens, $endStatementIndex + 1, 1); - } - } - - private function fixBlankLines(Tokens $tokens, int $index, int $countLines): void { - $content = $tokens[$index]->getContent(); - // Apply fix only in the case when the count lines do not equals to expected - if (substr_count($content, "\n") === $countLines + 1) { - return; - } - - // The final bit of the whitespace must be the next statement's indentation - Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches); - $lines = $matches[0]; - $eol = $this->whitespacesConfig->getLineEnding(); - $tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]); - } - - private function findStatementEnd(Tokens $tokens, int $index): int { - $nextIndex = $tokens->getNextMeaningfulToken($index); - $nextToken = $tokens[$nextIndex]; - - if ($nextToken->equals('(')) { - $parenthesisEndIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $nextIndex); - $possibleBeginBraceIndex = $tokens->getNextNonWhitespace($parenthesisEndIndex); - } else { - $possibleBeginBraceIndex = $nextIndex; - } - - // `do {} while ();` - if ($tokens[$index]->isGivenKind(T_WHILE) && $tokens[$possibleBeginBraceIndex]->equals(';')) { - return $possibleBeginBraceIndex; - } - - $possibleBeginBrace = $tokens[$possibleBeginBraceIndex]; - if ($possibleBeginBrace->equals('{')) { - $blockEnd = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $possibleBeginBraceIndex); - } else { - $blockEnd = $tokens->getNextTokenOfKind($possibleBeginBraceIndex, [';']); - } - - $nextStatementIndex = $tokens->getNextMeaningfulToken($blockEnd); - if ($nextStatementIndex === null) { - return $blockEnd; - } - - // `if () {} elseif {}` - if ($tokens[$nextStatementIndex]->isGivenKind(T_ELSEIF)) { - return $this->findStatementEnd($tokens, $nextStatementIndex); - } - - // `if () {} else if {}` or simple `if () {} else {}` - if ($tokens[$nextStatementIndex]->isGivenKind(T_ELSE)) { - $nextNextStatementIndex = $tokens->getNextMeaningfulToken($nextStatementIndex); - if ($tokens[$nextNextStatementIndex]->isGivenKind(T_IF)) { - return $this->findStatementEnd($tokens, $nextNextStatementIndex); - } - - return $this->findStatementEnd($tokens, $nextStatementIndex); - } - - return $blockEnd; - } - -} diff --git a/src/Fixer/Whitespace/MultilineIfStatementBracesFixer.php b/src/Fixer/Whitespace/MultilineIfStatementBracesFixer.php deleted file mode 100644 index 0fa1d1c..0000000 --- a/src/Fixer/Whitespace/MultilineIfStatementBracesFixer.php +++ /dev/null @@ -1,92 +0,0 @@ - false], - ), - ], - ); - } - - public function isCandidate(Tokens $tokens): bool { - return $tokens->isTokenKindFound(T_IF); - } - - protected function createConfigurationDefinition(): FixerConfigurationResolverInterface { - return new FixerConfigurationResolver([ - (new FixerOptionBuilder(self::C_KEEP_ON_OWN_LINE, 'adjusts the position of condition closing brace.')) - ->setAllowedTypes(['bool']) - ->setDefault(true) - ->getOption(), - ]); - } - - protected function applyFix(SplFileInfo $file, Tokens $tokens): void { - $keepOnOwnLine = $this->configuration[self::C_KEEP_ON_OWN_LINE]; - $tokensAnalyzer = new TokensAnalyzer($tokens); - $eol = $this->whitespacesConfig->getLineEnding(); - foreach ($tokens as $i => $token) { - if (!$token->isGivenKind(T_IF)) { - continue; - } - - $openBraceIndex = $tokens->getNextTokenOfKind($i, ['(']); - if (!$tokensAnalyzer->isBlockMultiline($tokens, $openBraceIndex)) { - continue; - } - - $closingBraceIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openBraceIndex); - /** @var \PhpCsFixer\Tokenizer\Token $statementBeforeClosingBrace */ - $statementBeforeClosingBrace = $tokens[$closingBraceIndex - 1]; - if ($keepOnOwnLine) { - if (!$statementBeforeClosingBrace->isWhitespace() - || !str_contains($statementBeforeClosingBrace->getContent(), $eol) - ) { - $indent = WhitespacesAnalyzer::detectIndent($tokens, $i); - $tokens->ensureWhitespaceAtIndex($closingBraceIndex, 0, $eol . $indent); - } - } else { - $tokens->removeLeadingWhitespace($closingBraceIndex); - } - } - } - -} diff --git a/src/Fixers.php b/src/Fixers.php deleted file mode 100644 index a500121..0000000 --- a/src/Fixers.php +++ /dev/null @@ -1,36 +0,0 @@ -in(__DIR__ . '/Fixer')->name('*.php'); - $classes = []; - foreach ($finder as $file) { - $class = '\\Ely\\CS' . str_replace('/', '\\', mb_substr($file->getPathname(), mb_strlen(__DIR__), -4)); - if (!class_exists($class)) { - continue; - } - - $rfl = new ReflectionClass($class); - if (!$rfl->implementsInterface(FixerInterface::class) || $rfl->isAbstract()) { - continue; - } - - $classes[] = $class; - } - - return new ArrayIterator(array_map(fn($class) => new $class(), $classes)); - } - -} diff --git a/src/Rules.php b/src/Rules.php index 7d93f57..fe12f09 100644 --- a/src/Rules.php +++ b/src/Rules.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace Ely\CS; -class Rules { +final class Rules { public static function create(array $overwrittenRules = []): array { return array_merge([ @@ -219,17 +219,17 @@ class Rules { ], // Our custom or extended fixers - 'Ely/align_multiline_parameters' => [ + 'ErickSkrauch/align_multiline_parameters' => [ 'variables' => false, 'defaults' => false, ], - 'Ely/blank_line_around_class_body' => [ + 'ErickSkrauch/blank_line_around_class_body' => [ 'apply_to_anonymous_classes' => false, ], - 'Ely/blank_line_before_return' => true, - 'Ely/line_break_after_statements' => true, - 'Ely/multiline_if_statement_braces' => true, - 'Ely/remove_class_name_method_usages' => true, + 'ErickSkrauch/blank_line_before_return' => true, + 'ErickSkrauch/line_break_after_statements' => true, + 'ErickSkrauch/multiline_if_statement_braces' => true, + 'ErickSkrauch/remove_class_name_method_usages' => true, ], $overwrittenRules); } diff --git a/tests/Fixer/FunctionNotation/AlignMultilineParametersFixerTest.php b/tests/Fixer/FunctionNotation/AlignMultilineParametersFixerTest.php deleted file mode 100644 index 85f45e2..0000000 --- a/tests/Fixer/FunctionNotation/AlignMultilineParametersFixerTest.php +++ /dev/null @@ -1,351 +0,0 @@ -fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => true, - AlignMultilineParametersFixer::C_DEFAULTS => true, - ]); - $this->doTest($expected, $input); - } - - public function provideTrueCases(): iterable { - yield 'empty function' => [ - ' [ - ' [ - ' [ - ' $b; - ', - ]; - - yield 'function, no defaults' => [ - ' [ - ' [ - ' [ - ' [ - ' [ - ' [ - ' [ - ' $int; - ', - ' $int; - ', - ]; - } - - /** - * @dataProvider provideFalseCases - */ - public function testBothFalse(string $expected, ?string $input = null): void { - $this->fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => false, - AlignMultilineParametersFixer::C_DEFAULTS => false, - ]); - $this->doTest($expected, $input); - } - - public function provideFalseCases(): iterable { - foreach ($this->provideTrueCases() as $key => $case) { - if (isset($case[1])) { - yield $key => [$case[1], $case[0]]; - } else { - yield $key => $case; - } - } - } - - /** - * @dataProvider provideNullCases - */ - public function testBothNull(string $expected, ?string $input = null): void { - $this->fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => null, - AlignMultilineParametersFixer::C_DEFAULTS => null, - ]); - $this->doTest($expected, $input); - } - - public function provideNullCases(): iterable { - foreach ($this->provideFalseCases() as $key => $case) { - yield $key => [$case[0]]; - } - } - - /** - * @dataProvider provide80TrueCases - * @requires PHP 8.0 - */ - public function test80BothTrue(string $expected, ?string $input = null): void { - $this->fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => true, - AlignMultilineParametersFixer::C_DEFAULTS => true, - ]); - $this->doTest($expected, $input); - } - - public function provide80TrueCases(): iterable { - yield 'constructor promotion, defaults' => [ - 'fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => false, - AlignMultilineParametersFixer::C_DEFAULTS => false, - ]); - $this->doTest($expected, $input); - } - - public function provideFalse80Cases(): iterable { - foreach ($this->provide80TrueCases() as $key => $case) { - if (isset($case[1])) { - yield $key => [$case[1], $case[0]]; - } else { - yield $key => $case; - } - } - } - - /** - * @dataProvider provide81TrueCases - * @requires PHP 8.1 - */ - public function test81BothTrue(string $expected, ?string $input = null): void { - $this->fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => true, - AlignMultilineParametersFixer::C_DEFAULTS => true, - ]); - $this->doTest($expected, $input); - } - - public function provide81TrueCases(): iterable { - yield 'constructor promotion, readonly, defaults' => [ - ' [ - 'fixer->configure([ - AlignMultilineParametersFixer::C_VARIABLES => false, - AlignMultilineParametersFixer::C_DEFAULTS => false, - ]); - $this->doTest($expected, $input); - } - - public function provideFalse81Cases(): iterable { - foreach ($this->provide81TrueCases() as $key => $case) { - if (isset($case[1])) { - yield $key => [$case[1], $case[0]]; - } else { - yield $key => $case; - } - } - } - - protected function createFixer(): AbstractFixer { - return new AlignMultilineParametersFixer(); - } - -} diff --git a/tests/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixerTest.php b/tests/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixerTest.php deleted file mode 100644 index 23a35d9..0000000 --- a/tests/Fixer/LanguageConstruct/RemoveClassNameMethodUsagesFixerTest.php +++ /dev/null @@ -1,66 +0,0 @@ -doTest($expected, $input); - } - - public function provideFixCases(): iterable { - yield [ - ' - * - * @covers \Ely\CS\Fixer\Whitespace\BlankLineAroundClassBodyFixer - */ -final class BlankLineAroundClassBodyFixerTest extends AbstractFixerTestCase { - - private static $configurationDoNotApplyForAnonymousClasses = ['apply_to_anonymous_classes' => false]; - - private static $configurationTwoEmptyLines = ['blank_lines_count' => 2]; - - /** - * @dataProvider provideFixCases - */ - public function testFix(string $expected, ?string $input = null, array $configuration = null): void { - if ($configuration !== null) { - $this->fixer->configure($configuration); - } - - $this->doTest($expected, $input); - } - - public function provideFixCases(): iterable { - yield [ - 'fixer; - $fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n")); - - $this->doTest($expected, $input); - } - - public function provideMessyWhitespacesCases(): iterable { - yield [ - " - * @author Andreas Möller - * @author SpacePossum - * - * @internal - * - * @property BlankLineBeforeReturnFixer $fixer - * - * @covers \Ely\CS\Fixer\Whitespace\BlankLineBeforeReturnFixer - */ -final class BlankLineBeforeReturnFixerTest extends AbstractFixerTestCase { - - /** - * @dataProvider provideFixCases - */ - public function testFix(string $expected, ?string $input = null): void { - $this->doTest($expected, $input); - } - - public function provideFixCases(): iterable { - yield [ - '$a = $a; -return $a; -', - ]; - yield [ - 'fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n")); - - $this->doTest($expected, $input); - } - - public function provideMessyWhitespacesCases(): iterable { - yield [ - " - */ -class LineBreakAfterStatementsFixerTest extends AbstractFixerTestCase { - - /** - * @dataProvider provideFixCases - */ - public function testFix(string $expected, ?string $input = null): void { - $this->doTest($expected, $input); - } - - public function provideFixCases(): iterable { - // Simple cases - yield [ - 'bar(); - - $a = "next statement"; - } -}', - 'bar(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - else - $this->baz(); - - $a = "next statement"; - } -}', - 'bar(); - else - $this->baz(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - - $a = "next statement"; - } -}', - 'bar(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - - $a = "next statement"; - } -}', - 'bar(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - - $a = "next statement"; - } -}', - 'bar(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - while ($i < 10); - - $a = "next statement"; - } -}', - 'bar(); - while ($i < 10); - $a = "next statement"; - } -}', - ]; - - yield [ - 'foo(); - else if ("a" === "c") - $this->bar(); - else if ("a" === "d") - $this->baz(); - - $a = "next statement"; - } -}', - 'foo(); - else if ("a" === "c") - $this->bar(); - else if ("a" === "d") - $this->baz(); - $a = "next statement"; - } -}', - ]; - - yield [ - 'bar(); - - return 3; - } -}', - 'bar(); - return 3; - } -}', - ]; - - yield [ - ' 10); // comment here - ', - ]; - } - - protected function createFixer(): AbstractFixer { - return new LineBreakAfterStatementsFixer(); - } - -} diff --git a/tests/Fixer/Whitespace/MultilineIfStatementBracesFixerTest.php b/tests/Fixer/Whitespace/MultilineIfStatementBracesFixerTest.php deleted file mode 100644 index dd2434b..0000000 --- a/tests/Fixer/Whitespace/MultilineIfStatementBracesFixerTest.php +++ /dev/null @@ -1,68 +0,0 @@ -doTest($expected, $input); - } - - public function provideFixCases(): iterable { - yield 'simple' => [ - ' [ - 'fixer->configure([ - MultilineIfStatementBracesFixer::C_KEEP_ON_OWN_LINE => false, - ]); - $this->doTest($expected, $input); - } - - public function provideInvertedFixCases(): iterable { - foreach ($this->provideFixCases() as $name => $case) { - yield $name => [$case[1], $case[0]]; - } - } - - protected function createFixer(): AbstractFixer { - return new MultilineIfStatementBracesFixer(); - } - -}