forked from rectorphp/rector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
592 lines (460 loc) · 35.7 KB
/
phpstan.neon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
includes:
- utils/phpstan-extensions/config/phpstan-extensions.neon
- utils/phpstan-extensions/config/rector-rules.neon
# allows symplify error formatter
- vendor/symplify/phpstan-extensions/config/config.neon
# see https://github.com/symplify/coding-standard
# - vendor/symplify/phpstan-rules/config/configurable-rules.neon
- vendor/symplify/phpstan-rules/config/services/services.neon
- vendor/symplify/phpstan-rules/packages/cognitive-complexity/config/cognitive-complexity-services.neon
- vendor/symplify/phpstan-rules/config/static-rules.neon
- vendor/symplify/phpstan-rules/config/array-rules.neon
- vendor/symplify/phpstan-rules/config/code-complexity-rules.neon
- vendor/symplify/phpstan-rules/config/doctrine-rules.neon
- vendor/symplify/phpstan-rules/config/naming-rules.neon
- vendor/symplify/phpstan-rules/config/regex-rules.neon
- vendor/symplify/phpstan-rules/config/services-rules.neon
- vendor/symplify/phpstan-rules/config/size-rules.neon
- vendor/symplify/phpstan-rules/config/forbidden-static-rules.neon
- vendor/symplify/phpstan-rules/config/string-to-constant-rules.neon
- vendor/symplify/phpstan-rules/config/symfony-rules.neon
- vendor/symplify/phpstan-rules/config/test-rules.neon
parameters:
level: max
paths:
- ecs.php
- rector.php
- bin
- src
- rules
- packages
- tests
- utils
# this cannot be put it, because it wipes PHPStan cache on each run :( - must run in separate
#- config
# to allow installing with various phsptan versions without reporting old errors here
bootstrapFiles:
- vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php
scanDirectories:
- stubs
reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
excludes_analyse:
- */config.php
- tests/debug_functions.php
# broken in PHPStan https://github.com/rectorphp/rector/runs/1305002460#step:5:56
- packages/BetterPhpDocParser/ValueObject/PhpDocNode/AbstractTagValueNode.php
- packages/Testing/PHPUnit/*.php
- packages-tests/NodeVisitor/FunctionMethodAndClassNodeVisitor/FunctionMethodAndClassNodeVisitorTest.php
- rules/DowngradePhp70/Rector/FunctionLike/AbstractDowngradeParamDeclarationRector.php
# generated files
- 'packages/DoctrineAnnotationGenerated/ConstantPreservingDocParser.php'
- 'packages/DoctrineAnnotationGenerated/ConstantPreservingAnnotationReader.php'
- "*/Expected/*"
# complex printer
- '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php'
# tests files
- '*tests/*/Fixture/*'
- '*tests/*/Source/*'
- '*tests/Source/*'
# part of composer
- '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php'
- packages-tests/BetterPhpDocPraser/PhpDocParser/TagValueNodeReprint/Fixture/SymfonyRoute/RouteName.php
# tests
- tests/DependencyInjection/config
ignoreErrors:
- '#Parameter \#1 \$children of class PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocNode constructor expects array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode\>, array<int, PHPStan\\PhpDocParser\\Ast\\Node\> given#'
# PHP 7.4 1_000 support
- '#Property PhpParser\\Node\\Scalar\\DNumber\:\:\$value \(float\) does not accept string#'
# mixed
- '#Offset int\|string\|null does not exist on array<PhpParser\\Node\\Stmt>\|null#'
# broken
- '#Parameter \#2 \$name of method Rector\\NodeNameResolver\\NodeNameResolver\:\:isName\(\) expects string, string\|null given#'
# mostly strings in tests
- '#Method Rector\\Naming\\Naming\\PropertyNaming\:\:resolveShortClassName\(\) should return string but returns string\|null#'
-
message: "#in iterable type Iterator#"
paths:
- *Test.php
-
message: "#^Cognitive complexity for \"Rector\\\\BetterPhpDocParser\\\\Printer\\\\WhitespaceDetector\\:\\:detectOldWhitespaces\\(\\)\" is 18, keep it under 9$#"
count: 1
path: packages/BetterPhpDocParser/Printer/WhitespaceDetector.php
- '#Parameter \#1 \$node of method Rector\\PostRector\\Collector\\NodesToAddCollector\:\:wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#'
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$class#'
- '#Property PhpParser\\Node\\Stmt\\Namespace_\:\:\$stmts \(array<PhpParser\\Node\\Stmt\>\) does not accept array<PhpParser\\Node\>#'
- '#Cognitive complexity for "Rector\\Php80\\NodeResolver\\SwitchExprsResolver\:\:resolve\(\)" is \d+, keep it under 9#'
-
message: "#^Cognitive complexity for \"Rector\\\\PhpSpecToPHPUnit\\\\Rector\\\\MethodCall\\\\PhpSpecPromisesToPHPUnitAssertRector\\:\\:refactor\\(\\)\" is 13, keep it under 9$#"
path: rules/PhpSpecToPHPUnit/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php
-
message: '#Class cognitive complexity is \d+, keep it under \d+#'
paths:
- rules/Php70/EregToPcreTransformer.php
- packages/NodeCollector/NodeCollector/NodeRepository.php
- packages/NodeTypeResolver/NodeTypeResolver.php
- rules/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php
- rules/Php80/Rector/If_/NullsafeOperatorRector.php
- "#^Cognitive complexity for \"Rector\\\\Php70\\\\EregToPcreTransformer\\:\\:(.*?)\" is (.*?), keep it under 9$#"
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\If_\\SimplifyIfIssetToNullCoalescingRector\:\:shouldSkip\(\)" is 10, keep it under 9#'
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\Type\\ObjectTypeSpecifier\:\:matchShortenedObjectType\(\)" is 10, keep it under 9#'
- '#Cognitive complexity for "Rector\\Core\\PhpParser\\Node\\Value\\ValueResolver\:\:getValue\(\)" is \d+, keep it under 9#'
- '#Cognitive complexity for "Rector\\NetteKdyby\\ContributeEventClassResolver\:\:resolveGetterMethodByEventClassAndParam\(\)" is \d+, keep it under 9#'
- '#Cognitive complexity for "Rector\\DeadCode\\NodeManipulator\\LivingCodeManipulator\:\:keepLivingCodeFromExpr\(\)" is \d+, keep it under 9#'
-
message: '#Class cognitive complexity is \d+, keep it under 50#'
paths:
- packages/NodeNameResolver/NodeNameResolver.php
- '#Parameter \#1 \$type of method PhpParser\\Builder\\FunctionLike\:\:setReturnType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
- '#Parameter \#1 \$type of class PhpParser\\Node\\NullableType constructor expects PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|string, PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType given#'
- '#Parameter \#1 \$objectType of method Rector\\Naming\\Naming\\PropertyNaming\:\:fqnToVariableName\(\) expects PHPStan\\Type\\ObjectType\|string, PHPStan\\Type\\Type given#'
# known value
- '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#'
- '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$type#'
- '#Parameter \#1 \$variable of class Rector\\Php70\\ValueObject\\VariableAssignPair constructor expects PhpParser\\Node\\Expr\\ArrayDimFetch\|PhpParser\\Node\\Expr\\PropertyFetch\|PhpParser\\Node\\Expr\\StaticPropertyFetch\|PhpParser\\Node\\Expr\\Variable, PhpParser\\Node\\Expr given#'
# is nested expr
- '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$expr#'
- '#Parameter \#2 \$currentNode of method Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector\:\:matchNextExprAssignConcatToSameVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp\\Concat, PhpParser\\Node given#'
-
message: '#Array (with keys|destruct) is not allowed\. Use value object to pass data instead#'
paths:
# 3rd party package
- rules/Php70/EregToPcreTransformer.php
-
message: '#Use explicit return value over magic &reference#'
paths:
# 3rd party code
- rules/Php70/EregToPcreTransformer.php
# symfony/console
-
message: '#Use explicit return value over magic &reference#'
path: 'rules/DeadCode/Rector/BinaryOp/RemoveDuplicatedInstanceOfRector.php'
-
message: '#Use value object over return of values#'
path: 'rules/PHPUnit/Composer/ComposerAutoloadedDirectoryProvider.php'
-
message: '#Use value object over return of values#'
path: 'rules/Php70/EregToPcreTransformer.php'
-
message: '#Nested foreach with empty statement is not allowed#'
path: packages-tests/BetterPhpDocParser/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php
-
message: '#Function "dump\(\)" cannot be used/left in the code#'
path: tests/debug_functions.php
- '#Method Rector\\NetteKdyby\\NodeFactory\\EventValueObjectClassFactory\:\:wrapClassToNamespace\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#'
- '#Parameter \#1 \$node of method Rector\\DeadCode\\Rector\\Plus\\RemoveDeadZeroAndOneOperationRector\:\:refactor\(\) expects PhpParser\\Node\\Expr\\AssignOp\\Div\|PhpParser\\Node\\Expr\\AssignOp\\Minus\|PhpParser\\Node\\Expr\\AssignOp\\Mul\|PhpParser\\Node\\Expr\\AssignOp\\Plus\|PhpParser\\Node\\Expr\\BinaryOp\\Div\|PhpParser\\Node\\Expr\\BinaryOp\\Minus\|PhpParser\\Node\\Expr\\BinaryOp\\Mul\|PhpParser\\Node\\Expr\\BinaryOp\\Plus, PhpParser\\Node\\Expr\\AssignOp\|PhpParser\\Node\\Expr\\BinaryOp given#'
# trait in trait call
- '#Parameter \#1 \$expr of class PhpParser\\Node\\Stmt\\Expression constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt given#'
# symplify 9
- '#Use decoupled factory service to create "(.*?)" object#'
- '#Use another value object over array with string\-keys and objects, array<string, ValueObject\>#'
- '#Do not use factory/method call in constructor\. Put factory in config and get service with dependency injection#'
- '#Constant string value need to only have small letters, _, \-, \. and numbers#'
-
message: '#Use explicit names over dynamic ones#'
paths:
- packages/DoctrineAnnotationGenerated/PhpDocNode/ConstantReferenceIdentifierRestorer.php # 61
-
message: '#"(getComments|getDocComment|setDocComment)\(\)" call on "PhpParser\\Node" type is not allowed#'
paths:
- src/PhpParser/NodeTransformer.php
- src/Rector/AbstractRector.php
# playing around with doc block format
- packages/Comments/CommentRemover.php
- rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php
- rules/CodeQuality/Rector/Return_/SimplifyUselessVariableRector.php
- rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php
- rules/DeadDocBlock/Rector/Node/RemoveNonExistingVarAnnotationRector.php
- rules/PhpSpecToPHPUnit/Rector/MethodCall/PhpSpecMocksToPHPUnitMocksRector.php
- rules/CodingStyle/Node/DocAliasResolver.php
- packages/BetterPhpDocParser/Comment/CommentsMerger.php
- packages/Comments/NodeDocBlock/DocBlockUpdater.php
- packages/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php
# false positives checked in another method
-
message: '#If condition is always false#'
paths:
- rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php
- rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php
- rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php
- packages/NodeNestingScope/NodeFinder/ScopeAwareNodeFinder.php
# internal generating Rector
-
message: '#Class "Rector\\Utils\\DoctrineAnnotationParserSyncer\\Rector\\(.*?)" is missing @see annotation with test case class reference#'
paths:
- utils/doctrine-annotation-parser-syncer/src/Rector/*
-
message: '#Do not use setter on a service#'
paths:
- src/Configuration/Configuration.php
# prevent circular dependnecy
- packages/StaticTypeMapper/Naming/NameScopeFactory.php
-
message: '#Cannot cast array<string\>\|bool\|string\|null to string#'
paths:
- src/Configuration/Configuration.php
- src/Console/Command/ProcessCommand.php
- '#Method (.*?) should return array<PhpParser\\Node\\(.*?)\> but returns array<PhpParser\\Node\>#'
- '#Parameter \#1 (.*?) expects Symfony\\Component\\DependencyInjection\\ContainerBuilder, Symfony\\Component\\DependencyInjection\\ContainerInterface given#'
# intersection
- '#Property Rector\\TypeDeclaration\\TypeInferer\\ReturnTypeInferer\:\:\$returnTypeInferers \(array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\ReturnTypeInfererInterface\>\) does not accept array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface\>#'
- '#Property Rector\\TypeDeclaration\\TypeInferer\\PropertyTypeInferer\:\:\$propertyTypeInferers \(array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PropertyTypeInfererInterface\>\) does not accept array<Rector\\TypeDeclaration\\Contract\\TypeInferer\\PriorityAwareTypeInfererInterface\>#'
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#'
# @todo loop magic, resolve later
-
message: '#Access to an undefined property PhpParser\\Node\:\:\$expr#'
paths:
- rules/Php80/Rector/If_/NullsafeOperatorRector.php
###################################################
- '#Method "evaluateBinaryToVersionCompareCondition\(\)" returns bool type, so the name should start with is/has/was#'
# soo many false positive naming - fix later with Recto rule
- '#Method "(.*?)\(\)" returns bool type, so the name should start with is/has/was#'
-
message: '#Comparison operation "<" between 0 and 2 is always true#'
paths:
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
- '#PHPDoc tag @param for parameter \$node with type float is incompatible with native type PhpParser\\Node#'
# intersection mess
- '#Parameter \#1 \$phpDocTagNodes of method Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMethodCallFactory\:\:createFromTagValueNodes\(\) expects array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\>, array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|Rector\\BetterPhpDocParser\\Contract\\PhpDocNode\\AttributeAwareNodeInterface\> given#'
# false postives
- '#Parameter \#2 \$right of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
- '#Parameter \#1 \$stmts of class Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace constructor expects array<PhpParser\\Node\\Stmt\>, array<PhpParser\\Node\> given#'
-
message: '#Call to function is_string\(\) with float will always evaluate to false#'
path: src/PhpParser/Printer/BetterStandardPrinter.php
# known values from other methods
-
message: '#Negated boolean expression is always true#'
path: rules/PhpSpecToPHPUnit/NodeFactory/AssertMethodCallFactory.php
-
message: '#Call to function in_array\(\) with arguments string, array\(\) and true will always evaluate to false#'
path: rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php
-
message: '#Parameter \#1 \$left of class PhpParser\\Node\\Expr\\BinaryOp\\Spaceship constructor expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|null given#'
path: rules/Php70/Rector/If_/IfToSpaceshipRector.php
- '#PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#'
# unable to test, because the method is final
- '#Class "Rector\\Nette\\Rector\\Class_\\MoveFinalGetUserToCheckRequirementsClassMethodRector" is missing @see annotation with test case class reference#'
# type juggling
- '#AttributeAwareNodeInterface#'
-
message: '#Use `\$class\-\>namespaceName` instead of `\$class\-\>name` that only returns short class name#'
paths:
- rules/CodingStyle/Naming/NameRenamer.php
- packages/NodeNameResolver/NodeNameResolver/ClassNameResolver.php
-
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
paths:
- rules/Defluent/ValueObject/*
- '#Parameter \#1 \$keyName of method Rector\\AttributeAwarePhpDoc\\Ast\\Type\\AttributeAwareArrayShapeItemNode\:\:createKeyWithSpacePattern\(\) expects PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null, PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprIntegerNode\|PHPStan\\PhpDocParser\\Ast\\ConstExpr\\ConstExprStringNode\|PHPStan\\PhpDocParser\\Ast\\Type\\IdentifierTypeNode\|null given#'
- '#AttributeAwarePhpDocNode#'
- '#Method Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:matchReturnOrAssignNode\(\) should return PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Stmt\\Return_\|null but returns PhpParser\\Node\|null#'
- '#Instanceof between PhpParser\\Node\\Stmt and Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace will always evaluate to false#'
-
message: '#Use value object over multi array assign#'
paths:
- packages/NodeCollector/NodeCollector/ParsedClassConstFetchNodeCollector.php
# @todo improvate later
- '#Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$description#'
-
message: '#Unreachable statement \- code above always terminates#'
paths:
- bin/rector.php
- rules/Php70/Rector/FuncCall/MultiDirnameRector.php
-
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
paths:
- bin/rector.php
-
message: '#Do not use static property#'
path: 'bin/rector.php'
# @todo fix later
-
message: '#There should be no empty class#'
paths:
- packages/StaticTypeMapper/ValueObject/Type/ParentStaticType.php #9
- packages/StaticTypeMapper/ValueObject/Type/SelfObjectType.php #9
# generics nullable bugs
- '#Method (.*?) should return T of PhpParser\\Node\|null but returns PhpParser\\Node\|null#'
- '#Method (.*?) should return T of PhpParser\\Node\|null but returns PhpParser\\Node#'
- '#Method (.*?) should return (.*?)\|null but returns PhpParser\\Node\|null#'
- '#Method (.*?) should return array<T of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
- '#Parameter \#1 \$nodes of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder<PhpParser\\Node\>\:\:findFirst\(\) expects array<PhpParser\\Node\>\|PhpParser\\Node, array<PhpParser\\Node\\Stmt\>\|null given#'
- '#Parameter \#2 \$type of method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder<T of PhpParser\\Node\>\:\:findInstanceOfName\(\) expects class\-string<T of PhpParser\\Node\>, string given#'
- '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findVariableOfName\(\) should return PhpParser\\Node\\Expr\\Variable\|null but returns T of PhpParser\\Node\|null#'
# fixed in php-parser master
- '#Method Rector\\Symfony\\NodeFactory\\RouteNameClassFactory\:\:create\(\) should return PhpParser\\Node\\Stmt\\Namespace_ but returns PhpParser\\Node#'
- '#Parameter \#4 \$classWithConstants of class Rector\\Privatization\\ValueObject\\ReplaceStringWithClassConstant constructor expects class\-string, string given#'
-
message: '#new <class\> is limited to 3 "new <class\>\(new <class\>\)\)" nesting to each other\.#'
paths:
- config/set/*
- '#Class with base "FileNode" name is already used in "PHPStan\\Node\\FileNode", "Rector\\Core\\PhpParser\\Node\\CustomNode\\FileNode"\. Use unique name to make classes easy to recognize#'
# buggy phpstan clas-string
- '#Method (.*?) should return class\-string but returns string#'
-
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
paths:
- src/Rector/AbstractRector.php
# setter to avoid circular dependency in nested collector
- rules/NetteCodeQuality/NodeResolver/MethodNamesByInputNamesResolver.php
- packages/StaticTypeMapper/StaticTypeMapper.php
- packages/BetterPhpDocParser/Attributes/Ast/AttributeAwareNodeFactory.php
- packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php
- packages/PHPStanStaticTypeMapper/PHPStanStaticTypeMapper.php
# refactor later
- '#Class Rector\\NodeTypeResolver\\Tests\\PerNodeTypeResolver\\PropertyFetchTypeResolver\\Source\\IDontExist not found\.#'
- '#Class A\\B\\C\\IDontExist not found\.#'
-
message: '#Use non\-dynamic property on static call#'
path: packages/BetterPhpDocParser/AnnotationReader/AnnotationReaderFactory.php #56
- '#Method Rector\\BetterPhpDocParser\\PhpDocNodeFactory\\MultiPhpDocNodeFactory\:\:getTagValueNodeClassesToAnnotationClasses\(\) should return array<class\-string<Rector\\BetterPhpDocParser\\ValueObject\\PhpDocNode\\AbstractTagValueNode\>, class\-string<Doctrine\\ORM\\Mapping\\Annotation\>\> but returns array<string, string\>#'
-
message: '#Use value object over return of values#'
path: packages/BetterPhpDocParser/PhpDocNodeFactory/MultiPhpDocNodeFactory.php
-
message: '#Use defined constant Symplify\\ComposerJsonManipulator\\ValueObject\\ComposerJsonSection\:\:REQUIRE over string require#'
paths:
# is "require" in PHP
- src/Php/ReservedKeywordAnalyzer.php
- '#Class Acme\\Bar\\DoNotUpdateExistingTargetNamespace not found#'
- '#Class Acme\\Foo\\DoNotUpdateExistingTargetNamespace not found#'
- '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findParentType\(\) should return T of PhpParser\\Node\|null but returns class\-string<T of PhpParser\\Node\>\|T of PhpParser\\Node#'
-
message: '#Namespace "Rector\\Composer\\Tests\\Rector" is only reserved for "Rector"\. Move the class somewhere else#'
path: rules-tests/Composer/Rector/AbstractComposerRectorTestCase.php
- '#Class with base "SetList" name is already used in "Symplify\\EasyCodingStandard\\ValueObject\\Set\\SetList", "Rector\\Set\\ValueObject\\SetList"\. Use unique name to make classes easy to recognize#'
- '#Class with base "PhpVersion" name is already used in "PHPStan\\Php\\PhpVersion", "Rector\\Core\\ValueObject\\PhpVersion"\. Use unique name to make classes easy to recognize#'
-
message: '#Use local named constant instead of inline string for regex to explain meaning by constant name#'
paths:
- packages/BetterPhpDocParser/Printer/ArrayPartPhpDocTagPrinter.php
-
message: '#Do not use static property#'
paths:
- packages/DoctrineAnnotationGenerated/DataCollector/ResolvedConstantStaticCollector.php
# tracy::$maxDepth
- tests/bootstrap.php
# known values
- '#Method Rector\\Testing\\Finder\\RectorsFinder\:\:findClassesInDirectoriesByName\(\) should return array<class\-string\> but returns array<int, \(int\|string\)\>#'
- '#Property PhpParser\\Node\\Param\:\:\$type \(PhpParser\\Node\\Identifier\|PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType\|null\) does not accept PhpParser\\Node#'
-
message: '#"%s" in sprintf\(\) format must be quoted#'
paths:
- packages/AttributeAwarePhpDoc/Ast/PhpDoc/AttributeAwareParamTagValueNode.php
- '#Property Rector\\Core\\PhpParser\\Node\\AssignAndBinaryMap\:\:\$binaryOpToAssignClasses \(array<class\-string<PhpParser\\Node\\Expr\\BinaryOp\>, class\-string<PhpParser\\Node\\Expr\\BinaryOp\>\>\) does not accept array#'
-
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
paths:
- packages/Testing/Finder/RectorsFinder.php
- packages/BetterPhpDocParser/AnnotationReader/AnnotationReaderFactory.php
-
message: '#Function "property_exists\(\)" cannot be used/left in the code#'
paths:
# on PhpParser Nodes
- src/NodeManipulator/ClassMethodAssignManipulator.php
- rules/Php80/Rector/If_/NullsafeOperatorRector.php
- packages/NodeTypeResolver/NodeVisitor/FunctionMethodAndClassNodeVisitor.php
- packages/NodeTypeResolver/NodeVisitor/StatementNodeVisitor.php
- packages/NodeNameResolver/NodeNameResolver.php
- packages/NodeNameResolver/NodeNameResolver/ClassNameResolver.php
- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php
- packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php
- packages/BetterPhpDocParser/Printer/MultilineSpaceFormatPreserver.php
-
message: '#Function "class_implements\(\)" cannot be used/left in the code#'
paths:
- rules/Symfony/ValueObject/ServiceMap/ServiceMap.php
-
message: '#Instead of "ReflectionClass" class/interface use "PHPStan\\Reflection\\ClassReflection"#'
paths:
# own classes
- packages/Testing/Finder/RectorsFinder.php
- packages/StaticTypeMapper/TypeFactory/UnionTypeFactory.php
- packages/Set/RectorSetProvider.php
- '#Method Rector\\TypeDeclaration\\PhpParserTypeAnalyzer\:\:unwrapNullableAndToString\(\) should return string but returns string\|null#'
- '#Cognitive complexity for "Rector\\DeadCode\\UnusedNodeResolver\\ClassUnusedPrivateClassMethodResolver\:\:filterOutParentAbstractMethods\(\)" is 10, keep it under 9#'
# known types
- '#Call to an undefined method PHPStan\\Type\\ConstantType\:\:getValue\(\)#'
- '#Method Rector\\BetterPhpDocParser\\AnnotationReader\\NodeAnnotationReader\:\:getNativePropertyReflection\(\) should return ReflectionProperty\|null but return statement is missing#'
- '#Parameter \#1 \$node of method Rector\\NetteKdyby\\Naming\\VariableNaming\:\:resolveFromMethodCall\(\) expects PhpParser\\Node\\Expr\\MethodCall\|PhpParser\\Node\\Expr\\NullsafeMethodCall\|PhpParser\\Node\\Expr\\StaticCall, PhpParser\\Node given#'
- '#Parameter \#1 \$stmts of method Rector\\EarlyReturn\\Rector\\Return_\\PreparedValueToEarlyReturnRector\:\:collectIfs\(\) expects array<PhpParser\\Node\\Stmt\\If_\>, array<PhpParser\\Node\\Stmt\> given#'
- '#Access to an undefined property PhpParser\\Node\\FunctionLike\|PhpParser\\Node\\Stmt\\If_\:\:\$stmts#'
- '#Method Rector\\NetteKdyby\\DataProvider\\EventAndListenerTreeProvider\:\:getListeningClassMethodsInEventSubscriberByClass\(\) should return array<class\-string, array<PhpParser\\Node\\Stmt\\ClassMethod\>\> but returns array<string, array<PhpParser\\Node\\Stmt\\ClassMethod\>\>#'
-
message: '#Function "get_declared_classes\(\)" cannot be used/left in the code#'
paths:
- rules/Restoration/ClassMap/ExistingClassesProvider.php
-
message: '#Parameter \#1 \$types of method Rector\\Defluent\\NodeAnalyzer\\FluentCallStaticTypeResolver\:\:filterOutAlreadyPresentParentClasses\(\) expects array<class\-string\>, array<int, string\> given#'
paths:
- rules/Defluent/NodeAnalyzer/FluentCallStaticTypeResolver.php
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Isset_\\IssetOnPropertyObjectToPropertyExistsRector\:\:refactor\(\)" is \d+, keep it under 9#'
# needed for native reflection parameter reference
-
message: '#Instead of "ReflectionFunction" class/interface use "PHPStan\\Reflection\\FunctionReflection"#'
paths:
- packages/ReadWrite/Guard/VariableToConstantGuard.php
- '#Cognitive complexity for "Rector\\NetteCodeQuality\\FormControlTypeResolver\\MagicNetteFactoryInterfaceFormControlTypeResolver\:\:resolve\(\)" is 12, keep it under 9#'
- '#Content of method "matchAssignExprToPropertyName\(\)" is duplicated with method "matchAssignExprToPropertyName\(\)" in "Rector\\TypeDeclaration\\AlreadyAssignDetector\\ConstructorAssignDetector" class\. Use unique content or abstract service instead#'
- '#Content of method "configure\(\)" is duplicated with method "configure\(\)" in (.*?) Use unique content or service instead#'
- '#Content of method "getFunctionLikePhpDocInfo\(\)" is duplicated with method "getFunctionLikePhpDocInfo\(\)" in "Rector\\TypeDeclaration\\TypeInferer\\ParamTypeInferer\\PHPUnitDataProviderParamTypeInferer" class\. Use unique content or service instead#'
- '#Content of method "getIfNextReturn\(\)" is duplicated with method "getIfNextReturn\(\)" in "Rector\\EarlyReturn\\NodeFactory\\InvertedIfFactory" class\. Use unique content or service instead#'
- '#Content of method "matchReturnMethodCall\(\)" is duplicated with method "matchReturnMethodCall\(\)" in "Rector\\Defluent\\Rector\\Return_\\ReturnFluentChainMethodCallToNormalMethodCallRector" class\. Use unique content or service instead#'
- '#Content of method "matchReturnMethodCall\(\)" is duplicated with method "matchReturnMethodCall\(\)" in "Rector\\Defluent\\Rector\\Return_\\ReturnNewFluentChainMethodCallToNonFluentRector" class\. Use unique content or service instead#'
- '#Content of method "decoratePropertyWithDocBlock\(\)" is duplicated with method "decoratePropertyWithDocBlock\(\)" in "Rector\\DowngradePhp74\\Rector\\Property\\DowngradeTypedPropertyRector" class\. Use unique content or service instead#'
- '#Content of method "decoratePropertyWithDocBlock\(\)" is duplicated with method "decoratePropertyWithDocBlock\(\)" in "Rector\\DowngradePhp80\\Rector\\Property\\DowngradeUnionTypeTypedPropertyRector" class\. Use unique content or service instead#'
-
message: '#Argument and options "debug" got confused#'
paths:
- src/Console/Command/ProcessCommand.php
- '#Content of method "getNextExpression\(\)" is duplicated with method "getNextExpression\(\)" in "Rector\\CodingStyle\\Rector\\Assign\\ManualJsonStringToJsonEncodeArrayRector" class\. Use unique content or service instead#'
- '#Content of method "getFunctionLikePhpDocInfo\(\)" is duplicated with method "getFunctionLikePhpDocInfo\(\)" in "Rector\\NodeTypeResolver\\NodeTypeResolver\\ParamTypeResolver" class\. Use unique content or service instead#'
- '#Cognitive complexity for "Rector\\EarlyReturn\\Rector\\If_\\ChangeAndIfToEarlyReturnRector\:\:refactor\(\)" is 10, keep it under 9#'
- '#Parameter \#2 \$returnedStrictTypeNode of method Rector\\TypeDeclaration\\Rector\\ClassMethod\\ReturnTypeFromStrictTypedCallRector\:\:refactorSingleReturnType\(\) expects PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PhpParser\\Node\\UnionType, PhpParser\\Node\\Name\|PhpParser\\Node\\NullableType\|PHPStan\\Type\\UnionType given#'
- '#Method Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeTrailingCommasInParamUseRector\:\:processUses\(\) should return PhpParser\\Node\\Expr\\Closure but returns PhpParser\\Node#'
- '#Cognitive complexity for "Rector\\NodeTypeResolver\\NodeTypeResolver\:\:getStaticType\(\)" is 11, keep it under 9#'
-
message: '#There should be no empty class#'
paths:
- packages/StaticTypeMapper/ValueObject/Type/FullyQualifiedGenericObjectType.php
- '#(.*?) class\-string, string given#'
-
message: '#Do not use trait, extract to a service and dependency injection instead#'
paths:
- packages/BetterPhpDocParser/Attributes/Attribute/AttributeTrait.php
- '#Content of method "getNextExpression\(\)" is duplicated with method "getNextExpression\(\)" in "Rector\\Php73\\Rector\\FuncCall\\ArrayKeyFirstLastRector" class\. Use unique content or service instead#'
-
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
paths:
- src/HttpKernel/RectorKernel.php
- '#Content of method "getIfNextReturn\(\)" is duplicated with method "getIfNextReturn\(\)" in "Rector\\EarlyReturn\\Rector\\If_\\ChangeAndIfToEarlyReturnRector" class\. Use unique content or service instead#'
# part of refactor() API, node must be returned, or does bring any value
-
message: '#Use void instead of modify and return self object#'
paths:
- '*Rector.php'
- '*NodeVisitor.php'
- '#Class with base "NodeComparator" name is already used in "Symplify\\PHPStanRules\\Printer\\NodeComparator", "Rector\\Core\\PhpParser\\Comparing\\NodeComparator"\. Use unique name to make classes easy to recognize#'
-
message: '#Property with protected modifier is not allowed\. Use interface contract method instead#'
paths:
- packages/BetterPhpDocParser/PhpDocNodeFactory/AbstractPhpDocNodeFactory.php
# @todo fix in symplify
-
message: '#Do not use chained method calls\. Put each on separated lines#'
paths:
- rules/Symfony/ConstantNameAndValueMatcher.php
- rules/Privatization/Rector/Class_/ChangeReadOnlyVariableWithDefaultValueToConstantRector.php
- rules/Privatization/Naming/ConstantNaming.php
-
message: '#Cannot cast array<string\>\|string\|null to string#'
paths:
- utils/compiler/src/Command/DowngradePathsCommand.php
- '#Method Rector\\Testing\\Finder\\RectorsFinder\:\:findClassesInDirectoriesByName\(\) should return array<class\-string\> but returns array<int, string\>#'
- '#Cannot cast array<string\>\|string\|null to string#'
# phpstan bug
- '#Unable to resolve the template type T in call to method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findParentTypes\(\)#'
-
message: '#Function "interface_exists\(\)" cannot be used/left in the code#'
path: packages/Testing/PhpConfigPrinter/config/php-config-printer-config.php