Skip to content

Commit 610cdff

Browse files
committed
:octocat: dependency update
1 parent 56530b1 commit 610cdff

13 files changed

Lines changed: 115 additions & 29 deletions

.github/workflows/ci.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,49 @@ jobs:
2020

2121
static-code-analysis:
2222
name: "Static Code Analysis"
23-
2423
runs-on: ubuntu-latest
2524

25+
# env:
26+
# PHAN_ALLOW_XDEBUG: 0
27+
# PHAN_DISABLE_XDEBUG_WARN: 1
28+
2629
strategy:
2730
fail-fast: true
2831
matrix:
2932
php-version:
3033
- "8.1"
3134
- "8.2"
3235
- "8.3"
33-
# - "8.4"
36+
- "8.4"
37+
- "8.5"
3438

3539
steps:
3640
- name: "Checkout"
37-
uses: actions/checkout@v4
41+
uses: actions/checkout@v6
3842

3943
- name: "Install PHP"
4044
uses: shivammathur/setup-php@v2
4145
with:
4246
php-version: ${{ matrix.php-version }}
43-
extensions: ${{ env.PHP_EXTENSIONS }}
47+
extensions: ast, ${{ env.PHP_EXTENSIONS }}
4448
ini-values: ${{ env.PHP_INI_VALUES }}
4549
coverage: none
4650

47-
- name: "Update dependencies with composer"
48-
uses: ramsey/composer-install@v3
51+
- name: "Validate composer.json"
52+
run: composer validate --no-interaction --ansi --verbose --with-dependencies
4953

50-
- name: "Run PHPStan"
51-
run: php vendor/bin/phpstan
54+
- name: "Install dependencies with composer"
55+
uses: ramsey/composer-install@v3
5256

53-
- name: "Run PHP_CodeSniffer"
57+
- name: "Run PHPCodeSniffer"
5458
run: php vendor/bin/phpcs
5559

60+
- name: "Run phan"
61+
run: php vendor/bin/phan --target-php-version=${{ matrix.php-version }}
62+
63+
# - name: "Run PHPStan"
64+
# run: php vendor/bin/phpstan
65+
5666

5767
build-docs:
5868
name: "Build and publish Docs"
@@ -61,7 +71,7 @@ jobs:
6171

6272
steps:
6373
- name: "Checkout sources"
64-
uses: actions/checkout@v4
74+
uses: actions/checkout@v6
6575

6676
- name: "Install PHP"
6777
uses: shivammathur/setup-php@v2
@@ -99,10 +109,11 @@ jobs:
99109
- "8.2"
100110
- "8.3"
101111
- "8.4"
112+
- "8.5"
102113

103114
steps:
104115
- name: "Checkout"
105-
uses: actions/checkout@v4
116+
uses: actions/checkout@v6
106117

107118
- name: "Install PHP with extensions"
108119
uses: shivammathur/setup-php@v2
@@ -122,7 +133,7 @@ jobs:
122133
run: php vendor/phpunit/phpunit/phpunit --configuration=phpunit.xml.dist
123134

124135
- name: "Send code coverage report to Codecov.io"
125-
uses: codecov/codecov-action@v4
136+
uses: codecov/codecov-action@v5
126137
with:
127138
token: ${{ secrets.CODECOV_TOKEN }}
128139
files: .build/coverage/clover.xml

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

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737
"require-dev": {
3838
"ext-curl": "*",
3939
"chillerlan/phpunit-http": "^1.0",
40-
"guzzlehttp/guzzle": "^7.8",
40+
"guzzlehttp/guzzle": "^7.10",
41+
"phan/phan": "^6.0.2",
4142
"phpmd/phpmd": "^2.15",
42-
"phpstan/phpstan": "^1.11",
43-
"phpstan/phpstan-deprecation-rules": "^1.2",
43+
"phpstan/phpstan": "^2.1.42",
44+
"phpstan/phpstan-deprecation-rules": "^2.0.4",
4445
"phpunit/phpunit": "^10.5",
45-
"slevomat/coding-standard": "^8.15",
46-
"squizlabs/php_codesniffer": "^3.10"
46+
"slevomat/coding-standard": "^8.28",
47+
"squizlabs/php_codesniffer": "^4.0"
4748
},
4849
"suggest": {
4950
"chillerlan/php-httpinterface": "A PSR-18 HTTP client implementation",
@@ -61,7 +62,9 @@
6162
}
6263
},
6364
"scripts": {
64-
"phpcs": "@php vendor/bin/phpcs",
65+
"phan": "@php vendor/bin/phan",
66+
"phpcs": "@php vendor/bin/phpcs -v",
67+
"phpmd": "@php vendor/bin/phpmd src text ./phpmd.xml.dist",
6568
"phpstan": "@php vendor/bin/phpstan",
6669
"phpstan-baseline": "@php vendor/bin/phpstan --generate-baseline",
6770
"phpunit": "@php vendor/bin/phpunit"

phpcs.xml.dist

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@
112112
<exclude-pattern>tests/ServerUtilTest.php</exclude-pattern>
113113
</rule>
114114

115-
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
115+
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
116116
<properties>
117-
<property name="withSpaces" value="no"/>
118117
<property name="shortNullable" value="no"/>
119118
<property name="nullPosition" value="last"/>
120119
</properties>
@@ -147,8 +146,6 @@
147146
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
148147
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
149148
<!--<rule ref="Generic.Formatting.MultipleStatementAlignment"/>-->
150-
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
151-
<rule ref="Generic.Functions.CallTimePassByReference"/>
152149
<rule ref="Generic.NamingConventions.InterfaceNameSuffix"/>
153150
<rule ref="Generic.NamingConventions.TraitNameSuffix"/>
154151
<rule ref="Generic.PHP.BacktickOperator"/>
@@ -183,7 +180,6 @@
183180

184181

185182
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
186-
<rule ref="Squiz.Classes.DuplicateProperty"/>
187183
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
188184
<rule ref="Squiz.Classes.SelfMemberReference"/>
189185
<rule ref="Squiz.Commenting.DocCommentAlignment"/>

src/HeaderUtil.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ protected static function normalizeKV(mixed $value):array{
124124
*
125125
* @param array<int, scalar|null> $values
126126
* @return array<int, string> $values
127+
* @phan-suppress PhanTypeMismatchReturn
127128
*/
128129
public static function trimValues(array $values):array{
129130

src/QueryUtil.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public static function cleanParams(
5757

5858
if(is_iterable($value)){
5959
// recursion
60+
/** @phan-suppress-next-line PhanTypeMismatchArgument */
6061
$cleaned[$key] = call_user_func_array(__METHOD__, [$value, $bool_cast, $remove_empty]);
6162
}
6263
elseif(is_bool($value)){
@@ -231,9 +232,10 @@ public static function parse(string $querystring, int|null $urlEncoding = null):
231232
/**
232233
* Recursive rawurlencode
233234
*
234-
* @param string|array<int, scalar|null> $data
235+
* @param scalar|array<int, scalar|null> $data
235236
* @return string|string[]
236237
* @throws \InvalidArgumentException
238+
* @phan-suppress PhanTypeMismatchDeclaredParamNullable
237239
*/
238240
public static function recursiveRawurlencode(mixed $data):array|string{
239241

src/ServerUtil.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function createServerRequestFromGlobals():ServerRequestInterface{
7272
->withCookieParams($_COOKIE)
7373
->withQueryParams($_GET)
7474
->withParsedBody($_POST)
75+
/** @phan-suppress-next-line PhanTypeMismatchArgument */
7576
->withUploadedFiles($this->normalizeFiles($_FILES))
7677
;
7778
}

src/StreamUtil.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ public static function tryFopen(string $filename, string $mode, mixed $context =
197197
throw $exception;
198198
}
199199

200+
/** @phan-suppress-next-line PhanPossiblyUndeclaredVariable */
200201
return $handle;
201202
}
202203

@@ -222,6 +223,7 @@ public static function tryGetContents($stream, int|null $length = null, int $off
222223
set_error_handler($errorHandler);
223224

224225
try{
226+
/** @phan-suppress-next-line PhanTypeMismatchArgumentNullableInternal */
225227
$contents = stream_get_contents($stream, $length, $offset);
226228

227229
if($contents === false){
@@ -239,6 +241,7 @@ public static function tryGetContents($stream, int|null $length = null, int $off
239241
throw $exception;
240242
}
241243

244+
/** @phan-suppress-next-line PhanPossiblyUndeclaredVariable */
242245
return $contents;
243246
}
244247

tests/CookieTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testSameSiteInvalidValueException():void{
154154
public function testSameSiteNoneWithoutSecureException():void{
155155
$this->expectException(InvalidArgumentException::class);
156156
$this->expectExceptionMessage('The same site attribute can only be "none" when secure is set to true');
157-
157+
/** @phan-suppress-next-line PhanNoopCast */
158158
(string)(new Cookie('test', 'samesite'))->withSameSite('none');
159159
}
160160

tests/Emitter/SapiEmitterTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @author smiley <smiley@chillerlan.net>
77
* @copyright 2023 smiley
88
* @license MIT
9+
*
10+
* @phan-file-suppress PhanUndeclaredMethod
911
*/
1012
declare(strict_types=1);
1113

@@ -17,7 +19,7 @@
1719
use PHPUnit\Framework\Attributes\DataProvider;
1820
use Psr\Http\Message\ResponseInterface;
1921
use Generator, RuntimeException;
20-
use function array_column, array_map, array_pop, explode, header, implode, sprintf, strlen, trim;
22+
use function array_column, array_map, array_pop, explode, implode, sprintf, strlen, trim;
2123

2224
final class SapiEmitterTest extends UtilTestAbstract{
2325

@@ -34,6 +36,7 @@ protected function initEmitter(ResponseInterface $response, int $bufferSize = 81
3436
protected array $content = [];
3537

3638
protected function sendHeader(string $header, bool $replace, int $response_code = 0):void{
39+
/** @phan-suppress-next-line PhanTypeMismatchProperty */
3740
$this->headers[] = ['header' => $header, 'replace' => $replace, 'response_code' => $response_code];
3841
}
3942

0 commit comments

Comments
 (0)