phpstan-phpunit icon indicating copy to clipboard operation
phpstan-phpunit copied to clipboard

error about global side-effects in non-isolated tests

Open staabm opened this issue 1 month ago • 0 comments

I think it would be helpful if we could error in tests which trigger a global side-effect like e.g.

  • error_reporting(E_ALL) when not restored to the old value within the test, see example
  • things like registration of a shutdown/autoload/tick/error-handler/exception-handler/stream-wrapper/...-function without cleanup
  • changes in global/super-global variables

no error should appear in case such a pattern occurs in tests which a run using PHPUnit process isolation (@runInSeparateProcess, @runTestsInSeparateProcesses, etc)

staabm avatar Nov 19 '25 09:11 staabm