Skip to content

Commit

Permalink
Move static code out of src
Browse files Browse the repository at this point in the history
muglug committed Oct 12, 2020
1 parent 3967872 commit 929be80
Showing 18 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions box.json.dist
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
"src/psalm-refactor.php"
],
"files-bin": ["config.xsd"],
"directories-bin" : ["assets"],
"directories-bin" : ["assets", "dictionaries", "stubs"],
"compactors" : [
"KevinGH\\Box\\Compactor\\PhpScoper"
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -20,13 +20,10 @@
<directory name="tests"/>
<directory name="examples"/>
<ignoreFiles>
<file name="src/Psalm/Internal/CallMap.php"/>
<file name="src/Psalm/Internal/PhpTraverser/CustomTraverser.php"/>
<file name="tests/ErrorBaselineTest.php"/>
<file name="vendor/symfony/console/Command/Command.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"/>
<file name="vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php" />
<directory name="vendor/netresearch/jsonmapper" />
4 changes: 0 additions & 4 deletions scoper.inc.php
Original file line number Diff line number Diff line change
@@ -83,10 +83,6 @@ function ($filePath, $prefix, $contents) {
'Psalm\*',
],
'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',
],
];
10 changes: 5 additions & 5 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
@@ -1713,21 +1713,21 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):
$codebase->register_stub_files = true;

// 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)) {
throw new \UnexpectedValueException('Cannot locate core generic stubs');
}

// 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)) {
throw new \UnexpectedValueException('Cannot locate core generic classes');
}

// 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)) {
throw new \UnexpectedValueException('Cannot locate core immutable classes');
@@ -1736,7 +1736,7 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):
$core_generic_files = [$generic_stubs_path, $generic_classes_path, $immutable_classes_path];

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)) {
throw new \UnexpectedValueException('Cannot locate core generic classes');
@@ -1764,7 +1764,7 @@ public function visitStubFiles(Codebase $codebase, ?Progress $progress = null):
}

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)) {
throw new \UnexpectedValueException('Cannot locate XDebug stub');
7 changes: 4 additions & 3 deletions src/Psalm/Internal/Codebase/InternalCallMapHandler.php
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type;
use Psalm\Type\Atomic\TCallable;
use function dirname;
use function strtolower;
use function substr;
use function version_compare;
@@ -355,7 +356,7 @@ public static function getCallMap(): array
}

/** @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 = [];

@@ -367,7 +368,7 @@ public static function getCallMap(): array
/**
* @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) {
$cased_key = strtolower($key);
@@ -377,7 +378,7 @@ public static function getCallMap(): array
if (version_compare($analyzer_version, $current_version, '<')) {
// 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) {
$delta_file = __DIR__ . '/../CallMap_' . $i . '_delta.php';
$delta_file = dirname(__DIR__, 4) . '/dictionaries/CallMap_' . $i . '_delta.php';
if (!file_exists($delta_file)) {
continue;
}
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Codebase/PropertyMap.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public static function getPropertyMap(): array
}

/** @var array<string, array<string, string>> */
$property_map = require(__DIR__ . '/../PropertyMap.php');
$property_map = require(\dirname(__DIR__, 4) . '/dictionaries/PropertyMap.php');

self::$property_map = [];

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 929be80

Please sign in to comment.