lint/dead-code/no-always-true-instanceof
In the dead-code set. Safe fix.
What it does
Remove instanceof checks and assert(instanceof) calls that are always true for the known type.
Configuration
[lint.rules]
"dead-code/no-always-true-instanceof" = "error"
To skip it in some files or lines, add an override or an ignore comment.
Options
| Name | Type | Allowed values | Default | Upstream name |
|---|---|---|---|---|
checks |
list |
assert, if |
["assert", "if"] |
None (Pun’s own) |
Replaces
RemoveDeadInstanceOf(rector)RemoveDeadInstanceOfAssert(rector)instanceof.alwaysTrue(phpstan)
Merged rules
These old IDs are now this rule. A config that still names one stops with an error. See merged rules.
lint/dead-code/no-always-true-instanceof-assert