Skip to content

Commit e451f2d

Browse files
committed
build(polyfill): Remove Symfony polyfill PHP82 and update analyzer and phpstan config
- Remove symfony/polyfill-php82 from composer.json dependencies. - In composer-dependency-analyser.php, use SensitiveParameter::class in ignoreUnknownClasses and drop the DEV_DEPENDENCY_IN_PROD ignore for the polyfill file. - In benchmarks/SoarBench.php, switch $soar from nullable to non-nullable and initialize it in setUp. - Update phpstan.neon.dist to remove ignore rules for logicalAnd.resultUnused and symplify.noDynamicName. Signed-off-by: guanguans <ityaozm@gmail.com>
1 parent 90bbdf3 commit e451f2d

File tree

10 files changed

+295
-287
lines changed

10 files changed

+295
-287
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ windows-latest, macos-latest, ubuntu-latest ]
15-
# php: [ 8.1, 8.5 ]
16-
php: [ 8.1 ]
15+
php: [ 8.1, 8.4 ]
1716
dependency-version: [ prefer-stable ]
1817

1918
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

benchmarks/SoarBench.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#[Revs(10)]
2525
final class SoarBench
2626
{
27-
private ?Soar $soar = null;
27+
private Soar $soar;
2828

2929
public function setUp(): void
3030
{

composer-bump

Lines changed: 220 additions & 219 deletions
Large diffs are not rendered by default.

composer-dependency-analyser.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
__DIR__.'/tests/',
2828
])
2929
->ignoreUnknownClasses([
30-
// '\SensitiveParameter',
30+
SensitiveParameter::class,
3131
])
3232
/** @see \ShipMonk\ComposerDependencyAnalyser\Analyser::CORE_EXTENSIONS */
3333
->ignoreErrorsOnExtensions(
@@ -42,11 +42,6 @@
4242
__DIR__.'/src/Support/helpers.php',
4343
[ErrorType::SHADOW_DEPENDENCY]
4444
)
45-
->ignoreErrorsOnPackageAndPath(
46-
'symfony/polyfill-php82',
47-
__DIR__.'/src/Concerns/HasSudoPassword.php',
48-
[ErrorType::DEV_DEPENDENCY_IN_PROD]
49-
)
5045
->ignoreErrorsOnPackageAndPath(
5146
'symfony/var-dumper',
5247
__DIR__.'/src/Concerns/WithDumpable.php',

composer.json

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
"spatie/pest-plugin-snapshots": "^2.2",
7979
"spaze/phpstan-disallowed-calls": "^4.7",
8080
"staabm/phpstan-todo-by": "^0.3",
81-
"symfony/polyfill-php82": "^1.33",
8281
"symfony/thanks": "^1.4",
8382
"symfony/var-dumper": "^6.4 || ^7.0 || ^8.0",
8483
"symplify/phpstan-rules": "^14.9",
@@ -87,6 +86,10 @@
8786
"tomasvotruba/type-coverage": "^2.0",
8887
"yamadashy/phpstan-friendly-formatter": "^1.2"
8988
},
89+
"conflict": {
90+
"pestphp/pest": "^4.0",
91+
"symplify/monorepo-builder": "^12.0"
92+
},
9093
"suggest": {
9194
"symfony/var-dumper": "Required to use the the trait [WithDumpable]."
9295
},
@@ -140,7 +143,7 @@
140143
},
141144
"hooks": {
142145
"post-merge": [
143-
"composer install --ansi -v",
146+
"composer install --ansi -vv",
144147
"composer checks:required"
145148
],
146149
"pre-commit": [
@@ -150,10 +153,12 @@
150153
},
151154
"scripts": {
152155
"post-install-cmd": [
153-
"@cghooks:upsert"
156+
"@cghooks:upsert",
157+
"@composer:normalize"
154158
],
155159
"post-update-cmd": [
156-
"@cghooks:upsert"
160+
"@cghooks:upsert",
161+
"@composer:normalize"
157162
],
158163
"actionlint": [
159164
"if ! command -v actionlint >/dev/null 2>&1; then echo 'actionlint not found, installing...'; brew install actionlint; fi",
@@ -162,14 +167,14 @@
162167
"blade-formatter": "blade-formatter resources/views/*.blade.php resources/views/**/*.blade.php --ignore-path= --php-version=8.1 --progress",
163168
"blade-formatter:check-formatted": "@blade-formatter --check-formatted",
164169
"blade-formatter:write": "@blade-formatter --write",
165-
"cghooks": "@php vendor/bin/cghooks --ansi -v",
170+
"cghooks": "@php vendor/bin/cghooks --ansi -vv",
166171
"cghooks:remove": [
167172
"@php -r \"file_exists('.git/hooks/post-merge') and rename('.git/hooks/post-merge', '.git/hooks/post-merge.sample');\"",
168173
"@php -r \"file_exists('.git/hooks/pre-commit') and rename('.git/hooks/pre-commit', '.git/hooks/pre-commit.sample');\""
169174
],
170175
"cghooks:try": [
171176
"@putenv:php",
172-
"[ ! -f \"vendor/bin/cghooks\" ] && exit 0 || $PHP81 vendor/bin/cghooks --ansi -v"
177+
"[ ! -f \"vendor/bin/cghooks\" ] && exit 0 || $PHP81 vendor/bin/cghooks --ansi -vv"
173178
],
174179
"cghooks:upsert": [
175180
"@cghooks add --ignore-lock",
@@ -206,14 +211,14 @@
206211
"@putenv:xdebug-off",
207212
"@composer:normalize-dry-run",
208213
"@composer-dependency-analyser",
209-
"@php-cs-fixer:fix-dry-run",
214+
"@php-cs-fixer:fix-dry-run-stop-on-violation",
210215
"@soar:check-binary",
211216
"@soar:dump-config",
212217
"@pest:bail",
213218
"@rector:process-dry-run",
214219
"@phpstan:analyse"
215220
],
216-
"class-leak": "@php vendor/bin/class-leak --ansi -v",
221+
"class-leak": "@php vendor/bin/class-leak --ansi -vv",
217222
"class-leak:check": "@class-leak check examples/ src/ --skip-type=\\Contracts\\Channel --skip-suffix=Channel --skip-path=Support/Rectors/",
218223
"composer-bump": [
219224
"@putenv:php",
@@ -227,33 +232,32 @@
227232
"@composer-bump:vendor-bin-php82"
228233
],
229234
"composer-bump:vendor-bin-common": [
235+
"@putenv:php",
230236
"ln -f composer-bump vendor-bin/common/composer-bump",
231-
"cd vendor-bin/common/",
232-
"@composer-bump"
237+
"@php vendor-bin/common/composer-bump --highest-php-binary=$PHP85 --ansi"
233238
],
234239
"composer-bump:vendor-bin-php82": [
235240
"@putenv:php",
236241
"ln -f composer-bump vendor-bin/php82/composer-bump",
237-
"cd vendor-bin/php82/",
238-
"$PHP82 composer-bump --highest-php-binary=$PHP85 --ansi -v"
242+
"$PHP82 vendor-bin/php82/composer-bump --php-binary=$PHP82 --highest-php-binary=$PHP85 --ansi"
239243
],
240244
"composer-config:disable-process-timeout": "Composer\\Config::disableProcessTimeout",
241245
"composer-dependency-analyser": "@php vendor/bin/composer-dependency-analyser --verbose",
242-
"composer:audit": "@composer audit --ansi -v",
243-
"composer:bin-all-update": "@composer bin all update --ansi -v",
244-
"composer:check-platform-reqs": "@composer check-platform-reqs --lock --ansi -v",
245-
"composer:diff": "@composer diff --with-platform --ansi -v",
246-
"composer:normalize": "@composer normalize --diff --ansi -v",
246+
"composer:audit": "@composer audit --ansi -vv",
247+
"composer:bin-all-update": "@composer bin all update --ansi -vv",
248+
"composer:check-platform-reqs": "@composer check-platform-reqs --lock --ansi -vv",
249+
"composer:diff": "@composer diff --with-platform --ansi -vv",
250+
"composer:normalize": "@composer normalize --diff --ansi -vv",
247251
"composer:normalize-dry-run": "@composer:normalize --dry-run",
248-
"composer:validate": "@composer validate --check-lock --strict --ansi -v",
252+
"composer:validate": "@composer validate --check-lock --strict --ansi -vv",
249253
"detect-collisions": "@php vendor/bin/detect-collisions examples/ src/",
250254
"facade:lint": "@facade:update --lint",
251255
"facade:update": "@php -f vendor/bin/facade.php -- Guanguans\\\\SoarPHP\\\\Facades\\\\SoarPHP",
252256
"git-chglog": "git-chglog $(git describe --tags $(git rev-list --tags --max-count=1))",
253257
"gitleaks": "gitleaks git --baseline-path=gitleaks-baseline.json --report-path=.build/gitleaks-report.json -v",
254258
"gitleaks:generate-baseline": "gitleaks git --report-path=gitleaks-baseline.json -v",
255-
"grumphp": "@php vendor/bin/grumphp run --ansi -v",
256-
"jack": "@php vendor/bin/jack --ansi -v",
259+
"grumphp": "@php vendor/bin/grumphp run --ansi -vv",
260+
"jack": "@php vendor/bin/jack --ansi -vv",
257261
"jack:breakpoint": "@jack breakpoint --limit=5",
258262
"jack:breakpoint-dev": "@jack:breakpoint --dev",
259263
"jack:open-versions": "@jack open-versions --limit=99",
@@ -278,10 +282,7 @@
278282
"mago:lint-dry-run": "@mago:lint --dry-run",
279283
"mago:lint-list-rules": "@mago lint --list-rules",
280284
"mago:lint-semantics-only": "@mago lint --semantics-only",
281-
"monorepo-builder": [
282-
"@putenv:php",
283-
"$PHP82 vendor/bin/monorepo-builder --ansi -v"
284-
],
285+
"monorepo-builder": "@php vendor/bin/monorepo-builder --ansi -vv",
285286
"monorepo-builder:release": "@monorepo-builder release",
286287
"monorepo-builder:release-1.0.0-BETA1": "@monorepo-builder:release 1.0.0-BETA1",
287288
"monorepo-builder:release-1.0.0-BETA1-dry-run": "@monorepo-builder:release-1.0.0-BETA1 --dry-run",
@@ -294,7 +295,7 @@
294295
"neon-lint": "@php vendor/bin/neon-lint *.neon",
295296
"peck": [
296297
"@putenv:php",
297-
"$PHP82 vendor/bin/peck check --path=src/ --config=../../peck.json --ansi -v"
298+
"$PHP82 vendor/bin/peck check --path=src/ --config=../../peck.json --ansi -vv"
298299
],
299300
"peck:ignore-all": "@peck --ignore-all",
300301
"peck:init": "@peck --init",
@@ -319,25 +320,26 @@
319320
"pest:profile": "@pest --profile",
320321
"pest:type-coverage": "@pest --type-coverage",
321322
"pest:update-snapshots": "@pest --update-snapshots",
322-
"php-cs-fixer": "@php vendor/bin/php-cs-fixer --ansi -v",
323+
"php-cs-fixer": "@php vendor/bin/php-cs-fixer --ansi -vv",
323324
"php-cs-fixer:check": "@php-cs-fixer check --show-progress=dots --diff",
324325
"php-cs-fixer:describe": "@php-cs-fixer describe",
325326
"php-cs-fixer:fix": "@php-cs-fixer fix --show-progress=dots --diff",
326327
"php-cs-fixer:fix-dry-run": "@php-cs-fixer:fix --dry-run",
328+
"php-cs-fixer:fix-dry-run-stop-on-violation": "@php-cs-fixer:fix-dry-run --stop-on-violation",
327329
"php-cs-fixer:list-files": "@php-cs-fixer list-files",
328-
"php-cs-fixer:list-sets": "@php-cs-fixer list-sets --ansi -v",
330+
"php-cs-fixer:list-sets": "@php-cs-fixer list-sets --ansi -vv",
329331
"php-lint": [
330332
"@putenv:php",
331333
"for DIR in .; do find $DIR -maxdepth 1 -type f -name '*.php' -type f ! -name 'xxx.php' -exec $PHP81 -l {} \\; 2>&1 | (! grep -v '^No syntax errors detected'); done",
332334
"for DIR in src/ tests/; do find $DIR -type f -name '*.php' -type f ! -name 'xxx.php' -exec $PHP81 -l {} \\; 2>&1 | (! grep -v '^No syntax errors detected'); done"
333335
],
334-
"phpbench": "@php vendor/bin/phpbench run --report=aggregate --ansi -v",
336+
"phpbench": "@php vendor/bin/phpbench run --report=aggregate --ansi -vv",
335337
"phpcs": "@php vendor/bin/phpcs examples/ src/ --extensions=php --ignore=*/vendor/* --parallel=8 --cache --colors -n -p -s -v",
336338
"phpcs:compatibility": "@phpcs --standard=PHPCompatibility --exclude=PHPCompatibility.FunctionDeclarations.NewClosure --runtime-set testVersion 8.5-",
337339
"phpcs:help": "@phpcs --help",
338340
"phpcs:i": "@phpcs -i",
339-
"phpmnd": "@php vendor/bin/phpmnd src/ --exclude-path=Support/helpers.phpp --ignore-numbers=2,-1 --hint --progress --ansi -v",
340-
"phpstan": "@php vendor/bin/phpstan --ansi -v",
341+
"phpmnd": "@php vendor/bin/phpmnd src/ --exclude-path=Support/helpers.phpp --ignore-numbers=2,-1 --hint --progress --ansi -vv",
342+
"phpstan": "@php vendor/bin/phpstan --ansi -vv",
341343
"phpstan:analyse": "@phpstan analyse",
342344
"phpstan:analyse-fix": "@phpstan:analyse --fix",
343345
"phpstan:analyse-generate-baseline": "@phpstan:analyse --generate-baseline --allow-empty-baseline",
@@ -350,7 +352,7 @@
350352
"phpstan:dump-parameters": "@phpstan dump-parameters",
351353
"pint": [
352354
"@putenv:xdebug-off",
353-
"@php vendor/bin/pint --ansi -v"
355+
"@php vendor/bin/pint --ansi -vv"
354356
],
355357
"pint:bail": "@pint --bail",
356358
"pint:dirty": "@pint --dirty",
@@ -372,7 +374,7 @@
372374
"@putenv XDEBUG_MODE=coverage,debug",
373375
"@putenv XDEBUG_SESSION=1"
374376
],
375-
"readme-lint": "@php readme-lint --ansi -v",
377+
"readme-lint": "@php readme-lint --ansi -vv",
376378
"rector": "@php vendor/bin/rector",
377379
"rector:custom-rule": "@rector custom-rule",
378380
"rector:list-rules": "@rector list-rules",
@@ -387,11 +389,11 @@
387389
"rector:setup-ci": "@rector setup-ci",
388390
"rule-doc-generator": [
389391
"@putenv:php",
390-
"$PHP82 rule-doc-generator --ansi -v"
392+
"$PHP82 rule-doc-generator --ansi -vv"
391393
],
392394
"rule-doc-generator:rector-generate": "@rule-doc-generator generate src/Support/Rectors/ --output-file=src/Support/Rectors/rector-rules-overview.md --categorize=rector",
393395
"rule-doc-generator:rector-validate": "@rule-doc-generator validate src/Support/Rectors/",
394-
"sk": "@php vendor/bin/swiss-knife --ansi -v",
396+
"sk": "@php vendor/bin/swiss-knife --ansi -vv",
395397
"sk:alice-yaml-fixtures-to-php": "@sk alice-yaml-fixtures-to-php --help",
396398
"sk:check-commented-code": "@sk check-commented-code examples/ src/ --line-limit=5 --skip-file=src/Soar.php",
397399
"sk:check-conflicts": "@sk check-conflicts examples/ src/",
@@ -407,11 +409,11 @@
407409
"sk:search-regex": "@sk search-regex 'Guanguans.*ValetDrivers'",
408410
"sk:split-config-per-package": "@sk split-config-per-package monorepo-builder.php",
409411
"sk:spot-lazy-traits": "@sk spot-lazy-traits src/ --max-used=2",
410-
"soar-php": "@php soar-php --ansi -v",
412+
"soar-php": "@php soar-php --ansi -vv",
411413
"soar-php:app-build": [
412-
"@composer install --no-dev --no-scripts --ansi -v",
414+
"@composer install --no-dev --no-scripts --ansi -vv",
413415
"@php soar-php app:build soar-php.phar --build-version=master --ansi",
414-
"@php builds/soar-php.phar list --ansi -v",
416+
"@php builds/soar-php.phar list --ansi -vv",
415417
"ls -lh builds/soar-php.phar",
416418
"ls -lr builds/soar-php.phar"
417419
],
@@ -445,27 +447,27 @@
445447
"user:composer": [
446448
"@putenv:composer-memory-unlimited",
447449
"@putenv:xdebug-off",
448-
"@composer --ansi -v"
450+
"@composer --ansi -vv"
449451
],
450452
"user:php": [
451453
"@putenv:xdebug-off",
452454
"@php -d xdebug.mode=off"
453455
],
454-
"var-dump-server:cli": "@php vendor/bin/var-dump-server --ansi -v",
456+
"var-dump-server:cli": "@php vendor/bin/var-dump-server --ansi -vv",
455457
"var-dump-server:html": [
456458
"@composer-config:disable-process-timeout",
457459
"[ -d .build ] || mkdir -p .build/",
458460
"[ -f .build/dump.html ] || touch .build/dump.html",
459461
"open .build/dump.html",
460462
"@php vendor/bin/var-dump-server --ansi -v --format=html > .build/dump.html"
461463
],
462-
"vendor-patches": "@php vendor/bin/vendor-patches generate --ansi -v",
464+
"vendor-patches": "@php vendor/bin/vendor-patches generate --ansi -vv",
463465
"vhs": [
464466
"@cghooks:remove",
465467
"vhs < soar-php.tape",
466468
"@cghooks:upsert"
467469
],
468-
"yaml-lint": "@php vendor/bin/yaml-lint .github/ examples/ --ansi -v",
470+
"yaml-lint": "@php vendor/bin/yaml-lint .github/ examples/ --ansi -vv",
469471
"zhlint": [
470472
"if ! command -v zhlint >/dev/null 2>&1; then echo 'zhlint not found, installing...'; npm install -g zhlint; fi",
471473
"@zhlint:prototype"

monorepo-builder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
return static function (MBConfig $mbConfig): void {
3838
require __DIR__.'/vendor/autoload.php';
39-
40-
require __DIR__.'/vendor-bin/php82/vendor/autoload.php';
4139
$mbConfig->defaultBranch('master');
4240
MBConfig::disableDefaultWorkers();
4341

@@ -66,7 +64,8 @@
6664
(new PhpExecutableFinder)->find(),
6765
(new ExecutableFinder)->find($composer = 'composer', $composer),
6866
'run',
69-
'checks',
67+
'checks:required',
68+
'--ansi',
7069
]))
7170
->setEnv(['COMPOSER_MEMORY_LIMIT' => -1])
7271
->setTimeout(600)

phpstan.neon.dist

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,21 @@ parameters:
7777
function: 'env_explode()'
7878
message: 'use config() instead'
7979
ignoreErrors:
80+
# - identifier: arrayFilter.strict
81+
# - identifier: assign.propertyType
82+
# - identifier: cast.double
83+
# - identifier: cast.int
8084
# - identifier: cast.string
85+
# - identifier: empty.notAllowed
8186
# - identifier: encapsedStringPart.nonString
82-
# - identifier: logicalAnd.resultUnused
87+
# - identifier: foreach.valueOverwrite
88+
# - identifier: logicalOr.resultUnused
89+
# - identifier: new.static
90+
# - identifier: offsetAccess.nonOffsetAccessible
91+
# - identifier: paramOut.type
8392
# - identifier: return.void
84-
# - identifier: symplify.noDynamicName
93+
# - identifier: symplify.noReference
94+
# - identifier: trait.unused
8595
# - identifier: typePerfect.noMixedMethodCaller
8696
- identifier: argument.templateType
8797
- identifier: argument.type

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
2626
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
2727
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
28+
use Rector\CodingStyle\Rector\ClassLike\NewlineBetweenClassLikeStmtsRector;
2829
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
2930
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
3031
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
@@ -190,6 +191,7 @@ classes(static fn (string $class): bool => str_starts_with($class, 'PhpBench\Att
190191
ExplicitBoolCompareRector::class,
191192
LogicalToBooleanRector::class,
192193
NewlineAfterStatementRector::class,
194+
NewlineBetweenClassLikeStmtsRector::class,
193195
ReturnBinaryOrToEarlyReturnRector::class,
194196
WrapEncapsedVariableInCurlyBracesRector::class,
195197
])

vendor-bin/common/composer.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
22
"require-dev": {
3-
"symplify/rule-doc-generator": "^12.2",
4-
"theofidry/composer-inheritance-plugin": "^1.2"
3+
"php": ">=8.1",
4+
"ergebnis/composer-normalize": "^2.48",
5+
"symplify/rule-doc-generator": "^12.2"
56
},
67
"config": {
78
"allow-plugins": {
8-
"wikimedia/composer-merge-plugin": true,
9-
"theofidry/composer-inheritance-plugin": true,
10-
"pestphp/pest-plugin": false,
11-
"symfony/thanks": false,
12-
"ergebnis/composer-normalize": false,
13-
"phpstan/extension-installer": false
9+
"ergebnis/composer-normalize": true,
10+
"theofidry/composer-inheritance-plugin": false,
11+
"wikimedia/composer-merge-plugin": false
1412
},
1513
"sort-packages": true
1614
}

vendor-bin/php82/composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"require-dev": {
3-
"guanguans/monorepo-builder-worker": "^2.1",
4-
"peckphp/peck": "^0.2.0",
5-
"symplify/monorepo-builder": "^12.0"
3+
"php": ">=8.2",
4+
"ergebnis/composer-normalize": "^2.48",
5+
"peckphp/peck": "^0.2",
6+
"theofidry/composer-inheritance-plugin": "^1.2"
67
},
78
"config": {
89
"allow-plugins": {
9-
"wikimedia/composer-merge-plugin": true,
10-
"theofidry/composer-inheritance-plugin": true
10+
"ergebnis/composer-normalize": true,
11+
"theofidry/composer-inheritance-plugin": false,
12+
"wikimedia/composer-merge-plugin": false
1113
},
1214
"sort-packages": true
1315
}

0 commit comments

Comments
 (0)