44
55namespace Rector \Tests \Scoper ;
66
7- use Webmozart \Assert \Assert ;
87use Closure ;
98use PHPUnit \Framework \TestCase ;
109use Symfony \Component \Finder \Finder ;
@@ -30,28 +29,39 @@ public function getRuleDefinition(): RuleDefinition
3029 {
3130 $metadata = 'RectorPrefix202607\Webmozart\Assert\Assert';
3231
33- new ConfiguredCodeSample(
34- <<<'CODE_SAMPLE'
32+ return new RuleDefinition(
33+ 'Demo',
34+ [
35+ new ConfiguredCodeSample(
36+ <<<'CODE_SAMPLE'
3537<?php
3638
3739namespace RectorPrefix202607;
3840
39- use RectorPrefix202607\Webmozart\Assert\Assert;
41+ class SomeClass
42+ {
43+ public function run()
44+ {
45+ }
46+ }
4047CODE_SAMPLE
41- ,
42- <<<'CODE_SAMPLE'
48+ ,
49+ <<<'CODE_SAMPLE'
4350<?php
4451
52+ use RectorPrefix202607\Webmozart\Assert\Assert;
53+
4554\RectorPrefix202607\Webmozart\Assert\Assert::allString($items);
4655CODE_SAMPLE
47- ,
48- []
49- );
50-
51- new CodeSample(
52- 'RectorPrefix202607\SomeVendor\ValueObject::class',
53- 'new RectorPrefix202607\SomeVendor\ValueObject()'
54- );
56+ ,
57+ []
58+ ),
59+ new CodeSample(
60+ 'RectorPrefix202607\SomeVendor\ValueObject::class',
61+ 'new RectorPrefix202607\SomeVendor\ValueObject()'
62+ ),
63+ ]
64+ );
5565 }
5666
5767 public function refactor(): void
@@ -71,7 +81,7 @@ public function refactor(): void
7181
7282 $ this ->assertStringContainsString ('use Webmozart\Assert\Assert; ' , (string ) $ content );
7383 $ this ->assertStringContainsString ('use RectorPrefix202607\Webmozart\Assert\Assert; ' , (string ) $ content );
74- $ this ->assertStringContainsString (Assert::class . ' ::allString($items); ' , (string ) $ content );
84+ $ this ->assertStringContainsString (' \Webmozart\Assert\Assert ::allString($items); ' , (string ) $ content );
7585 $ this ->assertStringContainsString ("'SomeVendor\ValueObject::class' " , (string ) $ content );
7686 $ this ->assertStringContainsString ("'new SomeVendor\ValueObject()' " , (string ) $ content );
7787 $ this ->assertStringContainsString ('$metadata = \'Webmozart\Assert\Assert \'; ' , (string ) $ content );
0 commit comments