From 3b9d6769bfc5f25e0d08574d615b6beb1024379a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 4 May 2018 10:55:52 +0200 Subject: [PATCH] Fix class names in comments being parsed in short_open_tags files, fixes #7289 --- src/Composer/Autoload/ClassMapGenerator.php | 4 ++++ tests/Composer/Test/Autoload/ClassMapGeneratorTest.php | 8 -------- .../Autoload/Fixtures/classmap/ShortOpenTagDocblock.php | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 5ff23921c..5d937433b 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -179,6 +179,10 @@ class ClassMapGenerator if (false !== $pos && false === strpos(substr($contents, $pos), ' 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', diff --git a/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php b/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php index 72464eaf7..0142ca45e 100644 --- a/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php +++ b/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php @@ -2,4 +2,5 @@ /** * Some class description here. */ +// other class name in comment class ShortOpenTagDocblock {}