An abstract class, interface, trait or enum is instantiated with new
What it finds
An abstract class, interface, trait or enum is instantiated with new
<?phpabstract class Shape {}interface Drawable {}class Circle extends Shape {} $a = new Shape();tx0 reports: Shape is abstract and cannot be instantiated$b = new Drawable();tx0 reports: Drawable is an interface and cannot be instantiated$c = new Circle(); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/php:abstract-class-instantiated" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:abstract-class-instantiated] reason="..."tx0 explain tx0/php:abstract-class-instantiated shows the same in the terminal. Found a false positive? Report it.