Skip to content

Commit

Permalink
Add psalm to require dev and initial run
Browse files Browse the repository at this point in the history
  • Loading branch information
M1ke committed Feb 28, 2024
1 parent 4e9a8ce commit 5edb910
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"require-dev": {
"nyholm/psr7": "^1.0",
"codeception/codeception": "^5.0",
"codeception/module-asserts": "*"
"codeception/module-asserts": "*",
"vimeo/psalm": "^5"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 23 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
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"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<!-- This set can be removed by adding psalm-api tags -->
<PossiblyUnusedMethod errorLevel="suppress"/>
<PossiblyUnusedProperty errorLevel="suppress"/>
<UnusedClass errorLevel="suppress"/>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Extensions/ExceptionReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ protected function getParameterNames(ReflectionFunctionAbstract $reflection): ar
*
* @param mixed[] $values raw PHP values
*
* @return string[] formatted values
* @return list<string> formatted values
*/
protected function formatValues(array $values): array
{
Expand Down
6 changes: 5 additions & 1 deletion src/Model/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function __construct(int $timestamp, string $level, string $message, arra
*/
public function jsonSerialize(): array
{
return array_filter(get_object_vars($this));
// Avoids a psalm error for unused property on "data"
$out = array_merge(get_object_vars($this), [
'data' => $this->data,
]);
return array_filter($out);
}
}
4 changes: 2 additions & 2 deletions src/Model/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class Request implements JsonSerializable
public $query_string;

/**
* @var string|null cookie values (unparsed, as a string)
* @var array cookie values (unparsed, as a string)
*/
public $cookies;
public $cookies = [];

/**
* @var string[] map where header-name => header-value
Expand Down

0 comments on commit 5edb910

Please sign in to comment.