Skip to content

Commit bf34b46

Browse files
committed
:octocat: reintroducing phan because phpstan keeps making trouble
1 parent 5477e12 commit bf34b46

21 files changed

+6853
-13
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
name: "Static Code Analysis"
2222
runs-on: ubuntu-latest
2323

24+
env:
25+
PHAN_ALLOW_XDEBUG: 0
26+
PHAN_DISABLE_XDEBUG_WARN: 1
27+
2428
strategy:
2529
fail-fast: true
2630
matrix:
@@ -37,19 +41,22 @@ jobs:
3741
uses: shivammathur/setup-php@v2
3842
with:
3943
php-version: ${{ matrix.php-version }}
40-
extensions: ${{ env.PHP_EXTENSIONS }}
44+
extensions: ast, ${{ env.PHP_EXTENSIONS }}
4145
ini-values: ${{ env.PHP_INI_VALUES }}
4246
coverage: none
4347

4448
- name: "Install dependencies with composer"
4549
uses: ramsey/composer-install@v3
4650

47-
- name: "Run PHPStan"
48-
run: php vendor/bin/phpstan
51+
- name: "Run phan"
52+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
4953

5054
- name: "Run PHP_CodeSniffer"
5155
run: php vendor/bin/phpcs
5256

57+
# - name: "Run PHPStan"
58+
# run: php vendor/bin/phpstan
59+
5360

5461
tests:
5562
name: "Unit Tests"

.phan/config.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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.2',
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+
'.phan/stubs',
31+
],
32+
33+
// A regex used to match every file name that you want to
34+
// exclude from parsing. Actual value will exclude every
35+
// "test", "tests", "Test" and "Tests" folders found in
36+
// "vendor/" directory.
37+
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
38+
39+
// A directory list that defines files that will be excluded
40+
// from static analysis, but whose class and method
41+
// information should be included.
42+
//
43+
// Generally, you'll want to include the directories for
44+
// third-party code (such as "vendor/") in this list.
45+
//
46+
// n.b.: If you'd like to parse but not analyze 3rd
47+
// party code, directories containing that code
48+
// should be added to both the `directory_list`
49+
// and `exclude_analysis_directory_list` arrays.
50+
'exclude_analysis_directory_list' => [
51+
'vendor/',
52+
'.phan/stubs',
53+
],
54+
'suppress_issue_types' => [
55+
'PhanAccessMethodInternal',
56+
'PhanAccessOverridesFinalConstant',
57+
'PhanDeprecatedClass',
58+
'PhanDeprecatedClassConstant',
59+
'PhanNoopNew',
60+
'PhanTypePossiblyInvalidDimOffset',
61+
],
62+
];

0 commit comments

Comments
 (0)