@@ -170,13 +170,14 @@ public function testConfigurationDefinition(): void
170
170
$ configDefinition = $ this ->fixer ->getConfigurationDefinition ();
171
171
$ options = $ configDefinition ->getOptions ();
172
172
173
- self ::assertCount (4 , $ options );
173
+ self ::assertCount (5 , $ options );
174
174
175
175
$ optionNames = array_map (fn ($ option ) => $ option ->getName (), $ options );
176
176
self ::assertContains ('annotations ' , $ optionNames );
177
177
self ::assertContains ('preserve_existing ' , $ optionNames );
178
178
self ::assertContains ('separate ' , $ optionNames );
179
179
self ::assertContains ('add_structure_name ' , $ optionNames );
180
+ self ::assertContains ('ensure_spacing ' , $ optionNames );
180
181
}
181
182
182
183
public function testParseExistingAnnotations (): void
@@ -237,6 +238,7 @@ public function testApplyFixAddsDocBlockToClass(): void
237
238
$ this ->fixer ->configure ([
238
239
'annotations ' => ['author ' => 'John Doe ' ],
239
240
'separate ' => 'none ' ,
241
+ 'ensure_spacing ' => false ,
240
242
]);
241
243
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
242
244
@@ -255,6 +257,7 @@ public function testApplyFixHandlesMultipleClasses(): void
255
257
$ this ->fixer ->configure ([
256
258
'annotations ' => ['author ' => 'John Doe ' ],
257
259
'separate ' => 'none ' ,
260
+ 'ensure_spacing ' => false ,
258
261
]);
259
262
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
260
263
@@ -270,7 +273,7 @@ public function testProcessClassDocBlockWithNewDocBlock(): void
270
273
271
274
$ method = new ReflectionMethod ($ this ->fixer , 'processStructureDocBlock ' );
272
275
273
- $ this ->fixer ->configure (['separate ' => 'none ' ]);
276
+ $ this ->fixer ->configure (['separate ' => 'none ' , ' ensure_spacing ' => false ]);
274
277
$ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
275
278
276
279
$ expected = "<?php /** \n * @author John Doe \n */class Foo {} " ;
@@ -379,7 +382,7 @@ public function testInsertNewDocBlockWithSeparateNone(): void
379
382
380
383
$ method = new ReflectionMethod ($ this ->fixer , 'insertNewDocBlock ' );
381
384
382
- $ this ->fixer ->configure (['separate ' => 'none ' ]);
385
+ $ this ->fixer ->configure (['separate ' => 'none ' , ' ensure_spacing ' => false ]);
383
386
$ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'Foo ' );
384
387
385
388
$ expected = "<?php /** \n * @author John Doe \n */class Foo {} " ;
@@ -702,6 +705,7 @@ public function testApplyFixAddsDocBlockToInterface(): void
702
705
$ this ->fixer ->configure ([
703
706
'annotations ' => ['author ' => 'John Doe ' ],
704
707
'separate ' => 'none ' ,
708
+ 'ensure_spacing ' => false ,
705
709
]);
706
710
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
707
711
@@ -720,6 +724,7 @@ public function testApplyFixAddsDocBlockToTrait(): void
720
724
$ this ->fixer ->configure ([
721
725
'annotations ' => ['author ' => 'Jane Doe ' ],
722
726
'separate ' => 'none ' ,
727
+ 'ensure_spacing ' => false ,
723
728
]);
724
729
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
725
730
@@ -738,6 +743,7 @@ public function testApplyFixAddsDocBlockToEnum(): void
738
743
$ this ->fixer ->configure ([
739
744
'annotations ' => ['license ' => 'MIT ' ],
740
745
'separate ' => 'none ' ,
746
+ 'ensure_spacing ' => false ,
741
747
]);
742
748
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
743
749
@@ -757,6 +763,7 @@ public function testApplyFixWithClassNameEnabled(): void
757
763
'annotations ' => ['author ' => 'John Doe ' ],
758
764
'add_structure_name ' => true ,
759
765
'separate ' => 'none ' ,
766
+ 'ensure_spacing ' => false ,
760
767
]);
761
768
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
762
769
@@ -776,6 +783,7 @@ public function testApplyFixWithMultipleClassesAndClassName(): void
776
783
'annotations ' => ['author ' => 'John Doe ' ],
777
784
'add_structure_name ' => true ,
778
785
'separate ' => 'none ' ,
786
+ 'ensure_spacing ' => false ,
779
787
]);
780
788
$ method ->invoke ($ this ->fixer , $ file , $ tokens );
781
789
@@ -830,6 +838,7 @@ public function testInsertNewDocBlockWithClassNameAndSeparateNone(): void
830
838
$ this ->fixer ->configure ([
831
839
'add_structure_name ' => true ,
832
840
'separate ' => 'none ' ,
841
+ 'ensure_spacing ' => false ,
833
842
]);
834
843
$ method ->invoke ($ this ->fixer , $ tokens , 1 , $ annotations , 'TestClass ' );
835
844
0 commit comments