From 3b1df92a4554d3fec2b55d183fcf2df38eaa4ded Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 6 Nov 2024 13:32:10 +0000 Subject: [PATCH] Updated Rector to commit 293eb9701e8035c7d1e57ba0627a637ad70c7c16 https://github.com/rectorphp/rector-src/commit/293eb9701e8035c7d1e57ba0627a637ad70c7c16 [Php81] Skip Doctrine Embeddable on ReadOnlyPropertyRector (#6411) --- src/Application/VersionResolver.php | 4 +- src/NodeManipulator/PropertyManipulator.php | 2 +- vendor/composer/autoload_classmap.php | 2 + vendor/composer/autoload_static.php | 2 + vendor/composer/installed.json | 36 +-- vendor/composer/installed.php | 2 +- .../src/GeneratedConfig.php | 2 +- .../DoctrineEntityDocumentAnalyser.php | 28 +++ ...ityDocumentCreateMockToDirectNewRector.php | 223 ++++++++++++++++++ vendor/symfony/console/Application.php | 2 +- vendor/symfony/process/ExecutableFinder.php | 23 +- .../symfony/process/PhpExecutableFinder.php | 11 +- vendor/symfony/process/Process.php | 9 +- 13 files changed, 306 insertions(+), 40 deletions(-) create mode 100644 vendor/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php create mode 100644 vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b1f84da7a1d..2d308ac1596 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = 'afe7c46c0387e27e1eae37cf76f8a3a4119a1d39'; + public const PACKAGE_VERSION = '293eb9701e8035c7d1e57ba0627a637ad70c7c16'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-11-05 21:18:05'; + public const RELEASE_DATE = '2024-11-06 20:29:42'; /** * @var int */ diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 58e91b8acf9..819681c14d1 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -92,7 +92,7 @@ final class PropertyManipulator /** * @var string[]|class-string[] */ - private const DOCTRINE_PROPERTY_ANNOTATIONS = ['Doctrine\\ORM\\Mapping\\Entity', 'Doctrine\\ORM\\Mapping\\Table', 'Doctrine\\ORM\\Mapping\\MappedSuperclass']; + private const DOCTRINE_PROPERTY_ANNOTATIONS = ['Doctrine\\ORM\\Mapping\\Entity', 'Doctrine\\ORM\\Mapping\\Table', 'Doctrine\\ORM\\Mapping\\MappedSuperclass', 'Doctrine\\ORM\\Mapping\\Embeddable']; public function __construct(\Rector\NodeManipulator\AssignManipulator $assignManipulator, BetterNodeFinder $betterNodeFinder, PhpDocInfoFactory $phpDocInfoFactory, PropertyFetchFinder $propertyFetchFinder, NodeNameResolver $nodeNameResolver, PhpAttributeAnalyzer $phpAttributeAnalyzer, NodeTypeResolver $nodeTypeResolver, PromotedPropertyResolver $promotedPropertyResolver, ConstructorAssignDetector $constructorAssignDetector, AstResolver $astResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer) { $this->assignManipulator = $assignManipulator; diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index cbf0feacb8e..38bb5523757 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1742,9 +1742,11 @@ 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\AnnotationWithValueToAttributeRector' => $vendorDir . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php', 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\CoversAnnotationWithValueToAttributeRector' => $vendorDir . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php', 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\TicketAnnotationToAttributeRector' => $vendorDir . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php', + 'Rector\\PHPUnit\\CodeQuality\\NodeAnalyser\\DoctrineEntityDocumentAnalyser' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php', 'Rector\\PHPUnit\\CodeQuality\\NodeFactory\\NestedClosureAssertFactory' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\CreateMockToAnonymousClassRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\DataProviderArrayItemsNewLinedRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php', + 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\EntityDocumentCreateMockToDirectNewRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\RemoveEmptyTestMethodRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\ReplaceTestAnnotationWithPrefixedFunctionRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\ReplaceTestFunctionPrefixWithAttributeRector' => $vendorDir . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a9520088287..d3446c7212a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1961,9 +1961,11 @@ class ComposerStaticInit4d4c37b878ce01a3ff505ba7def6aac7 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\AnnotationWithValueToAttributeRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/AnnotationWithValueToAttributeRector.php', 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\CoversAnnotationWithValueToAttributeRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/CoversAnnotationWithValueToAttributeRector.php', 'Rector\\PHPUnit\\AnnotationsToAttributes\\Rector\\Class_\\TicketAnnotationToAttributeRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/AnnotationsToAttributes/Rector/Class_/TicketAnnotationToAttributeRector.php', + 'Rector\\PHPUnit\\CodeQuality\\NodeAnalyser\\DoctrineEntityDocumentAnalyser' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php', 'Rector\\PHPUnit\\CodeQuality\\NodeFactory\\NestedClosureAssertFactory' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/NodeFactory/NestedClosureAssertFactory.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\CreateMockToAnonymousClassRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/CreateMockToAnonymousClassRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\DataProviderArrayItemsNewLinedRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/DataProviderArrayItemsNewLinedRector.php', + 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\EntityDocumentCreateMockToDirectNewRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\RemoveEmptyTestMethodRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/RemoveEmptyTestMethodRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\ReplaceTestAnnotationWithPrefixedFunctionRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php', 'Rector\\PHPUnit\\CodeQuality\\Rector\\ClassMethod\\ReplaceTestFunctionPrefixWithAttributeRector' => __DIR__ . '/..' . '/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index c1f3e5b3d08..b8eb8ba7edf 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1811,12 +1811,12 @@ "source": { "type": "git", "url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git", - "reference": "eb0b69aa213ec7925264453770090ca4ca4bacaa" + "reference": "29536ff4bb1177f2d8eebda377eee05f2f386618" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/eb0b69aa213ec7925264453770090ca4ca4bacaa", - "reference": "eb0b69aa213ec7925264453770090ca4ca4bacaa", + "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/29536ff4bb1177f2d8eebda377eee05f2f386618", + "reference": "29536ff4bb1177f2d8eebda377eee05f2f386618", "shasum": "" }, "require": { @@ -1840,7 +1840,7 @@ "tomasvotruba\/class-leak": "^1.0", "tracy\/tracy": "^2.10" }, - "time": "2024-11-05T22:55:54+00:00", + "time": "2024-11-06T08:24:44+00:00", "default-branch": true, "type": "rector-extension", "extra": { @@ -2008,17 +2008,17 @@ }, { "name": "symfony\/console", - "version": "v6.4.13", - "version_normalized": "6.4.13.0", + "version": "v6.4.14", + "version_normalized": "6.4.14.0", "source": { "type": "git", "url": "https:\/\/github.com\/symfony\/console.git", - "reference": "f793dd5a7d9ae9923e35d0503d08ba734cec1d79" + "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/f793dd5a7d9ae9923e35d0503d08ba734cec1d79", - "reference": "f793dd5a7d9ae9923e35d0503d08ba734cec1d79", + "url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/897c2441ed4eec8a8a2c37b943427d24dba3f26b", + "reference": "897c2441ed4eec8a8a2c37b943427d24dba3f26b", "shasum": "" }, "require": { @@ -2051,7 +2051,7 @@ "symfony\/stopwatch": "^5.4|^6.0|^7.0", "symfony\/var-dumper": "^5.4|^6.0|^7.0" }, - "time": "2024-10-09T08:40:40+00:00", + "time": "2024-11-05T15:34:40+00:00", "type": "library", "extra": { "patches_applied": [ @@ -2090,7 +2090,7 @@ "terminal" ], "support": { - "source": "https:\/\/github.com\/symfony\/console\/tree\/v6.4.13" + "source": "https:\/\/github.com\/symfony\/console\/tree\/v6.4.14" }, "funding": [ { @@ -2399,23 +2399,23 @@ }, { "name": "symfony\/process", - "version": "v6.4.13", - "version_normalized": "6.4.13.0", + "version": "v6.4.14", + "version_normalized": "6.4.14.0", "source": { "type": "git", "url": "https:\/\/github.com\/symfony\/process.git", - "reference": "1f9f59b46880201629df3bd950fc5ae8c55b960f" + "reference": "25214adbb0996d18112548de20c281be9f27279f" }, "dist": { "type": "zip", - "url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/1f9f59b46880201629df3bd950fc5ae8c55b960f", - "reference": "1f9f59b46880201629df3bd950fc5ae8c55b960f", + "url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/25214adbb0996d18112548de20c281be9f27279f", + "reference": "25214adbb0996d18112548de20c281be9f27279f", "shasum": "" }, "require": { "php": ">=8.1" }, - "time": "2024-09-25T14:18:03+00:00", + "time": "2024-11-06T09:25:01+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -2443,7 +2443,7 @@ "description": "Executes commands in sub-processes", "homepage": "https:\/\/symfony.com", "support": { - "source": "https:\/\/github.com\/symfony\/process\/tree\/v6.4.13" + "source": "https:\/\/github.com\/symfony\/process\/tree\/v6.4.14" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index b00a5ffebf7..5b74b8e2bbb 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -2,4 +2,4 @@ namespace RectorPrefix202411; -return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.1', 'version' => '3.3.1.0', 'reference' => '63aaeac21d7e775ff9bc9d45021e1745c97521c4', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '06dfc614aff58384b28ba5ad191f6a02d6b192cb', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '56312862af937bd6da8e6dc8bbd88188dfb478f8', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.19.4', 'version' => '4.19.4.0', 'reference' => '715f4d25e225bc47b293a8b997fe6ce99bf987d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.33.0', 'version' => '1.33.0.0', 'reference' => '82a311fd3690fb2bf7b64d5c98f912b3dd746140', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '1.12.7')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'e75008c293679e0bb0637bf09cf6dd43ff34526a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'd9cef571617b93e642b3ac45981b7092e1a2e89a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'eb0b69aa213ec7925264453770090ca4ca4bacaa', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '799b454b63c240edc962c8fafea2c5a2a61e5393', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'f793dd5a7d9ae9923e35d0503d08ba734cec1d79', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '1f9f59b46880201629df3bd950fc5ae8c55b960f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); +return array('root' => array('name' => 'rector/rector-src', 'pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \false), 'versions' => array('clue/ndjson-react' => array('pretty_version' => 'v1.3.0', 'version' => '1.3.0.0', 'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0', 'type' => 'library', 'install_path' => __DIR__ . '/../clue/ndjson-react', 'aliases' => array(), 'dev_requirement' => \false), 'composer/pcre' => array('pretty_version' => '3.3.1', 'version' => '3.3.1.0', 'reference' => '63aaeac21d7e775ff9bc9d45021e1745c97521c4', 'type' => 'library', 'install_path' => __DIR__ . '/./pcre', 'aliases' => array(), 'dev_requirement' => \false), 'composer/semver' => array('pretty_version' => '3.4.3', 'version' => '3.4.3.0', 'reference' => '4313d26ada5e0c4edfbd1dc481a92ff7bff91f12', 'type' => 'library', 'install_path' => __DIR__ . '/./semver', 'aliases' => array(), 'dev_requirement' => \false), 'composer/xdebug-handler' => array('pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef', 'type' => 'library', 'install_path' => __DIR__ . '/./xdebug-handler', 'aliases' => array(), 'dev_requirement' => \false), 'doctrine/inflector' => array('pretty_version' => '2.0.10', 'version' => '2.0.10.0', 'reference' => '5817d0659c5b50c9b950feb9af7b9668e2c436bc', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/inflector', 'aliases' => array(), 'dev_requirement' => \false), 'evenement/evenement' => array('pretty_version' => 'v3.0.2', 'version' => '3.0.2.0', 'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc', 'type' => 'library', 'install_path' => __DIR__ . '/../evenement/evenement', 'aliases' => array(), 'dev_requirement' => \false), 'fidry/cpu-core-counter' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '8520451a140d3f46ac33042715115e290cf5785f', 'type' => 'library', 'install_path' => __DIR__ . '/../fidry/cpu-core-counter', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/container' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '06dfc614aff58384b28ba5ad191f6a02d6b192cb', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/container', 'aliases' => array(), 'dev_requirement' => \false), 'illuminate/contracts' => array('pretty_version' => 'v11.30.0', 'version' => '11.30.0.0', 'reference' => '56312862af937bd6da8e6dc8bbd88188dfb478f8', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), 'dev_requirement' => \false), 'nette/utils' => array('pretty_version' => 'v4.0.5', 'version' => '4.0.5.0', 'reference' => '736c567e257dbe0fcf6ce81b4d6dbe05c6899f96', 'type' => 'library', 'install_path' => __DIR__ . '/../nette/utils', 'aliases' => array(), 'dev_requirement' => \false), 'nikic/php-parser' => array('pretty_version' => 'v4.19.4', 'version' => '4.19.4.0', 'reference' => '715f4d25e225bc47b293a8b997fe6ce99bf987d2', 'type' => 'library', 'install_path' => __DIR__ . '/../nikic/php-parser', 'aliases' => array(), 'dev_requirement' => \false), 'ondram/ci-detector' => array('pretty_version' => '4.2.0', 'version' => '4.2.0.0', 'reference' => '8b0223b5ed235fd377c75fdd1bfcad05c0f168b8', 'type' => 'library', 'install_path' => __DIR__ . '/../ondram/ci-detector', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpdoc-parser' => array('pretty_version' => '1.33.0', 'version' => '1.33.0.0', 'reference' => '82a311fd3690fb2bf7b64d5c98f912b3dd746140', 'type' => 'library', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'aliases' => array(), 'dev_requirement' => \false), 'phpstan/phpstan' => array('dev_requirement' => \false, 'replaced' => array(0 => '1.12.7')), 'psr/container' => array('pretty_version' => '2.0.2', 'version' => '2.0.2.0', 'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/container', 'aliases' => array(), 'dev_requirement' => \false), 'psr/container-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.1|2.0')), 'psr/log' => array('pretty_version' => '3.0.2', 'version' => '3.0.2.0', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/log', 'aliases' => array(), 'dev_requirement' => \false), 'psr/log-implementation' => array('dev_requirement' => \false, 'provided' => array(0 => '1.0|2.0|3.0')), 'psr/simple-cache' => array('pretty_version' => '3.0.0', 'version' => '3.0.0.0', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/simple-cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/cache' => array('pretty_version' => 'v1.2.0', 'version' => '1.2.0.0', 'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b', 'type' => 'library', 'install_path' => __DIR__ . '/../react/cache', 'aliases' => array(), 'dev_requirement' => \false), 'react/child-process' => array('pretty_version' => 'v0.6.5', 'version' => '0.6.5.0', 'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43', 'type' => 'library', 'install_path' => __DIR__ . '/../react/child-process', 'aliases' => array(), 'dev_requirement' => \false), 'react/dns' => array('pretty_version' => 'v1.13.0', 'version' => '1.13.0.0', 'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5', 'type' => 'library', 'install_path' => __DIR__ . '/../react/dns', 'aliases' => array(), 'dev_requirement' => \false), 'react/event-loop' => array('pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354', 'type' => 'library', 'install_path' => __DIR__ . '/../react/event-loop', 'aliases' => array(), 'dev_requirement' => \false), 'react/promise' => array('pretty_version' => 'v3.2.0', 'version' => '3.2.0.0', 'reference' => '8a164643313c71354582dc850b42b33fa12a4b63', 'type' => 'library', 'install_path' => __DIR__ . '/../react/promise', 'aliases' => array(), 'dev_requirement' => \false), 'react/socket' => array('pretty_version' => 'v1.16.0', 'version' => '1.16.0.0', 'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1', 'type' => 'library', 'install_path' => __DIR__ . '/../react/socket', 'aliases' => array(), 'dev_requirement' => \false), 'react/stream' => array('pretty_version' => 'v1.4.0', 'version' => '1.4.0.0', 'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d', 'type' => 'library', 'install_path' => __DIR__ . '/../react/stream', 'aliases' => array(), 'dev_requirement' => \false), 'rector/extension-installer' => array('pretty_version' => '0.11.2', 'version' => '0.11.2.0', 'reference' => '05544e9b195863b8571ae2a3b903cbec7fa062e0', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/../rector/extension-installer', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector' => array('dev_requirement' => \false, 'replaced' => array(0 => 'dev-main')), 'rector/rector-doctrine' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'e75008c293679e0bb0637bf09cf6dd43ff34526a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-doctrine', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-downgrade-php' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => 'd9cef571617b93e642b3ac45981b7092e1a2e89a', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-downgrade-php', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'rector/rector-phpunit' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '29536ff4bb1177f2d8eebda377eee05f2f386618', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-phpunit', 'aliases' => array(0 => '0.11.x-dev'), 'dev_requirement' => \false), 'rector/rector-src' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => null, 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'rector/rector-symfony' => array('pretty_version' => 'dev-main', 'version' => 'dev-main', 'reference' => '799b454b63c240edc962c8fafea2c5a2a61e5393', 'type' => 'rector-extension', 'install_path' => __DIR__ . '/../rector/rector-symfony', 'aliases' => array(0 => '9999999-dev'), 'dev_requirement' => \false), 'sebastian/diff' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/console' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '897c2441ed4eec8a8a2c37b943427d24dba3f26b', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/console', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/deprecation-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/filesystem' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => '4856c9cf585d5a0313d8d35afd681a526f038dd3', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/filesystem', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/finder' => array('pretty_version' => 'v6.4.13', 'version' => '6.4.13.0', 'reference' => 'daea9eca0b08d0ed1dc9ab702a46128fd1be4958', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/finder', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/polyfill-ctype' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-intl-grapheme' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/polyfill-mbstring' => array('pretty_version' => 'v1.31.0', 'version' => '1.31.0.0', 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/process' => array('pretty_version' => 'v6.4.14', 'version' => '6.4.14.0', 'reference' => '25214adbb0996d18112548de20c281be9f27279f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/service-contracts' => array('pretty_version' => 'v3.5.0', 'version' => '3.5.0.0', 'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/service-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'symfony/string' => array('dev_requirement' => \false, 'replaced' => array(0 => '*')), 'symfony/yaml' => array('pretty_version' => 'v7.1.6', 'version' => '7.1.6.0', 'reference' => '3ced3f29e4f0d6bce2170ff26719f1fe9aacc671', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/yaml', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/easy-parallel' => array('pretty_version' => '11.2.2', 'version' => '11.2.2.0', 'reference' => '8586c18bb8efb31cd192a4e5cc94ae7813f72ed9', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/easy-parallel', 'aliases' => array(), 'dev_requirement' => \false), 'symplify/rule-doc-generator-contracts' => array('pretty_version' => '11.2.0', 'version' => '11.2.0.0', 'reference' => '479cfcfd46047f80624aba931d9789e50475b5c6', 'type' => 'library', 'install_path' => __DIR__ . '/../symplify/rule-doc-generator-contracts', 'aliases' => array(), 'dev_requirement' => \false), 'webmozart/assert' => array('pretty_version' => '1.11.0', 'version' => '1.11.0.0', 'reference' => '11cb2199493b2f8a3b53e7f19068fc6aac760991', 'type' => 'library', 'install_path' => __DIR__ . '/../webmozart/assert', 'aliases' => array(), 'dev_requirement' => \false))); diff --git a/vendor/rector/extension-installer/src/GeneratedConfig.php b/vendor/rector/extension-installer/src/GeneratedConfig.php index 8aa27329a03..ea6170133f9 100644 --- a/vendor/rector/extension-installer/src/GeneratedConfig.php +++ b/vendor/rector/extension-installer/src/GeneratedConfig.php @@ -9,7 +9,7 @@ */ final class GeneratedConfig { - public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main e75008c'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main d9cef57'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main eb0b69a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 799b454')); + public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main e75008c'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main d9cef57'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 29536ff'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 799b454')); private function __construct() { } diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php b/vendor/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php new file mode 100644 index 00000000000..6940e70c719 --- /dev/null +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/NodeAnalyser/DoctrineEntityDocumentAnalyser.php @@ -0,0 +1,28 @@ +getResolvedPhpDoc(); + if (!$resolvedPhpDocBlock instanceof ResolvedPhpDocBlock) { + return \false; + } + foreach (self::ENTITY_DOCBLOCK_MARKERS as $entityDocBlockMarkers) { + if (\strpos($resolvedPhpDocBlock->getPhpDocString(), $entityDocBlockMarkers) !== \false) { + return \true; + } + } + // @todo apply attributes as well + return \false; + } +} diff --git a/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php new file mode 100644 index 00000000000..0dd54968e9b --- /dev/null +++ b/vendor/rector/rector-phpunit/rules/CodeQuality/Rector/ClassMethod/EntityDocumentCreateMockToDirectNewRector.php @@ -0,0 +1,223 @@ +valueResolver = $valueResolver; + $this->reflectionProvider = $reflectionProvider; + $this->doctrineEntityDocumentAnalyser = $doctrineEntityDocumentAnalyser; + } + public function getRuleDefinition() : RuleDefinition + { + return new RuleDefinition('Move from value object mocking, to direct use of value object', []); + } + /** + * @return array> + */ + public function getNodeTypes() : array + { + return [ClassMethod::class]; + } + /** + * @param ClassMethod $node + */ + public function refactor(Node $node) : ?ClassMethod + { + if ($node->stmts === null) { + return null; + } + $mockedVariablesToTypes = $this->collectMockedVariableToTypeAndRefactorAssign($node); + if ($mockedVariablesToTypes === []) { + return null; + } + foreach ($mockedVariablesToTypes as $mockedVariableName => $mockedClass) { + foreach ($node->stmts as $key => $stmt) { + if (!$stmt instanceof Expression) { + continue; + } + if (!$stmt->expr instanceof MethodCall) { + continue; + } + $methodCall = $stmt->expr; + $onVariableMethodCall = $this->findMethodCallOnVariableNamed($methodCall, $mockedVariableName); + if (!$onVariableMethodCall instanceof Node) { + continue; + } + // 2. find $mock->method("name") + $methodName = $this->resolveMethodCallFirstArgValue($methodCall, 'method'); + if (!\is_string($methodName)) { + throw new ShouldNotHappenException('Unable to resolve method name'); + } + // is set method mocked? Just remove it + if (\strncmp($methodName, 'set', \strlen('set')) === 0) { + unset($node->stmts[$key]); + } + $methodName = $this->resolveMethodName($methodName, $mockedClass); + $willReturnExpr = $this->resolveMethodCallFirstArgValue($methodCall, 'willReturn'); + if ($methodName && $willReturnExpr instanceof Expr) { + $stmt->expr = new MethodCall(new Variable($mockedVariableName), new Identifier($methodName), [new Arg($willReturnExpr)]); + } + } + } + // 3. replace value without "mock" in name + $mockedVariableNames = \array_keys($mockedVariablesToTypes); + $this->traverseNodesWithCallable($node, function (Node $node) use($mockedVariableNames) : ?Variable { + if (!$node instanceof Variable) { + return null; + } + if (!\is_string($node->name)) { + return null; + } + if (!\in_array($node->name, $mockedVariableNames)) { + return null; + } + return new Variable(\str_replace('Mock', '', $node->name)); + }); + return $node; + } + /** + * @return array + */ + private function collectMockedVariableToTypeAndRefactorAssign(ClassMethod $classMethod) : array + { + if ($classMethod->stmts === null) { + return []; + } + $mockedVariablesToTypes = []; + foreach ($classMethod->stmts as $stmt) { + // find assign mock + if (!$stmt instanceof Expression) { + continue; + } + $stmtExpr = $stmt->expr; + if (!$stmtExpr instanceof Assign) { + continue; + } + /** @var Assign $assign */ + $assign = $stmtExpr; + if (!$assign->expr instanceof MethodCall) { + continue; + } + $methodCall = $assign->expr; + if (!$this->isName($methodCall->name, 'createMock')) { + continue; + } + $firstArg = $methodCall->getArgs()[0]; + $mockedClass = $this->valueResolver->getValue($firstArg->value); + if (!\is_string($mockedClass)) { + continue; + } + if (!$this->reflectionProvider->hasClass($mockedClass)) { + continue; + } + $mockClassReflection = $this->reflectionProvider->getClass($mockedClass); + if ($mockClassReflection->isAbstract()) { + continue; + } + if (!$this->doctrineEntityDocumentAnalyser->isEntityClass($mockClassReflection)) { + continue; + } + // ready to replace :) + $assign->expr = new New_(new FullyQualified($mockedClass)); + $mockedVariableName = $this->getName($assign->var); + $mockedVariablesToTypes[$mockedVariableName] = $mockedClass; + } + return $mockedVariablesToTypes; + } + /** + * @return string|\PhpParser\Node\Expr|null + */ + private function resolveMethodCallFirstArgValue(MethodCall $methodCall, string $methodName) + { + $nodeFinder = new NodeFinder(); + $methodNameMethodCall = $nodeFinder->findFirst($methodCall, function (Node $node) use($methodName) : bool { + if (!$node instanceof MethodCall) { + return \false; + } + return $this->isName($node->name, $methodName); + }); + if (!$methodNameMethodCall instanceof MethodCall) { + return null; + } + $methodNameArg = $methodNameMethodCall->getArgs()[0]; + if ($methodNameArg->value instanceof String_) { + return $methodNameArg->value->value; + } + return $methodNameArg->value; + } + private function resolveMethodName(string $methodName, string $mockedClass) : string + { + // guess the setter name + if (\strncmp($methodName, 'get', \strlen('get')) === 0) { + return 'set' . \ucfirst(\substr($methodName, 3)); + } + if (\strncmp($methodName, 'is', \strlen('is')) === 0) { + $mockedClassReflection = $this->reflectionProvider->getClass($mockedClass); + $isSetterMethodNames = ['set' . \ucfirst($methodName), 'set' . \substr($methodName, 2)]; + foreach ($isSetterMethodNames as $isSetterMethodName) { + if ($mockedClassReflection->hasMethod($isSetterMethodName)) { + return $isSetterMethodName; + } + } + } + return $methodName; + } + private function findMethodCallOnVariableNamed(MethodCall $methodCall, string $desiredVariableName) : ?MethodCall + { + $nodeFinder = new NodeFinder(); + $foundMethodCall = $nodeFinder->findFirst($methodCall, function (Node $node) use($desiredVariableName) : bool { + if (!$node instanceof MethodCall) { + return \false; + } + if (!$node->var instanceof Variable) { + return \false; + } + return $this->isName($node->var, $desiredVariableName); + }); + if (!$foundMethodCall instanceof MethodCall) { + return null; + } + return $foundMethodCall; + } +} diff --git a/vendor/symfony/console/Application.php b/vendor/symfony/console/Application.php index 359519b184b..e806dd2a793 100644 --- a/vendor/symfony/console/Application.php +++ b/vendor/symfony/console/Application.php @@ -787,7 +787,7 @@ protected function doRenderThrowable(\Throwable $e, OutputInterface $output) : v $len = 0; } if (\strpos($message, "@anonymous\x00") !== \false) { - $message = \preg_replace_callback('/[a-zA-Z_\\x7f-\\xff][\\\\a-zA-Z0-9_\\x7f-\\xff]*+@anonymous\\x00.*?\\.php(?:0x?|:[0-9]++\\$)[0-9a-fA-F]++/', function ($m) { + $message = \preg_replace_callback('/[a-zA-Z_\\x7f-\\xff][\\\\a-zA-Z0-9_\\x7f-\\xff]*+@anonymous\\x00.*?\\.php(?:0x?|:[0-9]++\\$)?[0-9a-fA-F]++/', function ($m) { return \class_exists($m[0], \false) ? ((\get_parent_class($m[0]) ?: \key(\class_implements($m[0]))) ?: 'class') . '@anonymous' : $m[0]; }, $message); } diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php index c581978f6af..a074fa54e62 100644 --- a/vendor/symfony/process/ExecutableFinder.php +++ b/vendor/symfony/process/ExecutableFinder.php @@ -18,10 +18,11 @@ */ class ExecutableFinder { + private const CMD_BUILTINS = ['assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date', 'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto', 'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause', 'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set', 'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol']; /** * @var mixed[] */ - private $suffixes = ['.exe', '.bat', '.cmd', '.com']; + private $suffixes = []; /** * Replaces default suffixes of executable. * @@ -49,14 +50,23 @@ public function addSuffix(string $suffix) */ public function find(string $name, ?string $default = null, array $extraDirs = []) : ?string { + // windows built-in commands that are present in cmd.exe should not be resolved using PATH as they do not exist as exes + if ('\\' === \DIRECTORY_SEPARATOR && \in_array(\strtolower($name), self::CMD_BUILTINS, \true)) { + return $name; + } $dirs = \array_merge(\explode(\PATH_SEPARATOR, \getenv('PATH') ?: \getenv('Path')), $extraDirs); - $suffixes = ['']; + $suffixes = []; if ('\\' === \DIRECTORY_SEPARATOR) { $pathExt = \getenv('PATHEXT'); - $suffixes = \array_merge($pathExt ? \explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); + $suffixes = $this->suffixes; + $suffixes = \array_merge($suffixes, $pathExt ? \explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']); } + $suffixes = '' !== \pathinfo($name, \PATHINFO_EXTENSION) ? \array_merge([''], $suffixes) : \array_merge($suffixes, ['']); foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { + if ('' === $dir) { + $dir = '.'; + } if (@\is_file($file = $dir . \DIRECTORY_SEPARATOR . $name . $suffix) && ('\\' === \DIRECTORY_SEPARATOR || @\is_executable($file))) { return $file; } @@ -65,8 +75,11 @@ public function find(string $name, ?string $default = null, array $extraDirs = [ } } } - $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --'; - if (\function_exists('exec') && ($executablePath = \strtok(@\exec($command . ' ' . \escapeshellarg($name)), \PHP_EOL)) && @\is_executable($executablePath)) { + if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('exec') || \strlen($name) !== \strcspn($name, '/' . \DIRECTORY_SEPARATOR)) { + return $default; + } + $execResult = \exec('command -v -- ' . \escapeshellarg($name)); + if (($executablePath = \substr($execResult, 0, \strpos($execResult, \PHP_EOL) ?: null)) && @\is_executable($executablePath)) { return $executablePath; } return $default; diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php index 4eda5f2a151..0625c35a535 100644 --- a/vendor/symfony/process/PhpExecutableFinder.php +++ b/vendor/symfony/process/PhpExecutableFinder.php @@ -33,15 +33,8 @@ public function __construct() public function find(bool $includeArgs = \true) { if ($php = \getenv('PHP_BINARY')) { - if (!\is_executable($php)) { - $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v --'; - if (\function_exists('exec') && ($php = \strtok(\exec($command . ' ' . \escapeshellarg($php)), \PHP_EOL))) { - if (!\is_executable($php)) { - return \false; - } - } else { - return \false; - } + if (!\is_executable($php) && !($php = $this->executableFinder->find($php))) { + return \false; } if (@\is_dir($php)) { return \false; diff --git a/vendor/symfony/process/Process.php b/vendor/symfony/process/Process.php index d038d37aefa..22a4eafcf0b 100644 --- a/vendor/symfony/process/Process.php +++ b/vendor/symfony/process/Process.php @@ -1394,7 +1394,12 @@ private function prepareWindowsCommandLine(string $cmd, array &$env) : string $env[$var] = $value; return $varCache[$m[0]] = '!' . $var . '!'; }, $cmd); - $cmd = 'cmd /V:ON /E:ON /D /C (' . \str_replace("\n", ' ', $cmd) . ')'; + static $comSpec; + if (!$comSpec && ($comSpec = (new ExecutableFinder())->find('cmd.exe'))) { + // Escape according to CommandLineToArgvW rules + $comSpec = '"' . \preg_replace('{(\\\\*+)"}', '$1$1\\"', $comSpec) . '"'; + } + $cmd = ($comSpec ?? 'cmd') . ' /V:ON /E:ON /D /C (' . \str_replace("\n", ' ', $cmd) . ')'; foreach ($this->processPipes->getFiles() as $offset => $filename) { $cmd .= ' ' . $offset . '>"' . $filename . '"'; } @@ -1436,7 +1441,7 @@ private function escapeArgument(?string $argument) : string if (\strpos($argument, "\x00") !== \false) { $argument = \str_replace("\x00", '?', $argument); } - if (!\preg_match('/[\\/()%!^"<>&|\\s]/', $argument)) { + if (!\preg_match('/[()%!^"<>&|\\s]/', $argument)) { return $argument; } $argument = \preg_replace('/(\\\\+)$/', '$1$1', $argument);