update current Contrib configs

This commit is contained in:
TomasVotruba 2018-02-13 22:16:05 +01:00
parent 8894fe7f42
commit c9b31dba64
4 changed files with 46 additions and 26 deletions

View File

@ -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');
}
}
}

View File

@ -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'

View File

@ -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
# added default value
-
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: ~

View File

@ -12,8 +12,8 @@ rectors:
-
class: 'Symfony\Component\DependencyInjection\ContainerBuilder'
method: 'addCompilerPass'
position: 2
type: 'changed'
position: 2
default_value: 0
# remove argument