MIR1708
ImpureStaticPropertyAccess
An impure function reads a static property, making it dependent on external state that can change unexpectedly.
Example
Section titled “Example”<?phpclass Config { public static $debug = false;}
function isDevelopment(): bool { return Config::$debug; // Depends on external static state}How to fix
Section titled “How to fix”Pass dependencies explicitly or use dependency injection:
<?phpclass Config { private bool $debug;
public function __construct(bool $debug) { $this->debug = $debug; }
public function isDevelopment(): bool { return $this->debug; }}