diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index f047e4a91..fcc170223 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -190,8 +190,8 @@ class PluginManager $code = str_replace('__FILE__', var_export($path, true), $code); $code = str_replace('__DIR__', var_export(dirname($path), true), $code); $code = str_replace('__CLASS__', var_export($class, true), $code); - $code = preg_replace('/^(\s*<\?(?:php)?\s+)declare\s*\(\s*strict_types\s*=\s*\d+\s*\)\s*;/', '$1', $code); - eval('?>'.$code); + $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1); + eval($code); $class .= '_composer_tmp'.self::$classCounter; self::$classCounter++; }