forked from rectorphp/rector-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan.neon
796 lines (616 loc) · 42.5 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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
includes:
- vendor/symplify/phpstan-rules/config/symplify-rules.neon
parameters:
reportUnmatchedIgnoredErrors: false
cognitive_complexity:
class: 50
function: 10
level: 8
# requires exact closure types
checkMissingCallableSignature: true
paths:
- rector.php
- bin
- src
- rules
- packages
# tests
- packages-tests
- tests
- rules-tests
- utils
- utils-tests
# this cannot be put it, because it wipes PHPStan cache on each run :( - must run in separate
#- config
scanDirectories:
- stubs
checkGenericClassInNonGenericObjectType: false
excludePaths:
# too modern code for PHPStan 0.12.2
- bin/validate-phpstan-version.php
# temporary stinrgable migration from template type provider
- bin/generate-changelog.php
# broken in PHPStan https://github.com/rectorphp/rector/runs/1305002460#step:5:56
- packages/Testing/PHPUnit/*.php
# demo rule
- tests/Issues/AliasedImportDouble/Rector/ClassMethod/AddAliasImportRector.php
# complex printer
- '*tests/Rector/MethodCall/RenameMethodRector/**/SomeClass.php'
# tests files
- "*tests/*/Expected/*"
- '*tests/*/Fixture/*'
- '*tests/*/Source/*'
- '*tests/*/Source*'
- '*tests/*/Fixture*'
# part of composer
- '*/tests/Rector/Psr4/MultipleClassFileToPsr4ClassesRector/Expected/Just*ExceptionWithoutNamespace.php'
# tests
- tests/DependencyInjection/config
ignoreErrors:
- '#Parameter \#1 \$node of method Rector\\PostRector\\Collector\\NodesToAddCollector\:\:wrapToExpression\(\) expects PhpParser\\Node\\Expr\|PhpParser\\Node\\Stmt, PhpParser\\Node given#'
- '#Cognitive complexity for "Rector\\Php80\\NodeResolver\\SwitchExprsResolver\:\:resolve\(\)" is (.*?), keep it under 10#'
-
message: '#Class cognitive complexity is \d+, keep it under \d+#'
paths:
- rules/Php70/EregToPcreTransformer.php
- packages/NodeTypeResolver/NodeTypeResolver.php
- rules/Renaming/NodeManipulator/ClassRenamer.php
- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php
- "#^Cognitive complexity for \"Rector\\\\Php70\\\\EregToPcreTransformer\\:\\:(.*?)\" is (.*?), keep it under 10$#"
- '#Cognitive complexity for "Rector\\Core\\PhpParser\\Node\\Value\\ValueResolver\:\:getValue\(\)" is \d+, keep it under 10#'
- '#Cognitive complexity for "Rector\\DeadCode\\NodeManipulator\\LivingCodeManipulator\:\:keepLivingCodeFromExpr\(\)" is \d+, keep it under 10#'
# known value
- '#Property PhpParser\\Node\\Stmt\\Foreach_\:\:\$valueVar \(PhpParser\\Node\\Expr\) does not accept PhpParser\\Node\\Expr\|null#'
# is nested expr
-
message: '#Access to an undefined property PhpParser\\Node\\Expr\:\:\$expr#'
path: rules/DeadCode/NodeManipulator/LivingCodeManipulator.php
# 3rd party package
-
message: '#Array (with keys|destruct) is not allowed\. Use value object to pass data instead#'
path: rules/Php70/EregToPcreTransformer.php
-
message: '#Use explicit return value over magic &reference#'
path: rules/Php70/EregToPcreTransformer.php
# false positives checked in another method
-
message: '#If condition is always false#'
paths:
- rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php
- packages/NodeNestingScope/NodeFinder/ScopeAwareNodeFinder.php
- '#Method (.*?) should return array<PhpParser\\Node\\(.*?)\> but returns array<PhpParser\\Node\>#'
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable\:\:\$name#'
- '#PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable given#'
-
message: '#There should be no empty class#'
paths:
- packages/StaticTypeMapper/ValueObject/Type/*Type.php
# generics nullable bugs
- '#Method (.*?) should return (.*?)\|null but returns PhpParser\\Node\|null#'
- '#Method (.*?) should return array<T of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
-
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
paths:
- src/Rector/AbstractRector.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 "property_exists\(\)" cannot be used/left in the code#'
paths:
# on PhpParser Nodes
- packages/NodeNameResolver/NodeNameResolver.php
# known types
- '#Call to an undefined method PHPStan\\Type\\ConstantType\:\:getValue\(\)#'
# - '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Isset_\\IssetOnPropertyObjectToPropertyExistsRector\:\:refactor\(\)" is \d+, keep it under 10#'
- '#(.*?) class\-string, string given#'
-
message: '#Array destruct is not allowed\. Use value object to pass data instead#'
paths:
- packages/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php
-
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
paths:
- packages/BetterPhpDocParser/ValueObject/Parser/BetterTokenIterator.php
- '#Cognitive complexity for "Rector\\BetterPhpDocParser\\PhpDocParser\\DoctrineAnnotationDecorator\:\:mergeNestedDoctrineAnnotations\(\)" is \d+, keep it under 10#'
- '#Cognitive complexity for "Rector\\NodeTypeResolver\\NodeTypeResolver\:\:getType\(\)" is \d+, keep it under 10#'
# known types
- '#Parameter (.*?) expects PhpParser\\Node, PhpParser\\Node\|null given#'
-
message: '#Class cognitive complexity is \d+, keep it under \d+#'
paths:
- packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php
- '#Method Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser\:\:parseChildAndStoreItsPositions\(\) should return PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTextNode but returns PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode#'
# deserves better architecture
-
message: '#Do not use chained method calls#'
path: packages/BetterPhpDocParser/Printer/PhpDocInfoPrinter.php
- '#expects class\-string<TNode of PHPStan\\PhpDocParser\\Ast\\Node\>, string given#'
# array_index on generic types
- '#Method Rector\\NodeTypeResolver\\PHPStan\\Type\\TypeFactory\:\:uniquateTypes\(\) should return array<TType of PHPStan\\Type\\Type\> but returns array<int, PHPStan\\Type\\Type\>#'
# resolve later
- '#Method "(.*?)\(\)" only calling another method call and has no added value\. Use the inlined call instead#'
- '#Method "processRenameVariable\(\)" returns bool type, so the name should start with is/has/was#'
- '#Method "resolveObjectType\(\)" returns bool type, so the name should start with is/has/was#'
# native filesystem calls, required for performance reasons
-
message: '#"@\\unlink\(\$tmpPath\)" is forbidden to use#'
paths:
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
-
message: '#"@\\rename\(\$tmpPath, \$path\)" is forbidden to use#'
paths:
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
-
message: '#"@\\var_export\(new \\Rector\\Caching\\ValueObject\\CacheItem\(\$variableKey, \$data\), true\)" is forbidden to use#'
paths:
- packages/Caching/ValueObject/Storage/FileCacheStorage.php
-
message: '#Instead of abstract class, use specific service with composition#'
paths:
- packages/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php
- packages/PostRector/Rector/AbstractPostRector.php
- src/Rector/AbstractRector.php
- src/Rector/AbstractScopeAwareRector.php
# find everything class, better then 10 different finders
-
message: '#Class cognitive complexity is \d+, keep it under 50#'
paths:
- src/PhpParser/Node/BetterNodeFinder.php
-
message: '#Parameter \#2 \$length of function str_split expects int<1, max\>, int given#'
paths:
- rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
# share configuration to avoid duplication in 5 rules
-
message: '#Instead of abstract class, use specific service with composition#'
path: rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php
# many internal cases
- '#Calling (.*?) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version#'
-
path: src/Bootstrap/RectorConfigsResolver.php
message: '#Method Rector\\Core\\Bootstrap\\RectorConfigsResolver\:\:resolveFromInput\(\) should return string\|null but returns string\|false#'
# known value object, nullable due to typed property
-
message: '#Cannot call method (.*?)\(\) on (.*?)\\ProcessPool\|null#'
path: packages/Parallel/Application/ParallelFileProcessor.php
# parallel complexity
- '#Cognitive complexity for "Rector\\Parallel\\Application\\ParallelFileProcessor\:\:process\(\)" is \d+, keep it under 10#'
# strict rules
- '#Dynamic call to static method PHPUnit\\Framework\\Assert\:\:(.*?)\(\)#'
# specific generics
- '#Parameter \#1 \$node (.*?) of method Rector\\(.*?)Rector\:\:refactor\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Core\\Contract\\Rector\\PhpRectorInterface\:\:refactor\(\)#'
- '#Return type (.*?) of method Rector\\(.*?)\\Rector\\(.*?)\\(.*?)\:\:refactor\(\) should be covariant with return type \(array<PhpParser\\Node>\|PhpParser\\Node\|null\) of method Rector\\Core\\Contract\\Rector\\PhpRectorInterface\:\:refactor\(\)#'
# only for empty ctor
- '#Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
# generics
- '#Method Rector\\Core\\PhpParser\\NodeTraverser\\RectorNodeTraverser\:\:traverse\(\) should return array<TNode of PhpParser\\Node\> but returns array<PhpParser\\Node\>#'
- '#Parameter \#1 \$stmts of class Rector\\Core\\PhpParser\\Node\\CustomNode\\FileWithoutNamespace constructor expects array<PhpParser\\Node\\Stmt\>, array<TNode of PhpParser\\Node\> given#'
# strict - resolve later
- '#Foreach overwrites \$(.*?) with its value variable#'
-
message: '#Strict comparison using \!\=\= between null and null will always evaluate to false#'
path: rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php
# stricter child type on purpose
- '#Parameter \#1 \$nodes \(array<PhpParser\\Node\\Stmt\>\) of method Rector\\PostRector\\Rector\\(.*?)\:\:beforeTraverse\(\) should be contravariant with parameter \$nodes \(array<PhpParser\\Node\>\) of method PhpParser\\NodeVisitor\:\:beforeTraverse\(\)#'
# stricter child type on purpose
- '#Parameter \#1 \$tokenIterator \(Rector\\BetterPhpDocParser\\ValueObject\\Parser\\BetterTokenIterator\) of method Rector\\BetterPhpDocParser\\PhpDocParser\\BetterPhpDocParser\:\:parseTagValue\(\) should be contravariant with parameter \$tokens \(PHPStan\\PhpDocParser\\Parser\\TokenIterator\) of method PHPStan\\PhpDocParser\\Parser\\PhpDocParser\:\:parseTagValue\(\)#'
- '#Parameter \#1 \$nodes \(array<PhpParser\\Node\\Stmt\>\) of method Rector\\PostRector\\Rector\\(.*?)\:\:beforeTraverse\(\) should be contravariant with parameter \$nodes \(array<PhpParser\\Node\>\) of method PhpParser\\NodeVisitorAbstract\:\:beforeTraverse\(\)#'
# on purpose, allows empty tokens
- '#Rector\\BetterPhpDocParser\\ValueObject\\Parser\\BetterTokenIterator\:\:__construct\(\) does not call parent constructor from PHPStan\\PhpDocParser\\Parser\\TokenIterator#'
- '#Rector\\Comments\\NodeTraverser\\CommentRemovingNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
# confused generics
- '#Return type \(array<class\-string<PhpParser\\Node\>\>\) of method Rector\\NodeTypeResolver\\NodeTypeResolver\\(.*?)TypeResolver\:\:getNodeClasses\(\) should be covariant with return type \(array<class\-string<PhpParser\\Node\\(.*?)\>\>\) of method Rector\\NodeTypeResolver\\Contract\\NodeTypeResolverInterface<PhpParser\\Node\\(.*?)\>\:\:getNodeClasses\(\)#'
# skipped on purpose, as ctor overrie
- '#Rector\\StaticTypeMapper\\ValueObject\\Type\\SimpleStaticType\:\:__construct\(\) does not call parent constructor from PHPStan\\Type\\StaticType#'
# complex detection
- '#Cognitive complexity for "Rector\\Core\\DependencyInjection\\Collector\\ConfigureCallValuesCollector\:\:addConfigureCallValues\(\)" is \d+, keep it under 10#'
# return bool on change
- '#Method "(change|remove)(.*?)" returns bool type, so the name should start with is/has/was#'
-
message: '#Casting to float something that.{1}s already float#'
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #38
-
message: '#Casting to string something that.{1}s already string#'
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #42
-
message: '#Casting to int something that.{1}s already int#'
path: packages/NodeTypeResolver/NodeTypeResolver/ScalarTypeResolver.php #46
-
message: '#Use value object over return of values#'
paths:
- src/Application/ApplicationFileProcessor.php
- packages/Parallel/Application/ParallelFileProcessor.php
- packages/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser/ArrayParser.php
- rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php
- rules/Php70/EregToPcreTransformer.php
- rules/CodeQuality/Rector/PropertyFetch/ExplicitMethodCallOverMagicGetSetRector.php
- rules/PSR4/Rector/FileWithoutNamespace/NormalizeNamespaceByPSR4ComposerAutoloadRector.php
- rules/Renaming/NodeManipulator/ClassRenamer.php
- '#Method Rector\\Core\\Application\\ApplicationFileProcessor\:\:runParallel\(\) should return array\{system_errors\: array<Rector\\Core\\ValueObject\\Error\\SystemError\>, file_diffs\: array<Rector\\Core\\ValueObject\\Reporting\\FileDiff\>\} but returns array#'
# impossible to validate json string is a class-string
- '#Parameter \#1 \$rectorClass of class Rector\\ChangesReporting\\ValueObject\\RectorWithLineChange constructor expects class\-string<Rector\\Core\\Contract\\Rector\\RectorInterface\>\|Rector\\Core\\Contract\\Rector\\RectorInterface, string given#'
-
message: '#Only booleans are allowed in an if condition, array\|null given#'
paths:
- rules/Naming/Naming/PropertyNaming.php
- src/DependencyInjection/CompilerPass/AutowireArrayParameterCompilerPass.php
# mapper re-use
- '#Parameter \#1 \$type of method Rector\\PHPStanStaticTypeMapper\\TypeMapper\\ObjectWithoutClassTypeMapper\:\:mapToPhpParserNode\(\) expects PHPStan\\Type\\ObjectWithoutClassType, PHPStan\\Type\\Accessory\\Has(Property|Method)Type given#'
# Scope vs MutatingScope interchangable false positive
- '#Parameter \#3 \$nodeCallback of method PHPStan\\Analyser\\NodeScopeResolver\:\:processNodes\(\) expects callable\(PhpParser\\Node, PHPStan\\Analyser\\Scope\)\: void, (callable|Closure)\(PhpParser\\Node, PHPStan\\Analyser\\MutatingScope\)\: void given#'
# internal reflection
- '#Instead of "new ClassReflection\(\)" use ReflectionProvider service or "\(new PHPStan\\Reflection\\ClassReflection\(<desired_type>\)\)" for static reflection to work#'
- '#Callable callable\(PHPStan\\Type\\Type\)\: PHPStan\\Type\\Type invoked with 2 parameters, 1 required#'
-
message: '#Make callable type explicit#'
path: src/NodeManipulator/BinaryOpManipulator.php
# double protection on purpose to ensure the type
-
message: '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<string> will always evaluate to true#'
path: packages/Config/RectorConfig.php
# stmts refactoring
- '#Cognitive complexity for "Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector\:\:refactor\(\)" is \d+, keep it under 10#'
# empty parent construct
- '#Rector\\Core\\PhpParser\\NodeTraverser\\FileWithoutNamespaceNodeTraverser\:\:__construct\(\) does not call parent constructor from PhpParser\\NodeTraverser#'
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier\:\:matchShortenedObjectType\(\)" is \d+, keep it under 10#'
- '#Cognitive complexity for "Rector\\TypeDeclaration\\PHPStan\\ObjectTypeSpecifier\:\:narrowToFullyQualifiedOrAliasedObjectType\(\)" is \d+, keep it under 10#'
- '#Parameter \#1 \$node (.*?) of method Rector\\(.*?)\:\:refactorWithScope\(\) should be contravariant with parameter \$node \(PhpParser\\Node\) of method Rector\\Core\\Contract\\Rector\\ScopeAwarePhpRectorInterface\:\:refactorWithScope\(\)#'
# cleanup after merge of assing remover refactoring
- '#Cognitive complexity for "Rector\\Removing\\NodeManipulator\\ComplexNodeRemover\:\:removePropertyAndUsages\(\)" is \d+, keep it under 10#'
-
message: '#Cognitive complexity for "Rector\\(.*?)Rector\:\:refactor\(\)" is \d+, keep it under 10#'
paths:
- rules/EarlyReturn/Rector/If_/ChangeAndIfToEarlyReturnRector.php
- rules/CodingStyle/Rector/ClassMethod/MakeInheritedMethodVisibilitySameAsParentRector.php
# known value
- '#Method Rector\\Core\\Php\\PhpVersionProvider\:\:provide\(\) should return 50200\|50300\|50400\|50500\|50600\|70000\|70100\|70200\|70300\|70400\|80000\|80100\|80200\|100000 but returns int#'
# stubs-rector directory exists on target-repository
-
message: '#The path "/\.\./\.\./stubs\-rector" was not found#'
path: src/Autoloading/BootstrapFilesIncluder.php # 54
-
message: '#PHPDoc tag @param for parameter \$node with type array<PhpParser\\Node\\Stmt\\Expression>\|null is incompatible with native type PhpParser\\Node#'
paths:
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
-
message: '#Method Rector\\CodeQuality\\Rector\\FuncCall\\ChangeArrayPushToArrayAssignRector\:\:refactor\(\) return type has no value type specified in iterable type array#'
paths:
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
-
message: '#Access to an undefined property PhpParser\\Node\:\:\$expr#'
paths:
- rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php
# doc arrays cannot be trusted
-
message: '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<class\-string<Rector\\Core\\Contract\\Rector\\RectorInterface>> will always evaluate to true#'
path: packages/Config/RectorConfig.php
# hash key
-
path: rules/Renaming/NodeManipulator/ClassRenamer.php
message: '#Use separate function calls with readable variable names#'
- '#Cognitive complexity for "Rector\\NodeTypeResolver\\PHPStan\\Scope\\PHPStanNodeScopeResolver\:\:processNodes\(\)" is \d+, keep it under 10#'
# depends on falsy docs
- '#Call to static method Webmozart\\Assert\\Assert\:\:allIsInstanceOf\(\) with array<PhpParser\\Node\\Stmt> and (.*?)Stmt(.*?) will always evaluate to true#'
-
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
paths:
# autoload check in bin file
- bin/rector.php
- packages/NodeTypeResolver/DependencyInjection/PHPStanExtensionsConfigResolver.php
# for config class reflection
- src/Bootstrap/ExtensionConfigResolver.php
- src/DependencyInjection/CompilerPass/AutowireArrayParameterCompilerPass.php
- src/DependencyInjection/Skipper/ParameterSkipper.php
- src/DependencyInjection/DefinitionFinder.php
-
message: '#Function "interface_exists\(\)" cannot be used/left in the code\: use ReflectionProvider\->has\*\(\) instead#'
path: src/DependencyInjection/Skipper/ParameterSkipper.php
# use of internal phpstan classes
-
message: '#Creating new PHPStan\\Reflection\\BetterReflection\\SourceLocator\\Optimized(.*?)SourceLocator is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
path: packages/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php
-
message: '#Creating new PHPStan\\Reflection\\Native\\NativeFunctionReflection is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
path: src/PHPStan/Reflection/TypeToCallReflectionResolver/ClosureTypeToCallReflectionResolver
-
message: '#Do not name "[a-z]", shorter than 2 chars#'
paths:
# override parent method named "p"
- src/PhpParser/Printer/BetterStandardPrinter.php
# regex
- rules/Php70/EregToPcreTransformer.php
-
message: '#Instead of "DateTime" class/interface use "Nette\\Utils\\DateTime"#'
path: src/Application/VersionResolver.php
# complex multiprinter
-
message: '#Class cognitive complexity is \d+, keep it under 50#'
path: src/PhpParser/Printer/BetterStandardPrinter.php #41
# validate class-string input
-
message: '#Call to static method Webmozart\\Assert\\Assert\:\:(.*?)\(\) with (.*?) will always evaluate to (false|true)#'
path: packages/Config/RectorConfig.php
# optional rule for PHP 8.1
- '#Register "Rector\\Php81\\Rector\\Class_\\ConstantListClassToEnumRector" service to "php81\.php" config set#'
- '#Rule Rector\\Php81\\Rector\\Class_\\ConstantListClassToEnumRector must implements Rector\\VersionBonding\\Contract\\MinPhpVersionInterface#'
-
message: '#Method "refactor(Params|Return)\(\)" returns bool type, so the name should start with is/has/was#'
path: rules/Php81/Rector/Class_/ConstantListClassToEnumRector.php
- '#Method "replaceTagByAnother\(\)" returns bool type, so the name should start with is/has/was#'
- '#Method "refactorPhpDoc\(\)" returns bool type, so the name should start with is/has/was#'
- '#Cognitive complexity for "Rector\\Renaming\\Rector\\FileWithoutNamespace\\PseudoNamespaceToNamespaceRector\:\:refactorStmts\(\)" is 11, keep it under 10#'
# resolve later with configurable types
- '#On passing a constant, the method should have an enum type\. See https\://phpstan\.org/writing\-php\-code/phpdoc\-types\#literals\-and\-constants#'
-
message: '#@\\ini_set\(.*\)" is forbidden to use#'
path: bin/rector.php
# should be fixed in symplify next
-
message: '#New objects with "\$arrayItem" name are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
path: src/PhpParser/Node/NodeFactory.php
# faking node to invoke scope callable on attribute
-
message: '#New objects with "\$node" name are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
path: src/Application/ChangedNodeScopeRefresher.php
# mixed type correction
-
message: '#New objects with "\$(first|second)KeyType" name are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
path: packages/NodeTypeResolver/TypeComparator/TypeComparator.php
-
message: '#New objects with "\$staticType" name are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
path: packages/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php
-
message: '#New objects with "\$fullyQualifiedObjectType" name are overridden\. This can lead to unwanted bugs, please pick a different name to avoid it#'
path: packages/NodeTypeResolver/PhpDocNodeVisitor/NameImportingPhpDocNodeVisitor.php
# regex re-validation
-
message: '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<string> will always evaluate to true#'
path: rules/Transform/ValueObject/ParentClassToTraits.php
-
message: '#Relative file path ".+" is not allowed, use absolute one with __DIR__#'
paths:
- bin/rector.php
- src/Bootstrap/RectorConfigsResolver.php
- src/NonPhpFile/NonPhpFileProcessor.php
- tests/FileSystem/FilesFinder/FilesFinderTest.php
# part of tests
- '#Call to method PHPUnit\\Framework\\Assert\:\:assertIsInt\(\) with 50200\|50300\|50400\|50500\|50600\|70000\|70100\|70200\|70300\|70400\|80000\|80100\|80200\|100000 will always evaluate to true#'
-
message: '#Method call return value that should be used, but is not#'
paths:
- src/Console/Output/RectorOutputStyle.php
- rules/Compatibility/NodeFactory/ConstructorClassMethodFactory.php
- src/Application/ChangedNodeScopeRefresher.php
- rules/TypeDeclaration/TypeNormalizer.php
- rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictNewArrayRector.php
- rules/Removing/NodeManipulator/ComplexNodeRemover.php
- rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php
- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php
- packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php
-
message: '#Method call return value that should be used, but is not#'
path: src/PhpParser/Node/NodeFactory.php
count: 1
# false postive, on trait use in multiple classes
-
message: '#Method name "(.*?)Attribute\(\)" is used in multiple traits\. Make it unique to avoid conflicts#'
paths:
- packages/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php
- packages/BetterPhpDocParser/PhpDoc/ArrayItemNode.php
# @todo resolve later
-
message: '#Cognitive complexity#i'
path: rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php
# validation
- '#Call to static method Webmozart\\Assert\\Assert\:\:allIsInstanceOf\(\) with array<Rector\\BetterPhpDocParser\\PhpDoc\\ArrayItemNode> and (.*?) will always evaluate to true#'
- '#Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with array<string> will always evaluate to true#'
# simple array filters
-
message: '#Use separate function calls with readable variable names#'
paths:
- utils/RuleDocGenerator/PostRectorOutFilter.php
- src/FileSystem/FileAndDirectoryFilter.php
# phpdoc node traversing
-
message: "#Implicit array creation is not allowed \\- variable \\$doNodes might not exist#"
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php"
-
message: '#Instead of abstract class, use specific service with composition#'
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/AbstractPhpDocNodeVisitor.php"
-
message: '#Cognitive complexity for "Rector\\PhpDocParser\\PhpDocParser\\PhpDocNodeTraverser\:\:(.*?)\(\)" is \d+, keep it under 10#'
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php"
-
message: '#Variable property access on TNode of PHPStan\\PhpDocParser\\Ast\\Node#'
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php"
-
message: '#Use explicit names over dynamic ones#'
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php"
-
message: "#Class cognitive complexity is 69, keep it under 50#"
path: "packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php"
-
message: '#Creating new PHPStan\\Parser\\(CachedParser|SimpleParser) is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
path: packages/PhpDocParser/PhpParser/SmartPhpParserFactory.php
-
message: '#Only booleans are allowed in a negated boolean, string\|false given#'
path: packages/Testing/Fixture/FixtureFileUpdater.php
-
message: '#Only booleans are allowed in a negated boolean, array<int, ReflectionParameter> given#'
path: src/DependencyInjection/CompilerPass/AutowireArrayParameterCompilerPass.php
-
message: '#Only booleans are allowed in an if condition, array\|string\|null give#'
path: src/DependencyInjection/CompilerPass/AutowireArrayParameterCompilerPass.php
-
message: '#Content of method "(.*?)" is duplicated\. Use unique content or service instead#'
paths:
- packages/NodeTypeResolver/NodeTypeResolver.php
- packages/NodeTypeResolver/PHPStan/TypeHasher.php
-
message: '#Content of method "refactor\(\)" is duplicated\. Use unique content or service instead#'
paths:
- rules/CodingStyle/Rector/ArrowFunction/StaticArrowFunctionRector.php
- rules/CodingStyle/Rector/Closure/StaticClosureRector.php
-
message: '#Content of method "resolveAssignVar\(\)" is duplicated\. Use unique content or service instead#'
paths:
- rules/Php80/Rector/Switch_/ChangeSwitchToMatchRector.php
- rules/Php80/NodeFactory/MatchFactory.php
-
message: '#Content of method "(.*?)" is duplicated\. Use unique content or service instead#'
path: rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php
# known existing class
-
message: '#Instead of "instanceof/is_a\(\)" use ReflectionProvider service or "\(new ObjectType\(<desired_type>\)\)\->isSuperTypeOf\(<element_type>\)" for static reflection to work#'
path: packages/Skipper/Skipper/SkipSkipper.php
# split of string schema
-
message: '#Array destruct is not allowed\. Use value object to pass data instead#'
path: src/FileSystem/FilePathHelper.php
# the local instanceof for known types
- '#Instead of "instanceof/is_a\(\)" use ReflectionProvider service or "\(new ObjectType\(<desired_type>\)\)\->isSuperTypeOf\(<element_type>\)" for static reflection to work#'
# required for reflection
-
message: '#Function "(.*?)\(\)" cannot be used/left in the code#'
path: src/Util/Reflection/PrivatesAccessor.php
-
message: '#Use explicit return value over magic &reference#'
path: packages/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php
# for reflection
-
message: '#\$this as argument is not allowed\. Refactor method to service composition#'
path: packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php
-
message: '#Offset \(int\|string\) on array<PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocChildNode> in isset\(\) always exists and is not nullable#'
path: packages/BetterPhpDocParser/PhpDocParser/DoctrineAnnotationDecorator.php
-
message: '#Method Rector\\Core\\Util\\ArrayParametersMerger\:\:mergeLeftToRightWithCallable\(\) has parameter \$mergeCallback with no signature specified for callable#'
path: src/Util/ArrayParametersMerger.php
-
message: '#Make callable type explicit\. Here is how\: https\://phpstan\.org/writing\-php\-code/phpdoc\-types\#callables#'
path: src/Util/ArrayParametersMerger.php
# fixture class
- '#Class "Rector\\Core\\Tests\\Issues\\ScopeNotAvailable\\Variable\\ArrayItemForeachValueRector" is missing @see annotation with test case class reference#'
-
message: '#Offset (.*?)includes(.*?) always exists and is not nullable#'
paths:
- src/Bootstrap/ExtensionConfigResolver.php
- packages/NodeTypeResolver/DependencyInjection/PHPStanExtensionsConfigResolver.php
# returns bool for notifications
- '#Method "renamePropertyPromotion\(\)" returns bool type, so the name should start with is/has/was#'
# false positive
- '#Method Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddParamTypeBasedOnPHPUnitDataProviderRector\:\:resolveDataProviderPhpDocTagNode\(\) should return PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagNode\|null but returns PHPStan\\PhpDocParser\\Ast\\Node\|null#'
-
message: '#Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary#'
paths:
- src/DependencyInjection/DefinitionFinder.php
-
message: '#Parameter \#1 \$node of method Rector\\Core\\Rector\\AbstractRector\:\:getType\(\) expects PhpParser\\Node, PhpParser\\Node\\Expr\|null given#'
path: rules/TypeDeclaration/Rector/ClassMethod/FalseReturnClassMethodToNullableRector.php
# changelog generator
-
message: '#Do not use chained method calls\. Put each on separated lines#'
path: utils/ChangelogGenerator/GithubApiCaller.php
-
message: '#Anonymous (variable|variables) in#'
path: utils/ChangelogGenerator
# std class api
-
message: '#Function "property_exists\(\)" cannot be used/left in the code\: use ReflectionProvider\->has\*\(\) instead#'
path: utils/ChangelogGenerator
-
message: '#Function "property_exists\(\)" cannot be used/left in the code#'
path: utils/ChangelogGenerator
-
message: '#Parameter \#1 \$phpVersion of method Rector\\Config\\RectorConfig\:\:phpVersion\(\) expects 50200\|50300\|50400\|50500\|50600\|70000\|70100\|70200\|70300\|70400\|80000\|80100\|80200\|100000, (.*?) given#'
path: rules-tests
-
message: '#Class (.*?) not found#'
paths:
- rules-tests/*/config/*
-
message: '#Value object "(.*?)" should be named "(.*?)" instead to respect used service#'
paths:
- rules-tests/*/config/*
-
message: '#Offset \d does not exist on array<string, string>#'
paths:
- *Test.php
-
message: '#Relative file path "(.*?)" is not allowed, use absolute one with __DIR__#'
paths:
- packages-tests/Skipper/Skipper/Skipper/SkipperTest.php
- '#Parameter \#1 \$expected of method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) expects class\-string<object>, string given#'
# @todo fix in symplify
- '#Relative file path "mearie\\\.org" is not allowed, use absolute one with __DIR__#'
- '#Parameter \#3 \$nodeClass of method Rector\\Tests\\BetterPhpDocParser\\PhpDocParser\\TagValueNodeReprint\\TagValueNodeReprintTest\:\:doTestPrintedPhpDocInfo\(\) expects class\-string<PhpParser\\Node>, string given#'
-
message: '#Method call return value that should be used, but is not#'
path: packages-tests/BetterPhpDocParser/PhpDocInfo/PhpDocInfo/PhpDocInfoTest.php
-
message: '#"Tests" namespace cannot be used outside of "tests" directory#'
path: utils-tests
# trusted items
- '#Parameter \#1 \$nodes of method PhpParser\\PrettyPrinterAbstract\:\:pCommaSeparatedMultiline\(\) expects array<PhpParser\\Node>, array<PhpParser\\Node\\Expr\\ArrayItem\|null> given#'
# class string
- '#Parameter \#1 \$name of method PHPStan\\BetterReflection\\Reflection\\Adapter\\ReflectionClass\:\:getAttributes\(\) expects class\-string\|null, string given#'
-
message: '#Instead of protected element, use private element or contract method#'
paths:
- packages/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php
- rules/Strict/Rector/AbstractFalsyScalarRuleFixerRector.php
- src/Console/Command/AbstractProcessCommand.php
- src/Rector/AbstractRector.php
# useless
- '#Parameter \#1 \$suffix of method PHPUnit\\Framework\\Assert\:\:assertStringEndsWith\(\) expects non\-empty\-string, string given#'
# reported in configs
- '#Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\service not found#'
# array type assert
- '#Call to static method Webmozart\\Assert\\Assert\:\:allIsInstanceOf\(\) with array<PHPStan\\PhpDocParser\\Ast\\Type\\CallableTypeParameterNode> and (.*?) will always evaluate to true#'
-
message: '#Function "function_exists\(\)" cannot be used/left in the code#'
path: src/functions/node_helper.php
-
message: '#Function "dump_node\(\)" cannot be used/left in the code\: #'
path: src/functions/node_helper.php
# nullable in external package
- '#Parameters should use "PhpParser\\Node\\Expr\\FuncCall\|string\|string\|PHPStan\\Analyser\\Scope" types as the only types passed to this method#'
- '#Call to static method Webmozart\\Assert\\Assert\:\:(allIsAOf|isAOf|assertInstanceOf|allIsInstanceOf)(.*?) will always evaluate to true#'
- '#Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with (.*?) will always evaluate to true#'
- '#Doing instanceof PHPStan\\Type\\.* is error\-prone and deprecated(\. Use Type\:\:.*\(\) (or .* )?instead)?#'
# phpstan 1.10.0
- '#Call to deprecated method getDirectClassNames\(\) of class PHPStan\\Type\\TypeUtils.*#'
- '#Parameter 3 should use "PHPStan\\Reflection\\ParameterReflectionWithPhpDocs" type as the only type passed to this method#'
- '#Parameters should use "PHPStan\\Reflection\\ParameterReflectionWithPhpDocs\|PhpParser\\Node\\Param" types as the only types passed to this method#'
# various usage
- '#Parameters should use "PHPStan\\DependencyInjection\\Container" types as the only types passed to this method#'
# actually used in global scope
-
message: '#Anonymous function has an unused use \$container#'
path: src/Autoloading/BootstrapFilesIncluder.php
# false positive on enums
- '#Method Rector\\Core\\Console\\Command\\SetupCICommand\:\:resolveCurrentCI\(\) never returns (.*?) so it can be removed from the return type#'
- '#Access to an undefined property Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts#'
- '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassLike\|Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts#'
-
message: '#Method "renameVariableInFunctionLike\(\)" returns bool type, so the name should start with is/has/was#'
path: rules/Naming/VariableRenamer.php
-
message: '#Method call return value that should be used, but is not#'
paths:
- rules/Naming/ParamRenamer/ParamRenamer.php
- rules/Naming/PropertyRenamer/PropertyPromotionRenamer.php
- rules/Naming/Rector/Assign/RenameVariableToMatchMethodCallReturnTypeRector.php
- rules/Naming/Rector/ClassMethod/RenameVariableToMatchNewTypeRector.php
- rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php
# next to resolve
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Isset_\\IssetOnPropertyObjectToPropertyExistsRector\:\:refactor\(\)" is 13, keep it under 10#'
- '#Cognitive complexity for "Rector\\EarlyReturn\\Rector\\Return_\\PreparedValueToEarlyReturnRector\:\:refactor\(\)" is 11, keep it under 10#'
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Foreach_\\SimplifyForeachToCoalescingRector\:\:refactor\(\)" is 16, keep it under 10#'
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\Foreach_\\ForeachToInArrayRector\:\:refactor\(\)" is \d+, keep it under 10#'
- '#Cognitive complexity for "Rector\\CodeQuality\\Rector\\If_\\SimplifyIfNullableReturnRector\:\:refactor\(\)" is 15, keep it under 10#'
# resolve continually
- '#(Matching|Fetching) deprecated class constant (NEXT_NODE|PREVIOUS_NODE) of class Rector\\NodeTypeResolver\\Node\\AttributeKey#'
- '#Property Rector\\Core\\Contract\\PhpParser\\Node\\StmtsAwareInterface\:\:\$stmts \(array<PhpParser\\Node\\Stmt>\|null\) does not accept array<PhpParser\\Node\\Stmt\|null>#'
# make autoload of php-parser in rector first
- '#but class PhpParser\\Node\\Stmt\\Expression is not generic#'
- '#Parameter \#3 \$assign of method Rector\\CodeQuality\\Rector\\FunctionLike\\SimplifyUselessVariableRector\:\:processSimplifyUselessVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp, PhpParser\\Node\\Expr given#'