Skip to content

Commit c2b7983

Browse files
committed
Psalm fixes
1 parent 212fea2 commit c2b7983

File tree

4 files changed

+88
-9
lines changed

4 files changed

+88
-9
lines changed

DependencyInjection/WpSymfonyRouterExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ private function registerRouterConfiguration(
8484
$annotationsConfigEnabled = $container->getParameter('enable_annotations');
8585

8686
if ($config['default_uri'] === null) {
87-
$host = $container->getParameter('kernel.http.host');
88-
$schema = $container->getParameter('kernel.schema');
87+
$host = (string)$container->getParameter('kernel.http.host');
88+
$schema = (string)$container->getParameter('kernel.schema');
8989
$config['default_uri'] = $schema . '://' . $host . '/';
9090
}
9191

Services/Annotations/SearchAnnotatedClasses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646
*/
4747
public function collect() : array
4848
{
49-
if (!$this->paths) {
49+
if (count($this->paths) === 0) {
5050
return [];
5151
}
5252

Services/Utils/DispatchRoute.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DispatchRoute
4242
private $request;
4343

4444
/**
45-
* @var Response $response Response.
45+
* @var Response | null $response Response.
4646
*/
4747
private $response;
4848

@@ -57,12 +57,12 @@ class DispatchRoute
5757
private $controllerResolver;
5858

5959
/**
60-
* @var RouteCollection
60+
* @var RouteCollection | null $routes
6161
*/
6262
private $routes;
6363

6464
/**
65-
* @var RequestContext
65+
* @var RequestContext $requestContext
6666
*/
6767
private $requestContext;
6868

@@ -300,12 +300,12 @@ public function setHeaders(array $headers) : self
300300
private function addSubscribers(array $subscribers = []) : void
301301
{
302302
foreach ($subscribers as $subscriber) {
303+
/** @psalm-suppress DocblockTypeContradiction */
303304
if (!is_object($subscriber)) {
304305
continue;
305306
}
306-
/**
307-
* @var EventSubscriberInterface $subscriber
308-
*/
307+
308+
/** @var EventSubscriberInterface $subscriber */
309309
$this->dispatcher->addSubscriber($subscriber);
310310
}
311311
}

psalm.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="3"
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+
allowStringToStandInForClass="true"
9+
allowCoercionFromStringToClassConst="true"
10+
findUnusedPsalmSuppress="true"
11+
skipChecksOnUnresolvableIncludes="true"
12+
>
13+
<plugins>
14+
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
15+
<pluginClass class="Psalm\MockeryPlugin\Plugin"/>
16+
</plugins>
17+
<projectFiles>
18+
<directory name="/"/>
19+
<ignoreFiles>
20+
<directory name="vendor"/>
21+
<directory name="Tests"/>
22+
<file name="DependencyInjection/Configuration.php"/>
23+
</ignoreFiles>
24+
</projectFiles>
25+
<issueHandlers>
26+
<InvalidCatch>
27+
<errorLevel type="suppress">
28+
<referencedClass name="Psr\SimpleCache\InvalidArgumentException"/>
29+
<referencedClass name="Psr\Cache\InvalidArgumentException"/>
30+
</errorLevel>
31+
</InvalidCatch>
32+
<InvalidThrow>
33+
<errorLevel type="suppress">
34+
<referencedClass name="Psr\SimpleCache\InvalidArgumentException"/>
35+
<referencedClass name="Psr\Cache\InvalidArgumentException"/>
36+
</errorLevel>
37+
</InvalidThrow>
38+
<UnusedVariable>
39+
<errorLevel type="suppress">
40+
<directory name="/"/>
41+
</errorLevel>
42+
</UnusedVariable>
43+
<UndefinedConstant>
44+
<errorLevel type="suppress">
45+
<directory name="/"/>
46+
</errorLevel>
47+
</UndefinedConstant>
48+
<MissingDependency>
49+
<errorLevel type="suppress">
50+
<directory name="/"/>
51+
</errorLevel>
52+
</MissingDependency>
53+
<UndefinedClass>
54+
<errorLevel type="suppress">
55+
<directory name="/"/>
56+
</errorLevel>
57+
</UndefinedClass>
58+
<PropertyNotSetInConstructor>
59+
<errorLevel type="suppress">
60+
<directory name="/"/>
61+
</errorLevel>
62+
</PropertyNotSetInConstructor>
63+
<ImplicitToStringCast>
64+
<errorLevel type="suppress">
65+
<directory name="/"/>
66+
</errorLevel>
67+
</ImplicitToStringCast>
68+
<LessSpecificReturnStatement>
69+
<errorLevel type="suppress">
70+
<directory name="/"/>
71+
</errorLevel>
72+
</LessSpecificReturnStatement>
73+
<MoreSpecificReturnType>
74+
<errorLevel type="suppress">
75+
<directory name="/"/>
76+
</errorLevel>
77+
</MoreSpecificReturnType>
78+
</issueHandlers>
79+
</psalm>

0 commit comments

Comments
 (0)