@@ -71,7 +71,6 @@ public function testIsCandidateReturnsFalseWhenNoClass(): void
7171 public function testBuildDocBlockWithEmptyAnnotations (): void
7272 {
7373 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
74- $ method ->setAccessible (true );
7574
7675 $ result = $ method ->invoke ($ this ->fixer , [], 'TestClass ' );
7776
@@ -81,7 +80,6 @@ public function testBuildDocBlockWithEmptyAnnotations(): void
8180 public function testBuildDocBlockWithSingleAnnotation (): void
8281 {
8382 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
84- $ method ->setAccessible (true );
8583
8684 $ result = $ method ->invoke ($ this ->fixer , ['author ' => 'John Doe <john@example.com> ' ], '' );
8785
@@ -92,7 +90,6 @@ public function testBuildDocBlockWithSingleAnnotation(): void
9290 public function testBuildDocBlockWithMultipleAnnotations (): void
9391 {
9492 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
95- $ method ->setAccessible (true );
9693
9794 $ result = $ method ->invoke ($ this ->fixer , [
9895 'author ' => 'John Doe <john@example.com> ' ,
@@ -106,7 +103,6 @@ public function testBuildDocBlockWithMultipleAnnotations(): void
106103 public function testBuildDocBlockWithArrayValue (): void
107104 {
108105 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
109- $ method ->setAccessible (true );
110106
111107 $ result = $ method ->invoke ($ this ->fixer , [
112108 'author ' => [
@@ -123,7 +119,6 @@ public function testBuildDocBlockWithArrayValue(): void
123119 public function testBuildDocBlockWithEmptyValue (): void
124120 {
125121 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
126- $ method ->setAccessible (true );
127122
128123 $ result = $ method ->invoke ($ this ->fixer , [
129124 'deprecated ' => '' ,
@@ -137,7 +132,6 @@ public function testBuildDocBlockWithEmptyValue(): void
137132 public function testBuildDocBlockWithNullValue (): void
138133 {
139134 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
140- $ method ->setAccessible (true );
141135
142136 $ result = $ method ->invoke ($ this ->fixer , [
143137 'internal ' => null ,
@@ -151,7 +145,6 @@ public function testBuildDocBlockWithNullValue(): void
151145 public function testBuildDocBlockWithMixedEmptyAndNonEmptyValues (): void
152146 {
153147 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
154- $ method ->setAccessible (true );
155148
156149 $ result = $ method ->invoke ($ this ->fixer , [
157150 'deprecated ' => '' ,
@@ -189,7 +182,6 @@ public function testConfigurationDefinition(): void
189182 public function testParseExistingAnnotations (): void
190183 {
191184 $ method = new ReflectionMethod ($ this ->fixer , 'parseExistingAnnotations ' );
192- $ method ->setAccessible (true );
193185
194186 $ docBlock = "/** \n * @author John Doe \n * @license MIT \n */ " ;
195187 $ result = $ method ->invoke ($ this ->fixer , $ docBlock );
@@ -205,7 +197,6 @@ public function testParseExistingAnnotations(): void
205197 public function testMergeAnnotations (): void
206198 {
207199 $ method = new ReflectionMethod ($ this ->fixer , 'mergeAnnotations ' );
208- $ method ->setAccessible (true );
209200
210201 $ existing = ['author ' => 'Existing Author ' , 'version ' => '1.0 ' ];
211202 $ new = ['author ' => 'New Author ' , 'license ' => 'MIT ' ];
@@ -228,7 +219,6 @@ public function testApplyFixWithEmptyAnnotations(): void
228219 $ file = new SplFileInfo (__FILE__ );
229220
230221 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
231- $ method ->setAccessible (true );
232222
233223 $ this ->fixer ->configure (['annotations ' => []]);
234224 $ method ->invoke ($ this ->fixer , $ file , $ tokens );
@@ -243,7 +233,6 @@ public function testApplyFixAddsDocBlockToClass(): void
243233 $ file = new SplFileInfo (__FILE__ );
244234
245235 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
246- $ method ->setAccessible (true );
247236
248237 $ this ->fixer ->configure ([
249238 'annotations ' => ['author ' => 'John Doe ' ],
@@ -262,7 +251,6 @@ public function testApplyFixHandlesMultipleClasses(): void
262251 $ file = new SplFileInfo (__FILE__ );
263252
264253 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
265- $ method ->setAccessible (true );
266254
267255 $ this ->fixer ->configure ([
268256 'annotations ' => ['author ' => 'John Doe ' ],
@@ -281,7 +269,6 @@ public function testProcessClassDocBlockWithNewDocBlock(): void
281269 $ annotations = ['author ' => 'John Doe ' ];
282270
283271 $ method = new ReflectionMethod ($ this ->fixer , 'processStructureDocBlock ' );
284- $ method ->setAccessible (true );
285272
286273 $ this ->fixer ->configure (['separate ' => 'none ' ]);
287274 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
@@ -297,7 +284,6 @@ public function testProcessClassDocBlockWithExistingDocBlockPreserve(): void
297284 $ annotations = ['author ' => 'John Doe ' ];
298285
299286 $ method = new ReflectionMethod ($ this ->fixer , 'processStructureDocBlock ' );
300- $ method ->setAccessible (true );
301287
302288 $ this ->fixer ->configure (['preserve_existing ' => true ]);
303289 $ method ->invoke ($ this ->fixer , $ tokens , 2 , $ annotations , 'Foo ' );
@@ -313,7 +299,6 @@ public function testProcessClassDocBlockWithExistingDocBlockReplace(): void
313299 $ annotations = ['author ' => 'John Doe ' ];
314300
315301 $ method = new ReflectionMethod ($ this ->fixer , 'processStructureDocBlock ' );
316- $ method ->setAccessible (true );
317302
318303 $ this ->fixer ->configure (['preserve_existing ' => false ]);
319304 $ method ->invoke ($ this ->fixer , $ tokens , 2 , $ annotations , 'Foo ' );
@@ -328,7 +313,6 @@ public function testFindExistingDocBlockFound(): void
328313 $ tokens = Tokens::fromCode ($ code );
329314
330315 $ method = new ReflectionMethod ($ this ->fixer , 'findExistingDocBlock ' );
331- $ method ->setAccessible (true );
332316
333317 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 2 );
334318
@@ -341,7 +325,6 @@ public function testFindExistingDocBlockNotFound(): void
341325 $ tokens = Tokens::fromCode ($ code );
342326
343327 $ method = new ReflectionMethod ($ this ->fixer , 'findExistingDocBlock ' );
344- $ method ->setAccessible (true );
345328
346329 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 1 );
347330
@@ -354,7 +337,6 @@ public function testFindExistingDocBlockWithModifiers(): void
354337 $ tokens = Tokens::fromCode ($ code );
355338
356339 $ method = new ReflectionMethod ($ this ->fixer , 'findExistingDocBlock ' );
357- $ method ->setAccessible (true );
358340
359341 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 3 );
360342
@@ -368,7 +350,6 @@ public function testMergeWithExistingDocBlock(): void
368350 $ annotations = ['author ' => 'John Doe ' ];
369351
370352 $ method = new ReflectionMethod ($ this ->fixer , 'mergeWithExistingDocBlock ' );
371- $ method ->setAccessible (true );
372353
373354 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
374355
@@ -383,7 +364,6 @@ public function testReplaceDocBlock(): void
383364 $ annotations = ['author ' => 'John Doe ' ];
384365
385366 $ method = new ReflectionMethod ($ this ->fixer , 'replaceDocBlock ' );
386- $ method ->setAccessible (true );
387367
388368 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
389369
@@ -398,7 +378,6 @@ public function testInsertNewDocBlockWithSeparateNone(): void
398378 $ annotations = ['author ' => 'John Doe ' ];
399379
400380 $ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
401- $ method ->setAccessible (true );
402381
403382 $ this ->fixer ->configure (['separate ' => 'none ' ]);
404383 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
@@ -414,7 +393,6 @@ public function testInsertNewDocBlockWithSeparateTop(): void
414393 $ annotations = ['author ' => 'John Doe ' ];
415394
416395 $ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
417- $ method ->setAccessible (true );
418396
419397 $ this ->fixer ->configure (['separate ' => 'top ' ]);
420398 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
@@ -431,7 +409,6 @@ public function testInsertNewDocBlockWithSeparateBottom(): void
431409 $ annotations = ['author ' => 'John Doe ' ];
432410
433411 $ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
434- $ method ->setAccessible (true );
435412
436413 $ this ->fixer ->configure (['separate ' => 'bottom ' ]);
437414 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
@@ -448,7 +425,6 @@ public function testInsertNewDocBlockWithSeparateBoth(): void
448425 $ annotations = ['author ' => 'John Doe ' ];
449426
450427 $ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
451- $ method ->setAccessible (true );
452428
453429 $ this ->fixer ->configure (['separate ' => 'both ' ]);
454430 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
@@ -464,7 +440,6 @@ public function testFindInsertPositionSimpleClass(): void
464440 $ tokens = Tokens::fromCode ($ code );
465441
466442 $ method = new ReflectionMethod ($ this ->fixer , 'findInsertPosition ' );
467- $ method ->setAccessible (true );
468443
469444 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 1 );
470445
@@ -477,7 +452,6 @@ public function testFindInsertPositionWithFinalModifier(): void
477452 $ tokens = Tokens::fromCode ($ code );
478453
479454 $ method = new ReflectionMethod ($ this ->fixer , 'findInsertPosition ' );
480- $ method ->setAccessible (true );
481455
482456 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 2 );
483457
@@ -490,7 +464,6 @@ public function testFindInsertPositionWithAbstractModifier(): void
490464 $ tokens = Tokens::fromCode ($ code );
491465
492466 $ method = new ReflectionMethod ($ this ->fixer , 'findInsertPosition ' );
493- $ method ->setAccessible (true );
494467
495468 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 2 );
496469
@@ -503,7 +476,6 @@ public function testFindInsertPositionWithAttribute(): void
503476 $ tokens = Tokens::fromCode ($ code );
504477
505478 $ method = new ReflectionMethod ($ this ->fixer , 'findInsertPosition ' );
506- $ method ->setAccessible (true );
507479
508480 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 2 );
509481
@@ -513,7 +485,6 @@ public function testFindInsertPositionWithAttribute(): void
513485 public function testBuildDocBlockWithClassName (): void
514486 {
515487 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
516- $ method ->setAccessible (true );
517488
518489 $ this ->fixer ->configure (['add_structure_name ' => true ]);
519490 $ result = $ method ->invoke ($ this ->fixer , ['author ' => 'John Doe ' ], 'MyClass ' );
@@ -525,7 +496,6 @@ public function testBuildDocBlockWithClassName(): void
525496 public function testBuildDocBlockWithClassNameOnly (): void
526497 {
527498 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
528- $ method ->setAccessible (true );
529499
530500 $ this ->fixer ->configure (['add_structure_name ' => true ]);
531501 $ result = $ method ->invoke ($ this ->fixer , [], 'MyClass ' );
@@ -537,7 +507,6 @@ public function testBuildDocBlockWithClassNameOnly(): void
537507 public function testBuildDocBlockWithClassNameDisabled (): void
538508 {
539509 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
540- $ method ->setAccessible (true );
541510
542511 $ this ->fixer ->configure (['add_structure_name ' => false ]);
543512 $ result = $ method ->invoke ($ this ->fixer , ['author ' => 'John Doe ' ], 'MyClass ' );
@@ -549,7 +518,6 @@ public function testBuildDocBlockWithClassNameDisabled(): void
549518 public function testBuildDocBlockWithEmptyClassName (): void
550519 {
551520 $ method = new ReflectionMethod ($ this ->fixer , 'buildDocBlock ' );
552- $ method ->setAccessible (true );
553521
554522 $ this ->fixer ->configure (['add_structure_name ' => true ]);
555523 $ result = $ method ->invoke ($ this ->fixer , ['author ' => 'John Doe ' ], '' );
@@ -564,7 +532,6 @@ public function testGetClassName(): void
564532 $ tokens = Tokens::fromCode ($ code );
565533
566534 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
567- $ method ->setAccessible (true );
568535
569536 $ result = $ method ->invoke ($ this ->fixer , $ tokens , 1 );
570537
@@ -577,7 +544,6 @@ public function testGetClassNameWithModifiers(): void
577544 $ tokens = Tokens::fromCode ($ code );
578545
579546 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
580- $ method ->setAccessible (true );
581547
582548 // Find the class token index
583549 $ classIndex = null ;
@@ -600,7 +566,6 @@ public function testGetClassNameHitsBreakOnNonStringToken(): void
600566 $ tokens = Tokens::fromCode ($ code );
601567
602568 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
603- $ method ->setAccessible (true );
604569
605570 // Find the opening brace token (it comes after class name)
606571 $ braceIndex = null ;
@@ -625,7 +590,6 @@ public function testGetStructureNameInterface(): void
625590 $ tokens = Tokens::fromCode ($ code );
626591
627592 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
628- $ method ->setAccessible (true );
629593
630594 // Find the interface token index
631595 $ interfaceIndex = null ;
@@ -647,7 +611,6 @@ public function testGetStructureNameTrait(): void
647611 $ tokens = Tokens::fromCode ($ code );
648612
649613 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
650- $ method ->setAccessible (true );
651614
652615 // Find the trait token index
653616 $ traitIndex = null ;
@@ -669,7 +632,6 @@ public function testGetStructureNameEnum(): void
669632 $ tokens = Tokens::fromCode ($ code );
670633
671634 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
672- $ method ->setAccessible (true );
673635
674636 // Find the enum token index
675637 $ enumIndex = null ;
@@ -691,7 +653,6 @@ public function testGetStructureNameReturnsEmptyWhenLoopCompletes(): void
691653 $ tokens = Tokens::fromCode ($ code );
692654
693655 $ method = new ReflectionMethod ($ this ->fixer , 'getStructureName ' );
694- $ method ->setAccessible (true );
695656
696657 // Find the closing brace token - when we call getStructureName from there,
697658 // the loop should complete without finding anything and return empty string (line 153)
@@ -737,7 +698,6 @@ public function testApplyFixAddsDocBlockToInterface(): void
737698 $ file = new SplFileInfo (__FILE__ );
738699
739700 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
740- $ method ->setAccessible (true );
741701
742702 $ this ->fixer ->configure ([
743703 'annotations ' => ['author ' => 'John Doe ' ],
@@ -756,7 +716,6 @@ public function testApplyFixAddsDocBlockToTrait(): void
756716 $ file = new SplFileInfo (__FILE__ );
757717
758718 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
759- $ method ->setAccessible (true );
760719
761720 $ this ->fixer ->configure ([
762721 'annotations ' => ['author ' => 'Jane Doe ' ],
@@ -775,7 +734,6 @@ public function testApplyFixAddsDocBlockToEnum(): void
775734 $ file = new SplFileInfo (__FILE__ );
776735
777736 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
778- $ method ->setAccessible (true );
779737
780738 $ this ->fixer ->configure ([
781739 'annotations ' => ['license ' => 'MIT ' ],
@@ -794,7 +752,6 @@ public function testApplyFixWithClassNameEnabled(): void
794752 $ file = new SplFileInfo (__FILE__ );
795753
796754 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
797- $ method ->setAccessible (true );
798755
799756 $ this ->fixer ->configure ([
800757 'annotations ' => ['author ' => 'John Doe ' ],
@@ -814,7 +771,6 @@ public function testApplyFixWithMultipleClassesAndClassName(): void
814771 $ file = new SplFileInfo (__FILE__ );
815772
816773 $ method = new ReflectionMethod ($ this ->fixer , 'applyFix ' );
817- $ method ->setAccessible (true );
818774
819775 $ this ->fixer ->configure ([
820776 'annotations ' => ['author ' => 'John Doe ' ],
@@ -836,7 +792,6 @@ public function testMergeWithExistingDocBlockWithClassName(): void
836792 $ annotations = ['author ' => 'John Doe ' ];
837793
838794 $ method = new ReflectionMethod ($ this ->fixer , 'mergeWithExistingDocBlock ' );
839- $ method ->setAccessible (true );
840795
841796 $ this ->fixer ->configure (['add_structure_name ' => true ]);
842797 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'TestClass ' );
@@ -854,7 +809,6 @@ public function testReplaceDocBlockWithClassName(): void
854809 $ annotations = ['author ' => 'John Doe ' ];
855810
856811 $ method = new ReflectionMethod ($ this ->fixer , 'replaceDocBlock ' );
857- $ method ->setAccessible (true );
858812
859813 $ this ->fixer ->configure (['add_structure_name ' => true ]);
860814 $ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'TestClass ' );
@@ -872,7 +826,6 @@ public function testInsertNewDocBlockWithClassNameAndSeparateNone(): void
872826 $ annotations = ['author ' => 'John Doe ' ];
873827
874828 $ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
875- $ method ->setAccessible (true );
876829
877830 $ this ->fixer ->configure ([
878831 'add_structure_name ' => true ,
0 commit comments