Skip to content

Commit

Permalink
Improved static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 3, 2020
1 parent 70d6d9d commit a3b4718
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/phpstan.src.neon.dist export-ignore
/phpstan.tests.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/README.md export-ignore
/UPGRADING.md export-ignore
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ phpstan-analyze-tests:
psalm-analyze:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli

psalm-baseline:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --set-baseline=psalm-baseline.xml

psalm-show-info:
@docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:7.4-cli --show-info=true

Expand Down
25 changes: 25 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.2.1@ea9cb72143b77e7520c52fa37290bd8d8bc88fd9">
<file src="src/Parser/EntryParser.php">
<MissingClosureReturnType occurrences="1">
<code>static function (array $data) {</code>
</MissingClosureReturnType>
</file>
<file src="src/Repository/RepositoryBuilder.php">
<InvalidStringClass occurrences="3">
<code>$adapter::create()</code>
<code>$reader::create()</code>
<code>$writer::create()</code>
</InvalidStringClass>
<MissingClosureReturnType occurrences="3">
<code>static function ($adapter) {</code>
<code>static function ($reader) {</code>
<code>static function ($writer) {</code>
</MissingClosureReturnType>
</file>
<file src="src/Util/Regex.php">
<UndefinedFunction occurrences="1">
<code>\preg_last_error_msg()</code>
</UndefinedFunction>
</file>
</files>
3 changes: 2 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"phpstan/phpstan": "0.12.58",
"phpstan/extension-installer": "1.0.5",
"phpstan/phpstan-deprecation-rules": "0.12.5",
"phpstan/phpstan-phpunit": "~0.12.11",
"phpstan/phpstan-phpunit": "0.12.16",
"phpstan/phpstan-strict-rules": "0.12.5",
"thecodingmachine/phpstan-strict-rules": "0.12.1"
},
Expand Down

0 comments on commit a3b4718

Please sign in to comment.