Skip to content

Commit fe393f0

Browse files
authored
Merge pull request #4 from sasezaki/psalm4up
Psalm 4
2 parents 9a80a98 + 8ee0915 commit fe393f0

File tree

5 files changed

+54
-56
lines changed

5 files changed

+54
-56
lines changed

Plugin.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
class Plugin implements PluginEntryPointInterface
1010
{
11-
/** @return void */
12-
public function __invoke(RegistrationInterface $psalm, ?SimpleXMLElement $config = null)
11+
public function __invoke(RegistrationInterface $psalm, SimpleXMLElement $config = null) : void
1312
{
1413
if (isset($config->throwable) && ((bool)$config->throwable === true)) {
1514
$psalm->addStubFile(__DIR__ . '/throwable-stubs/LoggerInterface.php');

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
],
1313
"require": {
1414
"php" : ">=7.2.0",
15-
"vimeo/psalm": "^3.5"
15+
"vimeo/psalm": "^4"
1616
},
1717
"require-dev": {
1818
"psr/log": "^1.1",
1919
"squizlabs/php_codesniffer": "^3.3",
20-
"codeception/base": "^3.1",
21-
"weirdan/codeception-psalm-module": "^0.2.2"
20+
"weirdan/codeception-psalm-module": "^0.13.1"
2221
},
2322
"extra": {
2423
"psalm" : {

tests/acceptance.suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ modules:
1010
- Cli
1111
- Filesystem
1212
- \Weirdan\Codeception\Psalm\Module
13-
- \SfpTest\Psalm\PsrLogPlugin\Helper\Acceptance
13+
- \SfpTest\Psalm\PsrLogPlugin\Helper\Acceptance

tests/acceptance/ExceptionAcceptance.feature

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: Exception
44
Given I have the following config
55
"""
66
<?xml version="1.0"?>
7-
<psalm totallyTyped="true">
7+
<psalm>
88
<projectFiles>
99
<directory name="."/>
1010
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
@@ -57,22 +57,22 @@ Feature: Exception
5757
When I run Psalm
5858
Then I see these errors
5959
| Type | Message |
60-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Exception}, array{exception: string(foo)} provided |
61-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Exception}, array{exception: string(foo)} provided |
62-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Exception}, array{exception: string(foo)} provided |
63-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, array{exception: string(foo)} provided |
64-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Exception}, array{exception: string(foo)} provided |
65-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Exception}, array{exception: string(foo)} provided |
66-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Exception}, array{exception: string(foo)} provided |
67-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Exception}, array{exception: string(foo)} provided |
68-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Exception}, array{exception: Error} provided |
69-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Exception}, array{exception: Error} provided |
70-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Exception}, array{exception: Error} provided |
71-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, array{exception: Error} provided |
72-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Exception}, array{exception: Error} provided |
73-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Exception}, array{exception: Error} provided |
74-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Exception}, array{exception: Error} provided |
75-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Exception}, array{exception: Error} provided |
60+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Exception}, but array{exception: "foo"} provided |
61+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Exception}, but array{exception: "foo"} provided |
62+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Exception}, but array{exception: "foo"} provided |
63+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, but array{exception: "foo"} provided |
64+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Exception}, but array{exception: "foo"} provided |
65+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Exception}, but array{exception: "foo"} provided |
66+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Exception}, but array{exception: "foo"} provided |
67+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Exception}, but array{exception: "foo"} provided |
68+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Exception}, but array{exception: Error} provided |
69+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Exception}, but array{exception: Error} provided |
70+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Exception}, but array{exception: Error} provided |
71+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, but array{exception: Error} provided |
72+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Exception}, but array{exception: Error} provided |
73+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Exception}, but array{exception: Error} provided |
74+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Exception}, but array{exception: Error} provided |
75+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Exception}, but array{exception: Error} provided |
7676
And I see no other errors
7777

7878
Scenario: `exception` key is actually an Exception Object AS per AbstractLogger
@@ -98,20 +98,20 @@ Feature: Exception
9898
When I run Psalm
9999
Then I see these errors
100100
| Type | Message |
101-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Exception}, array{exception: string(foo)} provided |
102-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Exception}, array{exception: string(foo)} provided |
103-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Exception}, array{exception: string(foo)} provided |
104-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Exception}, array{exception: string(foo)} provided |
105-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Exception}, array{exception: string(foo)} provided |
106-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Exception}, array{exception: string(foo)} provided |
107-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Exception}, array{exception: string(foo)} provided |
108-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Exception}, array{exception: string(foo)} provided |
109-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Exception}, array{exception: Error} provided |
110-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Exception}, array{exception: Error} provided |
111-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Exception}, array{exception: Error} provided |
112-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Exception}, array{exception: Error} provided |
113-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Exception}, array{exception: Error} provided |
114-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Exception}, array{exception: Error} provided |
115-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Exception}, array{exception: Error} provided |
116-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Exception}, array{exception: Error} provided |
101+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Exception}, but array{exception: "foo"} provided |
102+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Exception}, but array{exception: "foo"} provided |
103+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Exception}, but array{exception: "foo"} provided |
104+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Exception}, but array{exception: "foo"} provided |
105+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Exception}, but array{exception: "foo"} provided |
106+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Exception}, but array{exception: "foo"} provided |
107+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Exception}, but array{exception: "foo"} provided |
108+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Exception}, but array{exception: "foo"} provided |
109+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Exception}, but array{exception: Error} provided |
110+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Exception}, but array{exception: Error} provided |
111+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Exception}, but array{exception: Error} provided |
112+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Exception}, but array{exception: Error} provided |
113+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Exception}, but array{exception: Error} provided |
114+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Exception}, but array{exception: Error} provided |
115+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Exception}, but array{exception: Error} provided |
116+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Exception}, but array{exception: Error} provided |
117117
And I see no other errors

tests/acceptance/ThrowableAcceptance.feature

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: Throwable
44
Given I have the following config
55
"""
66
<?xml version="1.0"?>
7-
<psalm totallyTyped="true">
7+
<psalm>
88
<projectFiles>
99
<directory name="."/>
1010
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>
@@ -59,14 +59,14 @@ Feature: Throwable
5959
When I run Psalm
6060
Then I see these errors
6161
| Type | Message |
62-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Throwable}, array{exception: string(foo)} provided |
63-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Throwable}, array{exception: string(foo)} provided |
64-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Throwable}, array{exception: string(foo)} provided |
65-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Throwable}, array{exception: string(foo)} provided |
66-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Throwable}, array{exception: string(foo)} provided |
67-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Throwable}, array{exception: string(foo)} provided |
68-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Throwable}, array{exception: string(foo)} provided |
69-
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Throwable}, array{exception: string(foo)} provided |
62+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::emergency expects array{exception?: Throwable}, but array{exception: "foo"} provided |
63+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::alert expects array{exception?: Throwable}, but array{exception: "foo"} provided |
64+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::critical expects array{exception?: Throwable}, but array{exception: "foo"} provided |
65+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Throwable}, but array{exception: "foo"} provided |
66+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::warning expects array{exception?: Throwable}, but array{exception: "foo"} provided |
67+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::notice expects array{exception?: Throwable}, but array{exception: "foo"} provided |
68+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::info expects array{exception?: Throwable}, but array{exception: "foo"} provided |
69+
| InvalidArgument | Argument 2 of Psr\Log\LoggerInterface::debug expects array{exception?: Throwable}, but array{exception: "foo"} provided |
7070
And I see no other errors
7171

7272
Scenario: `exception` key is actually an Throwable Object AS per AbstractLogger
@@ -92,12 +92,12 @@ Feature: Throwable
9292
When I run Psalm
9393
Then I see these errors
9494
| Type | Message |
95-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Throwable}, array{exception: string(foo)} provided |
96-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Throwable}, array{exception: string(foo)} provided |
97-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Throwable}, array{exception: string(foo)} provided |
98-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Throwable}, array{exception: string(foo)} provided |
99-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Throwable}, array{exception: string(foo)} provided |
100-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Throwable}, array{exception: string(foo)} provided |
101-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Throwable}, array{exception: string(foo)} provided |
102-
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Throwable}, array{exception: string(foo)} provided |
95+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::emergency expects array{exception?: Throwable}, but array{exception: "foo"} provided |
96+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::alert expects array{exception?: Throwable}, but array{exception: "foo"} provided |
97+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::critical expects array{exception?: Throwable}, but array{exception: "foo"} provided |
98+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::error expects array{exception?: Throwable}, but array{exception: "foo"} provided |
99+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::warning expects array{exception?: Throwable}, but array{exception: "foo"} provided |
100+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::notice expects array{exception?: Throwable}, but array{exception: "foo"} provided |
101+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::info expects array{exception?: Throwable}, but array{exception: "foo"} provided |
102+
| InvalidArgument | Argument 2 of Psr\Log\AbstractLogger::debug expects array{exception?: Throwable}, but array{exception: "foo"} provided |
103103
And I see no other errors

0 commit comments

Comments
 (0)