Skip to content

Commit c4af07e

Browse files
committed
refactor: apply phpstan
1 parent 5f5a2e0 commit c4af07e

File tree

11 files changed

+44
-35
lines changed

11 files changed

+44
-35
lines changed

baselines/complexity.functionLike.neon

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# total 2 errors
2+
3+
parameters:
4+
ignoreErrors:
5+
-
6+
message: '#^The statement contains side effects\: \[process_exit\]\.$#'
7+
count: 1
8+
path: ../src/Concerns/WithDumpable.php
9+
10+
-
11+
message: '#^The statement contains side effects\: \[unknown_class\]\.$#'
12+
count: 1
13+
path: ../src/Concerns/WithDumpable.php

baselines/loader.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
includes:
44
- assign.propertyType.neon
5-
- complexity.functionLike.neon
65
- disallowed.function.neon
6+
- guanguans.forbiddenSideEffects.neon
77
- new.static.neon
8-
- property.notFound.neon
98
- typePerfect.narrowPublicClassMethodParamType.neon

baselines/property.notFound.neon

Lines changed: 0 additions & 8 deletions
This file was deleted.

composer-dependency-analyser.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
__DIR__.'/src/Support/Rectors/',
2222
__DIR__.'/tests/',
2323
])
24-
->ignoreUnknownClasses([
25-
// SensitiveParameter::class,
26-
])
2724
/** @see \ShipMonk\ComposerDependencyAnalyser\Analyser::CORE_EXTENSIONS */
2825
->ignoreErrorsOnExtensions(
2926
[

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"mrpunyapal/rector-pest": "^0.2",
6666
"nette/utils": "^4.1",
6767
"nicksdot/phpstan-phpstorm-error-identifiers": "^0.3",
68-
"peckphp/peck": "^0.2",
6968
"pestphp/pest": "^3.8 || ^4.0",
7069
"pestphp/pest-plugin-arch": "^3.1 || ^4.0",
7170
"pestphp/pest-plugin-profanity": "^3.23 || ^4.0",

ecs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
->withPaths([
4141
__DIR__.'/src/',
4242
__DIR__.'/tests/',
43-
__DIR__.'/.changelog',
4443
__DIR__.'/composer-bump',
4544
])
4645
->withRootFiles()

phpstan.neon.dist

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ includes:
2626
- vendor/symplify/phpstan-rules/config/phpunit-rules.neon
2727
# - vendor/symplify/phpstan-rules/config/rector-rules.neon
2828
# - vendor/symplify/phpstan-rules/config/symfony-rules.neon
29+
# - vendor/symplify/phpstan-rules/config/symfony-config-rules.neon
2930

3031
services:
3132
# https://github.com/guanguans/notify/security/code-scanning
@@ -50,6 +51,7 @@ parameters:
5051
- vendor/composer/InstalledVersions.php
5152
excludePaths:
5253
- src/Support/ComposerScripts.php
54+
- src/Support/Rectors/
5355
- tests/Fixtures/
5456
tmpDir: .build/phpstan/
5557
phpVersion: 80200
@@ -68,8 +70,8 @@ parameters:
6870
disallowedShortTernary: false
6971
ergebnis:
7072
guanguans:
71-
# exceptionMustImplementNativeThrowable:
72-
# nativeThrowable: Guanguans\MonorepoBuilderWorker\Contract\ThrowableContract
73+
exceptionMustImplementNativeThrowable:
74+
nativeThrowable: Guanguans\SoarPHP\Contracts\Throwable
7375
# sidzIgnoreNumericStrings: true
7476
sidzIgnoreMagicNumbers: [0.9, 1, 2, 3, 5, 100, 600, 512, 1024, 1000, 0o755]
7577
cognitive_complexity:
@@ -168,23 +170,33 @@ parameters:
168170
# - identifier: typePerfect.noMixedMethodCaller
169171
# - message: '#^Unused Guanguans\\Notify\\Rector\\.*\\.*\:\:__construct$#'
170172

171-
- identifier: argument.templateType
172-
- identifier: argument.type
173-
- identifier: logicalAnd.resultUnused
174-
- identifier: method.childParameterType
175-
- identifier: method.dynamicName
176-
- identifier: method.nonObject
177-
- identifier: missingType.generics
178-
- identifier: missingType.iterableValue
179-
- identifier: return.type
173+
- identifier: ergebnis.final
174+
- identifier: ergebnis.noConstructorParameterWithDefaultValue
175+
- identifier: ergebnis.noExtends
176+
- identifier: ergebnis.noIsset
177+
- identifier: ergebnis.noNamedArgument
178+
- identifier: ergebnis.noNullableReturnTypeDeclaration
179+
- identifier: ergebnis.noParameterWithNullableTypeDeclaration
180+
- identifier: ergebnis.noParameterWithNullDefaultValue
181+
- identifier: shipmonk.binaryOperationWithNull
180182
- identifier: shipmonk.deadMethod
183+
- identifier: shipmonk.variableTypeOverwritten
181184
- identifier: symplify.explicitTraitSuffixName
182185
- identifier: symplify.forbiddenExtendOfNonAbstractClass
186+
- identifier: symplify.forbiddenFuncCall
187+
- identifier: symplify.forbiddenNode
183188
- identifier: symplify.forbiddenStaticClassConstFetch
184189
- identifier: symplify.noDynamicName
185190
- identifier: symplify.noReturnSetterMethod
186191
- identifier: symplify.requireExceptionNamespace
187-
- message: '#^Call to an undefined method Composer\\IO\\IOInterface\:\:enableDebugging\(\)\.$#'
192+
193+
- identifier: argument.type
194+
- identifier: logicalAnd.resultUnused
195+
- identifier: method.childParameterType
196+
- identifier: method.dynamicName
197+
- identifier: missingType.generics
198+
- identifier: missingType.iterableValue
199+
- identifier: return.type
188200
-
189201
identifier: symplify.explicitInterfaceSuffixName
190202
path: src/Contracts/

src/Soar.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function version(?callable $callback = null): string
6161
return $this->clone()->setVersion(true)->run($callback);
6262
}
6363

64+
/**
65+
* @api
66+
*/
6467
public function clone(): self
6568
{
6669
return clone $this;

src/Support/OsHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* @see https://github.com/jolicode/php-os-helper
2222
* @see https://github.com/loophp/phposinfo
2323
* @see https://github.com/utopia-php/system
24+
*
25+
* @api
2426
*/
2527
class OsHelper
2628
{

0 commit comments

Comments
 (0)