mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit c8e5b8abd72a9d38b3006955be0e6c7a96a65c63
c8e5b8abd7
[Php80] Handle AnnotationToAttributeRector + ClassPropertyAssignToConstructorPromotionRector (#1712)
This commit is contained in:
parent
d697482a5c
commit
676e7a5820
@ -14,7 +14,9 @@ use PHPStan\Type\Constant\ConstantArrayType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\NeverType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\Comment\CommentsMerger;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
|
||||
@ -43,12 +45,24 @@ final class PhpDocTypeChanger
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\NodeTypeResolver\TypeComparator\TypeComparator $typeComparator, \Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory $paramPhpDocNodeFactory, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Comment\CommentsMerger
|
||||
*/
|
||||
private $commentsMerger;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(\Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\NodeTypeResolver\TypeComparator\TypeComparator $typeComparator, \Rector\TypeDeclaration\PhpDocParser\ParamPhpDocNodeFactory $paramPhpDocNodeFactory, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\BetterPhpDocParser\Comment\CommentsMerger $commentsMerger, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory)
|
||||
{
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->typeComparator = $typeComparator;
|
||||
$this->paramPhpDocNodeFactory = $paramPhpDocNodeFactory;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->commentsMerger = $commentsMerger;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
}
|
||||
public function changeVarType(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo, \PHPStan\Type\Type $newType) : void
|
||||
{
|
||||
@ -126,12 +140,13 @@ final class PhpDocTypeChanger
|
||||
}
|
||||
public function copyPropertyDocToParam(\PhpParser\Node\Stmt\Property $property, \PhpParser\Node\Param $param) : void
|
||||
{
|
||||
$phpDocInfo = $property->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO);
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($property);
|
||||
if (!$phpDocInfo instanceof \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo) {
|
||||
return;
|
||||
}
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
if (!$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
|
||||
$this->processKeepComments($property, $param);
|
||||
return;
|
||||
}
|
||||
if ($varTag->description !== '') {
|
||||
@ -160,4 +175,23 @@ final class PhpDocTypeChanger
|
||||
$varTagValueNode = new \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode($typeNode, '', '');
|
||||
$phpDocInfo->addTagValueNode($varTagValueNode);
|
||||
}
|
||||
private function processKeepComments(\PhpParser\Node\Stmt\Property $property, \PhpParser\Node\Param $param) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($param);
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
$toBeRemoved = !$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
$this->commentsMerger->keepComments($param, [$property]);
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($param);
|
||||
$varTag = $phpDocInfo->getVarTagValueNode();
|
||||
if (!$toBeRemoved) {
|
||||
return;
|
||||
}
|
||||
if (!$varTag instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode) {
|
||||
return;
|
||||
}
|
||||
if ($varTag->description !== '') {
|
||||
return;
|
||||
}
|
||||
$phpDocInfo->removeByType(\PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode::class);
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'f0928ab52c0fefd4688f42bd3ff41c885e6672ef';
|
||||
public const PACKAGE_VERSION = 'c8e5b8abd72a9d38b3006955be0e6c7a96a65c63';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-01-21 13:12:22';
|
||||
public const RELEASE_DATE = '2022-01-21 23:59:31';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220121\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808::getLoader();
|
||||
return ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f::getLoader();
|
||||
|
8
vendor/bin/easy-testing
vendored
8
vendor/bin/easy-testing
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
8
vendor/bin/neon-lint
vendored
8
vendor/bin/neon-lint
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
8
vendor/bin/php-parse
vendored
8
vendor/bin/php-parse
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
8
vendor/bin/phpstan
vendored
8
vendor/bin/phpstan
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
10
vendor/bin/phpstan.phar
vendored
10
vendor/bin/phpstan.phar
vendored
@ -66,6 +66,16 @@ if (PHP_VERSION_ID < 80000) {
|
||||
return $operation ? flock($this->handle, $operation) : true;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = ftell($this->handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
8
vendor/bin/vendor-patches
vendored
8
vendor/bin/vendor-patches
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
8
vendor/bin/yaml-lint
vendored
8
vendor/bin/yaml-lint
vendored
@ -53,6 +53,14 @@ if (\PHP_VERSION_ID < 80000) {
|
||||
{
|
||||
return $operation ? \flock($this->handle, $operation) : \true;
|
||||
}
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
if (0 === \fseek($this->handle, $offset, $whence)) {
|
||||
$this->position = \ftell($this->handle);
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->position;
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -3236,6 +3236,7 @@ return array(
|
||||
'Ssch\\TYPO3Rector\\Rector\\Extensions\\solr\\v9\\ApacheSolrDocumentToSolariumDocumentRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\ConvertImplicitVariablesToExplicitGlobalsRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\ExtEmConfRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/General/ExtEmConfRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\InjectMethodToConstructorInjectionRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/General/InjectMethodToConstructorInjectionRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\MethodGetInstanceToMakeInstanceCallRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\Migrations\\RenameClassMapAliasRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/Migrations/RenameClassMapAliasRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\PostRector\\FullQualifiedNamePostRector' => $vendorDir . '/ssch/typo3-rector/src/Rector/PostRector/FullQualifiedNamePostRector.php',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808
|
||||
class ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit070361a864be5532525e6d5fbe0c1808::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit070361a864be5532525e6d5fbe0c1808::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire070361a864be5532525e6d5fbe0c1808($fileIdentifier, $file);
|
||||
composerRequire1a5adb26699162f4a3ae2c807a71040f($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire070361a864be5532525e6d5fbe0c1808($fileIdentifier, $file)
|
||||
function composerRequire1a5adb26699162f4a3ae2c807a71040f($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit070361a864be5532525e6d5fbe0c1808
|
||||
class ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3631,6 +3631,7 @@ class ComposerStaticInit070361a864be5532525e6d5fbe0c1808
|
||||
'Ssch\\TYPO3Rector\\Rector\\Extensions\\solr\\v9\\ApacheSolrDocumentToSolariumDocumentRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/Extensions/solr/v9/ApacheSolrDocumentToSolariumDocumentRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\ConvertImplicitVariablesToExplicitGlobalsRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/General/ConvertImplicitVariablesToExplicitGlobalsRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\ExtEmConfRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/General/ExtEmConfRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\InjectMethodToConstructorInjectionRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/General/InjectMethodToConstructorInjectionRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\General\\MethodGetInstanceToMakeInstanceCallRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/General/MethodGetInstanceToMakeInstanceCallRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\Migrations\\RenameClassMapAliasRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/Migrations/RenameClassMapAliasRector.php',
|
||||
'Ssch\\TYPO3Rector\\Rector\\PostRector\\FullQualifiedNamePostRector' => __DIR__ . '/..' . '/ssch/typo3-rector/src/Rector/PostRector/FullQualifiedNamePostRector.php',
|
||||
@ -3871,9 +3872,9 @@ class ComposerStaticInit070361a864be5532525e6d5fbe0c1808
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit070361a864be5532525e6d5fbe0c1808::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit070361a864be5532525e6d5fbe0c1808::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit070361a864be5532525e6d5fbe0c1808::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit1a5adb26699162f4a3ae2c807a71040f::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
26
vendor/composer/installed.json
vendored
26
vendor/composer/installed.json
vendored
@ -69,28 +69,28 @@
|
||||
},
|
||||
{
|
||||
"name": "composer\/pcre",
|
||||
"version": "1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"version": "1.0.1",
|
||||
"version_normalized": "1.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/composer\/pcre.git",
|
||||
"reference": "3d322d715c43a1ac36c7fe215fa59336265500f2"
|
||||
"reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/composer\/pcre\/zipball\/3d322d715c43a1ac36c7fe215fa59336265500f2",
|
||||
"reference": "3d322d715c43a1ac36c7fe215fa59336265500f2",
|
||||
"url": "https:\/\/api.github.com\/repos\/composer\/pcre\/zipball\/67a32d7d6f9f560b726ab25a061b38ff3a80c560",
|
||||
"reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.3.2 || ^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan\/phpstan": "^1",
|
||||
"phpstan\/phpstan": "^1.3",
|
||||
"phpstan\/phpstan-strict-rules": "^1.1",
|
||||
"symfony\/phpunit-bridge": "^4.2 || ^5"
|
||||
},
|
||||
"time": "2021-12-06T15:17:27+00:00",
|
||||
"time": "2022-01-21T20:24:37+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -123,7 +123,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/composer\/pcre\/issues",
|
||||
"source": "https:\/\/github.com\/composer\/pcre\/tree\/1.0.0"
|
||||
"source": "https:\/\/github.com\/composer\/pcre\/tree\/1.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2729,12 +2729,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/sabbelasichon\/typo3-rector.git",
|
||||
"reference": "d4a362b75299f195f976d0676a592bfaf0a7f8f3"
|
||||
"reference": "b5431a74f80d2812d85c51026650f4b670fa8012"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/d4a362b75299f195f976d0676a592bfaf0a7f8f3",
|
||||
"reference": "d4a362b75299f195f976d0676a592bfaf0a7f8f3",
|
||||
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/b5431a74f80d2812d85c51026650f4b670fa8012",
|
||||
"reference": "b5431a74f80d2812d85c51026650f4b670fa8012",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2765,7 +2765,7 @@
|
||||
"symplify\/vendor-patches": "^10.0",
|
||||
"tracy\/tracy": "^2.8"
|
||||
},
|
||||
"time": "2022-01-13T12:42:34+00:00",
|
||||
"time": "2022-01-21T21:48:24+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -2799,7 +2799,7 @@
|
||||
"description": "Instant fixes for your TYPO3 code by using Rector.",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/issues",
|
||||
"source": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/tree\/v0.11.37"
|
||||
"source": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/tree\/main"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
2
vendor/composer/pcre/composer.json
vendored
2
vendor/composer/pcre/composer.json
vendored
@ -21,7 +21,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony\/phpunit-bridge": "^4.2 || ^5",
|
||||
"phpstan\/phpstan": "^1",
|
||||
"phpstan\/phpstan": "^1.3",
|
||||
"phpstan\/phpstan-strict-rules": "^1.1"
|
||||
},
|
||||
"autoload": {
|
||||
|
4
vendor/composer/pcre/src/MatchAllResult.php
vendored
4
vendor/composer/pcre/src/MatchAllResult.php
vendored
@ -21,7 +21,7 @@ final class MatchAllResult
|
||||
public $matches;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
* @var 0|positive-int
|
||||
*/
|
||||
public $count;
|
||||
/**
|
||||
@ -30,7 +30,7 @@ final class MatchAllResult
|
||||
*/
|
||||
public $matched;
|
||||
/**
|
||||
* @param int $count
|
||||
* @param 0|positive-int $count
|
||||
* @param array<array<string|null>> $matches
|
||||
*/
|
||||
public function __construct($count, array $matches)
|
||||
|
@ -22,7 +22,7 @@ final class MatchAllWithOffsetsResult
|
||||
public $matches;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
* @var 0|positive-int
|
||||
*/
|
||||
public $count;
|
||||
/**
|
||||
@ -31,7 +31,7 @@ final class MatchAllWithOffsetsResult
|
||||
*/
|
||||
public $matched;
|
||||
/**
|
||||
* @param int $count
|
||||
* @param 0|positive-int $count
|
||||
* @param array<int|string, list<array{string|null, int}>> $matches
|
||||
* @phpstan-param array<int|string, list<array{string|null, int<-1, max>}>> $matches
|
||||
*/
|
||||
|
2
vendor/composer/pcre/src/MatchResult.php
vendored
2
vendor/composer/pcre/src/MatchResult.php
vendored
@ -25,7 +25,7 @@ final class MatchResult
|
||||
*/
|
||||
public $matched;
|
||||
/**
|
||||
* @param int $count
|
||||
* @param 0|positive-int $count
|
||||
* @param array<string|null> $matches
|
||||
*/
|
||||
public function __construct($count, array $matches)
|
||||
|
@ -26,7 +26,7 @@ final class MatchWithOffsetsResult
|
||||
*/
|
||||
public $matched;
|
||||
/**
|
||||
* @param int $count
|
||||
* @param 0|positive-int $count
|
||||
* @param array<array{string|null, int}> $matches
|
||||
* @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
|
||||
*/
|
||||
|
29
vendor/composer/pcre/src/Preg.php
vendored
29
vendor/composer/pcre/src/Preg.php
vendored
@ -14,12 +14,12 @@ class Preg
|
||||
{
|
||||
const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<string|null> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
* @return int
|
||||
* @return 0|1
|
||||
*/
|
||||
public static function match($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
|
||||
{
|
||||
@ -33,14 +33,14 @@ class Preg
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Runs preg_match_all with PREG_OFFSET_CAPTURE
|
||||
* Runs preg_match with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, array{string|null, int}> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
* @return int
|
||||
* @return 0|1
|
||||
*
|
||||
* @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
|
||||
*/
|
||||
@ -53,12 +53,12 @@ class Preg
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, list<string|null>> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
* @return int
|
||||
* @return 0|positive-int
|
||||
*/
|
||||
public static function matchAll($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
|
||||
{
|
||||
@ -77,12 +77,12 @@ class Preg
|
||||
/**
|
||||
* Runs preg_match_all with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, list<array{string|null, int}>> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
* @return int
|
||||
* @return 0|positive-int
|
||||
*
|
||||
* @phpstan-param array<int|string, list<array{string|null, int<-1, max>}>> $matches
|
||||
*/
|
||||
@ -198,7 +198,6 @@ class Preg
|
||||
if ($result === \false) {
|
||||
throw \RectorPrefix20220121\Composer\Pcre\PcreException::fromFunction('preg_split', $pattern);
|
||||
}
|
||||
// @phpstan-ignore-next-line See https://github.com/phpstan/phpstan/issues/6155
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
@ -217,7 +216,7 @@ class Preg
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<string|null> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
@ -229,7 +228,7 @@ class Preg
|
||||
return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
|
||||
}
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, list<string|null>> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
@ -241,9 +240,9 @@ class Preg
|
||||
return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
|
||||
}
|
||||
/**
|
||||
* Runs preg_match_all with PREG_OFFSET_CAPTURE
|
||||
* Runs preg_match with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, array{string|null, int}> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
@ -259,7 +258,7 @@ class Preg
|
||||
/**
|
||||
* Runs preg_match_all with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param array<int|string, list<array{string|null, int}>> $matches Set by method
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
|
10
vendor/composer/pcre/src/Regex.php
vendored
10
vendor/composer/pcre/src/Regex.php
vendored
@ -13,7 +13,7 @@ namespace RectorPrefix20220121\Composer\Pcre;
|
||||
class Regex
|
||||
{
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param int $offset
|
||||
* @return bool
|
||||
@ -23,7 +23,7 @@ class Regex
|
||||
return (bool) \RectorPrefix20220121\Composer\Pcre\Preg::match($pattern, $subject, $matches, 0, $offset);
|
||||
}
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
@ -40,7 +40,7 @@ class Regex
|
||||
/**
|
||||
* Runs preg_match with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
@ -52,7 +52,7 @@ class Regex
|
||||
return new \RectorPrefix20220121\Composer\Pcre\MatchWithOffsetsResult($count, $matches);
|
||||
}
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
@ -72,7 +72,7 @@ class Regex
|
||||
/**
|
||||
* Runs preg_match_all with PREG_OFFSET_CAPTURE
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param non-empty-string $pattern
|
||||
* @param string $subject
|
||||
* @param int $flags PREG_UNMATCHED_AS_NULL, only available on PHP 7.2+
|
||||
* @param int $offset
|
||||
|
4
vendor/composer/pcre/src/ReplaceResult.php
vendored
4
vendor/composer/pcre/src/ReplaceResult.php
vendored
@ -19,7 +19,7 @@ final class ReplaceResult
|
||||
public $result;
|
||||
/**
|
||||
* @readonly
|
||||
* @var int
|
||||
* @var 0|positive-int
|
||||
*/
|
||||
public $count;
|
||||
/**
|
||||
@ -28,7 +28,7 @@ final class ReplaceResult
|
||||
*/
|
||||
public $matched;
|
||||
/**
|
||||
* @param int $count
|
||||
* @param 0|positive-int $count
|
||||
* @param string $result
|
||||
*/
|
||||
public function __construct($count, $result)
|
||||
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbac1ab'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5a8c2a8'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 57743a8'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4a362b'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbac1ab'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5a8c2a8'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 57743a8'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b5431a7'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20220121\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808', false) && !interface_exists('ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808', false) && !trait_exists('ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808', false)) {
|
||||
spl_autoload_call('RectorPrefix20220121\ComposerAutoloaderInit070361a864be5532525e6d5fbe0c1808');
|
||||
if (!class_exists('ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f', false) && !interface_exists('ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f', false) && !trait_exists('ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f', false)) {
|
||||
spl_autoload_call('RectorPrefix20220121\ComposerAutoloaderInit1a5adb26699162f4a3ae2c807a71040f');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20220121\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220121\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire070361a864be5532525e6d5fbe0c1808')) {
|
||||
function composerRequire070361a864be5532525e6d5fbe0c1808() {
|
||||
return \RectorPrefix20220121\composerRequire070361a864be5532525e6d5fbe0c1808(...func_get_args());
|
||||
if (!function_exists('composerRequire1a5adb26699162f4a3ae2c807a71040f')) {
|
||||
function composerRequire1a5adb26699162f4a3ae2c807a71040f() {
|
||||
return \RectorPrefix20220121\composerRequire1a5adb26699162f4a3ae2c807a71040f(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 231 Rules Overview
|
||||
# 232 Rules Overview
|
||||
|
||||
## AddArgumentToSymfonyCommandRector
|
||||
|
||||
@ -1278,6 +1278,28 @@ Inject EnvironmentService if needed in subclass of Response
|
||||
|
||||
<br>
|
||||
|
||||
## InjectMethodToConstructorInjectionRector
|
||||
|
||||
|
||||
|
||||
- class: [`Ssch\TYPO3Rector\Rector\General\InjectMethodToConstructorInjectionRector`](../src/Rector/General/InjectMethodToConstructorInjectionRector.php)
|
||||
|
||||
```diff
|
||||
namespace App\Service;
|
||||
use \TYPO3\CMS\Core\Cache\CacheManager;
|
||||
class Service
|
||||
{
|
||||
private CacheManager $cacheManager;
|
||||
- public function injectCacheManager(CacheManager $cacheManager): void
|
||||
+ public function __construct(CacheManager $cacheManager)
|
||||
{
|
||||
$this->cacheManager = $cacheManager;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## InstantiatePageRendererExplicitlyRector
|
||||
|
||||
Instantiate PageRenderer explicitly
|
||||
|
110
vendor/ssch/typo3-rector/src/Rector/General/InjectMethodToConstructorInjectionRector.php
vendored
Normal file
110
vendor/ssch/typo3-rector/src/Rector/General/InjectMethodToConstructorInjectionRector.php
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Ssch\TYPO3Rector\Rector\General;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\NodeManipulator\ClassDependencyManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PostRector\ValueObject\PropertyMetadata;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @changelog https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html
|
||||
* @see \Ssch\TYPO3Rector\Tests\Rector\General\InjectMethodToConstructorInjectionRector\InjectMethodToConstructorInjectionRectorTest
|
||||
*/
|
||||
final class InjectMethodToConstructorInjectionRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\NodeManipulator\ClassDependencyManipulator
|
||||
*/
|
||||
private $classDependencyManipulator;
|
||||
public function __construct(\Rector\Core\NodeManipulator\ClassDependencyManipulator $classDependencyManipulator)
|
||||
{
|
||||
$this->classDependencyManipulator = $classDependencyManipulator;
|
||||
}
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
namespace App\Service;
|
||||
use \TYPO3\CMS\Core\Cache\CacheManager;
|
||||
class Service
|
||||
{
|
||||
private CacheManager $cacheManager;
|
||||
public function injectCacheManager(CacheManager $cacheManager): void
|
||||
{
|
||||
$this->cacheManager = $cacheManager;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
namespace App\Service;
|
||||
use \TYPO3\CMS\Core\Cache\CacheManager;
|
||||
class Service
|
||||
{
|
||||
private CacheManager $cacheManager;
|
||||
public function __construct(CacheManager $cacheManager)
|
||||
{
|
||||
$this->cacheManager = $cacheManager;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* List of nodes this class checks, classes that implements \PhpParser\Node See beautiful map of all nodes
|
||||
* https://github.com/rectorphp/rector/blob/master/docs/NodesOverview.md
|
||||
*
|
||||
* @return class-string[]
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\Class_::class];
|
||||
}
|
||||
/**
|
||||
* Process Node of matched type
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
/** @var Class_ $node */
|
||||
if ($this->shouldSkip($node)) {
|
||||
return null;
|
||||
}
|
||||
$injectMethods = \array_filter($node->getMethods(), function ($classMethod) {
|
||||
return \strncmp((string) $classMethod->name, 'inject', \strlen('inject')) === 0;
|
||||
});
|
||||
if ([] === $injectMethods) {
|
||||
return null;
|
||||
}
|
||||
foreach ($injectMethods as $injectMethod) {
|
||||
$params = $injectMethod->getParams();
|
||||
if ([] === $params) {
|
||||
continue;
|
||||
}
|
||||
\reset($params);
|
||||
/** @var Param $param */
|
||||
$param = \current($params);
|
||||
if (!$param->type instanceof \PhpParser\Node\Name\FullyQualified) {
|
||||
continue;
|
||||
}
|
||||
$paramName = $this->getName($param->var);
|
||||
if (null === $paramName) {
|
||||
continue;
|
||||
}
|
||||
$this->classDependencyManipulator->addConstructorDependency($node, new \Rector\PostRector\ValueObject\PropertyMetadata($paramName, new \PHPStan\Type\ObjectType((string) $param->type), \PhpParser\Node\Stmt\Class_::MODIFIER_PROTECTED));
|
||||
$this->removeNodeFromStatements($node, $injectMethod);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
private function shouldSkip(\PhpParser\Node\Stmt\Class_ $class) : bool
|
||||
{
|
||||
return [] === $class->getMethods();
|
||||
}
|
||||
}
|
@ -137,9 +137,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$arguments = [new \PhpParser\Node\Expr\ArrayDimFetch(new \PhpParser\Node\Expr\Variable(\Ssch\TYPO3Rector\Helper\Typo3NodeResolver::GLOBALS), new \PhpParser\Node\Scalar\String_('TYPO3_REQUEST'))];
|
||||
// Message
|
||||
if (isset($node->args[0])) {
|
||||
$arguments[] = $node->args[0]->value;
|
||||
}
|
||||
$arguments[] = isset($node->args[0]) ? $node->args[0]->value : new \PhpParser\Node\Scalar\String_('');
|
||||
return new \PhpParser\Node\Stmt\Expression(new \PhpParser\Node\Expr\Assign(new \PhpParser\Node\Expr\Variable('response'), $this->nodeFactory->createMethodCall($this->nodeFactory->createStaticCall('TYPO3\\CMS\\Core\\Utility\\GeneralUtility', 'makeInstance', [$this->nodeFactory->createClassConstReference('TYPO3\\CMS\\Frontend\\Controller\\ErrorController')]), self::MAP_METHODS[$methodCall], $arguments)));
|
||||
}
|
||||
private function throwException() : \PhpParser\Node
|
||||
|
Loading…
x
Reference in New Issue
Block a user