Severity Line Message
  Medium 3 An abstract class should contain Abstract in its name, preferably as a prefix (found in abstract class CompleteExample)
abstract class CompleteExample
  Low 5 Try to avoid using the mixed type if possible, which is too lax (found in property i)
  Low 5 The property i seems to have a short name, ensure it is explicit enough
public mixed $i;
  High 9 The type of property bar is missing
private $bar;
  Low 16 Try to avoid using the mixed return type if possible, which is too lax (found in method process)
public function process(): mixed
  High 18 Using yoda-style condition with >, >=, < and <= operators is extremely complicated to read and must be avoided
if (0 < $this->i) {
  High 19 Calling function system could be dangerous if user data is passed to it
\system('ifconfig');
  Low 22 Calling get_class() can be replaced most of the time by calling ::class on the object
  High 22 Identical operator ===/!== should always be used in place of equal operator ==/!=
} elseif (\is_object($this->i) && 'string' == \get_class($this->i)) {
  High 26 Calling function shell_exec could be dangerous if user data is passed to it
\shell_exec('ls');
  High 31 The return type of method start is missing
public function start()
  High 33 Calling function passthru could be dangerous if user data is passed to it
\passthru('ps aux');
  High 34 Calling var_dump(), dump() and dd() must be avoided in production code, remember to remove this call
\var_dump($this->bar);
  Low 37 The method it seems to have a short name, ensure it is explicit enough
private function it(): never

This analyzer can detect...

  • No class defined in the input
  • Interfaces not containing Interface in their name
  • Use of mixed as property type
  • Class that may have too many lines of code
  • Calls to var_dump that must be avoided in production
  • Use of equal operator == instead of identical operator ===
  • Property name that may have a name too short and not explicit enough
  • Use of mixed method return type
  • Missing method return type
  • Problematic order of operands when using yoda-style condition
  • Use of get_class() instead of ::class
  • Multiple classes defined in the input
  • Method name that may have a name too short and not explicit enough
  • Class defining too many public methods
  • Missing property type
  • Potentially dangerous calls, such as system, exec and alike
  • Abstract classes not containing Abstract in their name
  • Class defining too many properties methods
  • More to come!