Skip to content

Commit a3f0eb8

Browse files
committed
:octocat: run phan alongside
1 parent 1264aaa commit a3f0eb8

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: shivammathur/setup-php@v2
4343
with:
4444
php-version: ${{ matrix.php-version }}
45-
extensions: ${{ env.PHP_EXTENSIONS }}
45+
extensions: ast, var_representation, ${{ env.PHP_EXTENSIONS }}
4646
ini-values: ${{ env.PHP_INI_VALUES }}
4747
coverage: none
4848

@@ -55,6 +55,9 @@ jobs:
5555
- name: "Run PHP_CodeSniffer"
5656
run: php vendor/bin/phpcs -v
5757

58+
- name: "Run phan"
59+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
60+
5861
# - name: "Run PHPStan"
5962
# run: php vendor/bin/phpstan
6063

.phan/config.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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' => '7.4',
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+
'PhanDeprecatedFunction',
54+
'PhanAccessMethodInternal',
55+
],
56+
];

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
"ext-curl": "*",
4040
"ext-json": "*",
4141
"ext-sodium": "*",
42+
"phan/phan": "^5.5.2",
4243
"phpmd/phpmd": "^2.15",
43-
"phpstan/phpstan": "^2.1.27",
44+
"phpstan/phpstan": "^2.1.32",
4445
"phpstan/phpstan-deprecation-rules": "^2.0.3",
4546
"phpunit/phpunit": "^9.6",
4647
"slevomat/coding-standard": "^8.23",
@@ -60,6 +61,7 @@
6061
}
6162
},
6263
"scripts": {
64+
"phan": "@php vendor/bin/phan",
6365
"phpcs": "@php vendor/bin/phpcs",
6466
"phpunit": "@php vendor/bin/phpunit",
6567
"phpstan": "@php vendor/bin/phpstan",

src/Authenticators/HOTP.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
class HOTP extends AuthenticatorAbstract{
2929

30+
/** @phan-suppress-next-line PhanAccessOverridesFinalConstant */
3031
public const MODE = self::HOTP;
3132

3233
public function getCounter(?int $data = null):int{

0 commit comments

Comments
 (0)