Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jan 28, 2021
1 parent 75d63f1 commit 1b3acc4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
Expand Up @@ -30,7 +30,7 @@ public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Change $service->arg(...) to $service->call(...)', [
new ConfiguredCodeSample(
<<<'PHP'
<<<'CODE_SAMPLE'
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -39,9 +39,9 @@ public function getRuleDefinition(): RuleDefinition
$services->set(SomeClass::class)
->arg('$key', 'value');
}
PHP
CODE_SAMPLE
,
<<<'PHP'
<<<'CODE_SAMPLE'
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -52,7 +52,7 @@ public function getRuleDefinition(): RuleDefinition
'$key' => 'value'
]]);
}
PHP
CODE_SAMPLE
,
[self::CLASS_TYPE_TO_METHOD_NAME => ['SomeClass' => 'configure']]
)
Expand Down
Expand Up @@ -19,27 +19,25 @@ public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Description', [
new CodeSample(
<<<'PHP'
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
$this->something();
}
}
PHP

CODE_SAMPLE
,
<<<'PHP'
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
$this->somethingElse();
}
}
PHP

CODE_SAMPLE
)
]);
}
Expand Down
Expand Up @@ -108,7 +108,7 @@ public function refactor(Node $node): ?Node

private function shouldSkip(MethodCall $methodCall): bool
{
if (! $this->isObjectType($methodCall, 'Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor')) {
if (! $this->isObjectType($methodCall->var, 'Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor')) {
return true;
}

Expand Down Expand Up @@ -155,16 +155,17 @@ private function getContextOptionValue(MethodCall $methodCall): ?bool

private function prepareEnableMagicMethodsExtractionFlags(bool $enableMagicCallExtractionValue): BitwiseOr
{
$classConstFetch = $this->createClassConstFetch(
$magicGetClassConstFetch = $this->createClassConstFetch(
'Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor',
'MAGIC_GET'
);
$magicSet = $this->createClassConstFetch(
$magicSetClassConstFetch = $this->createClassConstFetch(
'Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor',
'MAGIC_SET'
);

if (! $enableMagicCallExtractionValue) {
return new BitwiseOr($classConstFetch, $magicSet);
return new BitwiseOr($magicGetClassConstFetch, $magicSetClassConstFetch);
}

return new BitwiseOr(
Expand All @@ -173,9 +174,9 @@ private function prepareEnableMagicMethodsExtractionFlags(bool $enableMagicCallE
'Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor',
'MAGIC_CALL'
),
$classConstFetch,
$magicGetClassConstFetch,
),
$magicSet,
$magicSetClassConstFetch,
);
}
}

0 comments on commit 1b3acc4

Please sign in to comment.