Skip to content

Commit 6994b2d

Browse files
Merge pull request #17 from weierophinney/feature/psalm-integration
Provide Psalm integration
2 parents d36e99a + 457d75d commit 6994b2d

11 files changed

+3137
-1068
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
"laminas/laminas-coding-standard": "~2.2.0",
5454
"laminas/laminas-db": "^2.8.1",
5555
"phpspec/prophecy-phpunit": "^2.0",
56-
"phpunit/phpunit": "^9.3"
56+
"phpunit/phpunit": "^9.3",
57+
"psalm/plugin-phpunit": "^0.16.0",
58+
"vimeo/psalm": "^4.7"
5759
},
5860
"autoload": {
5961
"psr-4": {

composer.lock

Lines changed: 2624 additions & 999 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

psalm-baseline.xml

Lines changed: 402 additions & 0 deletions
Large diffs are not rendered by default.

psalm.xml.dist

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
totallyTyped="true"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns="https://getpsalm.org/schema/config"
6+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7+
errorBaseline="psalm-baseline.xml"
8+
>
9+
<projectFiles>
10+
<directory name="config"/>
11+
<directory name="src"/>
12+
<directory name="test"/>
13+
<ignoreFiles>
14+
<directory name="vendor"/>
15+
</ignoreFiles>
16+
</projectFiles>
17+
18+
<issueHandlers>
19+
<InternalMethod>
20+
<errorLevel type="suppress">
21+
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::method"/>
22+
</errorLevel>
23+
<errorLevel type="suppress">
24+
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::willReturn"/>
25+
</errorLevel>
26+
<errorLevel type="suppress">
27+
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::with"/>
28+
</errorLevel>
29+
</InternalMethod>
30+
</issueHandlers>
31+
32+
<plugins>
33+
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
34+
</plugins>
35+
</psalm>

src/ContentValidationListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ public function onRoute(MvcEvent $e)
334334
* Add HTTP Method without body content
335335
*
336336
* @param string $method
337+
* @return void
337338
*/
338339
public function addMethodWithoutBody($method)
339340
{
@@ -396,10 +397,9 @@ protected function removeEmptyData(array $data, array $compareTo = [])
396397
* Callback for array_filter() to remove null values (array_filter() removes 'false' values)
397398
*
398399
* @param mixed $value
399-
* @param null $key
400-
* @return bool
400+
* @param null|int|string $key
401401
*/
402-
$removeNull = function ($value, $key = null) use ($compareTo) {
402+
$removeNull = function ($value, $key = null) use ($compareTo): bool {
403403
// If comparison array is empty, do a straight comparison
404404
if (empty($compareTo)) {
405405
return null !== $value;

src/Validator/Db/NoRecordExistsFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function createService(ServiceLocatorInterface $validators)
5555
* Implemented for backwards compatibility.
5656
*
5757
* @param array $options
58+
* @return void
5859
*/
5960
public function setCreationOptions(array $options)
6061
{

src/Validator/Db/RecordExistsFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function createService(ServiceLocatorInterface $validators)
5555
* Implemented for backwards compatibility.
5656
*
5757
* @param array $options
58+
* @return void
5859
*/
5960
public function setCreationOptions(array $options)
6061
{

0 commit comments

Comments
 (0)