Skip to content

Commit 5edb910

Browse files
committed
Add psalm to require dev and initial run
1 parent 4e9a8ce commit 5edb910

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require-dev": {
1919
"nyholm/psr7": "^1.0",
2020
"codeception/codeception": "^5.0",
21-
"codeception/module-asserts": "*"
21+
"codeception/module-asserts": "*",
22+
"vimeo/psalm": "^5"
2223
},
2324
"autoload": {
2425
"psr-4": {

psalm.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="4"
4+
resolveFromConfigFile="true"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns="https://getpsalm.org/schema/config"
7+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8+
findUnusedBaselineEntry="true"
9+
findUnusedCode="true"
10+
>
11+
<projectFiles>
12+
<directory name="src" />
13+
<ignoreFiles>
14+
<directory name="vendor" />
15+
</ignoreFiles>
16+
</projectFiles>
17+
<issueHandlers>
18+
<!-- This set can be removed by adding psalm-api tags -->
19+
<PossiblyUnusedMethod errorLevel="suppress"/>
20+
<PossiblyUnusedProperty errorLevel="suppress"/>
21+
<UnusedClass errorLevel="suppress"/>
22+
</issueHandlers>
23+
</psalm>

src/Extensions/ExceptionReporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ protected function getParameterNames(ReflectionFunctionAbstract $reflection): ar
350350
*
351351
* @param mixed[] $values raw PHP values
352352
*
353-
* @return string[] formatted values
353+
* @return list<string> formatted values
354354
*/
355355
protected function formatValues(array $values): array
356356
{

src/Model/Breadcrumb.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function __construct(int $timestamp, string $level, string $message, arra
4444
*/
4545
public function jsonSerialize(): array
4646
{
47-
return array_filter(get_object_vars($this));
47+
// Avoids a psalm error for unused property on "data"
48+
$out = array_merge(get_object_vars($this), [
49+
'data' => $this->data,
50+
]);
51+
return array_filter($out);
4852
}
4953
}

src/Model/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class Request implements JsonSerializable
2525
public $query_string;
2626

2727
/**
28-
* @var string|null cookie values (unparsed, as a string)
28+
* @var array cookie values (unparsed, as a string)
2929
*/
30-
public $cookies;
30+
public $cookies = [];
3131

3232
/**
3333
* @var string[] map where header-name => header-value

0 commit comments

Comments
 (0)