1
0
Fork 0

Merge remote-tracking branch 'igorw/classmap-missing-space'

pull/1366/head
Jordi Boggiano 2012-11-25 12:57:10 +01:00
commit d3b830efc3
3 changed files with 10 additions and 4 deletions

View File

@ -125,7 +125,7 @@ class ClassMapGenerator
preg_match_all('{ preg_match_all('{
(?: (?:
\b(?<![\$:>])(?<type>class|interface'.$traits.') \s+ (?<name>\S+) \b(?<![\$:>])(?<type>class|interface'.$traits.') \s+ (?<name>\w+)
| \b(?<![\$:>])(?<ns>namespace) (?<nsname>\s+[^\s;{}\\\\]+(?:\s*\\\\\s*[^\s;{}\\\\]+)*)? \s*[\{;] | \b(?<![\$:>])(?<ns>namespace) (?<nsname>\s+[^\s;{}\\\\]+(?:\s*\\\\\s*[^\s;{}\\\\]+)*)? \s*[\{;]
) )
}ix', $contents, $matches); }ix', $contents, $matches);

View File

@ -30,8 +30,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php', 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php',
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php', 'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php',
) )),
),
array(__DIR__.'/Fixtures/beta/NamespaceCollision', array( array(__DIR__.'/Fixtures/beta/NamespaceCollision', array(
'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php',
'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php', 'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php',
@ -53,7 +52,8 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php', 'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php',
'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php', 'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php',
'Foo\\LargeClass' => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php', 'Foo\\LargeClass' => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php',
'Foo\\LargeGap' => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php', 'Foo\\LargeGap' => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php',
'Foo\\MissingSpace' => realpath(__DIR__).'/Fixtures/classmap/MissingSpace.php',
)), )),
array(__DIR__.'/Fixtures/template', array()), array(__DIR__.'/Fixtures/template', array()),
); );

View File

@ -0,0 +1,6 @@
<?php
namespace Foo;
class MissingSpace{
}