Skip to content

Commit ef82114

Browse files
authored
Add unused public and type coverage packages (#140)
* add unused public * add type coverage * cleanup
1 parent 58c8dbf commit ef82114

File tree

8 files changed

+19
-23
lines changed

8 files changed

+19
-23
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
"symplify/rule-doc-generator": "^12.2",
1717
"phpunit/phpunit": "^10.5",
1818
"symfony/framework-bundle": "6.1.*",
19-
"rector/rector": "^1.1",
19+
"rector/rector": "^1.2.3",
2020
"symplify/easy-coding-standard": "^12.3",
2121
"phpstan/extension-installer": "^1.4",
22-
"tomasvotruba/class-leak": "^0.2"
22+
"tomasvotruba/class-leak": "^0.2",
23+
"tomasvotruba/unused-public": "^0.3.10",
24+
"tomasvotruba/type-coverage": "^0.3.1"
2325
},
2426
"autoload": {
2527
"psr-4": {

phpstan.neon

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ parameters:
1919
- */stubs/*
2020
- */Fixture/*
2121

22-
ignoreErrors:
23-
-
24-
message: '#Generator expects value type (.*?) given#'
25-
paths:
26-
- tests/Rules
22+
# https://github.com/TomasVotruba/unused-public
23+
unused_public:
24+
methods: true
25+
properties: true
26+
constants: true
27+
28+
type_coverage:
29+
return: 99
30+
param: 99
31+
property: 99
2732

33+
ignoreErrors:
2834
# needless generics
2935
- '#Class Symplify\\PHPStanRules\\(.*?)Rule implements generic interface PHPStan\\Rules\\Rule but does not specify its types\: TNodeType#'
3036

@@ -43,3 +49,6 @@ parameters:
4349

4450
# overly detailed
4551
- '#Class Symplify\\PHPStanRules\\Collector\\(.*?) implements generic interface PHPStan\\Collectors\\Collector but does not specify its types\: TNodeType, TValue#'
52+
53+
# used in tests
54+
- '#Public constant "(.*?)\:\:ERROR_MESSAGE" is never used#'

src/Rules/NoInlineStringRegexRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function getNodeType(): string
4343
}
4444

4545
/**
46-
* @param Node\Expr\CallLike $node
46+
* @param CallLike $node
4747
* @return mixed[]|string[]
4848
*/
4949
public function processNode(Node $node, Scope $scope): array

tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
2121
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
2222
}
2323

24-
/**
25-
* @return \Iterator<array<int, array<int[]|string[]>>|string[]>
26-
*/
2724
public static function provideData(): Iterator
2825
{
2926
$errorMessage = sprintf(ForbiddenNodeRule::ERROR_MESSAGE, 'empty($value)');

tests/Rules/ForbiddenStaticClassConstFetchRule/ForbiddenStaticClassConstFetchRuleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
2121
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
2222
}
2323

24-
/**
25-
* @return \Iterator<array<int, array<int[]|string[]>>|string[]>
26-
*/
2724
public static function provideData(): Iterator
2825
{
2926
yield [

tests/Rules/PreventParentMethodVisibilityOverrideRule/PreventParentMethodVisibilityOverrideRuleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
2121
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
2222
}
2323

24-
/**
25-
* @return Iterator<array<string|int[]|string[]>>
26-
*/
2724
public static function provideData(): Iterator
2825
{
2926
$errorMessage = sprintf(PreventParentMethodVisibilityOverrideRule::ERROR_MESSAGE, 'run', 'protected');

tests/Rules/RegexSuffixInRegexConstantRule/RegexSuffixInRegexConstantRuleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
2121
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
2222
}
2323

24-
/**
25-
* @return Iterator<array<string|int[]|string[]>>
26-
*/
2724
public static function provideData(): Iterator
2825
{
2926
$errorMessage = sprintf(RegexSuffixInRegexConstantRule::ERROR_MESSAGE, 'SOME_NAME');

tests/Rules/UppercaseConstantRule/UppercaseConstantRuleTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
2121
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
2222
}
2323

24-
/**
25-
* @return Iterator<int, array<int, array<int, int|string>|string>>
26-
*/
2724
public static function provideData(): Iterator
2825
{
2926
$errorMessage = sprintf(UppercaseConstantRule::ERROR_MESSAGE, 'SMall');

0 commit comments

Comments
 (0)