1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 12:24:49 +01:00

Move static code out of src

This commit is contained in:
Matt Brown 2020-10-12 00:59:19 -04:00 committed by Daniil Gentili
parent 01781af718
commit a531c2e450
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
18 changed files with 12 additions and 18 deletions

View File

@ -9,8 +9,8 @@
"src/psalm-refactor.php" "src/psalm-refactor.php"
], ],
"files-bin": ["config.xsd"], "files-bin": ["config.xsd"],
"directories-bin" : ["assets"], "directories-bin" : ["assets", "dictionaries", "stubs"],
"compactors" : [ "compactors" : [
"KevinGH\\Box\\Compactor\\PhpScoper" "KevinGH\\Box\\Compactor\\PhpScoper"
] ]
} }

View File

@ -20,13 +20,10 @@
<directory name="tests"/> <directory name="tests"/>
<directory name="examples"/> <directory name="examples"/>
<ignoreFiles> <ignoreFiles>
<file name="src/Psalm/Internal/CallMap.php"/>
<file name="src/Psalm/Internal/PhpTraverser/CustomTraverser.php"/> <file name="src/Psalm/Internal/PhpTraverser/CustomTraverser.php"/>
<file name="tests/ErrorBaselineTest.php"/> <file name="tests/ErrorBaselineTest.php"/>
<file name="vendor/symfony/console/Command/Command.php"/> <file name="vendor/symfony/console/Command/Command.php"/>
<file name="src/spl_object_id.php"/> <file name="src/spl_object_id.php"/>
<file name="src/Psalm/Internal/Stubs/*.php"/>
<file name="src/Psalm/Internal/Stubs/*.phpstub"/>
<directory name="tests/fixtures"/> <directory name="tests/fixtures"/>
<file name="vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php" /> <file name="vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php" />
<directory name="vendor/netresearch/jsonmapper" /> <directory name="vendor/netresearch/jsonmapper" />

View File

@ -83,10 +83,6 @@ return [
'Psalm\*', 'Psalm\*',
], ],
'files-whitelist' => [ 'files-whitelist' => [
'src/Psalm/Internal/PropertyMap.php',
'src/Psalm/Internal/CallMap.php',
'src/Psalm/Internal/Stubs/CoreGenericFunctions.phpstub',
'src/Psalm/Internal/Stubs/CoreGenericClasses.phpstub',
'src/spl_object_id.php', 'src/spl_object_id.php',
], ],
]; ];

View File

@ -1671,21 +1671,21 @@ class Config
$codebase->register_stub_files = true; $codebase->register_stub_files = true;
// note: don't realpath $generic_stubs_path, or phar version will fail // note: don't realpath $generic_stubs_path, or phar version will fail
$generic_stubs_path = __DIR__ . '/Internal/Stubs/CoreGenericFunctions.phpstub'; $generic_stubs_path = dirname(__DIR__, 2) . '/stubs/CoreGenericFunctions.phpstub';
if (!file_exists($generic_stubs_path)) { if (!file_exists($generic_stubs_path)) {
throw new \UnexpectedValueException('Cannot locate core generic stubs'); throw new \UnexpectedValueException('Cannot locate core generic stubs');
} }
// note: don't realpath $generic_classes_path, or phar version will fail // note: don't realpath $generic_classes_path, or phar version will fail
$generic_classes_path = __DIR__ . '/Internal/Stubs/CoreGenericClasses.phpstub'; $generic_classes_path = dirname(__DIR__, 2) . '/stubs/CoreGenericClasses.phpstub';
if (!file_exists($generic_classes_path)) { if (!file_exists($generic_classes_path)) {
throw new \UnexpectedValueException('Cannot locate core generic classes'); throw new \UnexpectedValueException('Cannot locate core generic classes');
} }
// note: don't realpath $generic_classes_path, or phar version will fail // note: don't realpath $generic_classes_path, or phar version will fail
$immutable_classes_path = __DIR__ . '/Internal/Stubs/CoreImmutableClasses.phpstub'; $immutable_classes_path = dirname(__DIR__, 2) . '/stubs/CoreImmutableClasses.phpstub';
if (!file_exists($immutable_classes_path)) { if (!file_exists($immutable_classes_path)) {
throw new \UnexpectedValueException('Cannot locate core immutable classes'); throw new \UnexpectedValueException('Cannot locate core immutable classes');
@ -1694,7 +1694,7 @@ class Config
$core_generic_files = [$generic_stubs_path, $generic_classes_path, $immutable_classes_path]; $core_generic_files = [$generic_stubs_path, $generic_classes_path, $immutable_classes_path];
if (\extension_loaded('ds')) { if (\extension_loaded('ds')) {
$ext_ds_path = __DIR__ . '/Internal/Stubs/ext-ds.php'; $ext_ds_path = dirname(__DIR__, 2) . '/stubs/ext-ds.php';
if (!file_exists($ext_ds_path)) { if (!file_exists($ext_ds_path)) {
throw new \UnexpectedValueException('Cannot locate core generic classes'); throw new \UnexpectedValueException('Cannot locate core generic classes');
@ -1722,7 +1722,7 @@ class Config
} }
if ($this->load_xdebug_stub) { if ($this->load_xdebug_stub) {
$xdebug_stub_path = __DIR__ . '/Internal/Stubs/Xdebug.php'; $xdebug_stub_path = dirname(__DIR__, 2) . '/stubs/Xdebug.php';
if (!file_exists($xdebug_stub_path)) { if (!file_exists($xdebug_stub_path)) {
throw new \UnexpectedValueException('Cannot locate XDebug stub'); throw new \UnexpectedValueException('Cannot locate XDebug stub');

View File

@ -12,6 +12,7 @@ use Psalm\Internal\Type\Comparator\UnionTypeComparator;
use Psalm\Storage\FunctionLikeParameter; use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type; use Psalm\Type;
use Psalm\Type\Atomic\TCallable; use Psalm\Type\Atomic\TCallable;
use function dirname;
use function strtolower; use function strtolower;
use function substr; use function substr;
use function version_compare; use function version_compare;
@ -354,7 +355,7 @@ class InternalCallMapHandler
} }
/** @var array<string, array<int|string, string>> */ /** @var array<string, array<int|string, string>> */
$call_map = require(__DIR__ . '/../CallMap.php'); $call_map = require(dirname(__DIR__, 4) . '/dictionaries/CallMap.php');
self::$call_map = []; self::$call_map = [];
@ -366,7 +367,7 @@ class InternalCallMapHandler
/** /**
* @var array<string, list<list<Type\TaintKind::*>>> * @var array<string, list<list<Type\TaintKind::*>>>
*/ */
$taint_map = require(__DIR__ . '/../InternalTaintSinkMap.php'); $taint_map = require(dirname(__DIR__, 4) . '/dictionaries/InternalTaintSinkMap.php');
foreach ($taint_map as $key => $value) { foreach ($taint_map as $key => $value) {
$cased_key = strtolower($key); $cased_key = strtolower($key);
@ -376,7 +377,7 @@ class InternalCallMapHandler
if (version_compare($analyzer_version, $current_version, '<')) { if (version_compare($analyzer_version, $current_version, '<')) {
// the following assumes both minor and major versions a single digits // the following assumes both minor and major versions a single digits
for ($i = $current_version_int; $i > $analyzer_version_int && $i >= self::LOWEST_AVAILABLE_DELTA; --$i) { for ($i = $current_version_int; $i > $analyzer_version_int && $i >= self::LOWEST_AVAILABLE_DELTA; --$i) {
$delta_file = __DIR__ . '/../CallMap_' . $i . '_delta.php'; $delta_file = dirname(__DIR__, 4) . '/dictionaries/CallMap_' . $i . '_delta.php';
if (!file_exists($delta_file)) { if (!file_exists($delta_file)) {
continue; continue;
} }

View File

@ -25,7 +25,7 @@ class PropertyMap
} }
/** @var array<string, array<string, string>> */ /** @var array<string, array<string, string>> */
$property_map = require(__DIR__ . '/../PropertyMap.php'); $property_map = require(\dirname(__DIR__, 4) . '/dictionaries/PropertyMap.php');
self::$property_map = []; self::$property_map = [];