mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-22 08:25:02 +02: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
0449aa5a88
commit
bb88af4819
24
vendor/composer/installed.json
vendored
24
vendor/composer/installed.json
vendored
@ -504,8 +504,8 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate\/container",
|
||||
"version": "v10.40.0",
|
||||
"version_normalized": "10.40.0.0",
|
||||
"version": "v10.41.0",
|
||||
"version_normalized": "10.41.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/container.git",
|
||||
@ -561,17 +561,17 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate\/contracts",
|
||||
"version": "v10.40.0",
|
||||
"version_normalized": "10.40.0.0",
|
||||
"version": "v10.41.0",
|
||||
"version_normalized": "10.41.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/contracts.git",
|
||||
"reference": "0b26d49d4bb0986da1ca30bcc701d5c22722576b"
|
||||
"reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/illuminate\/contracts\/zipball\/0b26d49d4bb0986da1ca30bcc701d5c22722576b",
|
||||
"reference": "0b26d49d4bb0986da1ca30bcc701d5c22722576b",
|
||||
"url": "https:\/\/api.github.com\/repos\/illuminate\/contracts\/zipball\/8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac",
|
||||
"reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -579,7 +579,7 @@
|
||||
"psr\/container": "^1.1.1|^2.0.1",
|
||||
"psr\/simple-cache": "^1.0|^2.0|^3.0"
|
||||
},
|
||||
"time": "2023-12-28T16:46:25+00:00",
|
||||
"time": "2024-01-15T18:52:32+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -1867,12 +1867,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "840b4a7e0c1b235575946b3830ed5de6d6155dca"
|
||||
"reference": "147897bc7e0075d5c141ed5cc4d9f1f752cf5b37"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/840b4a7e0c1b235575946b3830ed5de6d6155dca",
|
||||
"reference": "840b4a7e0c1b235575946b3830ed5de6d6155dca",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/147897bc7e0075d5c141ed5cc4d9f1f752cf5b37",
|
||||
"reference": "147897bc7e0075d5c141ed5cc4d9f1f752cf5b37",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1901,7 +1901,7 @@
|
||||
"tomasvotruba\/class-leak": "^0.2.6",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2024-01-16T14:58:26+00:00",
|
||||
"time": "2024-01-16T17:28:31+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
@ -53,19 +53,19 @@ interface Gate
|
||||
/**
|
||||
* Determine if all of the given abilities should be granted for the current user.
|
||||
*
|
||||
* @param iterable|string $abilities
|
||||
* @param iterable|string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function allows($abilities, $arguments = []);
|
||||
public function allows($ability, $arguments = []);
|
||||
/**
|
||||
* Determine if any of the given abilities should be denied for the current user.
|
||||
*
|
||||
* @param iterable|string $abilities
|
||||
* @param iterable|string $ability
|
||||
* @param array|mixed $arguments
|
||||
* @return bool
|
||||
*/
|
||||
public function denies($abilities, $arguments = []);
|
||||
public function denies($ability, $arguments = []);
|
||||
/**
|
||||
* Determine if all of the given abilities should be granted for the current user.
|
||||
*
|
||||
|
@ -17,7 +17,7 @@ interface Translator
|
||||
* Get a translation according to an integer value.
|
||||
*
|
||||
* @param string $key
|
||||
* @param \Countable|int|array $number
|
||||
* @param \Countable|int|float|array $number
|
||||
* @param array $replace
|
||||
* @param string|null $locale
|
||||
* @return string
|
||||
|
@ -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 840b4a7'));
|
||||
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 147897b'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -143,7 +143,13 @@ CODE_SAMPLE
|
||||
$configurationValues = $this->valueResolver->getValue($configurationArray);
|
||||
foreach ($configurationValues as $key => $value) {
|
||||
$splitMany = \false;
|
||||
if ($key === 'providers') {
|
||||
$nested = \false;
|
||||
// doctrine
|
||||
if (\in_array($key, ['dbal', 'orm'], \true)) {
|
||||
$methodCallName = $key;
|
||||
$splitMany = \true;
|
||||
$nested = \true;
|
||||
} elseif ($key === 'providers') {
|
||||
$methodCallName = 'provider';
|
||||
$splitMany = \true;
|
||||
} elseif ($key === 'firewalls') {
|
||||
@ -164,7 +170,21 @@ CODE_SAMPLE
|
||||
}
|
||||
}
|
||||
if ($splitMany) {
|
||||
if ($nested) {
|
||||
$configVariable = new MethodCall($configVariable, $methodCallName);
|
||||
}
|
||||
foreach ($value as $itemName => $itemConfiguration) {
|
||||
if ($nested && \is_array($itemConfiguration)) {
|
||||
$methodCallName = $itemName;
|
||||
}
|
||||
if (!\is_array($itemConfiguration)) {
|
||||
// simple call
|
||||
$args = $this->nodeFactory->createArgs([$itemConfiguration]);
|
||||
$itemName = StringUtils::underscoreToCamelCase($itemName);
|
||||
$methodCall = new MethodCall($configVariable, $itemName, $args);
|
||||
$methodCallStmts[] = new Expression($methodCall);
|
||||
continue;
|
||||
}
|
||||
$nextMethodCallExpressions = $this->nestedConfigCallsFactory->create([$itemName, $itemConfiguration], $configVariable, $methodCallName);
|
||||
$methodCallStmts = \array_merge($methodCallStmts, $nextMethodCallExpressions);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
use Rector\Symfony\Utils\StringUtils;
|
||||
final class NestedConfigCallsFactory
|
||||
{
|
||||
/**
|
||||
@ -14,6 +15,10 @@ final class NestedConfigCallsFactory
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private const GROUPING_METHOD_NAME_TO_SPLIT = ['connections' => 'connection', 'entity_managers' => 'entityManager'];
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
@ -21,24 +26,42 @@ final class NestedConfigCallsFactory
|
||||
/**
|
||||
* @param mixed[] $values
|
||||
* @return array<Expression<MethodCall>>
|
||||
* @param \PhpParser\Node\Expr\Variable|\PhpParser\Node\Expr\MethodCall $configCaller
|
||||
*/
|
||||
public function create(array $values, Variable $configVariable, string $mainMethodName) : array
|
||||
public function create(array $values, $configCaller, string $mainMethodName) : array
|
||||
{
|
||||
unset($values[0]);
|
||||
$methodCallStmts = [];
|
||||
foreach ($values as $value) {
|
||||
// build accessControl() method call here
|
||||
$accessControlMethodCall = new MethodCall($configVariable, $mainMethodName);
|
||||
foreach ($value as $methodName => $parameters) {
|
||||
// method correction
|
||||
if ($methodName === 'role') {
|
||||
$methodName = 'roles';
|
||||
$parameters = [$parameters];
|
||||
if (\is_array($value)) {
|
||||
// doctrine
|
||||
foreach (self::GROUPING_METHOD_NAME_TO_SPLIT as $groupingMethodName => $splitMethodName) {
|
||||
if ($mainMethodName === $groupingMethodName) {
|
||||
foreach ($value as $connectionName => $connectionConfiguration) {
|
||||
$connectionArgs = $this->nodeFactory->createArgs([$connectionName]);
|
||||
$connectionMethodCall = new MethodCall($configCaller, $splitMethodName, $connectionArgs);
|
||||
foreach ($connectionConfiguration as $configurationMethod => $configurationValue) {
|
||||
$configurationMethod = StringUtils::underscoreToCamelCase($configurationMethod);
|
||||
$args = $this->nodeFactory->createArgs([$configurationValue]);
|
||||
$connectionMethodCall = new MethodCall($connectionMethodCall, $configurationMethod, $args);
|
||||
}
|
||||
$methodCallStmts[] = new Expression($connectionMethodCall);
|
||||
}
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$args = $this->nodeFactory->createArgs([$parameters]);
|
||||
$accessControlMethodCall = new MethodCall($accessControlMethodCall, $methodName, $args);
|
||||
$mainMethodCall = new MethodCall($configCaller, $mainMethodName);
|
||||
foreach ($value as $methodName => $parameters) {
|
||||
// security
|
||||
if ($methodName === 'role') {
|
||||
$methodName = 'roles';
|
||||
$parameters = [$parameters];
|
||||
}
|
||||
$args = $this->nodeFactory->createArgs([$parameters]);
|
||||
$mainMethodCall = new MethodCall($mainMethodCall, $methodName, $args);
|
||||
}
|
||||
$methodCallStmts[] = new Expression($mainMethodCall);
|
||||
}
|
||||
$methodCallStmts[] = new Expression($accessControlMethodCall);
|
||||
}
|
||||
return $methodCallStmts;
|
||||
}
|
||||
|
@ -14,8 +14,9 @@ final class SecurityAccessDecisionManagerConfigArrayHandler
|
||||
{
|
||||
/**
|
||||
* @return array<Expression<MethodCall>>
|
||||
* @param \PhpParser\Node\Expr\Variable|\PhpParser\Node\Expr\MethodCall $configCaller
|
||||
*/
|
||||
public function handle(Array_ $array, Variable $configVariable, string $mainMethodName) : array
|
||||
public function handle(Array_ $array, $configCaller, string $mainMethodName) : array
|
||||
{
|
||||
if (!$array->items[0] instanceof ArrayItem) {
|
||||
return [];
|
||||
@ -26,7 +27,7 @@ final class SecurityAccessDecisionManagerConfigArrayHandler
|
||||
return [];
|
||||
}
|
||||
// build accessControl() method call here
|
||||
$accessDecisionManagerMethodCall = new MethodCall($configVariable, $mainMethodName);
|
||||
$accessDecisionManagerMethodCall = new MethodCall($configCaller, $mainMethodName);
|
||||
foreach ($nestedArray->items as $nestedArrayItem) {
|
||||
if (!$nestedArrayItem instanceof ArrayItem) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user