Skip to content

Commit

Permalink
Remove NoConstructorInTestRule as super narrow use case (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Oct 19, 2023
1 parent bd63c94 commit bb4027c
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 231 deletions.
1 change: 0 additions & 1 deletion config/static-rules.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
rules:
- Symplify\PHPStanRules\Rules\NoProtectedClassElementRule
- Symplify\PHPStanRules\Rules\ForbiddenExtendOfNonAbstractClassRule
- Symplify\PHPStanRules\Rules\NoConstructorInTestRule
- Symplify\PHPStanRules\Rules\Complexity\ForbiddenSameNamedNewInstanceRule

# domain
Expand Down
36 changes: 1 addition & 35 deletions docs/rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 49 Rules Overview
# 48 Rules Overview

## AnnotateRegexClassConstWithRegexLinkRule

Expand Down Expand Up @@ -688,40 +688,6 @@ class SomeClass

<br>

## NoConstructorInTestRule

Do not use constructor in tests. Move to `setUp()` method

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

```php
final class SomeTest
{
public function __construct()
{
// ...
}
}
```

:x:

<br>

```php
final class SomeTest
{
public function setUp()
{
// ...
}
}
```

:+1:

<br>

## NoDuplicatedShortClassNameRule

Class with base "%s" name is already used in "%s". Use unique name to make classes easy to recognize
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuite name="all">
<directory>tests</directory>
<exclude>tests/Rules/NoConstructorInTestRule/Fixture</exclude>
<exclude>tests/Rules/ClassNameRespectsParentSuffixRule/Fixture/</exclude>
</testsuite>
</phpunit>
5 changes: 0 additions & 5 deletions src/Enum/MethodName.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

final class MethodName
{
/**
* @var string
*/
public const CONSTRUCTOR = '__construct';

/**
* @var string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/ClassNameRespectsParentSuffixRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class ClassNameRespectsParentSuffixRule implements Rule, DocumentedRuleInt
];

/**
* @var class-string[]
* @var string[]
*/
private array $parentClasses = [];

Expand Down
93 changes: 0 additions & 93 deletions src/Rules/NoConstructorInTestRule.php

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions tests/Rules/NoConstructorInTestRule/Fixture/Test2/SomeTest.php

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bb4027c

Please sign in to comment.