Skip to content

Commit

Permalink
Add unused public and type coverage packages (#140)
Browse files Browse the repository at this point in the history
* add unused public

* add type coverage

* cleanup
  • Loading branch information
TomasVotruba authored Aug 23, 2024
1 parent 58c8dbf commit ef82114
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 23 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
"symplify/rule-doc-generator": "^12.2",
"phpunit/phpunit": "^10.5",
"symfony/framework-bundle": "6.1.*",
"rector/rector": "^1.1",
"rector/rector": "^1.2.3",
"symplify/easy-coding-standard": "^12.3",
"phpstan/extension-installer": "^1.4",
"tomasvotruba/class-leak": "^0.2"
"tomasvotruba/class-leak": "^0.2",
"tomasvotruba/unused-public": "^0.3.10",
"tomasvotruba/type-coverage": "^0.3.1"
},
"autoload": {
"psr-4": {
Expand Down
19 changes: 14 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ parameters:
- */stubs/*
- */Fixture/*

ignoreErrors:
-
message: '#Generator expects value type (.*?) given#'
paths:
- tests/Rules
# https://github.com/TomasVotruba/unused-public
unused_public:
methods: true
properties: true
constants: true

type_coverage:
return: 99
param: 99
property: 99

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

Expand All @@ -43,3 +49,6 @@ parameters:

# overly detailed
- '#Class Symplify\\PHPStanRules\\Collector\\(.*?) implements generic interface PHPStan\\Collectors\\Collector but does not specify its types\: TNodeType, TValue#'

# used in tests
- '#Public constant "(.*?)\:\:ERROR_MESSAGE" is never used#'
2 changes: 1 addition & 1 deletion src/Rules/NoInlineStringRegexRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getNodeType(): string
}

/**
* @param Node\Expr\CallLike $node
* @param CallLike $node
* @return mixed[]|string[]
*/
public function processNode(Node $node, Scope $scope): array
Expand Down
3 changes: 0 additions & 3 deletions tests/Rules/ForbiddenNodeRule/ForbiddenNodeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}

/**
* @return \Iterator<array<int, array<int[]|string[]>>|string[]>
*/
public static function provideData(): Iterator
{
$errorMessage = sprintf(ForbiddenNodeRule::ERROR_MESSAGE, 'empty($value)');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}

/**
* @return \Iterator<array<int, array<int[]|string[]>>|string[]>
*/
public static function provideData(): Iterator
{
yield [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}

/**
* @return Iterator<array<string|int[]|string[]>>
*/
public static function provideData(): Iterator
{
$errorMessage = sprintf(PreventParentMethodVisibilityOverrideRule::ERROR_MESSAGE, 'run', 'protected');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}

/**
* @return Iterator<array<string|int[]|string[]>>
*/
public static function provideData(): Iterator
{
$errorMessage = sprintf(RegexSuffixInRegexConstantRule::ERROR_MESSAGE, 'SOME_NAME');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function testRule(string $filePath, array $expectedErrorMessagesWithLines
$this->analyse([$filePath], $expectedErrorMessagesWithLines);
}

/**
* @return Iterator<int, array<int, array<int, int|string>|string>>
*/
public static function provideData(): Iterator
{
$errorMessage = sprintf(UppercaseConstantRule::ERROR_MESSAGE, 'SMall');
Expand Down

0 comments on commit ef82114

Please sign in to comment.