diff --git a/.gitignore b/.gitignore index 4b29770..96519ac 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ vendor/ .phpunit.cache .phpcs-cache +build/ +composer.lock diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..9bd3099 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +use Angelov\PHPUnitPHPVcr\Tests\Nexus\CodingStandard; +use Nexus\CsConfig\Factory; +use PhpCsFixer\Finder; + +$finder = Finder::create() + ->files() + ->in([ + __DIR__ . '/src/', + __DIR__ . '/tests/', + ]) + ->exclude('build') + ->append([ + __FILE__, + __DIR__ . '/rector.php', + ]); + +$overrides = [ + 'declare_strict_types' => true, + 'void_return' => true, +]; + +$options = [ + 'finder' => $finder, + 'cacheFile' => 'build/.php-cs-fixer.cache', +]; + +return Factory::create(new CodingStandard(), $overrides, $options)->forLibrary( + 'Angelov phpunit-vcr', + 'Angelov', + 'https://angelovdejan.me', +); diff --git a/README.md b/README.md index 0b6575b..49b7b72 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # PHP-VCR integration for PHPUnit +[![Build status](https://github.com/angelov/phpunit-php-vcr/actions/workflows/default.yaml/badge.svg?branch=main)](https://github.com/angelov/phpunit-php-vcr/actions/workflows/default.yaml) +[![Downloads](https://poser.pugx.org/angelov/phpunit-php-vcr/downloads)](https://packagist.org/packages/angelov/phpunit-php-vcr) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/angelov/phpunit-php-vcr)](https://packagist.org/packages/angelov/phpunit-php-vcr) +[![GitHub stars](https://img.shields.io/github/stars/angelov/phpunit-php-vcr)](https://packagist.org/packages/angelov/phpunit-php-vcr) +[![GitHub license](https://img.shields.io/github/license/angelov/phpunit-php-vcr)](https://github.com/angelov/phpunit-php-vcr/blob/main/LICENSE) + A library that allows you to easily use the PHP-VCR library in your PHPUnit tests. ## Requirements diff --git a/admin/pre-commit b/admin/pre-commit new file mode 100644 index 0000000..6ca9eda --- /dev/null +++ b/admin/pre-commit @@ -0,0 +1,37 @@ +#!/bin/sh + +PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"` +STAGED_PHP_FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php$` + +echo "Starting CodeIgniter precommit..." + +if [ "$STAGED_PHP_FILES" != "" ]; then + echo "Linting PHP code..." + for FILE in $STAGED_PHP_FILES; do + php -l -d display_errors=0 "$PROJECT/$FILE" + + if [ $? != 0 ]; then + echo "Fix the error(s) before commit." + exit 1 + fi + + FILES="$FILES $FILE" + done +fi + +if [ "$FILES" != "" ]; then + echo "Running PHP CS Fixer..." + + if [ -d /proc/cygdrive ]; then + ./vendor/bin/php-cs-fixer fix --verbose --dry-run --diff + else + php ./vendor/bin/php-cs-fixer fix --verbose --dry-run --diff + fi + + if [ $? != 0 ]; then + echo "Some files are not following the coding standards. Please fix them before commit (try 'composer style')." + exit 1 + fi +fi + +exit $? \ No newline at end of file diff --git a/admin/setup.sh b/admin/setup.sh new file mode 100644 index 0000000..2e0075e --- /dev/null +++ b/admin/setup.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Install a pre-commit hook that +# automatically runs phpcs to fix styles +cp admin/pre-commit .git/hooks/pre-commit +chmod +x .git/hooks/pre-commit \ No newline at end of file diff --git a/composer.json b/composer.json index ca94495..e8bdf35 100644 --- a/composer.json +++ b/composer.json @@ -7,16 +7,27 @@ { "name": "Dejan Angelov", "homepage": "https://angelovdejan.me" + }, + { + "name": "Daycry", + "homepage": "https://daycryweb.blogspot.com" } ], "require": { "php": "^8.2", - "php-vcr/php-vcr": "^1.0" + "php-vcr/php-vcr": "^1.7" }, "require-dev": { - "phpunit/phpunit": "^10.0 || ^11.0", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", "squizlabs/php_codesniffer": "^3.7", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^2.0", + "friendsofphp/php-cs-fixer": "^3.49", + "nexusphp/cs-config": "^3.21", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "rector/rector": "^2" }, "autoload": { "psr-4": { @@ -27,5 +38,37 @@ "psr-4": { "Angelov\\PHPUnitPHPVcr\\Tests\\": "tests/" } - } + }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true, + "allow-plugins": { + "phpstan/extension-installer": true + } + }, + "scripts": { + "post-update-cmd": [ + "bash admin/setup.sh" + ], + "analyze": [ + "Composer\\Config::disableProcessTimeout", + "phpstan analyze", + "rector process --dry-run" + ], + "ci": [ + "Composer\\Config::disableProcessTimeout", + "@cs", + "@test" + ], + "cs": "php-cs-fixer fix --ansi --verbose --dry-run --diff", + "cs-fix": "php-cs-fixer fix --ansi --verbose --diff", + "mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit", + "sa": "@analyze", + "style": "@cs-fix", + "test": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit" + ] + } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 1133dd7..0000000 --- a/composer.lock +++ /dev/null @@ -1,2336 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "3a7601fc05c5519cece13971f2935d7a", - "packages": [ - { - "name": "beberlei/assert", - "version": "v3.3.2", - "source": { - "type": "git", - "url": "https://github.com/beberlei/assert.git", - "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655", - "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-json": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "php": "^7.0 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "*", - "phpstan/phpstan": "*", - "phpunit/phpunit": ">=6.0.0", - "yoast/phpunit-polyfills": "^0.1.0" - }, - "suggest": { - "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" - }, - "type": "library", - "autoload": { - "files": [ - "lib/Assert/functions.php" - ], - "psr-4": { - "Assert\\": "lib/Assert" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de", - "role": "Lead Developer" - }, - { - "name": "Richard Quadling", - "email": "rquadling@gmail.com", - "role": "Collaborator" - } - ], - "description": "Thin assertion library for input validation in business models.", - "keywords": [ - "assert", - "assertion", - "validation" - ], - "support": { - "issues": "https://github.com/beberlei/assert/issues", - "source": "https://github.com/beberlei/assert/tree/v3.3.2" - }, - "time": "2021-12-16T21:41:27+00:00" - }, - { - "name": "php-vcr/php-vcr", - "version": "1.6.4", - "source": { - "type": "git", - "url": "https://github.com/php-vcr/php-vcr.git", - "reference": "bddc1fea824c9b571d21899a484dc680ff256091" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-vcr/php-vcr/zipball/bddc1fea824c9b571d21899a484dc680ff256091", - "reference": "bddc1fea824c9b571d21899a484dc680ff256091", - "shasum": "" - }, - "require": { - "beberlei/assert": "^3.2.5", - "ext-curl": "*", - "php": "^8", - "symfony/event-dispatcher": "^4|^5|^6", - "symfony/event-dispatcher-contracts": "^1|^2|^3", - "symfony/yaml": "^3|^4|^5|^6" - }, - "require-dev": { - "editorconfig-checker/editorconfig-checker": "^10.3", - "friendsofphp/php-cs-fixer": "^3.0", - "guzzlehttp/guzzle": "^7", - "mikey179/vfsstream": "^1.6.10", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1", - "phpstan/phpstan-beberlei-assert": "^1", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^9.5.10", - "thecodingmachine/phpstan-strict-rules": "^1" - }, - "type": "library", - "autoload": { - "psr-4": { - "VCR\\": "src/VCR/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Adrian Philipp", - "email": "mail@adrian-philipp.com" - } - ], - "description": "Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.", - "support": { - "issues": "https://github.com/php-vcr/php-vcr/issues", - "source": "https://github.com/php-vcr/php-vcr/tree/1.6.4" - }, - "time": "2022-12-27T21:48:04+00:00" - }, - { - "name": "psr/event-dispatcher", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Standard interfaces for event handling.", - "keywords": [ - "events", - "psr", - "psr-14" - ], - "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" - }, - "time": "2019-01-08T18:20:26+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "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": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" - }, - "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": "2023-05-23T14:45:45+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v6.4.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ae9d3a6f3003a6caf56acd7466d8d52378d44fef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ae9d3a6f3003a6caf56acd7466d8d52378d44fef", - "reference": "ae9d3a6f3003a6caf56acd7466d8d52378d44fef", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2.5|^3" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/service-contracts": "<2.5" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.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": "2024-01-23T14:51:35+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v3.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/event-dispatcher": "^1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "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": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" - }, - "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": "2023-05-23T14:45:45+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" - }, - "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": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/yaml", - "version": "v6.4.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d75715985f0f94f978e3a8fa42533e10db921b90", - "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<5.4" - }, - "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0" - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.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": "2024-01-23T14:51:35+00:00" - } - ], - "packages-dev": [ - { - "name": "myclabs/deep-copy", - "version": "1.11.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=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.1" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2023-03-08T13:26:56+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v5.0.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-json": "*", - "ext-tokenizer": "*", - "php": ">=7.4" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-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/v5.0.0" - }, - "time": "2024-01-07T17:17:35+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": "phpstan/phpstan", - "version": "1.10.57", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" - } - ], - "time": "2024-01-24T11:51:34+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "11.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5e238e4b982cb272bf9faeee6f33af83d465d0e2", - "reference": "5e238e4b982cb272bf9faeee6f33af83d465d0e2", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^5.0", - "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-text-template": "^4.0", - "sebastian/code-unit-reverse-lookup": "^4.0", - "sebastian/complexity": "^4.0", - "sebastian/environment": "^7.0", - "sebastian/lines-of-code": "^3.0", - "sebastian/version": "^5.0", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-pcov": "PHP extension that provides line coverage", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "11.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 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", - "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:03:46+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "99e95c94ad9500daca992354fa09d7b99abe2210" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/99e95c94ad9500daca992354fa09d7b99abe2210", - "reference": "99e95c94ad9500daca992354fa09d7b99abe2210", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:05:04+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5d8d9355a16d8cc5a1305b0a85342cfa420612be", - "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:05:50+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/d38f6cbff1cdb6f40b03c9811421561668cc133e", - "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.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", - "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:06:56+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "7.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8a59d9e25720482ee7fcdf296595e08795b84dc5", - "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.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", - "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:08:01+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "11.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", - "reference": "de24e7e7c67fbf437f7b6cd7bc919f2dc6fd89d4", - "shasum": "" - }, - "require": { - "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": ">=8.2", - "phpunit/php-code-coverage": "^11.0", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-invoker": "^5.0", - "phpunit/php-text-template": "^4.0", - "phpunit/php-timer": "^7.0", - "sebastian/cli-parser": "^3.0", - "sebastian/code-unit": "^3.0", - "sebastian/comparator": "^6.0", - "sebastian/diff": "^6.0", - "sebastian/environment": "^7.0", - "sebastian/exporter": "^6.0", - "sebastian/global-state": "^7.0", - "sebastian/object-enumerator": "^6.0", - "sebastian/type": "^5.0", - "sebastian/version": "^5.0" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "11.0-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", - "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.0.3" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2024-02-10T06:31:16+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", - "reference": "efd6ce5bb8131fe981e2f879dbd47605fbe0cc6f", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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 for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:48:04+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "6634549cb8d702282a04a774e36a7477d2bd9015" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6634549cb8d702282a04a774e36a7477d2bd9015", - "reference": "6634549cb8d702282a04a774e36a7477d2bd9015", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:50:41+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/df80c875d3e459b45c6039e4d9b71d4fbccae25d", - "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:52:17+00:00" - }, - { - "name": "sebastian/comparator", - "version": "6.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/bd0f2fa5b9257c69903537b266ccb80fcf940db8", - "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/diff": "^6.0", - "sebastian/exporter": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.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", - "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:53:45+00:00" - }, - { - "name": "sebastian/complexity", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "88a434ad86150e11a606ac4866b09130712671f0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/88a434ad86150e11a606ac4866b09130712671f0", - "reference": "88a434ad86150e11a606ac4866b09130712671f0", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.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", - "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:55:19+00:00" - }, - { - "name": "sebastian/diff", - "version": "6.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e3f502419518897a923aa1c64d51f9def2e0aff", - "reference": "3e3f502419518897a923aa1c64d51f9def2e0aff", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:56:35+00:00" - }, - { - "name": "sebastian/environment", - "version": "7.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/100d8b855d7180f79f9a9a5c483f2d960581c3ea", - "reference": "100d8b855d7180f79f9a9a5c483f2d960581c3ea", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.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 functionality to handle HHVM/PHP environments", - "homepage": "https://github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:57:54+00:00" - }, - { - "name": "sebastian/exporter", - "version": "6.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d0c0a93fc746b0c066037f1e7d09104129e868ff", - "reference": "d0c0a93fc746b0c066037f1e7d09104129e868ff", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=8.2", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.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", - "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:58:52+00:00" - }, - { - "name": "sebastian/global-state", - "version": "7.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", - "reference": "590e7cbc6565fa2e26c3df4e629a34bb0bc00c17", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.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": "https://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T05:59:33+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/376c5b3f6b43c78fdc049740bca76a7c846706c0", - "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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 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", - "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:00:36+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "6.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", - "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.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", - "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:01:29+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "4.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/bb2a6255d30853425fd38f032eb64ced9f7f132d", - "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:02:18+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "6.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b75224967b5a466925c6d54e68edd0edf8dd4ed4", - "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.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": "https://github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:08:48+00:00" - }, - { - "name": "sebastian/type", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8502785eb3523ca0dd4afe9ca62235590020f3f", - "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:09:34+00:00" - }, - { - "name": "sebastian/version", - "version": "5.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/13999475d2cb1ab33cb73403ba356a814fdbb001", - "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "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": "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", - "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.0" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-02-02T06:10:47+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.8.1", - "source": { - "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" - }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" - }, - "funding": [ - { - "url": "https://github.com/PHPCSStandards", - "type": "github" - }, - { - "url": "https://github.com/jrfnl", - "type": "github" - }, - { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" - } - ], - "time": "2024-01-11T20:47:48+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "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.2" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2023-11-20T00:12:19+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^8.1" - }, - "platform-dev": [], - "plugin-api-version": "2.1.0" -} diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 5e593da..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - tests - - - - - - - - src - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..8a712de --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,43 @@ + + + + + + + + + + + + tests + + + + + + + + src + + + + + + + + + \ No newline at end of file diff --git a/src/Extension.php b/src/Extension.php index 0085009..3d9c9ed 100644 --- a/src/Extension.php +++ b/src/Extension.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr; use Angelov\PHPUnitPHPVcr\Subscribers\ConfigureRecorder; @@ -24,8 +33,8 @@ public function bootstrap(Configuration $configuration, Facade $facade, Paramete $this->parameterAsArray($parameters, 'requestMatchers'), $this->parameterAsArray($parameters, 'whitelistedPaths'), $this->parameterAsArray($parameters, 'blacklistedPaths'), - $this->parameter($parameters, 'mode') - ) + $this->parameter($parameters, 'mode'), + ), ); $facade->registerSubscriber(new StartRecording()); @@ -41,18 +50,20 @@ private function parameter(ParameterCollection $parameters, string $name): ?stri return null; } - /** @return array|null */ + /** + * @return list|null + */ private function parameterAsArray(ParameterCollection $parameters, string $name): ?array { $value = $this->parameter($parameters, $name); - if ($value == null) { + if ($value === null) { return null; } return array_map( - fn(string $value): string => trim($value), - explode(",", $value) + static fn (string $value): string => trim($value), + explode(',', $value), ); } } diff --git a/src/Subscribers/AttributeResolverTrait.php b/src/Subscribers/AttributeResolverTrait.php index 1dd1097..e444222 100644 --- a/src/Subscribers/AttributeResolverTrait.php +++ b/src/Subscribers/AttributeResolverTrait.php @@ -2,30 +2,49 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Subscribers; use Angelov\PHPUnitPHPVcr\UseCassette; use Exception; +use PHPUnit\Event\Code\Test; +use PHPUnit\Event\Code\TestMethod; +use ReflectionClass; use ReflectionMethod; trait AttributeResolverTrait { - private function needsRecording(string $test): bool + private function needsRecording(Test $test): bool { return $this->getAttribute($test) !== null; } - private function getCassetteName(string $test): ?string + private function getCassetteName(Test $test): ?string { return $this->getAttribute($test)?->name; } - private function getAttribute(string $test): ?UseCassette + private function getAttribute(Test $test): ?UseCassette { - $test = $this->parseMethod($test); + $reflection = new ReflectionClass($test); + $class = $reflection->getProperty('className')->getValue($test); + + if ($test instanceof TestMethod) { + $method = $test->methodName(); + } else { + $method = $test->name(); + } try { - $method = new ReflectionMethod($test); + $method = new ReflectionMethod($class, $method); } catch (Exception) { return null; } @@ -35,21 +54,7 @@ private function getAttribute(string $test): ?UseCassette if ($attributes) { return $attributes[0]->newInstance(); } - - return $this->getAttributeFromClass($test); - } - - private function parseMethod(string $test): string - { - $test = explode(" ", $test)[0]; - - return explode("#", $test)[0]; - } - - private function getAttributeFromClass(string $test): ?UseCassette - { - $method = new ReflectionMethod($test); - $class = $method->getDeclaringClass(); + $class = $method->getDeclaringClass(); $attributes = $class->getAttributes(UseCassette::class); if ($attributes) { diff --git a/src/Subscribers/ConfigureRecorder.php b/src/Subscribers/ConfigureRecorder.php index 46f520d..7cba19a 100644 --- a/src/Subscribers/ConfigureRecorder.php +++ b/src/Subscribers/ConfigureRecorder.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Subscribers; use PHPUnit\Event\TestRunner\ExecutionStarted; @@ -11,10 +20,10 @@ class ConfigureRecorder implements ExecutionStartedSubscriber { /** - * @param array|null $libraryHooks - * @param array|null $requestMatchers - * @param array|null $whitelistedPaths - * @param array|null $blacklistedPaths + * @param list|null $libraryHooks + * @param list|null $requestMatchers + * @param list|null $whitelistedPaths + * @param list|null $blacklistedPaths */ public function __construct( private readonly ?string $cassettesPath, @@ -23,7 +32,7 @@ public function __construct( private readonly ?array $requestMatchers, private readonly ?array $whitelistedPaths, private readonly ?array $blacklistedPaths, - private readonly ?string $mode + private readonly ?string $mode, ) { } diff --git a/src/Subscribers/FinishRecording.php b/src/Subscribers/FinishRecording.php index c6539d2..5e9d31f 100644 --- a/src/Subscribers/FinishRecording.php +++ b/src/Subscribers/FinishRecording.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Subscribers; use PHPUnit\Event\Test\Finished; @@ -14,9 +23,9 @@ class FinishRecording implements FinishedSubscriber public function notify(Finished $event): void { - $test = $event->test()->name(); + $test = $event->test(); - if (!$this->needsRecording($test)) { + if (! $this->needsRecording($test)) { return; } diff --git a/src/Subscribers/StartRecording.php b/src/Subscribers/StartRecording.php index 049341f..749962f 100644 --- a/src/Subscribers/StartRecording.php +++ b/src/Subscribers/StartRecording.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Subscribers; use PHPUnit\Event\Test\Prepared; @@ -14,13 +23,14 @@ class StartRecording implements PreparedSubscriber public function notify(Prepared $event): void { - $test = $event->test()->id(); + $test = $event->test(); - if (!$this->needsRecording($test)) { + if (! $this->needsRecording($test)) { return; } $cassetteName = $this->getCassetteName($test); + assert($cassetteName !== null); VCR::turnOn(); diff --git a/src/UseCassette.php b/src/UseCassette.php index 0474b70..1109f8c 100644 --- a/src/UseCassette.php +++ b/src/UseCassette.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr; use Attribute; diff --git a/tests/AttributeDeclaredBothOnClassAndMethodTest.php b/tests/AttributeDeclaredBothOnClassAndMethodTest.php index ef1481a..e07cf51 100644 --- a/tests/AttributeDeclaredBothOnClassAndMethodTest.php +++ b/tests/AttributeDeclaredBothOnClassAndMethodTest.php @@ -2,21 +2,33 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Tests; use Angelov\PHPUnitPHPVcr\UseCassette; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -#[UseCassette("combined_on_class.yml")] -class AttributeDeclaredBothOnClassAndMethodTest extends TestCase +/** + * @internal + */ +#[UseCassette('combined_on_class.yml')] +final class AttributeDeclaredBothOnClassAndMethodTest extends TestCase { #[Test] - #[UseCassette("on_methods.yml")] - public function it_uses_cassette_from_method_when_declared_on_both_places(): void + #[UseCassette('on_methods.yml')] + public function itUsesCassetteFromMethodWhenDeclaredOnBothPlaces(): void { - $content = file_get_contents("https://example.com"); + $content = file_get_contents('https://example.com'); - $this->assertSame("Example body.", $content); + $this->assertSame('Example body.', $content); } } diff --git a/tests/AttributeDeclaredOnClassTest.php b/tests/AttributeDeclaredOnClassTest.php index 029e111..7ec4563 100644 --- a/tests/AttributeDeclaredOnClassTest.php +++ b/tests/AttributeDeclaredOnClassTest.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Tests; use Angelov\PHPUnitPHPVcr\UseCassette; @@ -9,30 +18,36 @@ use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -#[UseCassette("on_class.yml")] -class AttributeDeclaredOnClassTest extends TestCase +/** + * @internal + */ +#[UseCassette('on-class.yml')] +final class AttributeDeclaredOnClassTest extends TestCase { #[Test] - public function it_uses_vcr_on_methods_from_class_with_attribute(): void + public function itUsesVcrOnMethodsFromClassWithAttribute(): void { - $content = file_get_contents("https://example.com"); + $content = file_get_contents('https://example.com'); - $this->assertSame("Example body for \"https://example.com\"", $content); + $this->assertSame('Example body for "https://example.com"', $content); } + #[DataProvider('urls')] #[Test] - #[DataProvider("urls")] - public function it_uses_vcr_on_methods_with_data_provider(string $url): void + public function itUsesVcrOnMethodsWithDataProvider(string $url): void { $content = file_get_contents($url); - $this->assertSame(sprintf("Example body for \"%s\"", $url), $content); + $this->assertSame(sprintf('Example body for "%s"', $url), $content); } - /** @return iterable> */ + /** + * @return iterable> + */ public static function urls(): iterable { - yield ["https://example.com"]; - yield ["https://example.org"]; + yield ['https://example.com']; + + yield ['https://example.org']; } } diff --git a/tests/AttributeDeclaredOnMethodsTest.php b/tests/AttributeDeclaredOnMethodsTest.php index 12673a2..4a0afc7 100644 --- a/tests/AttributeDeclaredOnMethodsTest.php +++ b/tests/AttributeDeclaredOnMethodsTest.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of Angelov phpunit-vcr. + * + * (c) Angelov + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + namespace Angelov\PHPUnitPHPVcr\Tests; use Angelov\PHPUnitPHPVcr\UseCassette; @@ -9,31 +18,37 @@ use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; -class AttributeDeclaredOnMethodsTest extends TestCase +/** + * @internal + */ +final class AttributeDeclaredOnMethodsTest extends TestCase { #[Test] - #[UseCassette("on_methods.yml")] - public function it_uses_vcr_on_methods_with_attribute(): void + #[UseCassette('on_methods.yml')] + public function itUsesVcrOnMethodsWithAttribute(): void { - $content = file_get_contents("https://example.com"); + $content = file_get_contents('https://example.com'); - $this->assertSame("Example body.", $content); + $this->assertSame('Example body.', $content); } + #[DataProvider('urls')] #[Test] - #[UseCassette("with_data_provider.yml")] - #[DataProvider("urls")] - public function it_uses_vcr_on_methods_with_data_provider(string $url): void + #[UseCassette('with_data_provider.yml')] + public function itUsesVcrOnMethodsWithDataProvider(string $url): void { $content = file_get_contents($url); - $this->assertSame(sprintf("Example body for \"%s\"", $url), $content); + $this->assertSame(sprintf('Example body for "%s"', $url), $content); } - /** @return iterable> */ + /** + * @return iterable> + */ public static function urls(): iterable { - yield ["https://example.com"]; - yield ["https://example.org"]; + yield ['https://example.com']; + + yield ['https://example.org']; } } diff --git a/tests/Nexus/CodingStandard.php b/tests/Nexus/CodingStandard.php new file mode 100644 index 0000000..b68dc7c --- /dev/null +++ b/tests/Nexus/CodingStandard.php @@ -0,0 +1,715 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Angelov\PHPUnitPHPVcr\Tests\Nexus; + +use Nexus\CsConfig\Ruleset\AbstractRuleset; + +/** + * Defines the ruleset used for the CodeIgniter4 organization. + * + * {@internal Use of this class is not covered by the backward compatibility promise for CodeIgniter4.} + */ +final class CodingStandard extends AbstractRuleset +{ + public function __construct() + { + $this->name = 'Coding Standards'; + + $this->rules = [ + 'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], + 'array_indentation' => true, + 'array_push' => true, + 'array_syntax' => ['syntax' => 'short'], + 'assign_null_coalescing_to_coalesce_equal' => true, + 'attribute_empty_parentheses' => false, + 'backtick_to_shell_exec' => true, + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => [ + '=' => 'align_single_space_minimal', + '=>' => 'align_single_space_minimal', + '||' => 'align_single_space_minimal', + '.=' => 'align_single_space_minimal', + ], + ], + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => [ + 'statements' => [ + 'case', + 'continue', + 'declare', + 'default', + 'do', + 'exit', + 'for', + 'foreach', + 'goto', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + 'yield_from', + ], + ], + 'blank_line_between_import_groups' => true, + 'blank_lines_before_namespace' => [ + 'min_line_breaks' => 2, + 'max_line_breaks' => 2, + ], + 'braces_position' => [ + 'control_structures_opening_brace' => 'same_line', + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'anonymous_functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'anonymous_classes_opening_brace' => 'same_line', + 'allow_single_line_empty_anonymous_classes' => true, + 'allow_single_line_anonymous_functions' => true, + ], + 'cast_spaces' => ['space' => 'single'], + 'class_attributes_separation' => [ + 'elements' => [ + 'const' => 'none', + 'property' => 'none', + 'method' => 'one', + 'trait_import' => 'none', + ], + ], + 'class_definition' => [ + 'multi_line_extends_each_single_line' => true, + 'single_item_single_line' => true, + 'single_line' => true, + 'space_before_parenthesis' => true, + 'inline_constructor_arguments' => true, + ], + 'class_keyword' => false, + 'class_reference_name_casing' => true, + 'clean_namespace' => true, + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => [ + 'ignored_tags' => [ + 'todo', + 'codeCoverageIgnore', + 'codeCoverageIgnoreStart', + 'codeCoverageIgnoreEnd', + 'phpstan-ignore', + 'phpstan-ignore-line', + 'phpstan-ignore-next-line', + ], + ], + 'compact_nullable_type_declaration' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => ['case' => 'lower'], + 'control_structure_braces' => true, + 'control_structure_continuation_position' => ['position' => 'same_line'], + 'date_time_create_from_format_call' => true, + 'date_time_immutable' => false, + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'declare_strict_types' => false, + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => false, + 'doctrine_annotation_braces' => false, + 'doctrine_annotation_indentation' => false, + 'doctrine_annotation_spaces' => false, + 'echo_tag_syntax' => [ + 'format' => 'short', + 'long_function' => 'echo', + 'shorten_simple_statements_only' => false, + ], + 'elseif' => true, + 'empty_loop_body' => ['style' => 'braces'], + 'empty_loop_condition' => ['style' => 'while'], + 'encoding' => true, + 'ereg_to_preg' => true, + 'error_suppression' => [ + 'mute_deprecation_error' => true, + 'noise_remaining_usages' => false, + 'noise_remaining_usages_exclude' => [], + ], + 'explicit_indirect_variable' => true, + 'explicit_string_variable' => true, + 'final_class' => false, + 'final_internal_class' => [ + 'exclude' => ['no-final'], + 'include' => ['internal'], + 'consider_absent_docblock_as_internal_class' => false, + ], + 'final_public_method_for_abstract_class' => false, + 'fopen_flag_order' => true, + 'fopen_flags' => ['b_mode' => true], + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => [ + 'import_symbols' => false, + 'leading_backslash_in_global_namespace' => false, + 'phpdoc_tags' => [ + 'param', + 'phpstan-param', + 'phpstan-property', + 'phpstan-property-read', + 'phpstan-property-write', + 'phpstan-return', + 'phpstan-var', + 'property', + 'property-read', + 'property-write', + 'psalm-param', + 'psalm-property', + 'psalm-property-read', + 'psalm-property-write', + 'psalm-return', + 'psalm-var', + 'return', + 'throws', + 'var', + ], + ], + 'function_declaration' => [ + 'closure_function_spacing' => 'one', + 'closure_fn_spacing' => 'one', + 'trailing_comma_single_line' => false, + ], + 'function_to_constant' => [ + 'functions' => [ + 'get_called_class', + 'get_class', + 'get_class_this', + 'php_sapi_name', + 'phpversion', + 'pi', + ], + ], + 'general_attribute_remove' => ['attributes' => []], + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author', + 'package', + 'subpackage', + ], + 'case_sensitive' => false, + ], + 'general_phpdoc_tag_rename' => [ + 'case_sensitive' => false, + 'fix_annotation' => true, + 'fix_inline' => true, + 'replacements' => ['inheritDocs' => 'inheritDoc'], + ], + 'get_class_to_class_keyword' => true, + 'global_namespace_import' => [ + 'import_constants' => false, + 'import_functions' => false, + 'import_classes' => true, + ], + 'group_import' => false, + 'header_comment' => false, // false by default + 'heredoc_closing_marker' => false, + 'heredoc_indentation' => ['indentation' => 'start_plus_one'], + 'heredoc_to_nowdoc' => true, + 'implode_call' => true, + 'include' => true, + 'increment_style' => ['style' => 'post'], + 'indentation_type' => true, + 'integer_literal_case' => true, + 'is_null' => true, + 'lambda_not_used_import' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'long_to_shorthand_operator' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'mb_str_functions' => false, + 'method_argument_space' => [ + 'keep_multiple_spaces_after_comma' => false, + 'on_multiline' => 'ensure_fully_multiline', + 'after_heredoc' => false, + 'attribute_placement' => 'standalone', + ], + 'method_chaining_indentation' => true, + 'modernize_strpos' => ['modernize_stripos' => true], + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_string_to_heredoc' => false, + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], + 'native_constant_invocation' => false, + 'native_function_casing' => true, + 'native_function_invocation' => false, + 'native_type_declaration_casing' => true, + 'new_with_parentheses' => [ + 'named_class' => true, + 'anonymous_class' => true, + ], + 'no_alias_functions' => ['sets' => ['@all']], + 'no_alias_language_construct_call' => true, + 'no_alternative_syntax' => ['fix_non_monolithic_code' => false], + 'no_binary_string' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_break_comment' => ['comment_text' => 'no break'], + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'attribute', + 'break', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'return', + 'square_brace_block', + 'switch', + 'throw', + 'use', + ], + ], + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'echo'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiple_statements_per_line' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_space_around_double_colon' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => [ + 'allow_hidden_params' => true, + 'allow_mixed' => true, + 'allow_unused_params' => true, + 'remove_inheritdoc' => false, + ], + 'no_trailing_comma_in_singleline' => [ + 'elements' => [ + 'arguments', + 'array_destructuring', + 'array', + 'group_import', + ], + ], + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_trailing_whitespace_in_string' => true, + 'no_unneeded_braces' => ['namespaces' => true], + 'no_unneeded_control_parentheses' => [ + 'statements' => [ + 'break', + 'clone', + 'continue', + 'echo_print', + 'return', + 'switch_case', + 'yield', + ], + ], + 'no_unneeded_final_method' => ['private_methods' => true], + 'no_unneeded_import_alias' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => false, + 'no_unused_imports' => true, + 'no_useless_concat_operator' => ['juggle_simple_strings' => true], + 'no_useless_else' => true, + 'no_useless_nullsafe_operator' => true, + 'no_useless_return' => true, + 'no_useless_sprintf' => true, + 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => ['use_escape_sequences_in_strings' => true], + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, + 'not_operator_with_successor_space' => true, + 'nullable_type_declaration' => ['syntax' => 'question_mark'], + 'nullable_type_declaration_for_default_null_value' => true, + 'numeric_literal_separator' => false, + 'object_operator_without_whitespace' => true, + 'octal_notation' => false, // requires 8.1+ + 'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'], + 'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'], + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'case', + 'constant', + 'property', + 'method', + ], + 'sort_algorithm' => 'none', + 'case_sensitive' => false, + ], + 'ordered_imports' => [ + 'sort_algorithm' => 'alpha', + 'imports_order' => ['class', 'function', 'const'], + 'case_sensitive' => false, + ], + 'ordered_interfaces' => false, + 'ordered_traits' => false, + 'ordered_types' => [ + 'null_adjustment' => 'always_last', + 'sort_algorithm' => 'alpha', + 'case_sensitive' => false, + ], + 'php_unit_assert_new_names' => true, + 'php_unit_attributes' => [ + 'keep_annotations' => false, + ], + 'php_unit_construct' => [ + 'assertions' => [ + 'assertSame', + 'assertEquals', + 'assertNotEquals', + 'assertNotSame', + ], + ], + 'php_unit_data_provider_method_order' => [ + 'placement' => 'after', + ], + 'php_unit_data_provider_name' => [ + 'prefix' => 'provide', + 'suffix' => '', + ], + 'php_unit_data_provider_return_type' => true, + 'php_unit_data_provider_static' => ['force' => true], + 'php_unit_dedicate_assert' => ['target' => 'newest'], + 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], + 'php_unit_expectation' => ['target' => 'newest'], + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => ['types' => ['normal', 'final']], + 'php_unit_method_casing' => ['case' => 'camel_case'], + 'php_unit_mock' => ['target' => 'newest'], + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => ['target' => 'newest'], + 'php_unit_no_expectation_annotation' => [ + 'target' => 'newest', + 'use_class_const' => true, + ], + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, + 'php_unit_strict' => [ + 'assertions' => [ + 'assertAttributeEquals', + 'assertAttributeNotEquals', + 'assertEquals', + 'assertNotEquals', + ], + ], + 'php_unit_test_annotation' => ['style' => 'prefix'], + 'php_unit_test_case_static_method_calls' => [ + 'call_type' => 'this', + 'methods' => [], + ], + 'php_unit_test_class_requires_covers' => false, + 'phpdoc_add_missing_param_annotation' => ['only_untyped' => true], + 'phpdoc_align' => [ + 'align' => 'vertical', + 'spacing' => 1, + 'tags' => [ + 'method', + 'param', + 'phpstan-assert', + 'phpstan-assert-if-true', + 'phpstan-assert-if-false', + 'phpstan-param', + 'phpstan-property', + 'phpstan-return', + 'phpstan-type', + 'phpstan-var', + 'property', + 'property-read', + 'property-write', + 'return', + 'throws', + 'type', + 'var', + ], + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_array_type' => true, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag_normalizer' => [ + 'tags' => [ + 'example', + 'id', + 'internal', + 'inheritdoc', + 'inheritdocs', + 'link', + 'source', + 'toc', + 'tutorial', + ], + ], + 'phpdoc_line_span' => [ + 'const' => 'multi', + 'method' => 'multi', + 'property' => 'multi', + ], + 'phpdoc_list_type' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => [ + 'replacements' => [ + 'type' => 'var', + 'link' => 'see', + ], + ], + 'phpdoc_no_empty_return' => false, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => [ + 'order' => ['param', 'return', 'throws'], + ], + 'phpdoc_order_by_value' => [ + 'annotations' => [ + 'author', + 'covers', + 'coversNothing', + 'dataProvider', + 'depends', + 'group', + 'internal', + 'method', + 'property', + 'property-read', + 'property-write', + 'requires', + 'throws', + 'uses', + ], + ], + 'phpdoc_param_order' => false, + 'phpdoc_readonly_class_comment_to_keyword' => false, + 'phpdoc_return_self_reference' => [ + 'replacements' => [ + 'this' => '$this', + '@this' => '$this', + '$self' => 'self', + '@self' => 'self', + '$static' => 'static', + '@static' => 'static', + ], + ], + 'phpdoc_scalar' => [ + 'types' => [ + 'boolean', + 'callback', + 'double', + 'integer', + 'real', + 'str', + ], + ], + 'phpdoc_separation' => [ + 'groups' => [ + ['immutable', 'psalm-immutable'], + ['param', 'phpstan-param', 'psalm-param'], + ['phpstan-pure', 'psalm-pure'], + ['readonly', 'psalm-readonly'], + ['return', 'phpstan-return', 'psalm-return'], + ['runTestsInSeparateProcess', 'runInSeparateProcess', 'preserveGlobalState'], + ['template', 'phpstan-template', 'psalm-template'], + ['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'], + ['phpstan-type', 'psalm-type'], + ['var', 'phpstan-var', 'psalm-var'], + ], + 'skip_unlisted_annotations' => true, + ], + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_tag_casing' => ['tags' => ['inheritDoc']], + 'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']], + 'phpdoc_to_comment' => false, + 'phpdoc_to_param_type' => false, + 'phpdoc_to_property_type' => false, + 'phpdoc_to_return_type' => false, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']], + 'phpdoc_types_order' => [ + 'null_adjustment' => 'always_last', + 'sort_algorithm' => 'alpha', + 'case_sensitive' => false, + ], + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'psr_autoloading' => ['dir' => null], + 'random_api_migration' => [ + 'replacements' => [ + 'getrandmax' => 'mt_getrandmax', + 'rand' => 'mt_rand', + 'srand' => 'mt_srand', + ], + ], + 'regular_callable_call' => true, + 'return_assignment' => true, + 'return_to_yield_from' => false, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => false, + 'self_static_accessor' => true, + 'semicolon_after_instruction' => false, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simple_to_complex_string_variable' => true, + 'simplified_if_return' => true, + 'simplified_null_return' => false, + 'single_blank_line_at_eof' => true, + 'single_class_element_per_statement' => ['elements' => ['const', 'property']], + 'single_import_per_statement' => ['group_to_single_imports' => true], + 'single_line_after_imports' => true, + 'single_line_comment_spacing' => true, + 'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']], + 'single_line_empty_body' => false, + 'single_line_throw' => false, + 'single_quote' => ['strings_containing_single_quote_chars' => false], + 'single_space_around_construct' => [ + 'constructs_contain_a_single_space' => ['yield_from'], + 'constructs_preceded_by_a_single_space' => ['use_lambda'], + 'constructs_followed_by_a_single_space' => [ + 'abstract', + 'as', + 'attribute', + 'break', + 'case', + 'catch', + 'class', + 'clone', + 'comment', + 'const', + 'const_import', + 'continue', + 'do', + 'echo', + 'else', + 'elseif', + 'enum', + 'extends', + 'final', + 'finally', + 'for', + 'foreach', + 'function', + 'function_import', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'match', + 'named_argument', + 'namespace', + 'new', + 'open_tag_with_echo', + 'php_doc', + 'php_open', + 'print', + 'private', + 'protected', + 'public', + 'readonly', + 'require', + 'require_once', + 'return', + 'static', + 'switch', + 'throw', + 'trait', + 'try', + 'type_colon', + 'use', + 'use_lambda', + 'use_trait', + 'var', + 'while', + 'yield', + 'yield_from', + ], + ], + 'single_trait_insert_per_statement' => true, + 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], + 'spaces_inside_parentheses' => ['space' => 'none'], + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => false], + 'static_lambda' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'string_implicit_backslashes' => [ + 'double_quoted' => 'escape', + 'heredoc' => 'escape', + 'single_quoted' => 'ignore', + ], + 'string_length_to_empty' => true, + 'string_line_ending' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'switch_continue_to_break' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_elvis_operator' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + 'elements' => [ + 'arguments', + 'array_destructuring', + 'arrays', + 'match', + 'parameters', + ], + ], + 'trim_array_spaces' => true, + 'type_declaration_spaces' => ['elements' => ['function', 'property']], + 'types_spaces' => [ + 'space' => 'none', + 'space_multiple_catch' => 'none', + ], + 'unary_operator_spaces' => ['only_dec_inc' => false], + 'use_arrow_functions' => true, + 'visibility_required' => ['elements' => ['const', 'method', 'property']], + 'void_return' => false, // changes method signature + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], + 'yield_from_array_to_yields' => false, + 'yoda_style' => [ + 'equal' => false, + 'identical' => null, + 'less_and_greater' => false, + 'always_move_variable' => false, + ], + ]; + + $this->requiredPHPVersion = 80100; + + $this->autoActivateIsRiskyAllowed = true; + } +} diff --git a/tests/fixtures/on_class.yml b/tests/fixtures/on-class.yml similarity index 100% rename from tests/fixtures/on_class.yml rename to tests/fixtures/on-class.yml