Skip to content

Commit 753627d

Browse files
authored
Remove RequireEnumDocBlockOnConstantListPassRule as reports many false positive, better shift to native enums (#119)
* Remove RequireEnumDocBlockOnConstantListPassRule as reports many false positive, better shift to native enums * remove related services
1 parent a71f91c commit 753627d

20 files changed

+1
-651
lines changed

config/services/services.neon

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ services:
1515
- Symplify\PHPStanRules\Naming\ClassToSuffixResolver
1616
- Symplify\PHPStanRules\NodeAnalyzer\AttributeFinder
1717
- Symplify\PHPStanRules\NodeAnalyzer\EnumAnalyzer
18-
- Symplify\PHPStanRules\NodeAnalyzer\MethodCall\MethodCallClassConstFetchPositionResolver
1918
- Symplify\PHPStanRules\NodeAnalyzer\RegexFuncCallAnalyzer
2019
- Symplify\PHPStanRules\NodeAnalyzer\RegexStaticCallAnalyzer
2120
- Symplify\PHPStanRules\NodeFinder\ClassMethodNodeFinder
@@ -26,7 +25,6 @@ services:
2625
- Symplify\PHPStanRules\PhpDoc\BarePhpDocParser
2726
- Symplify\PHPStanRules\PhpDoc\PhpDocResolver
2827
- Symplify\PHPStanRules\Printer\NodeComparator
29-
- Symplify\PHPStanRules\Reflection\MethodCallNodeAnalyzer
3028
- Symplify\PHPStanRules\Reflection\MethodNodeAnalyser
3129
- Symplify\PHPStanRules\TypeAnalyzer\CallableTypeAnalyzer
3230
- Symplify\PHPStanRules\Matcher\Collector\PublicClassMethodMatcher

docs/rules_overview.md

+1-62
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 44 Rules Overview
1+
# 43 Rules Overview
22

33
## AnnotateRegexClassConstWithRegexLinkRule
44

@@ -1398,67 +1398,6 @@ final class SomeAttribute
13981398

13991399
<br>
14001400

1401-
## RequireEnumDocBlockOnConstantListPassRule
1402-
1403-
On passing a constant, the method should have an enum type. See https://phpstan.org/writing-php-code/phpdoc-types#literals-and-constants
1404-
1405-
- class: [`Symplify\PHPStanRules\Rules\Enum\RequireEnumDocBlockOnConstantListPassRule`](../src/Rules/Enum/RequireEnumDocBlockOnConstantListPassRule.php)
1406-
1407-
```php
1408-
final class Direction
1409-
{
1410-
public const LEFT = 'left';
1411-
1412-
public const RIGHT = 'right';
1413-
}
1414-
1415-
final class Driver
1416-
{
1417-
public function goToWork()
1418-
{
1419-
$this->turn(Direction::LEFT);
1420-
}
1421-
1422-
private function turn(string $direction)
1423-
{
1424-
// ...
1425-
}
1426-
}
1427-
```
1428-
1429-
:x:
1430-
1431-
<br>
1432-
1433-
```php
1434-
final class Direction
1435-
{
1436-
public const LEFT = 'left';
1437-
1438-
public const RIGHT = 'right';
1439-
}
1440-
1441-
final class Driver
1442-
{
1443-
public function goToWork()
1444-
{
1445-
$this->turn(Direction::LEFT);
1446-
}
1447-
1448-
/**
1449-
* @param Direction::*
1450-
*/
1451-
private function turn(string $direction)
1452-
{
1453-
// ...
1454-
}
1455-
}
1456-
```
1457-
1458-
:+1:
1459-
1460-
<br>
1461-
14621401
## RequireExceptionNamespaceRule
14631402

14641403
`Exception` must be located in "Exception" namespace

src/NodeAnalyzer/MethodCall/MethodCallClassConstFetchPositionResolver.php

-57
This file was deleted.

src/Reflection/MethodCallNodeAnalyzer.php

-57
This file was deleted.

src/Rules/Enum/RequireEnumDocBlockOnConstantListPassRule.php

-193
This file was deleted.

0 commit comments

Comments
 (0)