Skip to content

Commit

Permalink
Suppress E_DEPRECATED in vendor files
Browse files Browse the repository at this point in the history
Aura.Sql currently not supported PHP 8.1
  • Loading branch information
koriym committed Nov 14, 2021
1 parent d5a2c9a commit dbf1f3d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
use Koriym\Attributes\AttributeReader;
use Ray\ServiceLocator\ServiceLocator;

require dirname(__DIR__) . '/vendor/autoload.php';

$rm = static function ($dir) use (&$rm) {
foreach ((array) glob($dir . '/*') as $file) {
$f = (string) $file;
is_dir($f) ? $rm($f) : @unlink($f);
@rmdir($f);
}
};

$rm(__DIR__ . '/tmp');

// Suppress E_DEPRECATED in vendor files
if (PHP_VERSION_ID >= 80100) {
set_error_handler(static function (int $errno, string $errstr, string $errfile) {
return $errno === E_DEPRECATED && str_contains($errfile, dirname(__DIR__) . '/vendor');
});
}

// no annotation in PHP 8
if (PHP_MAJOR_VERSION >= 8) {
ServiceLocator::setReader(new AttributeReader());
Expand Down

0 comments on commit dbf1f3d

Please sign in to comment.