Skip to content

Commit 5b6a902

Browse files
wip
1 parent 14c45e5 commit 5b6a902

File tree

7 files changed

+91
-53
lines changed

7 files changed

+91
-53
lines changed

.github/workflows/phpstan.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
pull_request:
9+
paths:
10+
- '**.php'
11+
- 'phpstan.neon.dist'
12+
13+
14+
jobs:
15+
phpstan:
16+
name: phpstan
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.2'
25+
coverage: none
26+
27+
- name: Install composer dependencies
28+
uses: ramsey/composer-install@v2
29+
30+
- name: Run PHPStan
31+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/psalm.yml

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

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
],
1818
"require": {
1919
"php": "^8.0",
20-
"nikic/php-parser": "^4.13",
20+
"nikic/php-parser": "^4.13|^5.0",
2121
"phpdocumentor/type-resolver": "^1.6.2",
2222
"symfony/process": "^5.2|^6.0|^7.0"
2323
},
2424
"require-dev": {
2525
"friendsofphp/php-cs-fixer": "^3.40",
26+
"phpstan/extension-installer": "^1.1",
2627
"larapack/dd": "^1.1",
2728
"myclabs/php-enum": "^1.7",
2829
"pestphp/pest": "^1.22",
2930
"phpunit/phpunit": "^9.0",
3031
"spatie/data-transfer-object": "^2.0",
3132
"spatie/enum": "^3.0",
3233
"spatie/pest-plugin-snapshots": "^1.1",
33-
"spatie/temporary-directory": "^1.2|^2.0",
34-
"vimeo/psalm": "^4.2"
34+
"spatie/temporary-directory": "^1.2|^2.0"
3535
},
3636
"autoload": {
3737
"psr-4": {
@@ -44,6 +44,7 @@
4444
}
4545
},
4646
"scripts": {
47+
"analyse" : "vendor/bin/phpstan analyse",
4748
"test": "vendor/bin/pest",
4849
"test-coverage": "vendor/bin/pest --coverage",
4950
"psalm": "./vendor/bin/psalm -c psalm.xml",
@@ -52,7 +53,8 @@
5253
"config": {
5354
"sort-packages": true,
5455
"allow-plugins": {
55-
"pestphp/pest-plugin": true
56+
"pestphp/pest-plugin": true,
57+
"phpstan/extension-installer": false
5658
}
5759
},
5860
"minimum-stability": "dev",

phpstan-baseline.neon

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(PhpParser\\\\Node\\)\\: mixed\\)\\|null, Closure\\(PhpParser\\\\Node\\\\Stmt\\\\Class_\\|PhpParser\\\\Node\\\\Stmt\\\\Enum_\\|PhpParser\\\\Node\\\\Stmt\\\\Interface_\\|PhpParser\\\\Node\\\\Stmt\\\\Trait_\\)\\: \\(string\\|null\\) given\\.$#"
5+
count: 1
6+
path: src/Actions/ResolveClassesInPhpFileAction.php
7+
8+
-
9+
message: "#^Instanceof between phpDocumentor\\\\Reflection\\\\Type and phpDocumentor\\\\Reflection\\\\Types\\\\ClassString will always evaluate to false\\.$#"
10+
count: 1
11+
path: src/Actions/TranspileTypeToTypeScriptAction.php
12+
13+
-
14+
message: "#^If condition is always true\\.$#"
15+
count: 1
16+
path: src/Attributes/TypeScriptType.php
17+
18+
-
19+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
20+
count: 1
21+
path: src/Attributes/TypeScriptType.php
22+
23+
-
24+
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(ReflectionEnumUnitCase\\)\\: mixed\\)\\|null, Closure\\(ReflectionEnumBackedCase\\)\\: non\\-falsy\\-string given\\.$#"
25+
count: 1
26+
path: src/Transformers/EnumTransformer.php
27+
28+
-
29+
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(ReflectionEnumUnitCase\\)\\: mixed\\)\\|null, Closure\\(ReflectionEnumBackedCase\\)\\: string given\\.$#"
30+
count: 1
31+
path: src/Transformers/EnumTransformer.php
32+
33+
-
34+
message: "#^Method Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\:\\:new\\(\\) should return static\\(Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\) but returns Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\MethodParameterTypeReflector\\.$#"
35+
count: 1
36+
path: src/TypeReflectors/TypeReflector.php
37+
38+
-
39+
message: "#^Method Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\:\\:new\\(\\) should return static\\(Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\) but returns Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\MethodReturnTypeReflector\\.$#"
40+
count: 1
41+
path: src/TypeReflectors/TypeReflector.php
42+
43+
-
44+
message: "#^Method Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\:\\:new\\(\\) should return static\\(Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\TypeReflector\\) but returns Spatie\\\\TypeScriptTransformer\\\\TypeReflectors\\\\PropertyTypeReflector\\.$#"
45+
count: 1
46+
path: src/TypeReflectors/TypeReflector.php

phpstan.neon.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
level: 5
3+
paths:
4+
- src
5+
tmpDir: build/phpstan
6+
reportUnmatchedIgnoredErrors: true
7+
checkMissingIterableValueType: true

psalm.xml

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

src/Actions/ResolveClassesInPhpFileAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ResolveClassesInPhpFileAction
1818

1919
public function __construct()
2020
{
21-
$this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
21+
$this->parser = (new ParserFactory())->createForHostVersion();
2222
}
2323

2424
public function execute(SplFileInfo $file): array

0 commit comments

Comments
 (0)