mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 05:02:23 +00:00
update current Contrib configs
This commit is contained in:
parent
8894fe7f42
commit
c9b31dba64
|
@ -2,7 +2,8 @@
|
|||
|
||||
namespace Rector\Rector\Dynamic\Configuration;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
use Rector\Exception\Rector\InvalidRectorConfigurationException;
|
||||
use Rector\Rector\Dynamic\ArgumentReplacerRector;
|
||||
|
||||
final class ArgumentReplacerRecipe
|
||||
{
|
||||
|
@ -76,7 +77,6 @@ final class ArgumentReplacerRecipe
|
|||
*/
|
||||
public static function createFromArray(array $data): self
|
||||
{
|
||||
// @todo: make exceptions clear for end user
|
||||
self::validateArrayData($data);
|
||||
|
||||
return new self(
|
||||
|
@ -89,6 +89,19 @@ final class ArgumentReplacerRecipe
|
|||
);
|
||||
}
|
||||
|
||||
private static function ensureHasKey(array $data, string $key): void
|
||||
{
|
||||
if (isset($data[$key])) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new InvalidRectorConfigurationException(sprintf(
|
||||
'Configuration for "%s" Rector should have "%s" key, but is missing.',
|
||||
ArgumentReplacerRector::class,
|
||||
$key
|
||||
));
|
||||
}
|
||||
|
||||
public function getClass(): string
|
||||
{
|
||||
return $this->class;
|
||||
|
@ -130,13 +143,14 @@ final class ArgumentReplacerRecipe
|
|||
*/
|
||||
private static function validateArrayData(array $data): void
|
||||
{
|
||||
Assert::keyExists($data, 'class');
|
||||
Assert::keyExists($data, 'method');
|
||||
Assert::keyExists($data, 'position');
|
||||
Assert::keyExists($data, 'type');
|
||||
self::ensureHasKey($data, 'class');
|
||||
self::ensureHasKey($data, 'class');
|
||||
self::ensureHasKey($data, 'method');
|
||||
self::ensureHasKey($data, 'position');
|
||||
self::ensureHasKey($data, 'type');
|
||||
|
||||
if ($data['type'] === self::TYPE_REPLACED_DEFAULT_VALUE) {
|
||||
Assert::keyExists($data, 'replace_map');
|
||||
self::ensureHasKey($data, 'replace_map');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ rectors:
|
|||
'em': 'Doctrine\ORM\EntityManagerInterface'
|
||||
|
||||
Rector\Rector\Dynamic\ArgumentReplacerRector:
|
||||
'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister':
|
||||
'getSelectJoinColumnSQL':
|
||||
4:
|
||||
'~': ~
|
||||
-
|
||||
class: 'Doctrine\ORM\Persisters\Entity\AbstractEntityInheritancePersister'
|
||||
method: 'getSelectJoinColumnSQL'
|
||||
position: 4
|
||||
type: 'removed'
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
rectors:
|
||||
# dependency-injection
|
||||
Rector\Rector\Dynamic\ArgumentReplacerRector:
|
||||
'Symfony\Component\DependencyInjection\ContainerBuilder':
|
||||
'compile':
|
||||
0:
|
||||
# added default value
|
||||
'~': false
|
||||
'addCompilerPass':
|
||||
2:
|
||||
# added default value
|
||||
'~': 0
|
||||
'Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph':
|
||||
'connect':
|
||||
6:
|
||||
# added default value
|
||||
'~': false
|
||||
-
|
||||
class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
|
||||
method: 'compile'
|
||||
type: 'changed'
|
||||
position: 2
|
||||
default_value: 0
|
||||
-
|
||||
class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
|
||||
method: 'addCompilerPass'
|
||||
type: 'changed'
|
||||
position: 2
|
||||
default_value: 0
|
||||
-
|
||||
class: 'Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph'
|
||||
method: 'connect'
|
||||
position: 6
|
||||
type: 'changed'
|
||||
default_value: false
|
||||
|
||||
Rector\Rector\Contrib\Symfony\Console\ConsoleExceptionToErrorEventConstantRector: ~
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ rectors:
|
|||
-
|
||||
class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
|
||||
method: 'addCompilerPass'
|
||||
position: 2
|
||||
type: 'changed'
|
||||
position: 2
|
||||
default_value: 0
|
||||
|
||||
# remove argument
|
||||
|
|
Loading…
Reference in New Issue
Block a user