File tree Expand file tree Collapse file tree 6 files changed +55
-3
lines changed Expand file tree Collapse file tree 6 files changed +55
-3
lines changed Original file line number Diff line number Diff line change 3131 $x = '\\Symfony\\Component\\Yaml\\Ya_1';
3232 $x = 'Humbug\\Symfony\\Component\\Yaml\\Ya_1';
3333 $x = '\\Humbug\\Symfony\\Component\\Yaml\\Ya_1';
34+ $x = '1\2';
3435
3536 ----
3637 <?php
4546 $x = 'Humbug\Symfony\Component\Yaml\Ya_1';
4647 $x = 'Humbug\Symfony\Component\Yaml\Ya_1';
4748 $x = 'Humbug\Symfony\Component\Yaml\Ya_1';
49+ $x = '1\2';
4850
4951 PHP,
5052
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ final class StringScalarPrefixer extends NodeVisitorAbstract
102102 /^
103103 (\\)? # leading backslash
104104 (
105- [\p{L}_\d]+ # class-like name
105+ [\p{L}_] # class-like name first character
106+ [\p{L}_\d]* # class-like name
106107 \\ # separator
107108 )*
108109 [\p{L}_\d]+ # class-like name
Original file line number Diff line number Diff line change 3535{
3636 private const XML_EXTENSION_REGEX = '/\.xml$/i ' ;
3737 private const NAMESPACE_PATTERN = '/<prototype.*\snamespace="(?:(?<namespace>(?:[^ \\\\]+(?<separator> \\\\(?: \\\\)?))))"/ ' ;
38- private const SINGLE_CLASS_PATTERN = '/(?:(?<singleClass>(?:[\p{L}_\d]+ (?<singleSeparator> \\\\(?: \\\\)?))):)|(?<class>(?:[\p{L}_\d]+ (?<separator> \\\\(?: \\\\)?)+)+[\p{L}_\d]+)/u ' ;
38+ private const SINGLE_CLASS_PATTERN = '/(?:(?<singleClass>(?:[\p{L}_][\p{L}_\d]* (?<singleSeparator> \\\\(?: \\\\)?))):)|(?<class>(?:[\p{L}_][\p{L}_\d]* (?<separator> \\\\(?: \\\\)?)+)+[\p{L}_\d]+)/u ' ;
3939
4040 public function __construct (
4141 private Scoper $ decoratedScoper ,
Original file line number Diff line number Diff line change 3434final readonly class YamlScoper implements Scoper
3535{
3636 private const YAML_EXTENSION_REGEX = '/\.ya?ml$/i ' ;
37- private const CLASS_PATTERN = '/(?:(?<singleClass>(?:[\p{L}_\d]+ (?<singleSeparator> \\\\(?: \\\\)?))):)|(?<class>(?:[\p{L}_\d]+ (?<separator> \\\\(?: \\\\)?)+)+[\p{L}_\d]+)/u ' ;
37+ private const CLASS_PATTERN = '/(?:(?<singleClass>(?:[\p{L}_][\p{L}_\d]* (?<singleSeparator> \\\\(?: \\\\)?))):)|(?<class>(?:[\p{L}_][\p{L}_\d]* (?<separator> \\\\(?: \\\\)?)+)+[\p{L}_\d]+)/u ' ;
3838
3939 public function __construct (
4040 private Scoper $ decoratedScoper ,
Original file line number Diff line number Diff line change @@ -387,6 +387,45 @@ public static function provideXmlFiles(): iterable
387387 [],
388388 ];
389389
390+ yield 'class-like pattern ' => [
391+ <<<'XML'
392+ <!-- config/services.xml -->
393+ <?xml version="1.0" encoding="UTF-8" ?>
394+ <container xmlns="http://symfony.com/schema/dic/services"
395+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
396+ xsi:schemaLocation="http://symfony.com/schema/dic/services
397+ http://symfony.com/schema/dic/services/services-1.0.xsd">
398+
399+ <services>
400+ <service id="App\Mail\PhpMailer" />
401+ <service id="1\2" />
402+
403+ <service id="s1" class="App\Mail\PhpMailer" alias="App\Mail\PhpMailer" />
404+ <service id="s2" class="1\2" alias="1\2" />
405+ </services>
406+ </container>
407+ XML,
408+ SymbolsConfiguration::create (),
409+ <<<'XML'
410+ <!-- config/services.xml -->
411+ <?xml version="1.0" encoding="UTF-8" ?>
412+ <container xmlns="http://symfony.com/schema/dic/services"
413+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
414+ xsi:schemaLocation="http://symfony.com/schema/dic/services
415+ http://symfony.com/schema/dic/services/services-1.0.xsd">
416+
417+ <services>
418+ <service id="Humbug\App\Mail\PhpMailer" />
419+ <service id="1\2" />
420+
421+ <service id="s1" class="Humbug\App\Mail\PhpMailer" alias="Humbug\App\Mail\PhpMailer" />
422+ <service id="s2" class="1\2" alias="1\2" />
423+ </services>
424+ </container>
425+ XML,
426+ [],
427+ ];
428+
390429 yield 'service with argument ' => [
391430 <<<'XML'
392431 <!-- app/config/services.xml -->
Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ public static function provideYamlFiles(): iterable
152152 Symfony\Component\Console\Input\InputInterface:
153153 alias: 'Symfony\Component\Console\Input\ArgvInput'
154154 Symfony\Component\Console\Output\OutputInterface: '@Symfony\Component\Console\Output\ConsoleOutput'
155+ 1\2: ~
156+ Service2:
157+ class: 1\2
158+ Service3:
159+ alias: 1\2
155160 YAML,
156161 SymbolsConfiguration::create (),
157162 <<<'YAML'
@@ -160,6 +165,11 @@ public static function provideYamlFiles(): iterable
160165 Humbug\Symfony\Component\Console\Input\InputInterface:
161166 alias: 'Humbug\Symfony\Component\Console\Input\ArgvInput'
162167 Humbug\Symfony\Component\Console\Output\OutputInterface: '@Humbug\Symfony\Component\Console\Output\ConsoleOutput'
168+ 1\2: ~
169+ Service2:
170+ class: 1\2
171+ Service3:
172+ alias: 1\2
163173 YAML,
164174 [],
165175 ];
You can’t perform that action at this time.
0 commit comments