mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-06 03:10:50 +00:00
Updated Rector to commit 07df7dc1a344c52711441149d61251a4fe10366d
07df7dc1a3
Remove collector interface and fix SpatieEnumClassToEnumRector already has underscore to double underscore (#5473)
This commit is contained in:
parent
bae6d284a0
commit
0449aa5a88
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1867,12 +1867,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "0da1af3e69588a0993f62b49ccce4595d0cdb120"
|
||||
"reference": "840b4a7e0c1b235575946b3830ed5de6d6155dca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/0da1af3e69588a0993f62b49ccce4595d0cdb120",
|
||||
"reference": "0da1af3e69588a0993f62b49ccce4595d0cdb120",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/840b4a7e0c1b235575946b3830ed5de6d6155dca",
|
||||
"reference": "840b4a7e0c1b235575946b3830ed5de6d6155dca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1901,7 +1901,7 @@
|
|||
"tomasvotruba\/class-leak": "^0.2.6",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2024-01-16T14:22:30+00:00",
|
||||
"time": "2024-01-16T14:58:26+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-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b419ce7'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 51ff6e7'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 4581a9a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 0da1af3'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b419ce7'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 51ff6e7'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 4581a9a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 840b4a7'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1642,11 +1642,6 @@ Add config builder classes
|
|||
|
||||
-return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
- $containerConfigurator->extension('security', [
|
||||
- 'providers' => [
|
||||
- 'webservice' => [
|
||||
- 'id' => LoginServiceUserProvider::class,
|
||||
- ],
|
||||
- ],
|
||||
- 'firewalls' => [
|
||||
- 'dev' => [
|
||||
- 'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
|
||||
|
@ -1655,9 +1650,6 @@ Add config builder classes
|
|||
- ],
|
||||
- ]);
|
||||
+return static function (SecurityConfig $securityConfig): void {
|
||||
+ $securityConfig->provider('webservice')
|
||||
+ ->id(LoginServiceUserProvider::class);
|
||||
+
|
||||
+ $securityConfig->firewall('dev')
|
||||
+ ->pattern('^/(_(profiler|wdt)|css|images|js)/')
|
||||
+ ->security(false);
|
||||
|
|
|
@ -87,11 +87,6 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('security', [
|
||||
'providers' => [
|
||||
'webservice' => [
|
||||
'id' => LoginServiceUserProvider::class,
|
||||
],
|
||||
],
|
||||
'firewalls' => [
|
||||
'dev' => [
|
||||
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
|
||||
|
@ -105,9 +100,6 @@ CODE_SAMPLE
|
|||
use Symfony\Config\SecurityConfig;
|
||||
|
||||
return static function (SecurityConfig $securityConfig): void {
|
||||
$securityConfig->provider('webservice')
|
||||
->id(LoginServiceUserProvider::class);
|
||||
|
||||
$securityConfig->firewall('dev')
|
||||
->pattern('^/(_(profiler|wdt)|css|images|js)/')
|
||||
->security(false);
|
||||
|
|
|
@ -7,6 +7,7 @@ use PhpParser\Node\Expr\Array_;
|
|||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Symfony\ValueObject\ExtensionKeyAndConfiguration;
|
||||
|
@ -29,6 +30,15 @@ final class SymfonyClosureExtensionMatcher
|
|||
}
|
||||
public function match(Closure $closure) : ?ExtensionKeyAndConfiguration
|
||||
{
|
||||
if (\count($closure->stmts) > 1) {
|
||||
$extensionNames = $this->resolveExtensionNames($closure);
|
||||
if (\count($extensionNames) > 2) {
|
||||
return null;
|
||||
}
|
||||
// warn use early about it, to avoid silent skip
|
||||
$errorMessage = \sprintf('Split extensions "%s" to multiple separated files first', \implode('", "', $extensionNames));
|
||||
throw new ShouldNotHappenException($errorMessage);
|
||||
}
|
||||
// must be exactly single line
|
||||
if (\count($closure->stmts) !== 1) {
|
||||
return null;
|
||||
|
@ -41,16 +51,46 @@ final class SymfonyClosureExtensionMatcher
|
|||
return null;
|
||||
}
|
||||
$methodCall = $onlyStmt->expr;
|
||||
if (!$this->nodeNameResolver->isName($methodCall->name, 'extension')) {
|
||||
$args = $methodCall->getArgs();
|
||||
$extensionKey = $this->matchExtensionName($methodCall);
|
||||
if (!\is_string($extensionKey)) {
|
||||
return null;
|
||||
}
|
||||
$args = $methodCall->getArgs();
|
||||
$firstArg = $args[0];
|
||||
$extensionKey = $this->valueResolver->getValue($firstArg->value);
|
||||
$secondArg = $args[1];
|
||||
if (!$secondArg->value instanceof Array_) {
|
||||
return null;
|
||||
}
|
||||
return new ExtensionKeyAndConfiguration($extensionKey, $secondArg->value);
|
||||
}
|
||||
private function matchExtensionName(MethodCall $methodCall) : ?string
|
||||
{
|
||||
if (!$this->nodeNameResolver->isName($methodCall->name, 'extension')) {
|
||||
return null;
|
||||
}
|
||||
$args = $methodCall->getArgs();
|
||||
$firstArg = $args[0];
|
||||
return $this->valueResolver->getValue($firstArg->value);
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function resolveExtensionNames(Closure $closure) : array
|
||||
{
|
||||
$extensionNames = [];
|
||||
foreach ($closure->stmts as $stmt) {
|
||||
if (!$stmt instanceof Expression) {
|
||||
continue;
|
||||
}
|
||||
$expr = $stmt->expr;
|
||||
if (!$expr instanceof MethodCall) {
|
||||
continue;
|
||||
}
|
||||
$extensionName = $this->matchExtensionName($expr);
|
||||
if (!\is_string($extensionName)) {
|
||||
continue;
|
||||
}
|
||||
$extensionNames[] = $extensionName;
|
||||
}
|
||||
return $extensionNames;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user