Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[PHPStanRules] Remove ForbiddenNestedForeachWithEmptyStatementRule, a…
Browse files Browse the repository at this point in the history
…s not very helpful in pratise (#3945)
  • Loading branch information
TomasVotruba authored Feb 20, 2022
1 parent 802cb62 commit 9f70dfd
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 282 deletions.
4 changes: 0 additions & 4 deletions packages/phpstan-rules/config/static-rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ services:
class: Symplify\PHPStanRules\Rules\RequireThisCallOnLocalMethodRule
tags: [phpstan.rules.rule]

-
class: Symplify\PHPStanRules\Rules\ForbiddenNestedForeachWithEmptyStatementRule
tags: [phpstan.rules.rule]

-
class: Symplify\PHPStanRules\Rules\ForbiddenMultipleClassLikeInOneFileRule
tags: [phpstan.rules.rule]
Expand Down
32 changes: 0 additions & 32 deletions packages/phpstan-rules/docs/rules_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -1304,38 +1304,6 @@ final class SomeClass extends TestCase

<br>

## ForbiddenNestedForeachWithEmptyStatementRule

Nested foreach with empty statement is not allowed

- class: [`Symplify\PHPStanRules\Rules\ForbiddenNestedForeachWithEmptyStatementRule`](../src/Rules/ForbiddenNestedForeachWithEmptyStatementRule.php)

```php
$collectedFileErrors = [];

foreach ($errors as $fileErrors) {
foreach ($fileErrors as $fileError) {
$collectedFileErrors[] = $fileError;
}
}
```

:x:

<br>

```php
$collectedFileErrors = [];

foreach ($fileErrors as $fileError) {
$collectedFileErrors[] = $fileError;
}
```

:+1:

<br>

## ForbiddenNodeRule

"%s" is forbidden to use
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 2 additions & 9 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ parameters:
# known types
- '#Method Symplify\\Astral\\NodeFinder\\SimpleNodeFinder\:\:findByType\(\) should return array<T of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
- '#Method Symplify\\Astral\\NodeFinder\\SimpleNodeFinder\:\:findFirstParentByType\(\) should return T of PhpParser\\Node\|null but returns class\-string<T of PhpParser\\Node\>\|T of PhpParser\\Node#'
# node finder generics meshup
- '#Method Symplify\\Astral\\NodeFinder\\SimpleNodeFinder\:\:findFirstByType\(\) should return T of PhpParser\\Node\|null but returns PhpParser\\Node\|null#'

-
message: '#Use void instead of modify and return self object#'
Expand Down Expand Up @@ -391,11 +393,6 @@ parameters:
message: '#Removing parent param type is forbidden#'
path: *FileLoader.php

# this class is used by scoper, so better use less external deps
-
message: '#Nested foreach with empty statement is not allowed#'
path: packages/php-config-printer/src/PhpParser/NodeFactory/ConfiguratorClosureNodeFactory.php

- '#Method "processTokensByFixer\(\)" returns bool type, so the name should start with is/has/was#'

-
Expand Down Expand Up @@ -523,7 +520,6 @@ parameters:

# parallel
- '#popen(.*?)" is forbidden to use#'
- '#PHPDoc tag @param for parameter \$postFileCallback with type \(Closure\)\|null is not subtype of native type Closure#'

# json return
-
Expand Down Expand Up @@ -567,9 +563,6 @@ parameters:
- packages/symfony-static-dumper/src/Routing/RoutesProvider.php
- packages/autowire-array-parameter/src/DependencyInjection/DefinitionFinder.php

# node finder generics meshup
- '#Method Symplify\\Astral\\NodeFinder\\SimpleNodeFinder\:\:findFirstByType\(\) should return T of PhpParser\\Node\|null but returns PhpParser\\Node\|null#'

# false positive, due to scoped autoload of rector.php
- '#Call to an undefined method Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ServiceConfigurator\:\:configure\(\)#'

Expand Down

0 comments on commit 9f70dfd

Please sign in to comment.