mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 09:50:49 +00:00
Updated Rector to commit a7bdabc86a
a7bdabc86a
Fix some minor misprints (#1922)
This commit is contained in:
parent
c81f2fa79d
commit
0d17a3944d
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4::getLoader();
|
||||
return ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -2912,6 +2912,7 @@ return array(
|
|||
'Rector\\Symfony\\Rector\\ClassMethod\\RemoveServiceFromSensioRouteRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\RenderMethodParamToTypeDeclarationRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/RenderMethodParamToTypeDeclarationRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\ReplaceSensioRouteAnnotationWithSymfonyRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\ResponseReturnTypeControllerActionRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\RouteCollectionBuilderToRoutingConfiguratorRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/RouteCollectionBuilderToRoutingConfiguratorRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\TemplateAnnotationToThisRenderRector' => $vendorDir . '/rector/rector-symfony/src/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php',
|
||||
'Rector\\Symfony\\Rector\\Class_\\ChangeFileLoaderInExtensionAndKernelRector' => $vendorDir . '/rector/rector-symfony/src/Rector/Class_/ChangeFileLoaderInExtensionAndKernelRector.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 ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4
|
||||
class ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd', '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\ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0915f6ddea31df936f70e044ec422ebd::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,12 +42,12 @@ class ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit0915f6ddea31df936f70e044ec422ebd::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire2dcc053845e9815bd9cfd870a65fefb4($fileIdentifier, $file);
|
||||
composerRequire0915f6ddea31df936f70e044ec422ebd($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -59,7 +59,7 @@ class ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire2dcc053845e9815bd9cfd870a65fefb4($fileIdentifier, $file)
|
||||
function composerRequire0915f6ddea31df936f70e044ec422ebd($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 ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4
|
||||
class ComposerStaticInit0915f6ddea31df936f70e044ec422ebd
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
|
@ -3286,6 +3286,7 @@ class ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4
|
|||
'Rector\\Symfony\\Rector\\ClassMethod\\RemoveServiceFromSensioRouteRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/RemoveServiceFromSensioRouteRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\RenderMethodParamToTypeDeclarationRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/RenderMethodParamToTypeDeclarationRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\ReplaceSensioRouteAnnotationWithSymfonyRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/ReplaceSensioRouteAnnotationWithSymfonyRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\ResponseReturnTypeControllerActionRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\RouteCollectionBuilderToRoutingConfiguratorRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/RouteCollectionBuilderToRoutingConfiguratorRector.php',
|
||||
'Rector\\Symfony\\Rector\\ClassMethod\\TemplateAnnotationToThisRenderRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/ClassMethod/TemplateAnnotationToThisRenderRector.php',
|
||||
'Rector\\Symfony\\Rector\\Class_\\ChangeFileLoaderInExtensionAndKernelRector' => __DIR__ . '/..' . '/rector/rector-symfony/src/Rector/Class_/ChangeFileLoaderInExtensionAndKernelRector.php',
|
||||
|
@ -3838,9 +3839,9 @@ class ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2dcc053845e9815bd9cfd870a65fefb4::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0915f6ddea31df936f70e044ec422ebd::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0915f6ddea31df936f70e044ec422ebd::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0915f6ddea31df936f70e044ec422ebd::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -2695,12 +2695,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "9c5de0f9350d3b96d9f9abd46db56686eedc992e"
|
||||
"reference": "5ba000274809542dac65856e4fe9e4f91487b580"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/9c5de0f9350d3b96d9f9abd46db56686eedc992e",
|
||||
"reference": "9c5de0f9350d3b96d9f9abd46db56686eedc992e",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/5ba000274809542dac65856e4fe9e4f91487b580",
|
||||
"reference": "5ba000274809542dac65856e4fe9e4f91487b580",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2728,7 +2728,7 @@
|
|||
"symplify\/rule-doc-generator": "^10.0",
|
||||
"symplify\/vendor-patches": "^10.0"
|
||||
},
|
||||
"time": "2022-03-08T10:33:37+00:00",
|
||||
"time": "2022-03-11T15:22:36+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
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 96ff8cb'), '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 0aaf0a6'), '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 5952218'), '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 9c5de0f'), '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 b88a7c1'));
|
||||
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 96ff8cb'), '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 0aaf0a6'), '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 5952218'), '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 5ba0002'), '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 b88a7c1'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ namespace RectorPrefix20220311;
|
|||
use Rector\Symfony\Rector\BinaryOp\ResponseStatusCodeRector;
|
||||
use Rector\Symfony\Rector\Class_\EventListenerToEventSubscriberRector;
|
||||
use Rector\Symfony\Rector\Class_\MakeCommandLazyRector;
|
||||
use Rector\Symfony\Rector\ClassMethod\ResponseReturnTypeControllerActionRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
return static function (\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator) : void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(\Rector\Symfony\Rector\BinaryOp\ResponseStatusCodeRector::class);
|
||||
$services->set(\Rector\Symfony\Rector\Class_\MakeCommandLazyRector::class);
|
||||
$services->set(\Rector\Symfony\Rector\Class_\EventListenerToEventSubscriberRector::class);
|
||||
$services->set(\Rector\Symfony\Rector\ClassMethod\ResponseReturnTypeControllerActionRector::class);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 55 Rules Overview
|
||||
# 56 Rules Overview
|
||||
|
||||
## ActionSuffixRemoverRector
|
||||
|
||||
|
@ -18,25 +18,6 @@ Removes Action suffixes from methods in Symfony Controllers
|
|||
|
||||
<br>
|
||||
|
||||
## AddFlashRector
|
||||
|
||||
Turns long flash adding to short helper method in Controller in Symfony
|
||||
|
||||
- class: [`Rector\Symfony\Rector\MethodCall\AddFlashRector`](../src/Rector/MethodCall/AddFlashRector.php)
|
||||
|
||||
```diff
|
||||
class SomeController extends Controller
|
||||
{
|
||||
public function some(Request $request)
|
||||
{
|
||||
- $request->getSession()->getFlashBag()->add("success", "something");
|
||||
+ $this->addFlash("success", "something");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## AddMessageToEqualsResponseCodeRector
|
||||
|
||||
Add response content to response code assert, so it is easier to debug
|
||||
|
@ -62,6 +43,20 @@ Add response content to response code assert, so it is easier to debug
|
|||
|
||||
<br>
|
||||
|
||||
## AuthorizationCheckerIsGrantedExtractorRector
|
||||
|
||||
Extract `$this->authorizationChecker->isGranted([$a,` $b]) to `$this->authorizationChecker->isGranted($a)` || `$this->authorizationChecker->isGranted($b)`
|
||||
|
||||
- class: [`Rector\Symfony\Rector\MethodCall\AuthorizationCheckerIsGrantedExtractorRector`](../src/Rector/MethodCall/AuthorizationCheckerIsGrantedExtractorRector.php)
|
||||
|
||||
```diff
|
||||
-if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
|
||||
+if ($this->authorizationChecker->isGranted('ROLE_USER') || $this->authorizationChecker->isGranted('ROLE_USER')) {
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## BinaryFileResponseCreateToNewInstanceRector
|
||||
|
||||
Change deprecated `BinaryFileResponse::create()` to use `__construct()` instead
|
||||
|
@ -1026,6 +1021,30 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
<br>
|
||||
|
||||
## ResponseReturnTypeControllerActionRector
|
||||
|
||||
Add Response object return type to controller actions
|
||||
|
||||
- class: [`Rector\Symfony\Rector\ClassMethod\ResponseReturnTypeControllerActionRector`](../src/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php)
|
||||
|
||||
```diff
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
+use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class SomeController extends AbstractController
|
||||
{
|
||||
#[Route]
|
||||
- public function detail()
|
||||
+ public function detail(): Response
|
||||
{
|
||||
return $this->render('some_template');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## ResponseStatusCodeRector
|
||||
|
||||
Turns status code numbers to constants
|
||||
|
|
92
vendor/rector/rector-symfony/src/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php
vendored
Normal file
92
vendor/rector/rector-symfony/src/Rector/ClassMethod/ResponseReturnTypeControllerActionRector.php
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Symfony\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Doctrine\NodeAnalyzer\AttrinationFinder;
|
||||
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Symfony\Tests\Rector\ClassMethod\ResponseReturnTypeControllerActionRector\ResponseReturnTypeControllerActionRectorTest
|
||||
*/
|
||||
final class ResponseReturnTypeControllerActionRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Symfony\TypeAnalyzer\ControllerAnalyzer
|
||||
*/
|
||||
private $controllerAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\NodeAnalyzer\AttrinationFinder
|
||||
*/
|
||||
private $attrinationFinder;
|
||||
public function __construct(\Rector\Symfony\TypeAnalyzer\ControllerAnalyzer $controllerAnalyzer, \Rector\Doctrine\NodeAnalyzer\AttrinationFinder $attrinationFinder)
|
||||
{
|
||||
$this->controllerAnalyzer = $controllerAnalyzer;
|
||||
$this->attrinationFinder = $attrinationFinder;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Add Response object return type to controller actions', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class SomeController extends AbstractController
|
||||
{
|
||||
#[Route]
|
||||
public function detail()
|
||||
{
|
||||
return $this->render('some_template');
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
final class SomeController extends AbstractController
|
||||
{
|
||||
#[Route]
|
||||
public function detail(): Response
|
||||
{
|
||||
return $this->render('some_template');
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\ClassMethod::class];
|
||||
}
|
||||
/**
|
||||
* @param ClassMethod $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
if (!$node->isPublic()) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->controllerAnalyzer->isInsideController($node)) {
|
||||
return null;
|
||||
}
|
||||
if ($node->returnType !== null) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->attrinationFinder->hasByOne($node, 'Symfony\\Component\\Routing\\Annotation\\Route')) {
|
||||
return null;
|
||||
}
|
||||
$node->returnType = new \PhpParser\Node\Name\FullyQualified('Symfony\\Component\\HttpFoundation\\Response');
|
||||
return $node;
|
||||
}
|
||||
}
|
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('RectorPrefix20220311\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4', false) && !interface_exists('ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4', false) && !trait_exists('ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4', false)) {
|
||||
spl_autoload_call('RectorPrefix20220311\ComposerAutoloaderInit2dcc053845e9815bd9cfd870a65fefb4');
|
||||
if (!class_exists('ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd', false) && !interface_exists('ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd', false) && !trait_exists('ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd', false)) {
|
||||
spl_autoload_call('RectorPrefix20220311\ComposerAutoloaderInit0915f6ddea31df936f70e044ec422ebd');
|
||||
}
|
||||
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('RectorPrefix20220311\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20220311\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire2dcc053845e9815bd9cfd870a65fefb4')) {
|
||||
function composerRequire2dcc053845e9815bd9cfd870a65fefb4() {
|
||||
return \RectorPrefix20220311\composerRequire2dcc053845e9815bd9cfd870a65fefb4(...func_get_args());
|
||||
if (!function_exists('composerRequire0915f6ddea31df936f70e044ec422ebd')) {
|
||||
function composerRequire0915f6ddea31df936f70e044ec422ebd() {
|
||||
return \RectorPrefix20220311\composerRequire0915f6ddea31df936f70e044ec422ebd(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user