Skip to content

Commit

Permalink
improve psalm analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
radarlog committed Dec 17, 2021
1 parent 305119b commit 0893150
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"require-dev": {
"phpstan/phpstan": "^0.12.92",
"phpunit/phpunit": "^7.3 || ^8.0 || ^9.0",
"psalm/plugin-phpunit": "^0.16.1",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.6",
"vimeo/psalm": "^4.8"
Expand All @@ -49,7 +50,7 @@
"tests": [
"vendor/bin/phpcs",
"vendor/bin/phpstan analyse --ansi",
"vendor/bin/psalm --taint-analysis",
"vendor/bin/psalm",
"vendor/bin/phpunit --coverage-text"
]
}
Expand Down
11 changes: 6 additions & 5 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<psalm
addParamDefaultToDocblockType="true"
allowNamedArgumentCalls="false"
allowPhpStormGenerics="true"
cacheDirectory="build/psalm.cache"
checkForThrowsDocblock="true"
checkForThrowsInGlobalScope="true"
ensureArrayIntOffsetsExist="true"
ensureArrayStringOffsetsExist="true"
Expand All @@ -15,7 +13,7 @@
forbidEcho="true"
ignoreInternalFunctionFalseReturn="false"
ignoreInternalFunctionNullReturn="false"
runTaintAnalysis="true"
reportMixedIssues="false"
strictBinaryOperands="true"
throwExceptionOnError="true"
useDocblockPropertyTypes="true"
Expand All @@ -25,11 +23,14 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
<directory name="tests/"/>
<ignoreFiles>
<directory name="vendor"/>
<directory name="vendor/"/>
</ignoreFiles>
</projectFiles>
</psalm>
2 changes: 1 addition & 1 deletion src/Gtin/Gtin12.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function length(): int
*/
public function prefix(): string
{
return substr($this->padded(), 1, 3);
return (string) substr($this->padded(), 1, 3);
}
}
2 changes: 1 addition & 1 deletion src/Gtin/Gtin13.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function length(): int
*/
public function prefix(): string
{
return substr($this->padded(), 1, 3);
return (string) substr($this->padded(), 1, 3);
}
}
2 changes: 1 addition & 1 deletion src/Gtin/Gtin14.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function length(): int
*/
public function prefix(): string
{
return substr($this->padded(), 1, 3);
return (string) substr($this->padded(), 1, 3);
}
}
2 changes: 1 addition & 1 deletion src/Gtin/Gtin8.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function length(): int
*/
public function prefix(): string
{
return substr($this->padded(), 6, 3);
return (string) substr($this->padded(), 6, 3);
}
}

0 comments on commit 0893150

Please sign in to comment.