Skip to content

Commit 3b3c435

Browse files
phpstan-botclaude
authored andcommitted
Add missing rule descriptions to README
The features table was missing descriptions for four rules that are implemented in src/ and registered in rules.neon: uselessCast, disallowedImplicitArrayCreation, strictArrayFilter, and illegalConstructorMethodCall. Also expanded the numericOperandsInArithmeticOperators description to include binary arithmetic operators (+, -, *, /, %, **) which were omitted. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e8e9032 commit 3b3c435

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
|:---------------------------------------|:--------------------------------------------------------------------------------------------------------|
1111
| `booleansInConditions` | Require booleans in `if`, `elseif`, ternary operator, after `!`, and on both sides of `&&` and `\|\|`. |
1212
| `booleansInLoopConditions` | Require booleans in `while` and `do while` loop conditions. |
13-
| `numericOperandsInArithmeticOperators` | Require numeric operand in `+$var`, `-$var`, `$var++`, `$var--`, `++$var` and `--$var`. |
13+
| `uselessCast` | Detect useless casts — e.g. casting to `int` when the expression is already `int`. |
14+
| `numericOperandsInArithmeticOperators` | Require numeric operands in `+`, `-`, `*`, `/`, `%`, `**`, `+$var`, `-$var`, `$var++`, `$var--`, `++$var` and `--$var`. |
1415
| `strictFunctionCalls` | These functions contain a `$strict` parameter for better type safety, it must be set to `true`:<br>* `in_array` (3rd parameter)<br>* `array_search` (3rd parameter)<br>* `array_keys` (3rd parameter; only if the 2nd parameter `$search_value` is provided)<br>* `base64_decode` (2nd parameter). |
1516
| `overwriteVariablesWithLoop` | * Disallow overwriting variables with `foreach` key and value variables.<br>* Disallow overwriting variables with `for` loop initial assignment. |
1617
| `switchConditionsMatchingType` | Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results. |
@@ -26,6 +27,9 @@
2627
| | Check LSP even for static methods. |
2728
| `requireParentConstructorCall` | Require calling parent constructor. |
2829
| `disallowedBacktick` | Disallow usage of backtick operator (`` $ls = `ls -la` ``). |
30+
| `disallowedImplicitArrayCreation` | Disallow implicit array creation through `$var[] =` when the variable does not exist yet. |
31+
| `strictArrayFilter` | Require `array_filter()` to have a callback parameter to avoid loose comparison semantics. |
32+
| `illegalConstructorMethodCall` | Disallow calling `__construct()` on an existing object or as a static call outside of parent constructor. |
2933
| `closureUsesThis` | Closure should use `$this` directly instead of using `$this` variable indirectly. |
3034

3135
Additional rules are coming in subsequent releases!

0 commit comments

Comments
 (0)