Skip to content

Commit

Permalink
Cleanup phpstan errors (#3748)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 6, 2023
1 parent 3c592b0 commit 14fa8c9
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 170 deletions.
2 changes: 1 addition & 1 deletion packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public function getTemplateTagValueNodes(): array
}

/**
* @deprecated
* @internal
* Should be handled by attributes of phpdoc node - if stard_and_end is missing in one of nodes, it has been changed
* Similar to missing original node in php-aprser
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
}

/**
* @deprecated Use file-> method instead
* @internal Use file-> method instead
*/
public function notifyNodeFileInfo(Node $node): void
{
Expand Down
6 changes: 3 additions & 3 deletions packages/PostRector/Collector/NodesToAddCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function isActive(): bool
}

/**
* @deprecated Return created nodes right in refactor() method to keep context instead.
* @internal Return created nodes right in refactor() method to keep context instead.
*/
public function addNodeBeforeNode(Node $addedNode, Node $positionNode): void
{
Expand All @@ -66,7 +66,7 @@ public function addNodeBeforeNode(Node $addedNode, Node $positionNode): void
/**
* @api
* @param Node[] $addedNodes
* @deprecated Return created nodes right in refactor() method to keep context instead.
* @internal Return created nodes right in refactor() method to keep context instead.
*/
public function addNodesAfterNode(array $addedNodes, Node $positionNode): void
{
Expand All @@ -81,7 +81,7 @@ public function addNodesAfterNode(array $addedNodes, Node $positionNode): void

/**
* Better return created nodes right in refactor() method to keep context
* @deprecated
* @internal
*/
public function addNodeAfterNode(Node $addedNode, Node $positionNode): void
{
Expand Down
134 changes: 0 additions & 134 deletions phpstan-baseline.neon

This file was deleted.

26 changes: 0 additions & 26 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
includes:
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
- phpstan-baseline.neon

parameters:
reportUnmatchedIgnoredErrors: false

unused_public:
properties: true
constants: true
methods: true

type_coverage:
param_type: 99
return_type: 99
property_type: 99

cognitive_complexity:
class: 50
function: 10
Expand All @@ -24,10 +13,6 @@ parameters:
# requires exact closure types
checkMissingCallableSignature: true

parallel:
# to prevent full thread lagging pc
maximumNumberOfProcesses: 15

paths:
- rector.php
- bin
Expand Down Expand Up @@ -244,8 +229,6 @@ parameters:
path: src/Bootstrap/RectorConfigsResolver.php
message: '#Method Rector\\Core\\Bootstrap\\RectorConfigsResolver\:\:resolveFromInput\(\) should return string\|null but returns string\|false#'

- '#Cognitive complexity for "Rector\\Core\\NodeManipulator\\ClassMethodAssignManipulator\:\:collectReferenceVariableNames\(\)" is 13, keep it under 10#'

# known value object, nullable due to typed property
-
message: '#Cannot call method (.*?)\(\) on (.*?)\\ProcessPool\|null#'
Expand Down Expand Up @@ -692,10 +675,6 @@ parameters:
message: '#Anonymous (variable|variables) in#'
path: utils/ChangelogGenerator

-
message: '#Separate function "sprintf\(\)" in method call to standalone row to improve readability#'
path: utils/ChangelogGenerator

# std class api
-
message: '#Function "property_exists\(\)" cannot be used/left in the code\: use ReflectionProvider\->has\*\(\) instead#'
Expand Down Expand Up @@ -757,11 +736,6 @@ parameters:
- src/Console/Command/AbstractProcessCommand.php
- src/Rector/AbstractRector.php

# allow PHPUnit 10 attributes without keys
-
message: '#Attribute must have all names explicitly defined#'
path: '*Test.php'

# useless
- '#Parameter \#1 \$suffix of method PHPUnit\\Framework\\Assert\:\:assertStringEndsWith\(\) expects non\-empty\-string, string given#'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ public function test(string $filePath): void

public static function provideData(): Iterator
{
foreach (self::yieldFilesFromDirectory(__DIR__ . '/Fixture') as $filePath) {
yield basename((string) $filePath[0]) => $filePath;
}
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node
return null;
}

/** @var Expr $assignVariable */
$assignVariable = $this->foreachAnalyzer->matchAssignItemsOnlyForeachArrayVariable($node);
if (! $assignVariable instanceof Expr) {
return null;
}

return new Assign($assignVariable, $node->expr);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rector/AbstractRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ abstract class AbstractRector extends NodeVisitorAbstract implements PhpRectorIn
protected BetterNodeFinder $betterNodeFinder;

/**
* @deprecated Use service directly or return changes nodes
* @internal Use service directly or return changes nodes
*/
protected NodeRemover $nodeRemover;

Expand Down

0 comments on commit 14fa8c9

Please sign in to comment.