Skip to content

Commit

Permalink
Cleanup configs + remove few unused classes (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 19, 2023
1 parent 43f05cb commit d4b0cd4
Show file tree
Hide file tree
Showing 16 changed files with 11 additions and 320 deletions.
3 changes: 1 addition & 2 deletions build/target-repository/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
},
"phpstan": {
"includes": [
"config/services/services.neon",
"config/packages/symfony/services.neon"
"config/services/services.neon"
]
}
},
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"extra": {
"phpstan": {
"includes": [
"config/services/services.neon",
"config/packages/symfony/services.neon"
"config/services/services.neon"
]
}
},
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/symfony/services.neon

This file was deleted.

72 changes: 0 additions & 72 deletions config/packages/symfony/symfony-rules.neon

This file was deleted.

5 changes: 0 additions & 5 deletions config/services/services.neon
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,3 @@ services:
- Symplify\PHPStanRules\Matcher\Collector\PublicClassMethodMatcher
- Symplify\PHPStanRules\Matcher\ClassMethodCallReferenceResolver
- Symplify\PHPStanRules\Printer\CollectorMetadataPrinter

-
class: Symplify\PHPStanRules\NodeVisitor\AssignedToPropertyNodeVisitor
tags:
- phpstan.parser.richParserNodeVisitor
1 change: 1 addition & 0 deletions config/static-rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rules:
- Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
- Symplify\PHPStanRules\Rules\NoStaticPropertyRule
- Symplify\PHPStanRules\Rules\NoConstructorInTestRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenSameNamedNewInstanceRule

# domain
- Symplify\PHPStanRules\Rules\Domain\RequireExceptionNamespaceRule
Expand Down
14 changes: 3 additions & 11 deletions config/symplify-rules.neon
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
includes:
# 1. basic static sets
- static-rules.neon

# 2. prepared sets
- code-complexity-rules.neon
- forbidden-static-rules.neon
- regex-rules.neon
- packages/symfony/symfony-rules.neon
- test-rules.neon
- naming-rules.neon
- collector-rules.neon

# 3. custom symplify configuratoin
- configurable-rules.neon
- naming-rules.neon
- regex-rules.neon
- static-rules.neon
169 changes: 0 additions & 169 deletions src/Collector/ClassMethod/NewAndSetterCallsCollector.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/Enum/AttributeKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ final class AttributeKey
*/
public const PHPSTAN_CACHE_PRINTER = 'phpstan_cache_printer';

/**
* @var string
*/
public const ASSIGNED_TO = 'assigned_to';

/**
* PHPStan @api
*
Expand Down
26 changes: 0 additions & 26 deletions src/NodeVisitor/AssignedToPropertyNodeVisitor.php

This file was deleted.

11 changes: 4 additions & 7 deletions src/Symfony/NodeAnalyzer/SymfonyControllerAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ final class SymfonyControllerAnalyzer
*/
private const ROUTE_ATTRIBUTE = 'Symfony\Component\Routing\Annotation\Route';

public function __construct(
private readonly AttributeFinder $attributeFinder
) {
}

public function isControllerActionMethod(ClassMethod $classMethod): bool
public static function isControllerActionMethod(ClassMethod $classMethod): bool
{
$attributeFinder = new AttributeFinder();

if (! $classMethod->isPublic()) {
return false;
}

if ($this->attributeFinder->hasAttribute($classMethod, self::ROUTE_ATTRIBUTE)) {
if ($attributeFinder->hasAttribute($classMethod, self::ROUTE_ATTRIBUTE)) {
return true;
}

Expand Down
7 changes: 1 addition & 6 deletions src/Symfony/Rules/RequireInvokableControllerRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ final class RequireInvokableControllerRule implements Rule, DocumentedRuleInterf
*/
public const ERROR_MESSAGE = 'Use invokable controller with __invoke() method instead of named action method';

public function __construct(
private readonly SymfonyControllerAnalyzer $symfonyControllerAnalyzer
) {
}

/**
* @return class-string<Node>
*/
Expand All @@ -58,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array

$classLike = $node->getOriginalNode();
foreach ($classLike->getMethods() as $classMethod) {
if (! $this->symfonyControllerAnalyzer->isControllerActionMethod($classMethod)) {
if (! SymfonyControllerAnalyzer::isControllerActionMethod($classMethod)) {
continue;
}

Expand Down
Loading

0 comments on commit d4b0cd4

Please sign in to comment.