Skip to content

Commit

Permalink
Fix PHPStan detection
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Sep 22, 2018
1 parent f71ea74 commit d91395c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/bootstrap.php
Expand Up @@ -4,7 +4,9 @@
require __DIR__ . '/../vendor/autoload.php';

// detect PHPStan
if (!isset($_ENV['IS_PHPSTAN'])) {
if (getenv('IS_PHPSTAN') !== false) {
$_ENV['IS_PHPSTAN'] = in_array(strtolower(getenv('IS_PHPSTAN')), ['1', 'true', 'yes', 'on'], true);
} else {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$_ENV['IS_PHPSTAN'] = (bool) preg_match('~[/\\\\]phpstan(?:\.phar)?$~', end($trace)['file'] ?? '');
}
Expand Down

0 comments on commit d91395c

Please sign in to comment.