mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 11:44:14 +01:00
PropertyFetchAnalyzer: simplify method names in consistent way
This commit is contained in:
parent
d3a73a566c
commit
570d6a0978
@ -28,7 +28,7 @@ final class PropertyFetchAnalyzer
|
||||
/**
|
||||
* @param string[] $types
|
||||
*/
|
||||
public function isPropertyFetchOnTypes(Node $node, array $types, string $property): bool
|
||||
public function isTypesAndProperty(Node $node, array $types, string $property): bool
|
||||
{
|
||||
if (! $node instanceof PropertyFetch) {
|
||||
return false;
|
||||
@ -45,7 +45,7 @@ final class PropertyFetchAnalyzer
|
||||
return $nodePropertyName === $property;
|
||||
}
|
||||
|
||||
public function isMagicPropertyFetchOnType(Node $node, string $type): bool
|
||||
public function isMagicOnType(Node $node, string $type): bool
|
||||
{
|
||||
if (! $node instanceof PropertyFetch) {
|
||||
return false;
|
||||
|
@ -39,7 +39,7 @@ final class ChoiceDefaultValueRector extends AbstractRector
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->propertyFetchAnalyzer->isPropertyFetchOnTypes(
|
||||
return $this->propertyFetchAnalyzer->isTypesAndProperty(
|
||||
$node->var,
|
||||
['Nette\Forms\Controls\MultiChoiceControl', 'Nette\Forms\Controls\ChoiceControl'],
|
||||
'checkAllowedValues'
|
||||
|
@ -34,7 +34,7 @@ final class IdentifierRector extends AbstractRector
|
||||
{
|
||||
$types = ['PhpParser\Node\Const_'];
|
||||
|
||||
if (! $this->propertyFetchAnalyzer->isPropertyFetchOnTypes($node, $types, 'name')) {
|
||||
if (! $this->propertyFetchAnalyzer->isTypesAndProperty($node, $types, 'name')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ final class GetAndSetToMethodCallRector extends AbstractRector
|
||||
}
|
||||
|
||||
foreach ($this->typeToMethodCalls as $type => $transformation) {
|
||||
if ($this->propertyFetchAnalyzer->isMagicPropertyFetchOnType($propertyFetchNode, $type)) {
|
||||
if ($this->propertyFetchAnalyzer->isMagicOnType($propertyFetchNode, $type)) {
|
||||
$this->activeTransformation = $transformation;
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user