Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 18, 2024
1 parent 1cab76b commit 57729c4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 123 deletions.
1 change: 0 additions & 1 deletion config/services/services.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
- Symplify\PHPStanRules\Composer\Psr4PathValidator
- Symplify\PHPStanRules\Formatter\RequiredWithMessageFormatter
- Symplify\PHPStanRules\Location\DirectoryChecker
- Symplify\PHPStanRules\Naming\BoolishNameAnalyser
- Symplify\PHPStanRules\Naming\ClassToSuffixResolver
- Symplify\PHPStanRules\NodeAnalyzer\AttributeFinder
- Symplify\PHPStanRules\NodeAnalyzer\EnumAnalyzer
Expand Down
74 changes: 1 addition & 73 deletions docs/rules_overview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 48 Rules Overview
# 46 Rules Overview

## AnnotateRegexClassConstWithRegexLinkRule

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

<br>

## BoolishClassMethodPrefixRule

Method `"%s()"` returns bool type, so the name should start with is/has/was...

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

```php
class SomeClass
{
public function old(): bool
{
return $this->age > 100;
}
}
```

:x:

<br>

```php
class SomeClass
{
public function isOld(): bool
{
return $this->age > 100;
}
}
```

:+1:

<br>

## CheckClassNamespaceFollowPsr4Rule

Class like namespace "%s" does not follow PSR-4 configuration in `composer.json`
Expand Down Expand Up @@ -616,44 +582,6 @@ interface RunnableInterface

<br>

## NoAbstractRule

Instead of abstract class, use specific service with composition

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

```php
final class NormalHelper extends AbstractHelper
{
}

abstract class AbstractHelper
{
}
```

:x:

<br>

```php
final class NormalHelper
{
public function __construct(
private SpecificHelper $specificHelper
) {
}
}

final class SpecificHelper
{
}
```

:+1:

<br>

## NoArrayAccessOnObjectRule

Use explicit methods over array access on object
Expand Down
49 changes: 0 additions & 49 deletions src/Naming/BoolishNameAnalyser.php

This file was deleted.

1 change: 1 addition & 0 deletions src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Rector\NodeTypeResolver\Node\AttributeKey;

/**
* @api used in rector rules
* @see \Symplify\PHPStanRules\Tests\ReturnTypeExtension\NodeGetAttributeTypeExtension\NodeGetAttributeTypeExtensionTest
*/
final class NodeGetAttributeTypeExtension implements DynamicMethodReturnTypeExtension
Expand Down
11 changes: 11 additions & 0 deletions stubs/Symfony/Component/Console/Command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Symfony\Component\Console\Command;

if (class_exists('Symfony\Component\Console\Command\Command')) {
return;
}

class Command
{
}

0 comments on commit 57729c4

Please sign in to comment.