From 41c1c1e53a865c71604f9c7687d00d485003a69f Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Mon, 22 Jan 2024 13:20:54 +0300 Subject: [PATCH 1/4] Introduced static-analysis-tester --- .gitattributes | 1 + .gitignore | 1 + .php-cs-fixer.dist.php | 3 - composer.json | 14 +- composer.lock | 1827 +++++++++++++++-- phpunit.xml.dist | 22 + psalm.xml.dist | 5 + static-analysis-tester/PsalmTester.php | 97 + static-analysis-tester/StaticAnalysisTest.php | 109 + static-analysis-tester/psalm.xml | 19 + tests/PsalmTest.php | 43 + tests/psalm/ArrayKeyTest.php | 8 - tests/psalm/ArrayKeyType.phpt | 9 + tests/psalm/ArrayShapeTest.php | 20 - tests/psalm/ArrayShapeType.phpt | 9 + tests/psalm/ArrayTest.php | 15 - tests/psalm/ArrayType.phpt | 12 + tests/psalm/BoolTest.php | 8 - tests/psalm/BoolType.phpt | 9 + tests/psalm/CallableArrayType.phpt | 9 + tests/psalm/CallableStringType.phpt | 9 + tests/psalm/CallableType.phpt | 9 + tests/psalm/ClassConstantType.phpt | 9 + tests/psalm/ClassStringLiteralTest.php | 18 - tests/psalm/ClassStringLiteralType.phpt | 9 + tests/psalm/ClassStringType.phpt | 9 + tests/psalm/ClosedResourceType.phpt | 9 + tests/psalm/ClosureType.phpt | 9 + tests/psalm/ConditionalType.phpt | 14 + tests/psalm/ConstantType.phpt | 9 + tests/psalm/EnumStringType.phpt | 9 + tests/psalm/FalseType.phpt | 9 + tests/psalm/FloatLiteralTest.php | 21 - tests/psalm/FloatLiteralType.phpt | 9 + tests/psalm/FloatType.phpt | 9 + tests/psalm/IntLiteralTest.php | 29 - tests/psalm/IntLiteralType.phpt | 9 + tests/psalm/IntMaskOfTest.php | 25 - tests/psalm/IntMaskOfType.phpt | 22 + tests/psalm/IntMaskTest.php | 17 - tests/psalm/IntMaskType.phpt | 9 + tests/psalm/IntRangeTest.php | 8 - tests/psalm/IntRangeType.phpt | 9 + tests/psalm/IntType.phpt | 9 + tests/psalm/InterfaceStringType.phpt | 9 + tests/psalm/IntersectionType.phpt | 9 + tests/psalm/IterableType.phpt | 9 + tests/psalm/KeyOfType.phpt | 9 + tests/psalm/ListType.phpt | 9 + tests/psalm/LiteralIntType.phpt | 9 + tests/psalm/LiteralStringTest.php | 8 - tests/psalm/LiteralStringType.phpt | 9 + tests/psalm/MixedType.phpt | 9 + tests/psalm/NamedClassStringTest.php | 8 - tests/psalm/NamedClassStringType.phpt | 9 + tests/psalm/NamedObjectTest.php | 17 - tests/psalm/NamedObjectType.phpt | 9 + tests/psalm/NeverType.phpt | 10 + tests/psalm/NonEmptyArrayType.phpt | 9 + tests/psalm/NonEmptyListType.phpt | 9 + tests/psalm/NonEmptyStringType.phpt | 9 + tests/psalm/NullType.phpt | 9 + tests/psalm/NumericStringType.phpt | 9 + tests/psalm/NumericType.phpt | 9 + tests/psalm/ObjectShapeType.phpt | 9 + tests/psalm/ObjectType.phpt | 9 + tests/psalm/ResourceType.phpt | 9 + tests/psalm/ScalarType.phpt | 9 + tests/psalm/StaticTest.php | 18 - tests/psalm/StaticType.phpt | 9 + tests/psalm/StringLiteralTest.php | 26 - tests/psalm/StringLiteralType.phpt | 9 + tests/psalm/StringType.phpt | 9 + tests/psalm/TemplateTest.php | 17 - tests/psalm/TemplateType.phpt | 9 + tests/psalm/TraitStringType.phpt | 9 + tests/psalm/TrueTest.php | 8 - tests/psalm/TrueType.phpt | 9 + tests/psalm/TruthyStringTest.php | 12 - tests/psalm/TruthyStringType.phpt | 9 + tests/psalm/UnionTest.php | 12 - tests/psalm/UnionType.phpt | 9 + tests/psalm/ValueOfType.phpt | 9 + tests/psalm/VoidType.phpt | 10 + tests/psalm/functions.php | 16 - 85 files changed, 2514 insertions(+), 447 deletions(-) create mode 100644 phpunit.xml.dist create mode 100644 static-analysis-tester/PsalmTester.php create mode 100644 static-analysis-tester/StaticAnalysisTest.php create mode 100644 static-analysis-tester/psalm.xml create mode 100644 tests/PsalmTest.php delete mode 100644 tests/psalm/ArrayKeyTest.php create mode 100644 tests/psalm/ArrayKeyType.phpt delete mode 100644 tests/psalm/ArrayShapeTest.php create mode 100644 tests/psalm/ArrayShapeType.phpt delete mode 100644 tests/psalm/ArrayTest.php create mode 100644 tests/psalm/ArrayType.phpt delete mode 100644 tests/psalm/BoolTest.php create mode 100644 tests/psalm/BoolType.phpt create mode 100644 tests/psalm/CallableArrayType.phpt create mode 100644 tests/psalm/CallableStringType.phpt create mode 100644 tests/psalm/CallableType.phpt create mode 100644 tests/psalm/ClassConstantType.phpt delete mode 100644 tests/psalm/ClassStringLiteralTest.php create mode 100644 tests/psalm/ClassStringLiteralType.phpt create mode 100644 tests/psalm/ClassStringType.phpt create mode 100644 tests/psalm/ClosedResourceType.phpt create mode 100644 tests/psalm/ClosureType.phpt create mode 100644 tests/psalm/ConditionalType.phpt create mode 100644 tests/psalm/ConstantType.phpt create mode 100644 tests/psalm/EnumStringType.phpt create mode 100644 tests/psalm/FalseType.phpt delete mode 100644 tests/psalm/FloatLiteralTest.php create mode 100644 tests/psalm/FloatLiteralType.phpt create mode 100644 tests/psalm/FloatType.phpt delete mode 100644 tests/psalm/IntLiteralTest.php create mode 100644 tests/psalm/IntLiteralType.phpt delete mode 100644 tests/psalm/IntMaskOfTest.php create mode 100644 tests/psalm/IntMaskOfType.phpt delete mode 100644 tests/psalm/IntMaskTest.php create mode 100644 tests/psalm/IntMaskType.phpt delete mode 100644 tests/psalm/IntRangeTest.php create mode 100644 tests/psalm/IntRangeType.phpt create mode 100644 tests/psalm/IntType.phpt create mode 100644 tests/psalm/InterfaceStringType.phpt create mode 100644 tests/psalm/IntersectionType.phpt create mode 100644 tests/psalm/IterableType.phpt create mode 100644 tests/psalm/KeyOfType.phpt create mode 100644 tests/psalm/ListType.phpt create mode 100644 tests/psalm/LiteralIntType.phpt delete mode 100644 tests/psalm/LiteralStringTest.php create mode 100644 tests/psalm/LiteralStringType.phpt create mode 100644 tests/psalm/MixedType.phpt delete mode 100644 tests/psalm/NamedClassStringTest.php create mode 100644 tests/psalm/NamedClassStringType.phpt delete mode 100644 tests/psalm/NamedObjectTest.php create mode 100644 tests/psalm/NamedObjectType.phpt create mode 100644 tests/psalm/NeverType.phpt create mode 100644 tests/psalm/NonEmptyArrayType.phpt create mode 100644 tests/psalm/NonEmptyListType.phpt create mode 100644 tests/psalm/NonEmptyStringType.phpt create mode 100644 tests/psalm/NullType.phpt create mode 100644 tests/psalm/NumericStringType.phpt create mode 100644 tests/psalm/NumericType.phpt create mode 100644 tests/psalm/ObjectShapeType.phpt create mode 100644 tests/psalm/ObjectType.phpt create mode 100644 tests/psalm/ResourceType.phpt create mode 100644 tests/psalm/ScalarType.phpt delete mode 100644 tests/psalm/StaticTest.php create mode 100644 tests/psalm/StaticType.phpt delete mode 100644 tests/psalm/StringLiteralTest.php create mode 100644 tests/psalm/StringLiteralType.phpt create mode 100644 tests/psalm/StringType.phpt delete mode 100644 tests/psalm/TemplateTest.php create mode 100644 tests/psalm/TemplateType.phpt create mode 100644 tests/psalm/TraitStringType.phpt delete mode 100644 tests/psalm/TrueTest.php create mode 100644 tests/psalm/TrueType.phpt delete mode 100644 tests/psalm/TruthyStringTest.php create mode 100644 tests/psalm/TruthyStringType.phpt delete mode 100644 tests/psalm/UnionTest.php create mode 100644 tests/psalm/UnionType.phpt create mode 100644 tests/psalm/ValueOfType.phpt create mode 100644 tests/psalm/VoidType.phpt delete mode 100644 tests/psalm/functions.php diff --git a/.gitattributes b/.gitattributes index 92f7b04..d896523 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,3 +7,4 @@ /composer.lock export-ignore /phpunit.xml.dist export-ignore /psalm.xml.dist export-ignore +/static-analysis-tester/ export-ignore diff --git a/.gitignore b/.gitignore index c564efc..e6bd342 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /var/ /vendor/ /.php-cs-fixer.php +/phpunit.xml /psalm.xml diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 0d83b31..01ec297 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -13,9 +13,6 @@ ]) ->append([ __FILE__, - ]) - ->exclude([ - 'psalm', ]); $config = (new Config()) diff --git a/composer.json b/composer.json index 69b208c..2b8cf7f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,10 @@ "require-dev": { "ergebnis/composer-normalize": "^2.36.0", "friendsofphp/php-cs-fixer": "^3.26.1", + "phpunit/phpunit": "^10.5", "phpyh/coding-standard": "^2.5.0", + "symfony/console": "^6.4", + "symfony/var-dumper": "^7.0", "vimeo/psalm": "^5.15.0" }, "autoload": { @@ -25,11 +28,9 @@ }, "autoload-dev": { "psr-4": { - "Typhoon\\Type\\": "tests/psalm/" - }, - "files": [ - "tests/psalm/functions.php" - ] + "StaticAnalysisTester\\": "static-analysis-tester/", + "Typhoon\\Type\\": "tests/" + } }, "config": { "allow-plugins": { @@ -40,6 +41,7 @@ "scripts": { "fixcs": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix -v", "pre-command-run": "mkdir -p var", - "psalm": "psalm --show-info --no-diff" + "psalm": "psalm --show-info --no-diff", + "test": "phpunit" } } diff --git a/composer.lock b/composer.lock index 3bc1624..34d1b67 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e0aadf9112c05df072efc90f2da5e1eb", + "content-hash": "5c786a15096f6f46d0f98d7547c1df23", "packages": [], "packages-dev": [ { @@ -1272,6 +1272,65 @@ ], "time": "2020-07-06T04:49:32+00:00" }, + { + "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": "netresearch/jsonmapper", "version": "v4.2.0", @@ -1379,6 +1438,117 @@ }, "time": "2023-08-13T19:53:39+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": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -1595,237 +1765,1517 @@ "time": "2023-09-18T12:18:02+00:00" }, { - "name": "phpyh/coding-standard", - "version": "2.6.0", + "name": "phpunit/php-code-coverage", + "version": "10.1.10", "source": { "type": "git", - "url": "https://github.com/phpyh/coding-standard.git", - "reference": "1951ba48062ff45dd9c6b4fdb27ca65e5103666a" + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpyh/coding-standard/zipball/1951ba48062ff45dd9c6b4fdb27ca65e5103666a", - "reference": "1951ba48062ff45dd9c6b4fdb27ca65e5103666a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "^3.47.1", - "php": "^8.1" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "ergebnis/composer-normalize": "^2.41.1", - "icanhazstring/composer-unused": "^0.8.11", - "maglnet/composer-require-checker": "^4.8.0", - "rector/rector": "^0.18.13", - "vimeo/psalm": "^5.20.0" + "phpunit/phpunit": "^10.1" + }, + "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": "10.1-dev" + } + }, "autoload": { - "psr-4": { - "PHPyh\\CodingStandard\\": "src/" + "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/10.1.10" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" } + ], + "time": "2023-12-11T06:28:43+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Valentin Udaltsov", - "email": "udaltsov.valentin@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "PHPyh Coding Standard For PHP CS Fixer", + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ - "Static code analysis", - "fixer", - "standards", - "static analysis" + "filesystem", + "iterator" ], "support": { - "issues": "https://github.com/phpyh/coding-standard/issues", - "source": "https://github.com/phpyh/coding-standard/tree/2.6.0" + "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/4.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T06:24:48+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:56:09+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.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": "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/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T14:07:24+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.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", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:57:52+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "10.5.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/08f4fa74d5fbfff1ef22abffee47aaedcaea227e", + "reference": "08f4fa74d5fbfff1ef22abffee47aaedcaea227e", + "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.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.8" + }, + "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-01-19T07:07:27+00:00" + }, + { + "name": "phpyh/coding-standard", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpyh/coding-standard.git", + "reference": "1951ba48062ff45dd9c6b4fdb27ca65e5103666a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpyh/coding-standard/zipball/1951ba48062ff45dd9c6b4fdb27ca65e5103666a", + "reference": "1951ba48062ff45dd9c6b4fdb27ca65e5103666a", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^3.47.1", + "php": "^8.1" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.41.1", + "icanhazstring/composer-unused": "^0.8.11", + "maglnet/composer-require-checker": "^4.8.0", + "rector/rector": "^0.18.13", + "vimeo/psalm": "^5.20.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPyh\\CodingStandard\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Valentin Udaltsov", + "email": "udaltsov.valentin@gmail.com" + } + ], + "description": "PHPyh Coding Standard For PHP CS Fixer", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpyh/coding-standard/issues", + "source": "https://github.com/phpyh/coding-standard/tree/2.6.0" + }, + "time": "2024-01-18T23:30:39+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+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": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", + "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:15+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:58:43+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.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" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:59:15+00:00" + }, + { + "name": "sebastian/comparator", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.3" + }, + "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" + }, + { + "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/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-14T13:18:12+00:00" + }, + { + "name": "sebastian/complexity", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", + "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.10", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "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/3.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-09-28T11:50:59+00:00" + }, + { + "name": "sebastian/diff", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-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/5.1.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T10:55:06+00:00" + }, + { + "name": "sebastian/environment", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", + "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "suggest": { + "ext-posix": "*" + }, + "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": "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/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-04-11T05:39:26+00:00" + }, + { + "name": "sebastian/exporter", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-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/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-09-24T13:22:09+00:00" + }, + { + "name": "sebastian/global-state", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^10.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": "Snapshotting of global state", + "homepage": "http://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/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-07-19T07:19:23+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.10", + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for 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/2.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-31T09:25:50+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^10.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" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, - "time": "2024-01-18T23:30:39+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:08:32+00:00" }, { - "name": "psr/container", - "version": "2.0.2", + "name": "sebastian/object-reflector", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.4.0" + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-main": "3.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, - "time": "2021-11-05T16:47:00+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:06:18+00:00" }, { - "name": "psr/event-dispatcher", - "version": "1.0.0", + "name": "sebastian/recursion-context", + "version": "5.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-main": "5.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Standard interfaces for event handling.", - "keywords": [ - "events", - "psr", - "psr-14" - ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, - "time": "2019-01-08T18:20:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:05:40+00:00" }, { - "name": "psr/log", - "version": "3.0.0", + "name": "sebastian/type", + "version": "4.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-main": "4.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, - "time": "2021-07-14T16:46:02+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T07:10:45+00:00" }, { - "name": "sebastian/diff", - "version": "5.1.0", + "name": "sebastian/version", + "version": "4.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", - "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { "php": ">=8.1" }, - "require-dev": { - "phpunit/phpunit": "^10.0", - "symfony/process": "^4.2 || ^5" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1840,25 +3290,15 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], + "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/diff/issues", - "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -1866,7 +3306,7 @@ "type": "github" } ], - "time": "2023-12-22T10:55:06+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "spatie/array-to-xml", @@ -3225,6 +4665,139 @@ ], "time": "2023-12-10T16:54:46+00:00" }, + { + "name": "symfony/var-dumper", + "version": "v7.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "5f6f1a527002068f6d40fda068399220eabebf71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5f6f1a527002068f6d40fda068399220eabebf71", + "reference": "5f6f1a527002068f6d40fda068399220eabebf71", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/uid": "^6.4|^7.0", + "twig/twig": "^3.0.4" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v7.0.2" + }, + "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-12-28T19:18:20+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" + }, { "name": "vimeo/psalm", "version": "5.15.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..318a2a5 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,22 @@ + + + + + tests + + + + + + src + + + diff --git a/psalm.xml.dist b/psalm.xml.dist index e2cf9d4..ca45380 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -50,4 +50,9 @@ + + + + + diff --git a/static-analysis-tester/PsalmTester.php b/static-analysis-tester/PsalmTester.php new file mode 100644 index 0000000..784d899 --- /dev/null +++ b/static-analysis-tester/PsalmTester.php @@ -0,0 +1,97 @@ +createTemporaryCodeFile($test->code); + + try { + /** @psalm-suppress ForbiddenCode */ + $output = shell_exec(sprintf( + '%s --output-format=json %s %s', + $this->psalmPath, + $test->arguments ?: $this->defaultArguments, + $codeFile, + )); + + if (!\is_string($output)) { + throw new \RuntimeException(); + } + + $formattedOutput = $this->formatOutput($output, $test->codeFirstLine); + + Assert::assertThat($formattedOutput, $test->constraint); + } finally { + @unlink($codeFile); + } + } + + private function createTemporaryCodeFile(string $contents): string + { + $file = tempnam($this->temporaryDirectory, 'code_'); + + if (!$file) { + throw new \LogicException(sprintf('Failed to create temporary code file in %s.', $this->temporaryDirectory)); + } + + file_put_contents($file, $contents); + + return $file; + } + + private function formatOutput(string $output, int $codeFirstLine): string + { + /** @var list */ + $decoded = json_decode($output, true, flags: JSON_THROW_ON_ERROR); + + return implode("\n", array_map( + static fn(array $error): string => sprintf( + '%s on line %d: %s', + $error['type'], + $error['line_from'] + $codeFirstLine - 1, + $error['message'], + ), + $decoded, + )); + } +} diff --git a/static-analysis-tester/StaticAnalysisTest.php b/static-analysis-tester/StaticAnalysisTest.php new file mode 100644 index 0000000..46a6302 --- /dev/null +++ b/static-analysis-tester/StaticAnalysisTest.php @@ -0,0 +1,109 @@ + + */ +final class StaticAnalysisTest +{ + /** + * @param positive-int $codeFirstLine + */ + public function __construct( + public readonly string $code, + public readonly Constraint $constraint, + public readonly string $arguments = '', + public readonly int $codeFirstLine = 1, + ) {} + + /** + * @see https://qa.php.net/phpt_details.php + */ + public static function fromPhptFile(string $phptFile): self + { + $sections = self::parsePhpt($phptFile); + + if (!isset($sections['FILE'])) { + throw new \LogicException(sprintf('File %s must have a FILE section.', $phptFile)); + } + + return new self( + code: $sections['FILE'][0], + constraint: self::resolvePhptConstraint($phptFile, $sections), + arguments: $sections['ARGS'][0] ?? '', + codeFirstLine: $sections['FILE'][1], + ); + } + + /** + * @param PhptSections $sections + */ + private static function resolvePhptConstraint(string $file, array $sections): Constraint + { + if (isset($sections['EXPECT'])) { + return new IsIdentical($sections['EXPECT'][0]); + } + + if (isset($sections['EXPECTF'])) { + return new StringMatchesFormatDescription($sections['EXPECTF'][0]); + } + + if (isset($sections['EXPECTREGEX'])) { + return new RegularExpression($sections['EXPECTREGEX'][0]); + } + + if (isset($sections['EXPECT_EXTERNAL'])) { + return new IsIdentical(file_get_contents($sections['EXPECT_EXTERNAL'][0])); + } + + if (isset($sections['EXPECTF_EXTERNAL'])) { + return new StringMatchesFormatDescription(file_get_contents($sections['EXPECTF_EXTERNAL'][0])); + } + + if (isset($sections['EXPECTREGEX_EXTERNAL'])) { + return new RegularExpression(file_get_contents($sections['EXPECTREGEX_EXTERNAL'][0])); + } + + throw new \LogicException(sprintf('File %s must have an EXPECT* section.', $file)); + } + + /** + * @return PhptSections + */ + private static function parsePhpt(string $phptFile): array + { + $name = null; + $sections = []; + $lineNumber = 0; + + foreach (file($phptFile, FILE_IGNORE_NEW_LINES) as $line) { + ++$lineNumber; + + if (preg_match('/^--([_A-Z]+)--/', $line, $matches)) { + /** @var non-empty-string */ + $name = $matches[1]; + $sections[$name] = ['', $lineNumber + 1]; + + continue; + } + + if ($name === null) { + throw new \LogicException('.phpt file must start with a section delimiter, f.e. --TEST--.'); + } + + $sections[$name][0] .= ($sections[$name][0] ? "\n" : '') . $line; + } + + /** @var PhptSections */ + return $sections; + } +} diff --git a/static-analysis-tester/psalm.xml b/static-analysis-tester/psalm.xml new file mode 100644 index 0000000..3620570 --- /dev/null +++ b/static-analysis-tester/psalm.xml @@ -0,0 +1,19 @@ + + + diff --git a/tests/PsalmTest.php b/tests/PsalmTest.php new file mode 100644 index 0000000..f7333f0 --- /dev/null +++ b/tests/PsalmTest.php @@ -0,0 +1,43 @@ + $_type + * @return TType + */ + public static function extractType(Type $_type): mixed + { + /** @var TType */ + return null; + } + + /** + * @return \Generator + */ + public static function phptFiles(): \Generator + { + foreach (glob(__DIR__ . '/psalm/*.phpt') as $file) { + yield basename($file) => [$file]; + } + } + + #[DataProvider('phptFiles')] + public function testPhptFiles(string $phptFile): void + { + $this->psalmTester ??= PsalmTester::create(); + $this->psalmTester->test(StaticAnalysisTest::fromPhptFile($phptFile)); + } +} diff --git a/tests/psalm/ArrayKeyTest.php b/tests/psalm/ArrayKeyTest.php deleted file mode 100644 index ac2f5ba..0000000 --- a/tests/psalm/ArrayKeyTest.php +++ /dev/null @@ -1,8 +0,0 @@ - */ -$_shapeType = new ArrayShapeType([ - 'a' => new ArrayElement(StringType::type, optional: true), - 10 => new ArrayElement(IntType::type), -]); -/** @psalm-check-type-exact $_shape = array{a?: string, 10: int} */ -$_shape = extractType($_shapeType); - -function testShapeIsCovariant(ArrayShapeType $_type): void {} - -testShapeIsCovariant($_shapeType); diff --git a/tests/psalm/ArrayShapeType.phpt b/tests/psalm/ArrayShapeType.phpt new file mode 100644 index 0000000..83ee997 --- /dev/null +++ b/tests/psalm/ArrayShapeType.phpt @@ -0,0 +1,9 @@ +--FILE-- + */ -$_intStringArray = extractType(new ArrayType(IntType::type, StringType::type)); - -function testArrayIsCovariant(ArrayType $_type): void {} - -testArrayIsCovariant(new ArrayType(IntType::type, StringType::type)); diff --git a/tests/psalm/ArrayType.phpt b/tests/psalm/ArrayType.phpt new file mode 100644 index 0000000..7b1c0f0 --- /dev/null +++ b/tests/psalm/ArrayType.phpt @@ -0,0 +1,12 @@ +--FILE-- +, but enum(Typhoon\Type\ObjectType::type) provided diff --git a/tests/psalm/BoolTest.php b/tests/psalm/BoolTest.php deleted file mode 100644 index 1c32c1f..0000000 --- a/tests/psalm/BoolTest.php +++ /dev/null @@ -1,8 +0,0 @@ - $_type - */ -function testClassStringLiteralIsCovariant(ClassStringLiteralType $_type): void {} - -testClassStringLiteralIsCovariant(new ClassStringLiteralType(\Iterator::class)); diff --git a/tests/psalm/ClassStringLiteralType.phpt b/tests/psalm/ClassStringLiteralType.phpt new file mode 100644 index 0000000..2a9493b --- /dev/null +++ b/tests/psalm/ClassStringLiteralType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $_type - */ -function testFloatLiteralIsCovariant(FloatLiteralType $_type): void {} - -testFloatLiteralIsCovariant(new FloatLiteralType(-1.7)); diff --git a/tests/psalm/FloatLiteralType.phpt b/tests/psalm/FloatLiteralType.phpt new file mode 100644 index 0000000..92c2db6 --- /dev/null +++ b/tests/psalm/FloatLiteralType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $_type - */ -function testIntLiteralIsCovariant(IntLiteralType $_type): void {} - -testIntLiteralIsCovariant(new IntLiteralType(1)); diff --git a/tests/psalm/IntLiteralType.phpt b/tests/psalm/IntLiteralType.phpt new file mode 100644 index 0000000..f661e37 --- /dev/null +++ b/tests/psalm/IntLiteralType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $constantType - */ -function testItPreservesPassedType(Type $constantType): void -{ - /** @psalm-check-type-exact $_int = 1|2|4 */ - $_int = extractType(new IntMaskOfType($constantType)); -} diff --git a/tests/psalm/IntMaskOfType.phpt b/tests/psalm/IntMaskOfType.phpt new file mode 100644 index 0000000..642ad5c --- /dev/null +++ b/tests/psalm/IntMaskOfType.phpt @@ -0,0 +1,22 @@ +--FILE-- + $constantType + */ +function testItPreservesPassedType(Type $constantType): void +{ + /** @psalm-check-type-exact $_type = 1|2|4 */ + $_type = PsalmTest::extractType(new IntMaskOfType($constantType)); +} + +--EXPECT-- diff --git a/tests/psalm/IntMaskTest.php b/tests/psalm/IntMaskTest.php deleted file mode 100644 index c20cf9e..0000000 --- a/tests/psalm/IntMaskTest.php +++ /dev/null @@ -1,17 +0,0 @@ -> $type - */ -function a(IntMaskType $type): void -{ - /** @psalm-check-type-exact $_int = int-mask<1, 2, 4> */ - $_int = extractType($type); -} diff --git a/tests/psalm/IntMaskType.phpt b/tests/psalm/IntMaskType.phpt new file mode 100644 index 0000000..d94f280 --- /dev/null +++ b/tests/psalm/IntMaskType.phpt @@ -0,0 +1,9 @@ +--FILE-- + */ + +--EXPECT-- diff --git a/tests/psalm/IntRangeTest.php b/tests/psalm/IntRangeTest.php deleted file mode 100644 index 9ef4c2b..0000000 --- a/tests/psalm/IntRangeTest.php +++ /dev/null @@ -1,8 +0,0 @@ - */ -$_classString = extractType(new NamedClassStringType(new NamedObjectType(\stdClass::class))); diff --git a/tests/psalm/NamedClassStringType.phpt b/tests/psalm/NamedClassStringType.phpt new file mode 100644 index 0000000..7cf8994 --- /dev/null +++ b/tests/psalm/NamedClassStringType.phpt @@ -0,0 +1,9 @@ +--FILE-- + */ + +--EXPECT-- diff --git a/tests/psalm/NamedObjectTest.php b/tests/psalm/NamedObjectTest.php deleted file mode 100644 index c173dfa..0000000 --- a/tests/psalm/NamedObjectTest.php +++ /dev/null @@ -1,17 +0,0 @@ -> */ -$arrayObjectType = new NamedObjectType(\ArrayObject::class, [IntType::type, StringType::type]); -/** @psalm-check-type-exact $_arrayObject = \ArrayObject */ -$_arrayObject = extractType($arrayObjectType); - -function testObjectIsCovariant(NamedObjectType $_type): void {} - -testObjectIsCovariant(new NamedObjectType(\stdClass::class)); diff --git a/tests/psalm/NamedObjectType.phpt b/tests/psalm/NamedObjectType.phpt new file mode 100644 index 0000000..9834651 --- /dev/null +++ b/tests/psalm/NamedObjectType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $type - */ -function testStatic(StaticType $type): void -{ - /** @psalm-check-type-exact $_class = \stdClass */ - $_class = extractType($type); -} diff --git a/tests/psalm/StaticType.phpt b/tests/psalm/StaticType.phpt new file mode 100644 index 0000000..0c31cfc --- /dev/null +++ b/tests/psalm/StaticType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $_type - */ -function testStringLiteralIsCovariant(StringLiteralType $_type): void {} - -testStringLiteralIsCovariant(new StringLiteralType('abc')); diff --git a/tests/psalm/StringLiteralType.phpt b/tests/psalm/StringLiteralType.phpt new file mode 100644 index 0000000..bec5f12 --- /dev/null +++ b/tests/psalm/StringLiteralType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $type - */ -function testStatic(TemplateType $type): void -{ - /** @psalm-check-type-exact $_type = non-empty-string */ - $_type = extractType($type); -} diff --git a/tests/psalm/TemplateType.phpt b/tests/psalm/TemplateType.phpt new file mode 100644 index 0000000..c27bd19 --- /dev/null +++ b/tests/psalm/TemplateType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $_type - */ -function testUnionIsCovariant(UnionType $_type): void {} - -testUnionIsCovariant(new UnionType([IntType::type, StringType::type])); diff --git a/tests/psalm/UnionType.phpt b/tests/psalm/UnionType.phpt new file mode 100644 index 0000000..882361f --- /dev/null +++ b/tests/psalm/UnionType.phpt @@ -0,0 +1,9 @@ +--FILE-- + $_type - * @return TType - */ -function extractType(Type $_type): mixed -{ - /** @var TType */ - return null; -} From 8f276433a28e317334afbcf4a1ee9032977a37d2 Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Mon, 22 Jan 2024 15:14:49 +0300 Subject: [PATCH 2/4] Removed symfony/var-dumper, symfony/console --- composer.json | 2 -- composer.lock | 85 +-------------------------------------------------- 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/composer.json b/composer.json index 2b8cf7f..10a6b71 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,6 @@ "friendsofphp/php-cs-fixer": "^3.26.1", "phpunit/phpunit": "^10.5", "phpyh/coding-standard": "^2.5.0", - "symfony/console": "^6.4", - "symfony/var-dumper": "^7.0", "vimeo/psalm": "^5.15.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 34d1b67..6562bf3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5c786a15096f6f46d0f98d7547c1df23", + "content-hash": "9501f75761e9d8fe7b71b6fb325d4bef", "packages": [], "packages-dev": [ { @@ -4665,89 +4665,6 @@ ], "time": "2023-12-10T16:54:46+00:00" }, - { - "name": "symfony/var-dumper", - "version": "v7.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "5f6f1a527002068f6d40fda068399220eabebf71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5f6f1a527002068f6d40fda068399220eabebf71", - "reference": "5f6f1a527002068f6d40fda068399220eabebf71", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/console": "<6.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/process": "^6.4|^7.0", - "symfony/uid": "^6.4|^7.0", - "twig/twig": "^3.0.4" - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.0.2" - }, - "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-12-28T19:18:20+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.2", From bfd266efaf0ae2507329a046cdca8f9b8517166a Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Mon, 22 Jan 2024 15:16:20 +0300 Subject: [PATCH 3/4] Added static-analysis-tester to fixer & psalm configs --- .php-cs-fixer.dist.php | 1 + psalm.xml.dist | 1 + 2 files changed, 2 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 01ec297..ded24cc 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -9,6 +9,7 @@ $finder = Finder::create() ->in([ __DIR__ . '/src', + __DIR__ . '/static-analysis-tester', __DIR__ . '/tests', ]) ->append([ diff --git a/psalm.xml.dist b/psalm.xml.dist index ca45380..1c2060a 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -23,6 +23,7 @@ + From e829dd4696cf97ad0f3c6a6aa9321f3da5a25990 Mon Sep 17 00:00:00 2001 From: Valentin Udaltsov Date: Mon, 22 Jan 2024 16:20:44 +0300 Subject: [PATCH 4/4] Added --no-diff to $defaultArguments of PsalmTester --- static-analysis-tester/PsalmTester.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static-analysis-tester/PsalmTester.php b/static-analysis-tester/PsalmTester.php index 784d899..f4d542a 100644 --- a/static-analysis-tester/PsalmTester.php +++ b/static-analysis-tester/PsalmTester.php @@ -20,7 +20,7 @@ private function __construct( public static function create( ?string $psalmPath = null, - string $defaultArguments = '--no-progress --config=' . __DIR__ . '/psalm.xml', + string $defaultArguments = '--no-progress --no-diff --config=' . __DIR__ . '/psalm.xml', ?string $temporaryDirectory = null, ): self { if ($psalmPath === null) {