You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update README and Rules documentation to clarify rules and add new rules
- Revised README to specify that all controllers must be `readonly` and clarified method argument limits.
- Enhanced Rules documentation with new rules for catching exceptions and naming conventions for boolean-returning methods.
- Corrected class names in configuration examples for consistency.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Additional rules for PHPStan, mostly focused on Clean Code and architecture conv
4
4
5
5
The rules help with enforcing certain method signatures, return types and dependency constraints in your codebase.
6
6
7
-
All controllers in your application should be `readonly`, no method should have more than 3 arguments, and no class should have more than 2 nested control structures.
7
+
For example, you can configure the rules so that all controllers in your application must be `readonly`, no method should have more than 3 arguments, and no class should have more than 2 nested control structures.
8
8
9
9
## Usage
10
10
@@ -21,6 +21,8 @@ See [Rules documentation](docs/Rules.md) for a list of available rules and confi
21
21
-[Readonly Class Rule](docs/Rules.md#readonly-class-rule)
22
22
-[Final Class Rule](docs/Rules.md#final-class-rule)
23
23
-[Namespace Class Pattern Rule](docs/Rules.md#namespace-class-pattern-rule)
24
+
-[Catch Exception of Type Not Allowed Rule](docs/Rules.md#catch-exception-of-type-not-allowed-rule)
25
+
-[Methods Returning Bool Must Follow Naming Convention Rule](docs/Rules.md#methods-returning-bool-must-follow-naming-convention-rule)
24
26
-[Method Signature Must Match Rule](docs/Rules.md#method-signature-must-match-rule)
25
27
-[Method Must Return Type Rule](docs/Rules.md#method-must-return-type-rule)
@@ -99,28 +99,42 @@ Ensures that classes inside namespaces matching a given regex must have names ma
99
99
- phpstan.rules.rule
100
100
```
101
101
102
-
## Catch Exception of Type Not Allowed Rule
102
+
## Catch Exception of Type Not Allowed Rule {#catch-exception-of-type-not-allowed-rule}
103
103
104
104
Ensures that specific exception types are not caught in catch blocks. This is useful for preventing the catching of overly broad exception types like `Exception`, `Error`, or `Throwable`.
## Methods Returning Bool Must Follow Naming Convention Rule {#methods-returning-bool-must-follow-naming-convention-rule}
117
+
118
+
Ensures that methods returning boolean values follow a specific naming convention. By default, boolean methods should start with `is`, `has`, `can`, `should`, `was`, or `will`.
0 commit comments