Skip to content

Commit 6a06448

Browse files
committed
:octocat: phan (again)
1 parent cb9b9b9 commit 6a06448

File tree

3 files changed

+74
-5
lines changed

3 files changed

+74
-5
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ jobs:
3030
name: "Static Code Analysis"
3131
runs-on: ubuntu-latest
3232

33+
env:
34+
PHAN_ALLOW_XDEBUG: 0
35+
PHAN_DISABLE_XDEBUG_WARN: 1
36+
3337
strategy:
3438
fail-fast: true
3539
matrix:
3640
php-version:
3741
- "8.1"
3842
- "8.2"
3943
- "8.3"
44+
- "8.4"
4045

4146
steps:
4247
- name: "Checkout"
@@ -46,7 +51,7 @@ jobs:
4651
uses: shivammathur/setup-php@v2
4752
with:
4853
php-version: ${{ matrix.php-version }}
49-
extensions: ${{ env.PHP_EXTENSIONS }}
54+
extensions: ast, ${{ env.PHP_EXTENSIONS }}
5055
ini-values: ${{ env.PHP_INI_VALUES }}
5156
coverage: none
5257

@@ -56,6 +61,12 @@ jobs:
5661
- name: "Install dependencies with composer"
5762
uses: ramsey/composer-install@v3
5863

64+
- name: "Run PHP_CodeSniffer"
65+
run: php vendor/bin/phpcs -v
66+
67+
- name: "Run phan"
68+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
69+
5970
- name: "Run PHPStan"
6071
run: php vendor/bin/phpstan
6172

@@ -75,6 +86,7 @@ jobs:
7586
- "8.1"
7687
- "8.2"
7788
- "8.3"
89+
- "8.4"
7890

7991
steps:
8092
- name: "Checkout"
@@ -95,7 +107,7 @@ jobs:
95107
run: php vendor/bin/phpunit --colors=always --configuration=phpunit.xml.dist
96108

97109
# - name: "Send code coverage report to Codecov.io"
98-
# uses: codecov/codecov-action@v4
110+
# uses: codecov/codecov-action@v5
99111
# with:
100112
# token: ${{ secrets.CODECOV_TOKEN }}
101113
# files: .build/coverage/clover.xml

.phan/config.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* This configuration will be read and overlaid on top of the
4+
* default configuration. Command-line arguments will be applied
5+
* after this file is read.
6+
*/
7+
return [
8+
// If this is set to `null`,
9+
// then Phan assumes the PHP version which is closest to the minor version
10+
// of the php executable used to execute Phan.
11+
//
12+
// Note that the **only** effect of choosing `'5.6'` is to infer
13+
// that functions removed in php 7.0 exist.
14+
// (See `backward_compatibility_checks` for additional options)
15+
'target_php_version' => null,
16+
'minimum_target_php_version' => '8.1',
17+
18+
// A list of directories that should be parsed for class and
19+
// method information. After excluding the directories
20+
// defined in exclude_analysis_directory_list, the remaining
21+
// files will be statically analyzed for errors.
22+
//
23+
// Thus, both first-party and third-party code being used by
24+
// your application should be included in this list.
25+
'directory_list' => [
26+
'examples',
27+
'src',
28+
'tests',
29+
'vendor',
30+
],
31+
32+
// A regex used to match every file name that you want to
33+
// exclude from parsing. Actual value will exclude every
34+
// "test", "tests", "Test" and "Tests" folders found in
35+
// "vendor/" directory.
36+
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
37+
38+
// A directory list that defines files that will be excluded
39+
// from static analysis, but whose class and method
40+
// information should be included.
41+
//
42+
// Generally, you'll want to include the directories for
43+
// third-party code (such as "vendor/") in this list.
44+
//
45+
// n.b.: If you'd like to parse but not analyze 3rd
46+
// party code, directories containing that code
47+
// should be added to both the `directory_list`
48+
// and `exclude_analysis_directory_list` arrays.
49+
'exclude_analysis_directory_list' => [
50+
'vendor',
51+
],
52+
'suppress_issue_types' => [
53+
'PhanUndeclaredGlobalVariable', // likely happens in examples
54+
],
55+
];

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
"php": "^8.1"
3434
},
3535
"require-dev": {
36+
"phan/phan": "^5.5.0",
3637
"phpmd/phpmd": "^2.15",
37-
"phpstan/phpstan": "^1.12",
38-
"phpstan/phpstan-deprecation-rules": "^1.2",
38+
"phpstan/phpstan": "^2.1.22",
39+
"phpstan/phpstan-deprecation-rules": "^2.0.3",
3940
"phpunit/phpunit": "^10.5",
4041
"slevomat/coding-standard": "^8.15",
4142
"squizlabs/php_codesniffer": "^3.10"
@@ -53,7 +54,8 @@
5354
}
5455
},
5556
"scripts": {
56-
"phpcs": "@php vendor/bin/phpcs",
57+
"phan": "@php vendor/bin/phan",
58+
"phpcs": "@php vendor/bin/phpcs -v",
5759
"phpstan": "@php vendor/bin/phpstan",
5860
"phpstan-baseline": "@php vendor/bin/phpstan --generate-baseline",
5961
"phpunit": "@php vendor/bin/phpunit"

0 commit comments

Comments
 (0)