mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 23:00:28 -04:00
Add Safe PHP functions
This commit is contained in:
parent
04a956886a
commit
58cc098058
260 changed files with 49458 additions and 45 deletions
32
vendor/thecodingmachine/phpstan-safe-rule/src/Utils/FunctionListLoader.php
vendored
Normal file
32
vendor/thecodingmachine/phpstan-safe-rule/src/Utils/FunctionListLoader.php
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace TheCodingMachine\Safe\PHPStan\Utils;
|
||||
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\FunctionReflection;
|
||||
use PHPStan\Reflection\MethodReflection;
|
||||
|
||||
class FunctionListLoader
|
||||
{
|
||||
private static $functions;
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getFunctionList(): array
|
||||
{
|
||||
if (self::$functions === null) {
|
||||
if (\file_exists(__DIR__.'/../../../safe/generated/functionsList.php')) {
|
||||
$functions = require __DIR__.'/../../../safe/generated/functionsList.php';
|
||||
} elseif (\file_exists(__DIR__.'/../../vendor/thecodingmachine/safe/generated/functionsList.php')) {
|
||||
$functions = require __DIR__.'/../../vendor/thecodingmachine/safe/generated/functionsList.php';
|
||||
} else {
|
||||
throw new \RuntimeException('Could not find thecodingmachine/safe\'s functionsList.php file.');
|
||||
}
|
||||
// Let's index these functions by their name
|
||||
self::$functions = \Safe\array_combine($functions, $functions);
|
||||
}
|
||||
return self::$functions;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue