44
55namespace Rector \Tests \Scoper ;
66
7+ use Webmozart \Assert \Assert ;
78use Closure ;
89use PHPUnit \Framework \TestCase ;
910use Symfony \Component \Finder \Finder ;
@@ -27,13 +28,7 @@ final class AddAssertArrayFromClassMethodDocblockRector
2728{
2829 public function getRuleDefinition(): RuleDefinition
2930 {
30- $metadata = 'RectorPrefix202607\Webmozart\Assert\Assert';
31-
32- return new RuleDefinition(
33- 'Demo',
34- [
35- new ConfiguredCodeSample(
36- <<<'CODE_SAMPLE'
31+ return new RuleDefinition('Demo', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
3732<?php
3833
3934namespace RectorPrefix202607;
@@ -46,8 +41,7 @@ public function run()
4641}
4742\class_alias('SomeClass', 'SomeClass', \false);
4843CODE_SAMPLE
49- ,
50- <<<'CODE_SAMPLE'
44+ , <<<'CODE_SAMPLE'
5145<?php
5246
5347namespace RectorPrefix202607;
@@ -63,15 +57,7 @@ public function run()
6357}
6458\class_alias('SomeClass', 'SomeClass', \false);
6559CODE_SAMPLE
66- ,
67- []
68- ),
69- new CodeSample(
70- 'RectorPrefix202607\SomeVendor\ValueObject::class',
71- 'new RectorPrefix202607\SomeVendor\ValueObject()'
72- ),
73- ]
74- );
60+ , [AssertClassName::WEBMOZART])]);
7561 }
7662
7763 public function refactor(): void
@@ -110,9 +96,7 @@ public function refactor(): void
11096
11197 $ this ->assertStringContainsString ('use RectorPrefix202607\Webmozart\Assert\Assert; ' , (string ) $ content );
11298 $ this ->assertStringContainsString ('use Webmozart\Assert\Assert; ' , $ codeSampleContent );
113- $ this ->assertStringContainsString ('\Webmozart\Assert\Assert::allString($items); ' , $ codeSampleContent );
114- $ this ->assertStringContainsString ("'SomeVendor\ValueObject::class' " , (string ) $ content );
115- $ this ->assertStringContainsString ('$metadata = \'Webmozart\Assert\Assert \'; ' , (string ) $ content );
99+ $ this ->assertStringContainsString (Assert::class . '::allString($items); ' , $ codeSampleContent );
116100 $ this ->assertStringContainsString ('\RectorPrefix202607\SomeVendor\Runtime::class; ' , (string ) $ content );
117101 $ this ->assertStringNotContainsString ('namespace RectorPrefix202607; ' , $ codeSampleContent );
118102 $ this ->assertStringNotContainsString ('use RectorPrefix202607\Webmozart\Assert\Assert; ' , $ codeSampleContent );
0 commit comments