mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit 15e28c6de8
15e28c6de8
[RemoveFinalFromConstRector] (#1732)
This commit is contained in:
parent
e923bcd0d6
commit
890cd8f422
|
@ -7,6 +7,7 @@ use Rector\CodingStyle\Rector\Assign\PHPStormVarAnnotationRector;
|
|||
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
|
||||
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
|
||||
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedConstantsAndPropertiesRector;
|
||||
use Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector;
|
||||
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
|
||||
|
@ -62,4 +63,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
$services->set(\Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class);
|
||||
$services->set(\Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector::class);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 519 Rules Overview
|
||||
# 520 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
- [CodeQuality](#codequality) (70)
|
||||
|
||||
- [CodingStyle](#codingstyle) (34)
|
||||
- [CodingStyle](#codingstyle) (35)
|
||||
|
||||
- [Compatibility](#compatibility) (1)
|
||||
|
||||
|
@ -2253,6 +2253,22 @@ Non-magic PHP object methods cannot start with "__"
|
|||
|
||||
<br>
|
||||
|
||||
### RemoveFinalFromConstRector
|
||||
|
||||
Remove final from constants in classes defined as final
|
||||
|
||||
- class: [`Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector`](../rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
- final public const NAME = 'value';
|
||||
+ public const NAME = 'value';
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### ReturnArrayClassMethodToYieldRector
|
||||
|
||||
Turns array return to yield return in specific type and method
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\Rector\ClassConst;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassConst;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @changelog https://php.watch/versions/8.1/final-class-const
|
||||
*
|
||||
* @see \Rector\Tests\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector\RemoveFinalFromConstRectorTest
|
||||
*/
|
||||
final class RemoveFinalFromConstRector extends \Rector\Core\Rector\AbstractRector implements \Rector\VersionBonding\Contract\MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Privatization\NodeManipulator\VisibilityManipulator
|
||||
*/
|
||||
private $visibilityManipulator;
|
||||
public function __construct(\Rector\Privatization\NodeManipulator\VisibilityManipulator $visibilityManipulator)
|
||||
{
|
||||
$this->visibilityManipulator = $visibilityManipulator;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove final from constants in classes defined as final', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
final public const NAME = 'value';
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public const NAME = 'value';
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\ClassConst::class];
|
||||
}
|
||||
/**
|
||||
* @param ClassConst $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$parentClass = $this->betterNodeFinder->findParentType($node, \PhpParser\Node\Stmt\Class_::class);
|
||||
if (!$parentClass instanceof \PhpParser\Node\Stmt\Class_) {
|
||||
return null;
|
||||
}
|
||||
if ($parentClass->isFinal() && $node->isFinal()) {
|
||||
$this->visibilityManipulator->removeFinal($node);
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
return \Rector\Core\ValueObject\PhpVersionFeature::FINAL_CLASS_CONSTANTS;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '75c0b27d37ee34844b0eb5faf35742c6631d5ab2';
|
||||
public const PACKAGE_VERSION = '15e28c6de8bbe5424b4aa54b3673349a5022f078';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-01-26 12:52:30';
|
||||
public const RELEASE_DATE = '2022-01-26 19:33:01';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220126\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 ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61::getLoader();
|
||||
return ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -1556,6 +1556,7 @@ return array(
|
|||
'Rector\\CodingStyle\\Rector\\Assign\\PHPStormVarAnnotationRector' => $baseDir . '/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\SplitDoubleAssignRector' => $baseDir . '/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => $baseDir . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedConstantsAndPropertiesRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedConstantsAndPropertiesRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\VarConstantCommentRector' => $baseDir . '/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => $baseDir . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.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 ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61
|
||||
class ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5', '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\ComposerStaticInite8a4bdc4c957415df2616c711192dd61::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,12 +42,12 @@ class ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInite8a4bdc4c957415df2616c711192dd61::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiree8a4bdc4c957415df2616c711192dd61($fileIdentifier, $file);
|
||||
composerRequirece40cb863e3b6d96a93d84157e5a75e5($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -59,7 +59,7 @@ class ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequiree8a4bdc4c957415df2616c711192dd61($fileIdentifier, $file)
|
||||
function composerRequirece40cb863e3b6d96a93d84157e5a75e5($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 ComposerStaticInite8a4bdc4c957415df2616c711192dd61
|
||||
class ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -1946,6 +1946,7 @@ class ComposerStaticInite8a4bdc4c957415df2616c711192dd61
|
|||
'Rector\\CodingStyle\\Rector\\Assign\\PHPStormVarAnnotationRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Assign\\SplitDoubleAssignRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Assign/SplitDoubleAssignRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\Catch_\\CatchExceptionNameMatchingTypeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\RemoveFinalFromConstRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/RemoveFinalFromConstRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\SplitGroupedConstantsAndPropertiesRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/SplitGroupedConstantsAndPropertiesRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassConst\\VarConstantCommentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php',
|
||||
'Rector\\CodingStyle\\Rector\\ClassMethod\\FuncGetArgsToVariadicParamRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php',
|
||||
|
@ -3866,9 +3867,9 @@ class ComposerStaticInite8a4bdc4c957415df2616c711192dd61
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInite8a4bdc4c957415df2616c711192dd61::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInite8a4bdc4c957415df2616c711192dd61::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInite8a4bdc4c957415df2616c711192dd61::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitce40cb863e3b6d96a93d84157e5a75e5::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/composer/installed.json
vendored
10
vendor/composer/installed.json
vendored
|
@ -2729,12 +2729,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/sabbelasichon\/typo3-rector.git",
|
||||
"reference": "9394ec97f3239aeae7ebd42e73acef92d32f8e6a"
|
||||
"reference": "f7c66ecb414a7fdd56c8c854f4f07d23d148a20f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/9394ec97f3239aeae7ebd42e73acef92d32f8e6a",
|
||||
"reference": "9394ec97f3239aeae7ebd42e73acef92d32f8e6a",
|
||||
"url": "https:\/\/api.github.com\/repos\/sabbelasichon\/typo3-rector\/zipball\/f7c66ecb414a7fdd56c8c854f4f07d23d148a20f",
|
||||
"reference": "f7c66ecb414a7fdd56c8c854f4f07d23d148a20f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2764,7 +2764,7 @@
|
|||
"symplify\/vendor-patches": "^10.0",
|
||||
"tracy\/tracy": "^2.8"
|
||||
},
|
||||
"time": "2022-01-25T22:43:50+00:00",
|
||||
"time": "2022-01-26T15:19:26+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2798,7 +2798,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.38"
|
||||
"source": "https:\/\/github.com\/sabbelasichon\/typo3-rector\/tree\/v0.11.39"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -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 9394ec9'));
|
||||
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 f7c66ec'));
|
||||
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('RectorPrefix20220126\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61', false) && !interface_exists('ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61', false) && !trait_exists('ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61', false)) {
|
||||
spl_autoload_call('RectorPrefix20220126\ComposerAutoloaderInite8a4bdc4c957415df2616c711192dd61');
|
||||
if (!class_exists('ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5', false) && !interface_exists('ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5', false) && !trait_exists('ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5', false)) {
|
||||
spl_autoload_call('RectorPrefix20220126\ComposerAutoloaderInitce40cb863e3b6d96a93d84157e5a75e5');
|
||||
}
|
||||
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('RectorPrefix20220126\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20220126\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequiree8a4bdc4c957415df2616c711192dd61')) {
|
||||
function composerRequiree8a4bdc4c957415df2616c711192dd61() {
|
||||
return \RectorPrefix20220126\composerRequiree8a4bdc4c957415df2616c711192dd61(...func_get_args());
|
||||
if (!function_exists('composerRequirece40cb863e3b6d96a93d84157e5a75e5')) {
|
||||
function composerRequirece40cb863e3b6d96a93d84157e5a75e5() {
|
||||
return \RectorPrefix20220126\composerRequirece40cb863e3b6d96a93d84157e5a75e5(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use RectorPrefix20220126\Helmich\TypoScriptParser\Parser\Printer\PrettyPrinterCo
|
|||
use Helmich\TypoScriptParser\Parser\Traverser\Traverser;
|
||||
use RectorPrefix20220126\Helmich\TypoScriptParser\Parser\Traverser\Visitor;
|
||||
use RectorPrefix20220126\Helmich\TypoScriptParser\Tokenizer\TokenizerException;
|
||||
use Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory;
|
||||
use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector;
|
||||
use Rector\Core\Console\Output\RectorOutputStyle;
|
||||
use Rector\Core\Provider\CurrentFileProvider;
|
||||
|
@ -42,6 +43,10 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
* @var string[]
|
||||
*/
|
||||
private $allowedFileExtensions = ['typoscript', 'ts', 'txt'];
|
||||
/**
|
||||
* @var FileDiff[]
|
||||
*/
|
||||
private $fileDiffs = [];
|
||||
/**
|
||||
* @var \Helmich\TypoScriptParser\Parser\ParserInterface
|
||||
*/
|
||||
|
@ -70,6 +75,10 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
* @var \Rector\Core\Console\Output\RectorOutputStyle
|
||||
*/
|
||||
private $rectorOutputStyle;
|
||||
/**
|
||||
* @var \Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory
|
||||
*/
|
||||
private $fileDiffFactory;
|
||||
/**
|
||||
* @var TypoScriptRectorInterface[]
|
||||
*/
|
||||
|
@ -82,7 +91,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
* @param TypoScriptRectorInterface[] $typoScriptRectors
|
||||
* @param TypoScriptPostRectorInterface[] $typoScriptPostRectors
|
||||
*/
|
||||
public function __construct(\RectorPrefix20220126\Helmich\TypoScriptParser\Parser\ParserInterface $typoscriptParser, \RectorPrefix20220126\Symfony\Component\Console\Output\BufferedOutput $output, \RectorPrefix20220126\Helmich\TypoScriptParser\Parser\Printer\ASTPrinterInterface $typoscriptPrinter, \Rector\Core\Provider\CurrentFileProvider $currentFileProvider, \Rector\FileFormatter\EditorConfig\EditorConfigParser $editorConfigParser, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector $removedAndAddedFilesCollector, \Rector\Core\Console\Output\RectorOutputStyle $rectorOutputStyle, array $typoScriptRectors = [], array $typoScriptPostRectors = [])
|
||||
public function __construct(\RectorPrefix20220126\Helmich\TypoScriptParser\Parser\ParserInterface $typoscriptParser, \RectorPrefix20220126\Symfony\Component\Console\Output\BufferedOutput $output, \RectorPrefix20220126\Helmich\TypoScriptParser\Parser\Printer\ASTPrinterInterface $typoscriptPrinter, \Rector\Core\Provider\CurrentFileProvider $currentFileProvider, \Rector\FileFormatter\EditorConfig\EditorConfigParser $editorConfigParser, \Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector $removedAndAddedFilesCollector, \Rector\Core\Console\Output\RectorOutputStyle $rectorOutputStyle, \Rector\ChangesReporting\ValueObjectFactory\FileDiffFactory $fileDiffFactory, array $typoScriptRectors = [], array $typoScriptPostRectors = [])
|
||||
{
|
||||
$this->typoscriptParser = $typoscriptParser;
|
||||
$this->output = $output;
|
||||
|
@ -91,6 +100,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
$this->editorConfigParser = $editorConfigParser;
|
||||
$this->removedAndAddedFilesCollector = $removedAndAddedFilesCollector;
|
||||
$this->rectorOutputStyle = $rectorOutputStyle;
|
||||
$this->fileDiffFactory = $fileDiffFactory;
|
||||
$this->typoScriptRectors = $typoScriptRectors;
|
||||
$this->typoScriptPostRectors = $typoScriptPostRectors;
|
||||
}
|
||||
|
@ -109,8 +119,7 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
{
|
||||
$this->processFile($file);
|
||||
$this->convertTypoScriptToPhpFiles();
|
||||
// to keep parent contract with return values
|
||||
return [\Rector\Parallel\ValueObject\Bridge::SYSTEM_ERRORS => [], \Rector\Parallel\ValueObject\Bridge::FILE_DIFFS => []];
|
||||
return [\Rector\Parallel\ValueObject\Bridge::SYSTEM_ERRORS => [], \Rector\Parallel\ValueObject\Bridge::FILE_DIFFS => $this->fileDiffs];
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
|
@ -161,7 +170,9 @@ final class TypoScriptFileProcessor implements \Ssch\TYPO3Rector\Contract\Proces
|
|||
$this->typoscriptPrinter->printStatements($originalStatements, $this->output);
|
||||
$newTypoScriptContent = $this->applyTypoScriptPostRectors($this->output->fetch());
|
||||
$typoScriptContent = \rtrim($newTypoScriptContent) . $editorConfiguration->getNewLine();
|
||||
$oldFileContents = $file->getFileContent();
|
||||
$file->changeFileContent($typoScriptContent);
|
||||
$this->fileDiffs[] = $this->fileDiffFactory->createFileDiff($file, $oldFileContents, $file->getFileContent());
|
||||
} catch (\RectorPrefix20220126\Helmich\TypoScriptParser\Tokenizer\TokenizerException $exception) {
|
||||
return;
|
||||
} catch (\RectorPrefix20220126\Helmich\TypoScriptParser\Parser\ParseError $exception) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
declare (strict_types=1);
|
||||
namespace Ssch\TYPO3Rector\Rector\v9\v5\ExtbaseCommandControllerToSymfonyCommand;
|
||||
|
||||
use PhpParser\Comment;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
|
@ -10,6 +11,7 @@ use PhpParser\Node\Scalar\String_;
|
|||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -68,7 +70,9 @@ CODE_SAMPLE
|
|||
}, \true);
|
||||
});
|
||||
foreach ($commands as $commandName => $command) {
|
||||
$node->expr->items[] = new \PhpParser\Node\Expr\ArrayItem($this->nodeFactory->createArray(['class' => $this->nodeFactory->createClassConstReference($command)]), new \PhpParser\Node\Scalar\String_($commandName));
|
||||
$commandArray = new \PhpParser\Node\Expr\Array_();
|
||||
$commandArray->items[] = new \PhpParser\Node\Expr\ArrayItem($this->nodeFactory->createClassConstReference($command), new \PhpParser\Node\Scalar\String_('class'), \false, [\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS => [new \PhpParser\Comment(\PHP_EOL)]]);
|
||||
$node->expr->items[] = new \PhpParser\Node\Expr\ArrayItem($commandArray, new \PhpParser\Node\Scalar\String_($commandName), \false, [\Rector\NodeTypeResolver\Node\AttributeKey::COMMENTS => [new \PhpParser\Comment(\PHP_EOL)]]);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\NodeVisitor\NameResolver;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
|
@ -31,6 +32,10 @@ use RectorPrefix20220126\Symplify\SmartFileSystem\SmartFileSystem;
|
|||
*/
|
||||
final class ExtbaseCommandControllerToSymfonyCommandRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const REMOVE_EMPTY_LINES = '/^[ \\t]*[\\r\\n]+/m';
|
||||
/**
|
||||
* @var \Symplify\SmartFileSystem\SmartFileSystem
|
||||
*/
|
||||
|
@ -232,8 +237,7 @@ CODE_SAMPLE
|
|||
$commandsSmartFileInfo = new \Symplify\SmartFileSystem\SmartFileInfo($commandsFilePath);
|
||||
$nodes = $this->rectorParser->parseFile($commandsSmartFileInfo);
|
||||
} else {
|
||||
$defaultsCommandsTemplate = $this->templateFinder->getCommandsConfiguration();
|
||||
$nodes = $this->rectorParser->parseFile($defaultsCommandsTemplate);
|
||||
$nodes = [new \PhpParser\Node\Stmt\Return_($this->nodeFactory->createArray([]))];
|
||||
}
|
||||
$this->decorateNamesToFullyQualified($nodes);
|
||||
$nodeTraverser = new \PhpParser\NodeTraverser();
|
||||
|
@ -241,6 +245,7 @@ CODE_SAMPLE
|
|||
$nodeTraverser->addVisitor($this->addCommandsToReturnRector);
|
||||
$nodes = $nodeTraverser->traverse($nodes);
|
||||
$changedCommandsContent = $this->betterStandardPrinter->prettyPrintFile($nodes);
|
||||
$changedCommandsContent = \RectorPrefix20220126\Nette\Utils\Strings::replace($changedCommandsContent, self::REMOVE_EMPTY_LINES, '');
|
||||
$this->removedAndAddedFilesCollector->addAddedFile(new \Rector\FileSystemRector\ValueObject\AddedFileWithContent($commandsFilePath, $changedCommandsContent));
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -18,10 +18,6 @@ final class TemplateFinder
|
|||
{
|
||||
return $this->createSmartFileInfo('Commands/Command.tpl');
|
||||
}
|
||||
public function getCommandsConfiguration() : \Symplify\SmartFileSystem\SmartFileInfo
|
||||
{
|
||||
return $this->createSmartFileInfo('Commands/Commands.tpl');
|
||||
}
|
||||
private function createSmartFileInfo(string $template) : \Symplify\SmartFileSystem\SmartFileInfo
|
||||
{
|
||||
return new \Symplify\SmartFileSystem\SmartFileInfo($this->templateDirectory . $template);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user