mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-21 09:42:45 +01:00
rename class is not needed
This commit is contained in:
parent
7fb892b9d1
commit
de4477b0f9
@ -1,10 +1,6 @@
|
||||
# from: https://github.com/Kdyby/Events/
|
||||
# to: https://github.com/contributte/event-dispatcher/
|
||||
services:
|
||||
Rector\Renaming\Rector\Class_\RenameClassRector:
|
||||
$oldToNewClasses:
|
||||
Kdyby\Events\Subscriber: 'Symfony\Component\EventDispatcher\EventSubscriberInterface'
|
||||
|
||||
Rector\NetteKdyby\Rector\Class_\KdybyEventSubscriberToContributteEventSubscriberRector: null
|
||||
Rector\NetteKdyby\Rector\MethodCall\ReplaceMagicPropertyEventWithEventClassRector: null
|
||||
Rector\NetteKdyby\Rector\ClassMethod\ReplaceMagicEventPropertySubscriberWithEventClassSubscriberRector: null
|
||||
|
@ -13,6 +13,7 @@ use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Cast\String_ as StringCast;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
@ -148,6 +149,10 @@ final class CustomEventFactory
|
||||
return $this->resolveParamNameFromPropertyFetch($value);
|
||||
}
|
||||
|
||||
if ($value instanceof MethodCall) {
|
||||
return $this->resolveParamNameFromMethodCall($value);
|
||||
}
|
||||
|
||||
if ($value === null) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@ -178,4 +183,19 @@ final class CustomEventFactory
|
||||
|
||||
return $varName . ucfirst($propertyName);
|
||||
}
|
||||
|
||||
private function resolveParamNameFromMethodCall(MethodCall $methodCall): string
|
||||
{
|
||||
$varName = $this->nodeNameResolver->getName($methodCall->var);
|
||||
if (! is_string($varName)) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
$methodName = $this->nodeNameResolver->getName($methodCall->name);
|
||||
if (! is_string($methodName)) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
return $varName . ucfirst($methodName);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user