From 3752dce19b8949a5529f1830f5e3f475e6e9673b Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Thu, 15 Apr 2021 21:18:18 +0200 Subject: [PATCH 1/2] decoupled PropertyFetchByMethodAnalyzer --- phpstan.neon | 4 - .../AddArrayDefaultToArrayPropertyRector.php | 1 + .../ClassLike/RemoveAnnotationRector.php | 2 + .../RemoveUselessParamTagRector.php | 2 + .../RemoveUselessReturnTagRector.php | 2 + .../Property/RemoveUselessVarTagRector.php | 2 + .../PropertyFetchByMethodAnalyzer.php | 195 ++++++++++++++++++ .../ChangeLocalPropertyToVariableRector.php | 169 ++------------- .../AddArrayParamDocTypeRector.php | 3 + 9 files changed, 220 insertions(+), 160 deletions(-) create mode 100644 rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php diff --git a/phpstan.neon b/phpstan.neon index 739ebb809bbf..ddf86fd76200 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -527,8 +527,4 @@ parameters: message: '#\$this as argument is not allowed\. Refactor method to service composition#' path: rules/TypeDeclaration/Rector/ClassMethod/ParamTypeFromStrictTypedPropertyRector.php - - - message: '#Class cognitive complexity is 32, keep it under 30#' - path: rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php - - '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findParentTypes\(\) should return T of PhpParser\\Node\|null but returns class\-string\|T of PhpParser\\Node#' diff --git a/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php b/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php index 7a3e75d7aad2..3f528445e0fc 100644 --- a/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php +++ b/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php @@ -262,6 +262,7 @@ private function isLocalPropertyOfNamesNotIdenticalToNull(Expr $expr, array $pro ) && $this->valueResolver->isNull($expr->right)) { return true; } + if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($expr->right, $propertyNames)) { return false; } diff --git a/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php b/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php index b5fa8938f86a..f0c6580f9d05 100644 --- a/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php +++ b/rules/DeadCode/Rector/ClassLike/RemoveAnnotationRector.php @@ -11,6 +11,7 @@ use PhpParser\Node\Stmt\Property; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; +use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Contract\Rector\ConfigurableRectorInterface; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample; @@ -96,6 +97,7 @@ public function refactor(Node $node): ?Node } if ($phpDocInfo->hasChanged()) { + $this->file->addRectorClassWithLine(new RectorWithLineChange($this, $node->getLine())); return null; } diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php index fb8273f40d2f..af5399e322c2 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php @@ -7,6 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover; +use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Rector\AbstractRector; use Rector\DeadCode\PhpDoc\DeadParamTagValueNodeAnalyzer; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -93,6 +94,7 @@ public function refactor(Node $node): ?Node } if ($phpDocInfo->hasChanged()) { + $this->file->addRectorClassWithLine(new RectorWithLineChange($this, $node->getLine())); return $node; } diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php index 709c798730a4..07c83f747f05 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php @@ -6,6 +6,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; +use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Rector\AbstractRector; use Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -77,6 +78,7 @@ public function refactor(Node $node): ?Node $this->returnTagRemover->removeReturnTagIfUseless($phpDocInfo, $node); if ($phpDocInfo->hasChanged()) { + $this->file->addRectorClassWithLine(new RectorWithLineChange($this, $node->getLine())); return $node; } diff --git a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php index 7e564cada7ed..0f4137a58d50 100644 --- a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php @@ -6,6 +6,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Property; +use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Rector\AbstractRector; use Rector\DeadCode\PhpDoc\TagRemover\VarTagRemover; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; @@ -69,6 +70,7 @@ public function refactor(Node $node): ?Node $this->varTagRemover->removeVarTagIfUseless($phpDocInfo, $node); if ($phpDocInfo->hasChanged()) { + $this->file->addRectorClassWithLine(new RectorWithLineChange($this, $node->getLine())); return $node; } diff --git a/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php new file mode 100644 index 000000000000..144b75ae166b --- /dev/null +++ b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php @@ -0,0 +1,195 @@ +> + */ + private const SCOPE_CHANGING_NODE_TYPES = [Do_::class, While_::class, If_::class, Else_::class]; + + /** + * @var NodeNameResolver + */ + private $nodeNameResolver; + + /** + * @var PropertyFetchAnalyzer + */ + private $propertyFetchAnalyzer; + + /** + * @var SimpleCallableNodeTraverser + */ + private $simpleCallableNodeTraverser; + + public function __construct( + NodeNameResolver $nodeNameResolver, + PropertyFetchAnalyzer $propertyFetchAnalyzer, + SimpleCallableNodeTraverser $simpleCallableNodeTraverser + ) { + $this->nodeNameResolver = $nodeNameResolver; + $this->propertyFetchAnalyzer = $propertyFetchAnalyzer; + $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; + } + + /** + * @param string[] $propertyNames + * @return array + */ + public function collectPropertyFetchByMethods(Class_ $class, array $propertyNames): array + { + $propertyUsageByMethods = []; + + foreach ($propertyNames as $privatePropertyName) { + foreach ($class->getMethods() as $classMethod) { + // assigned in constructor injection → skip + if ($this->nodeNameResolver->isName($classMethod, MethodName::CONSTRUCT)) { + return []; + } + + if (! $this->propertyFetchAnalyzer->containsLocalPropertyFetchName( + $classMethod, + $privatePropertyName + )) { + continue; + } + + if ($this->isPropertyChangingInMultipleMethodCalls($classMethod, $privatePropertyName)) { + continue; + } + + $classMethodName = $this->nodeNameResolver->getName($classMethod); + $propertyUsageByMethods[$privatePropertyName][] = $classMethodName; + } + } + + return $propertyUsageByMethods; + } + + /** + * Covers https://github.com/rectorphp/rector/pull/2558#discussion_r363036110 + */ + private function isPropertyChangingInMultipleMethodCalls(ClassMethod $classMethod, string $propertyName): bool + { + $isPropertyChanging = false; + $isPropertyReadInIf = false; + $isIfFollowedByAssign = false; + + $this->simpleCallableNodeTraverser->traverseNodesWithCallable( + (array) $classMethod->getStmts(), + function (Node $node) use ( + &$isPropertyChanging, + $propertyName, + &$isPropertyReadInIf, + &$isIfFollowedByAssign + ): ?int { + if ($isPropertyReadInIf) { + if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($node, [$propertyName])) { + return null; + } + + $parentNode = $node->getAttribute(AttributeKey::PARENT_NODE); + if ($parentNode instanceof Assign && $parentNode->var === $node) { + $isIfFollowedByAssign = true; + } + } + + if (! $this->isScopeChangingNode($node)) { + return null; + } + + if ($node instanceof If_) { + $isPropertyReadInIf = $this->refactorIf($node, $propertyName); + } + + $isPropertyChanging = $this->isPropertyChanging($node, $propertyName); + if (! $isPropertyChanging) { + return null; + } + + return NodeTraverser::STOP_TRAVERSAL; + } + ); + + return $isPropertyChanging || $isIfFollowedByAssign || $isPropertyReadInIf; + } + + private function isScopeChangingNode(Node $node): bool + { + foreach (self::SCOPE_CHANGING_NODE_TYPES as $type) { + if (is_a($node, $type, true)) { + return true; + } + } + + return false; + } + + private function refactorIf(If_ $if, string $privatePropertyName): ?bool + { + $this->simpleCallableNodeTraverser->traverseNodesWithCallable($if->cond, function (Node $node) use ( + $privatePropertyName, + &$isPropertyReadInIf + ): ?int { + if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($node, [$privatePropertyName])) { + return null; + } + + $isPropertyReadInIf = true; + + return NodeTraverser::STOP_TRAVERSAL; + }); + + return $isPropertyReadInIf; + } + + private function isPropertyChanging(Node $node, string $privatePropertyName): bool + { + $isPropertyChanging = false; + // here cannot be any property assign + + $this->simpleCallableNodeTraverser->traverseNodesWithCallable($node, function (Node $node) use ( + &$isPropertyChanging, + $privatePropertyName + ): ?int { + if (! $node instanceof Assign) { + return null; + } + + if (! $node->var instanceof PropertyFetch) { + return null; + } + + if (! $this->nodeNameResolver->isName($node->var->name, $privatePropertyName)) { + return null; + } + + $isPropertyChanging = true; + + return NodeTraverser::STOP_TRAVERSAL; + }); + + return $isPropertyChanging; + } +} diff --git a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php index 45b1784d8ac8..573fdcf25dbb 100644 --- a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php +++ b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php @@ -5,21 +5,11 @@ namespace Rector\Privatization\Rector\Class_; use PhpParser\Node; -use PhpParser\Node\Expr\Assign; -use PhpParser\Node\Expr\PropertyFetch; -use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Do_; -use PhpParser\Node\Stmt\Else_; -use PhpParser\Node\Stmt\If_; -use PhpParser\Node\Stmt\While_; -use PhpParser\NodeTraverser; use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\Core\NodeManipulator\ClassManipulator; use Rector\Core\Rector\AbstractRector; -use Rector\Core\ValueObject\MethodName; -use Rector\NodeTypeResolver\Node\AttributeKey; +use Rector\Privatization\NodeAnalyzer\PropertyFetchByMethodAnalyzer; use Rector\Privatization\NodeReplacer\PropertyFetchWithVariableReplacer; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -29,11 +19,6 @@ */ final class ChangeLocalPropertyToVariableRector extends AbstractRector { - /** - * @var array> - */ - private const SCOPE_CHANGING_NODE_TYPES = [Do_::class, While_::class, If_::class, Else_::class]; - /** * @var ClassManipulator */ @@ -49,14 +34,21 @@ final class ChangeLocalPropertyToVariableRector extends AbstractRector */ private $propertyFetchWithVariableReplacer; + /** + * @var PropertyFetchByMethodAnalyzer + */ + private $propertyFetchByMethodAnalyzer; + public function __construct( ClassManipulator $classManipulator, PropertyFetchAnalyzer $propertyFetchAnalyzer, - PropertyFetchWithVariableReplacer $propertyFetchWithVariableReplacer + PropertyFetchWithVariableReplacer $propertyFetchWithVariableReplacer, + PropertyFetchByMethodAnalyzer $propertyFetchByMethodAnalyzer ) { $this->classManipulator = $classManipulator; $this->propertyFetchAnalyzer = $propertyFetchAnalyzer; $this->propertyFetchWithVariableReplacer = $propertyFetchWithVariableReplacer; + $this->propertyFetchByMethodAnalyzer = $propertyFetchByMethodAnalyzer; } public function getRuleDefinition(): RuleDefinition @@ -110,7 +102,10 @@ public function refactor(Node $node): ?Node $privatePropertyNames = $this->classManipulator->getPrivatePropertyNames($node); - $propertyUsageByMethods = $this->collectPropertyFetchByMethods($node, $privatePropertyNames); + $propertyUsageByMethods = $this->propertyFetchByMethodAnalyzer->collectPropertyFetchByMethods( + $node, + $privatePropertyNames + ); if ($propertyUsageByMethods === []) { return null; } @@ -137,142 +132,4 @@ public function refactor(Node $node): ?Node return $node; } - - /** - * @param string[] $privatePropertyNames - * @return array - */ - private function collectPropertyFetchByMethods(Class_ $class, array $privatePropertyNames): array - { - $propertyUsageByMethods = []; - - foreach ($privatePropertyNames as $privatePropertyName) { - foreach ($class->getMethods() as $classMethod) { - // assigned in constructor injection → skip - if ($this->isName($classMethod, MethodName::CONSTRUCT)) { - return []; - } - - if (! $this->propertyFetchAnalyzer->containsLocalPropertyFetchName( - $classMethod, - $privatePropertyName - )) { - continue; - } - - if ($this->isPropertyChangingInMultipleMethodCalls($classMethod, $privatePropertyName)) { - continue; - } - - /** @var string $classMethodName */ - $classMethodName = $this->getName($classMethod); - $propertyUsageByMethods[$privatePropertyName][] = $classMethodName; - } - } - - return $propertyUsageByMethods; - } - - /** - * Covers https://github.com/rectorphp/rector/pull/2558#discussion_r363036110 - */ - private function isPropertyChangingInMultipleMethodCalls(ClassMethod $classMethod, string $propertyName): bool - { - $isPropertyChanging = false; - $isPropertyReadInIf = false; - $isIfFollowedByAssign = false; - - $this->traverseNodesWithCallable((array) $classMethod->getStmts(), function (Node $node) use ( - &$isPropertyChanging, - $propertyName, - &$isPropertyReadInIf, - &$isIfFollowedByAssign - ): ?int { - if ($isPropertyReadInIf) { - if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($node, [$propertyName])) { - return null; - } - - $parentNode = $node->getAttribute(AttributeKey::PARENT_NODE); - if ($parentNode instanceof Assign && $parentNode->var === $node) { - $isIfFollowedByAssign = true; - } - } - - if (! $this->isScopeChangingNode($node)) { - return null; - } - - if ($node instanceof If_) { - $isPropertyReadInIf = $this->refactorIf($node, $propertyName); - } - - $isPropertyChanging = $this->isPropertyChanging($node, $propertyName); - if (! $isPropertyChanging) { - return null; - } - - return NodeTraverser::STOP_TRAVERSAL; - }); - - return $isPropertyChanging || $isIfFollowedByAssign || $isPropertyReadInIf; - } - - private function isScopeChangingNode(Node $node): bool - { - foreach (self::SCOPE_CHANGING_NODE_TYPES as $type) { - if (is_a($node, $type, true)) { - return true; - } - } - - return false; - } - - private function refactorIf(If_ $if, string $privatePropertyName): ?bool - { - $this->traverseNodesWithCallable($if->cond, function (Node $node) use ( - $privatePropertyName, - &$isPropertyReadInIf - ): ?int { - if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($node, [$privatePropertyName])) { - return null; - } - - $isPropertyReadInIf = true; - - return NodeTraverser::STOP_TRAVERSAL; - }); - - return $isPropertyReadInIf; - } - - private function isPropertyChanging(Node $node, string $privatePropertyName): bool - { - $isPropertyChanging = false; - // here cannot be any property assign - - $this->traverseNodesWithCallable($node, function (Node $node) use ( - &$isPropertyChanging, - $privatePropertyName - ): ?int { - if (! $node instanceof Assign) { - return null; - } - - if (! $node->var instanceof PropertyFetch) { - return null; - } - - if (! $this->isName($node->var->name, $privatePropertyName)) { - return null; - } - - $isPropertyChanging = true; - - return NodeTraverser::STOP_TRAVERSAL; - }); - - return $isPropertyChanging; - } } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php index a4307757a4cd..74b90895b5fd 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php @@ -12,6 +12,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger; +use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Rector\AbstractRector; use Rector\DeadCode\PhpDoc\TagRemover\ParamTagRemover; use Rector\TypeDeclaration\TypeInferer\ParamTypeInferer; @@ -120,10 +121,12 @@ public function refactor(Node $node): ?Node } $paramName = $this->getName($param); + $this->phpDocTypeChanger->changeParamType($phpDocInfo, $paramType, $param, $paramName); } if ($phpDocInfo->hasChanged()) { + $this->file->addRectorClassWithLine(new RectorWithLineChange($this, $node->getLine())); $this->paramTagRemover->removeParamTagsIfUseless($phpDocInfo, $node); return $node; } From de100b32822a3611add1e184b5aa5b2d1f39401e Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Thu, 15 Apr 2021 23:44:01 +0200 Subject: [PATCH 2/2] 2 splits --- .github/workflows/rector.yaml | 4 +--- .../NodeAnalyzer/PropertyFetchByMethodAnalyzer.php | 11 ++++------- .../Class_/ChangeLocalPropertyToVariableRector.php | 8 -------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index a0b5cafa3ddd..246cc2739733 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -25,10 +25,8 @@ jobs: fail-fast: false matrix: directories: - - src tests - - packages packages-tests + - src tests rules-tests packages packages-tests - rules - - rules-tests runs-on: ubuntu-latest steps: diff --git a/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php index 144b75ae166b..54f2a4682692 100644 --- a/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php +++ b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php @@ -61,26 +61,23 @@ public function collectPropertyFetchByMethods(Class_ $class, array $propertyName { $propertyUsageByMethods = []; - foreach ($propertyNames as $privatePropertyName) { + foreach ($propertyNames as $propertyName) { foreach ($class->getMethods() as $classMethod) { // assigned in constructor injection → skip if ($this->nodeNameResolver->isName($classMethod, MethodName::CONSTRUCT)) { return []; } - if (! $this->propertyFetchAnalyzer->containsLocalPropertyFetchName( - $classMethod, - $privatePropertyName - )) { + if (! $this->propertyFetchAnalyzer->containsLocalPropertyFetchName($classMethod, $propertyName)) { continue; } - if ($this->isPropertyChangingInMultipleMethodCalls($classMethod, $privatePropertyName)) { + if ($this->isPropertyChangingInMultipleMethodCalls($classMethod, $propertyName)) { continue; } $classMethodName = $this->nodeNameResolver->getName($classMethod); - $propertyUsageByMethods[$privatePropertyName][] = $classMethodName; + $propertyUsageByMethods[$propertyName][] = $classMethodName; } } diff --git a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php index 573fdcf25dbb..e94070c953ef 100644 --- a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php +++ b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php @@ -6,7 +6,6 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Class_; -use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer; use Rector\Core\NodeManipulator\ClassManipulator; use Rector\Core\Rector\AbstractRector; use Rector\Privatization\NodeAnalyzer\PropertyFetchByMethodAnalyzer; @@ -24,11 +23,6 @@ final class ChangeLocalPropertyToVariableRector extends AbstractRector */ private $classManipulator; - /** - * @var PropertyFetchAnalyzer - */ - private $propertyFetchAnalyzer; - /** * @var PropertyFetchWithVariableReplacer */ @@ -41,12 +35,10 @@ final class ChangeLocalPropertyToVariableRector extends AbstractRector public function __construct( ClassManipulator $classManipulator, - PropertyFetchAnalyzer $propertyFetchAnalyzer, PropertyFetchWithVariableReplacer $propertyFetchWithVariableReplacer, PropertyFetchByMethodAnalyzer $propertyFetchByMethodAnalyzer ) { $this->classManipulator = $classManipulator; - $this->propertyFetchAnalyzer = $propertyFetchAnalyzer; $this->propertyFetchWithVariableReplacer = $propertyFetchWithVariableReplacer; $this->propertyFetchByMethodAnalyzer = $propertyFetchByMethodAnalyzer; }