Browse Source

Tweak #1361 to re-enable support for unicode classnames

Jordi Boggiano 12 years ago
parent
commit
2d7c3c9d27

+ 2 - 2
src/Composer/Autoload/ClassMapGenerator.php

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

+ 1 - 0
tests/Composer/Test/Autoload/ClassMapGeneratorTest.php

@@ -54,6 +54,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
                 'Foo\\LargeClass'         => realpath(__DIR__).'/Fixtures/classmap/LargeClass.php',
                 'Foo\\LargeGap'           => realpath(__DIR__).'/Fixtures/classmap/LargeGap.php',
                 'Foo\\MissingSpace'       => realpath(__DIR__).'/Fixtures/classmap/MissingSpace.php',
+                'Unicode\\↑'              => realpath(__DIR__).'/Fixtures/classmap/Unicode.php',
             )),
             array(__DIR__.'/Fixtures/template', array()),
         );

+ 6 - 0
tests/Composer/Test/Autoload/Fixtures/classmap/Unicode.php

@@ -0,0 +1,6 @@
+<?php
+
+namespace Unicode;
+
+class ↑{
+}