Fix class names in comments being parsed in short_open_tags files, fixes #7289
parent
a3ed8484be
commit
3b9d6769bf
|
@ -179,6 +179,10 @@ class ClassMapGenerator
|
|||
if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
|
||||
$contents = substr($contents, 0, $pos);
|
||||
}
|
||||
// strip comments if short open tags are in the file
|
||||
if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
|
||||
$contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
|
||||
}
|
||||
|
||||
preg_match_all('{
|
||||
(?:
|
||||
|
|
|
@ -62,14 +62,6 @@ class ClassMapGeneratorTest extends TestCase
|
|||
'ShortOpenTagDocblock' => realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php',
|
||||
);
|
||||
|
||||
/**
|
||||
* @wontfix If short_open_tag is not enabled, we end up parsing the docblock because
|
||||
* php_strip_whitespace won't recognize the file. Funky edge-case (does not apply to HHVM).
|
||||
*/
|
||||
if (!defined('HHVM_VERSION') && !ini_get('short_open_tag')) {
|
||||
$classmap['description'] = realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php';
|
||||
}
|
||||
|
||||
$data = array(
|
||||
array(__DIR__ . '/Fixtures/Namespaced', array(
|
||||
'Namespaced\\Bar' => realpath(__DIR__) . '/Fixtures/Namespaced/Bar.inc',
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
/**
|
||||
* Some class description here.
|
||||
*/
|
||||
// other class name in comment
|
||||
class ShortOpenTagDocblock {}
|
||||
|
|
Loading…
Reference in New Issue