Skip to content

Commit e5060ec

Browse files
authored
Merge pull request #7 from sasezaki/psalm5
support Psalm 5
2 parents 132b398 + 3d00d19 commit e5060ec

File tree

14 files changed

+114
-99
lines changed

14 files changed

+114
-99
lines changed

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/.github/ export-ignore
2+
/benchmark/ export-ignore
3+
/docs/ export-ignore
4+
/tests/ export-ignore
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.laminas-ci.json export-ignore
8+
/phpbench.json
9+
/phpcs.xml export-ignore
10+
/phpunit.xml.dist export-ignore
11+
/psalm.xml
12+
/psalm-baseline.xml
13+
/mkdocs.yml export-ignore
14+
15+
/examples/ export-ignore
16+
/vendor-bin/ export-ignore
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Automatic Releases"
2+
3+
on:
4+
milestone:
5+
types:
6+
- "closed"
7+
8+
jobs:
9+
release:
10+
uses: laminas/workflow-automatic-releases/.github/workflows/[email protected]
11+
secrets:
12+
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
13+
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
14+
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
15+
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}

Plugin.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

codeception.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ paths:
33
tests: tests
44
output: tests/_output
55
data: tests/_data
6-
support: tests/_support
6+
support: tests
77
envs: tests/_envs
88
actor_suffix: Tester
99
extensions:

composer.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
}
1212
],
1313
"require": {
14-
"php" : ">=7.2.0",
15-
"vimeo/psalm": "^4"
14+
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
15+
"ext-simplexml": "*",
16+
"vimeo/psalm": "^5"
1617
},
1718
"require-dev": {
1819
"psr/log": "^1.1",
19-
"squizlabs/php_codesniffer": "^3.3",
20-
"weirdan/codeception-psalm-module": "^0.13.1"
20+
"squizlabs/php_codesniffer": "^3.7",
21+
"weirdan/codeception-psalm-module": "^0.14.0"
2122
},
2223
"extra": {
2324
"psalm" : {
@@ -26,15 +27,22 @@
2627
},
2728
"autoload": {
2829
"psr-4": {
29-
"Sfp\\Psalm\\PsrLogPlugin\\": ["."]
30+
"Sfp\\Psalm\\PsrLogPlugin\\": "src"
3031
}
3132
},
3233
"autoload-dev": {
3334
"psr-4": {
34-
"SfpTest\\Psalm\\PsrLogPlugin\\": [
35-
"tests/_support",
36-
"tests/acceptance"
37-
]
35+
"SfpTest\\Psalm\\PsrLogPlugin\\": "tests"
36+
}
37+
},
38+
"config": {
39+
"sort-packages": true,
40+
"allow-plugins": {
41+
"dealerdirect/phpcodesniffer-composer-installer": true,
42+
"bamarni/composer-bin-plugin": true
43+
},
44+
"platform": {
45+
"php": "7.4.99"
3846
}
3947
},
4048
"scripts" : {

phpcs.xml.dist renamed to phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<arg name="colors"/>
66

77
<!-- Paths to check -->
8-
<file>Plugin.php</file>
8+
<file>src</file>
99

1010
<!-- inherit rules from: -->
1111
<rule ref="PSR12"/>

phpunit.xml.dist

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
11
<?xml version="1.0"?>
22
<psalm
3-
totallyTyped="true"
3+
errorLevel="1"
4+
findUnusedPsalmSuppress="true"
5+
findUnusedBaselineEntry="true"
6+
findUnusedCode="true"
47
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
58
xmlns="https://getpsalm.org/schema/config"
69
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
710
>
811
<projectFiles>
9-
<directory name="." />
12+
<directory name="src" />
1013
<ignoreFiles>
1114
<directory name="vendor" />
1215
</ignoreFiles>
1316
</projectFiles>
1417

1518
<issueHandlers>
16-
1719
<LessSpecificReturnType errorLevel="info" />
18-
19-
<PropertyNotSetInConstructor>
20-
<errorLevel type="suppress">
21-
<directory name="tests" />
22-
</errorLevel>
23-
</PropertyNotSetInConstructor>
24-
25-
<TypeCoercion>
26-
<errorLevel type="suppress">
27-
<directory name="tests" />
28-
</errorLevel>
29-
</TypeCoercion>
30-
20+
<UnnecessaryVarAnnotation errorLevel="suppress" />
3121
</issueHandlers>
3222
</psalm>

src/Plugin.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Sfp\Psalm\PsrLogPlugin;
4+
5+
use SimpleXMLElement;
6+
use Psalm\Plugin\PluginEntryPointInterface;
7+
use Psalm\Plugin\RegistrationInterface;
8+
9+
/**
10+
* @api
11+
* @psalm-suppress UnusedClass
12+
*/
13+
class Plugin implements PluginEntryPointInterface
14+
{
15+
public function __invoke(RegistrationInterface $psalm, SimpleXMLElement $config = null): void
16+
{
17+
if (isset($config->throwable) && ((bool)$config->throwable === true)) {
18+
$psalm->addStubFile(__DIR__ . '/../throwable-stubs/LoggerInterface.php');
19+
$psalm->addStubFile(__DIR__ . '/../throwable-stubs/AbstractLogger.php');
20+
} else {
21+
$psalm->addStubFile(__DIR__ . '/../stubs/LoggerInterface.php');
22+
$psalm->addStubFile(__DIR__ . '/../stubs/AbstractLogger.php');
23+
}
24+
}
25+
}

tests/_support/AcceptanceTester.php renamed to tests/AcceptanceTester.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
namespace SfpTest\Psalm\PsrLogPlugin;
44

5-
use Behat\Gherkin\Node\TableNode;
6-
use Codeception\Exception\TestRuntimeException;
7-
use PHPUnit\Framework\Assert;
8-
95
/**
106
* Inherited Methods
117
* @method void wantToTest($text)

0 commit comments

Comments
 (0)