mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Analyse scoped build with Psalm
This commit is contained in:
parent
025b7049fd
commit
83811e6e8a
@ -21,6 +21,12 @@ php -d memory_limit=-1 `which php-scoper` add-prefix --prefix='PsalmPhar' --outp
|
||||
# and optimize the loader
|
||||
composer dump-autoload --working-dir=build/psalm --classmap-authoritative --no-dev
|
||||
|
||||
chmod 755 build/psalm/psalm
|
||||
|
||||
cp bin/phar.psalm.xml build/psalm/psalm.xml
|
||||
|
||||
./build/psalm/psalm --config=build/psalm/psalm.xml --root=build/psalm
|
||||
|
||||
php -d memory_limit=-1 -d phar.readonly=0 `which box` compile
|
||||
|
||||
# clean up build
|
||||
|
60
bin/phar.psalm.xml
Normal file
60
bin/phar.psalm.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
name="Psalm for Psalm"
|
||||
useDocblockTypes="true"
|
||||
totallyTyped="true"
|
||||
strictBinaryOperands="false"
|
||||
rememberPropertyAssignmentsAfterCall="true"
|
||||
throwExceptionOnError="0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="../../config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<file name="src/Psalm/CallMap.php" />
|
||||
<directory name="src/Psalm/Stubs" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
|
||||
<issueHandlers>
|
||||
<MisplacedRequiredParam errorLevel="suppress" />
|
||||
<PossiblyNullOperand errorLevel="suppress" />
|
||||
<MissingConstructor errorLevel="suppress" />
|
||||
<DeprecatedProperty errorLevel="suppress" />
|
||||
|
||||
<LessSpecificReturnType>
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Psalm/Plugin.php" />
|
||||
</errorLevel>
|
||||
</LessSpecificReturnType>
|
||||
|
||||
<UnusedProperty>
|
||||
<errorLevel type="info">
|
||||
<file name="src/Psalm/FileManipulation/FunctionDocblockManipulator.php" />
|
||||
</errorLevel>
|
||||
</UnusedProperty>
|
||||
|
||||
<PossiblyUnusedProperty>
|
||||
<errorLevel type="info">
|
||||
<file name="src/Psalm/Storage/FunctionLikeStorage.php" />
|
||||
</errorLevel>
|
||||
</PossiblyUnusedProperty>
|
||||
|
||||
<PossiblyUnusedMethod>
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Psalm/Type/Atomic/GenericTrait.php" />
|
||||
<file name="src/Psalm/Plugin.php" />
|
||||
</errorLevel>
|
||||
<errorLevel type="info">
|
||||
<file name="src/Psalm/Codebase.php" />
|
||||
</errorLevel>
|
||||
</PossiblyUnusedMethod>
|
||||
|
||||
<PropertyNotSetInConstructor>
|
||||
<errorLevel type="suppress">
|
||||
<file name="src/Psalm/Config.php" />
|
||||
</errorLevel>
|
||||
</PropertyNotSetInConstructor>
|
||||
</issueHandlers>
|
||||
</psalm>
|
@ -57,17 +57,47 @@ return [
|
||||
|
||||
return $contents;
|
||||
},
|
||||
function ($filePath, $prefix, $contents) {
|
||||
if (strpos($filePath, realpath(__DIR__ . '/src/Psalm')) === 0) {
|
||||
return str_replace(
|
||||
[' \\Psalm\\', ' \\PhpParser\\'],
|
||||
[' \\' . $prefix . '\\Psalm\\', ' \\' . $prefix . '\\PhpParser\\'],
|
||||
$contents
|
||||
);
|
||||
}
|
||||
|
||||
return $contents;
|
||||
},
|
||||
function ($filePath, $prefix, $contents) {
|
||||
if (strpos($filePath, realpath(__DIR__ . '/vendor/openlss')) === 0) {
|
||||
return str_replace(
|
||||
$prefix . '\\DomDocument',
|
||||
'DomDocument',
|
||||
$contents
|
||||
);
|
||||
}
|
||||
|
||||
return $contents;
|
||||
},
|
||||
function ($filePath, $prefix, $contents) {
|
||||
if ($filePath === realpath(__DIR__ . '/src/Psalm/PropertyMap.php')
|
||||
|| $filePath === realpath(__DIR__ . '/src/Psalm/CallMap.php')
|
||||
|| $filePath === realpath(__DIR__ . '/src/Psalm/Stubs/CoreGenericFunctions.php')
|
||||
|| $filePath === realpath(__DIR__ . '/src/Psalm/Stubs/CoreGenericClasses.php')
|
||||
) {
|
||||
return str_replace(
|
||||
$contents = str_replace(
|
||||
['namespace ' . $prefix . ';', $prefix . '\\\\', $prefix . '\\'],
|
||||
'',
|
||||
$contents
|
||||
);
|
||||
|
||||
$contents = str_replace(
|
||||
['\'phpparser\\\\', 'PhpParser\\\\'],
|
||||
['\'' . strtolower($prefix) . '\\\\phpparser\\\\', $prefix . '\\\\PhpParser\\\\'],
|
||||
$contents
|
||||
);
|
||||
|
||||
return str_replace('Psalm\\\\', $prefix . '\\\\Psalm\\\\', $contents);
|
||||
}
|
||||
|
||||
return $contents;
|
||||
|
Loading…
Reference in New Issue
Block a user