Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 7, 2022
1 parent cbe6271 commit b8fec64
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 97 deletions.
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION_STRICT,
NetteSetList::NETTE_UTILS_CODE_QUALITY,
NetteSetList::NETTE_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
SetList::CODING_STYLE,
]);
Expand Down
2 changes: 1 addition & 1 deletion rules/Php80/Rector/Identical/StrEndsWithRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
use Rector\Core\NodeAnalyzer\BinaryOpAnalyzer;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\FuncCallAndExpr;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\Nette\ValueObject\FuncCallAndExpr;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\MethodName;
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
use Symplify\Astral\Naming\SimpleNameResolver;

final class ControllerRenderMethodAnalyzer
{
public function __construct(
private readonly SimpleNameResolver $simpleNameResolver,
private readonly PhpAttributeAnalyzer $phpAttributeAnalyzer,
private readonly PhpDocInfoFactory $phpDocInfoFactory,
private readonly ReflectionResolver $reflectionResolver
Expand Down Expand Up @@ -47,7 +46,14 @@ private function isNetteRenderMethod(ClassReflection $classReflection, ClassMeth
return false;
}

return $this->simpleNameResolver->isNames($classMethod->name, ['render*', 'handle*', 'action*']);
$classMethodName = $classMethod->name->toString();
foreach (['render', 'handle', 'action'] as $methodPrefix) {
if (str_starts_with($classMethodName, $methodPrefix)) {
return true;
}
}

return false;
}

private function isSymfonyRenderMethod(ClassReflection $classReflection, ClassMethod $classMethod): bool
Expand All @@ -62,7 +68,12 @@ private function isSymfonyRenderMethod(ClassReflection $classReflection, ClassMe
return false;
}

if ($this->simpleNameResolver->isNames($classMethod->name, ['__invoke', '*action'])) {
$classMethodName = $classMethod->name->toString();
if ($classMethodName === MethodName::INVOKE) {
return true;
}

if (str_ends_with($classMethodName, 'action')) {
return true;
}

Expand Down

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions tests/Issues/AddConstructMethodNoScope/config/configured_rule.php

This file was deleted.

0 comments on commit b8fec64

Please sign in to comment.