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
  • Loading branch information
TomasVotruba committed Feb 20, 2022
1 parent 8ebc489 commit 777643f
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 283 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 @@ -136,10 +136,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
34 changes: 1 addition & 33 deletions packages/phpstan-rules/docs/rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 134 Rules Overview
# 132 Rules Overview

## AnnotateRegexClassConstWithRegexLinkRule

Expand Down 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.

9 changes: 0 additions & 9 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,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 +518,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 +561,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 777643f

Please sign in to comment.