Skip to content

Commit

Permalink
Adding Psalm (#2706)
Browse files Browse the repository at this point in the history
* Adding Psalm

* Do composer install

* Install psalm phar

* typo

* typo

* Test psalm

* Added make file

* remove from composer.json

* minor

* revert order
  • Loading branch information
Nyholm committed Jul 10, 2020
1 parent a88a06b commit 59dada7
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/static.yml
Expand Up @@ -34,3 +34,27 @@ jobs:
uses: OskarStark/php-cs-fixer-ga@2.16.3.1
with:
args: --dry-run --diff-format udiff

psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
tools: composer:v2

- name: Checkout code
uses: actions/checkout@v2

- name: Download dependencies
run: |
composer require --dev --no-update psalm/phar:3.12.1
composer update --no-interaction --prefer-dist
- name: Psalm
run: |
./vendor/bin/psalm.phar --version
./vendor/bin/psalm.phar --output-format=github --no-progress --show-info=false --stats
5 changes: 4 additions & 1 deletion Makefile
Expand Up @@ -63,7 +63,10 @@ tag:
git commit -m '$(TAG) release'
chag tag

static: static-phpstan static-codestyle-check
static: static-phpstan static-psalm static-codestyle-check

static-psalm:
docker run --rm -it -v ${PWD}:/app -w /app vimeo/psalm-github-actions

static-phpstan:
docker run --rm -it -e REQUIRE_DEV=true -v ${PWD}:/app -w /app oskarstark/phpstan-ga:0.12.31 analyze $(PHPSTAN_PARAMS)
Expand Down
87 changes: 87 additions & 0 deletions psalm.baseline.xml
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.11.5@3c60609c218d4d4b3b257728b8089094e5c6c6c2">
<file src="src/Client.php">
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
<PossiblyUndefinedVariable occurrences="1">
<code>$options</code>
</PossiblyUndefinedVariable>
<UndefinedInterfaceMethod occurrences="1">
<code>getBoundary</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Cookie/CookieJar.php">
<PossiblyFalseOperand occurrences="1">
<code>$result</code>
</PossiblyFalseOperand>
</file>
<file src="src/Exception/RequestException.php">
<ImplicitToStringCast occurrences="1">
<code>$uri</code>
</ImplicitToStringCast>
</file>
<file src="src/Handler/CurlFactory.php">
<ImplicitToStringCast occurrences="1">
<code>$easy-&gt;request-&gt;getUri()</code>
</ImplicitToStringCast>
<TypeDoesNotContainType occurrences="1">
<code>$timeoutRequiresNoSignal &amp;&amp; \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN'</code>
</TypeDoesNotContainType>
</file>
<file src="src/Handler/CurlMultiHandler.php">
<InvalidArgument occurrences="1">
<code>$this-&gt;active</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1">
<code>$this-&gt;active</code>
</InvalidPropertyAssignmentValue>
<UndefinedThisPropertyAssignment occurrences="1">
<code>$this-&gt;_mh</code>
</UndefinedThisPropertyAssignment>
</file>
<file src="src/Handler/MockHandler.php">
<InvalidScalarArgument occurrences="1">
<code>$options['delay'] * 1000</code>
</InvalidScalarArgument>
</file>
<file src="src/Handler/StreamHandler.php">
<ImplicitToStringCast occurrences="1">
<code>$uri</code>
</ImplicitToStringCast>
</file>
<file src="src/HandlerStack.php">
<PropertyTypeCoercion occurrences="4">
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
<code>$this-&gt;stack</code>
</PropertyTypeCoercion>
</file>
<file src="src/MessageFormatter.php">
<InvalidScalarArgument occurrences="1"/>
</file>
<file src="src/Middleware.php">
<InvalidArgument occurrences="1">
<code>$request</code>
</InvalidArgument>
</file>
<file src="src/RedirectMiddleware.php">
<ImplicitToStringCast occurrences="1">
<code>$location</code>
</ImplicitToStringCast>
</file>
<file src="src/RetryMiddleware.php">
<TooManyArguments occurrences="1">
<code>($this-&gt;delay)(++$options['retries'], $response)</code>
</TooManyArguments>
</file>
<file src="src/Utils.php">
<ForbiddenCode occurrences="1">
<code>\var_dump($input)</code>
</ForbiddenCode>
<PossiblyNullArgument occurrences="1">
<code>$info</code>
</PossiblyNullArgument>
</file>
</files>
16 changes: 16 additions & 0 deletions psalm.xml
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
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" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

0 comments on commit 59dada7

Please sign in to comment.