Skip to content

Commit 7d7f092

Browse files
committed
Use PHPStan instead of Psalm
1 parent 914c770 commit 7d7f092

File tree

9 files changed

+35
-37
lines changed

9 files changed

+35
-37
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
php-versions: ['7.2', '7.3', '7.4']
10+
php-versions: ['7.4']
1111
dependencies:
1212
- lowest
1313
- highest
1414

1515
name: phpunit (${{ matrix.php-versions }}-${{ matrix.dependencies }})
1616

1717
steps:
18-
- uses: actions/checkout@v2.3.4
18+
- uses: actions/checkout@v4.2.2
1919

20-
- uses: shivammathur/setup-php@2.15.0
20+
- uses: shivammathur/setup-php@2.31.1
2121
with:
2222
php-version: ${{ matrix.php-versions }}
2323
coverage: none
2424
if: matrix.php-versions != '7.4' || matrix.dependencies != 'highest'
2525

26-
- uses: shivammathur/setup-php@2.15.0
26+
- uses: shivammathur/setup-php@2.31.1
2727
with:
2828
php-version: ${{ matrix.php-versions }}
2929
coverage: pcov
@@ -56,8 +56,8 @@ jobs:
5656
runs-on: ubuntu-latest
5757

5858
steps:
59-
- uses: actions/checkout@v2.3.4
60-
- uses: shivammathur/setup-php@2.15.0
59+
- uses: actions/checkout@v4.2.2
60+
- uses: shivammathur/setup-php@2.31.1
6161
with:
6262
php-version: 7.4
6363
coverage: none
@@ -69,18 +69,18 @@ jobs:
6969
- name: Run PHP Codesniffer
7070
run: vendor/bin/phpcs --report=checkstyle -q | cs2pr --graceful-warnings
7171

72-
psalm:
72+
phpstan:
7373
runs-on: ubuntu-latest
7474

7575
steps:
76-
- uses: actions/checkout@v2.3.4
77-
- uses: shivammathur/setup-php@2.15.0
76+
- uses: actions/checkout@v4.2.2
77+
- uses: shivammathur/setup-php@2.31.1
7878
with:
7979
php-version: 7.4
8080
coverage: none
8181

8282
- name: Install dependencies
8383
run: composer install
8484

85-
- name: Run Psalm
86-
run: vendor/bin/psalm --output-format=github
85+
- name: Run PHPStan
86+
run: vendor/bin/phpstan

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
"php_codesniffer",
1515
"gitlab",
1616
"code quality",
17+
"code climate",
1718
"report"
1819
],
1920
"minimum-stability": "stable",
2021
"require": {
2122
"ext-json": "*"
2223
},
2324
"require-dev": {
25+
"phpstan/phpstan": "^2.0",
2426
"phpunit/phpunit": "^8.0 || ^9.0",
25-
"squizlabs/php_codesniffer": "^3.3.1",
26-
"vimeo/psalm": "^4.3"
27+
"squizlabs/php_codesniffer": "^3.3.1"
2728
},
2829
"autoload": {
2930
"psr-4": {

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
parameters:
3+
level: 8
4+
paths:
5+
- src
6+
- tests
7+
scanDirectories:
8+
- vendor/squizlabs/php_codesniffer

psalm.xml.dist

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

src/Report/Gitlab.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright (c) 2020, Michel Hunziker <[email protected]>
4+
* @copyright Copyright (c) 2025, Michel Hunziker <[email protected]>
55
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD-3-Clause License
66
*/
77

@@ -21,7 +21,7 @@
2121
class Gitlab implements Report
2222
{
2323
/**
24-
* @psalm-suppress ImplementedParamTypeMismatch PHP_CodeSniffer has a wrong docblock
24+
* @param array{filename: string, errors: int, warnings: int, fixable: int, messages: array<mixed>} $report
2525
*/
2626
public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80)
2727
{

tests/Fixtures/MixedViolations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright (c) 2020, Michel Hunziker <[email protected]>
4+
* @copyright Copyright (c) 2025, Michel Hunziker <[email protected]>
55
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD-3-Clause License
66
*/
77

tests/Fixtures/ReportFixture.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright (c) 2020, Michel Hunziker <[email protected]>
4+
* @copyright Copyright (c) 2025, Michel Hunziker <[email protected]>
55
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD-3-Clause License
66
*/
77

@@ -11,6 +11,9 @@
1111

1212
interface ReportFixture
1313
{
14+
/**
15+
* @return array{filename: string, errors: int, warnings: int, fixable: int, messages: array<mixed>}
16+
*/
1417
public function getReportData(): array;
1518

1619
public function getExpectedOutput(): string;

tests/Fixtures/SingleViolation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright (c) 2020, Michel Hunziker <[email protected]>
4+
* @copyright Copyright (c) 2025, Michel Hunziker <[email protected]>
55
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD-3-Clause License
66
*/
77

tests/Report/GitlabTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* @copyright Copyright (c) 2020, Michel Hunziker <[email protected]>
4+
* @copyright Copyright (c) 2025, Michel Hunziker <[email protected]>
55
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD-3-Clause License
66
*/
77

@@ -47,6 +47,9 @@ public function testGenerateWithEmpty(): void
4747
$this->report->generate('', 5, 0, 0, 0);
4848
}
4949

50+
/**
51+
* @return array<string, array<class-string<ReportFixture>>>
52+
*/
5053
public function violations(): array
5154
{
5255
return [
@@ -56,6 +59,7 @@ public function violations(): array
5659
}
5760

5861
/**
62+
* @param class-string<ReportFixture> $class
5963
* @covers \Micheh\PhpCodeSniffer\Report\Gitlab::generateFileReport
6064
* @dataProvider violations
6165
*/

0 commit comments

Comments
 (0)