Merge branch '1.8'
commit
2b421a94cb
|
@ -162,7 +162,7 @@ class ClassMapGenerator
|
|||
}
|
||||
|
||||
// strip heredocs/nowdocs
|
||||
$contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
|
||||
$contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
|
||||
// strip strings
|
||||
$contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
|
||||
// strip leading non-php code if needed
|
||||
|
|
|
@ -25,6 +25,7 @@ use Composer\Plugin\CommandEvent;
|
|||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\IO\IOInterface;
|
||||
|
||||
/**
|
||||
* @author Jérémy Romey <jeremy@free-agent.fr>
|
||||
|
@ -160,16 +161,27 @@ EOT
|
|||
if ($input->getOption('no-update')) {
|
||||
return 0;
|
||||
}
|
||||
$updateDevMode = !$input->getOption('update-no-dev');
|
||||
$optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
|
||||
$authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
|
||||
$apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
|
||||
|
||||
try {
|
||||
return $this->doUpdate($input, $output, $io, $requirements);
|
||||
} catch (\Exception $e) {
|
||||
$this->revertComposerFile(false);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
|
||||
{
|
||||
// Update packages
|
||||
$this->resetComposer();
|
||||
$composer = $this->getComposer(true, $input->getOption('no-plugins'));
|
||||
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
|
||||
|
||||
$updateDevMode = !$input->getOption('update-no-dev');
|
||||
$optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
|
||||
$authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
|
||||
$apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
|
||||
|
||||
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
|
||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||
|
||||
|
|
|
@ -166,8 +166,14 @@ class PlatformRepository extends ArrayRepository
|
|||
case 'imagick':
|
||||
$imagick = new \Imagick();
|
||||
$imageMagickVersion = $imagick->getVersion();
|
||||
preg_match('/^ImageMagick ([\d.]+)-(\d+)/', $imageMagickVersion['versionString'], $matches);
|
||||
// 6.x: ImageMagick 6.2.9 08/24/06 Q16 http://www.imagemagick.org
|
||||
// 7.x: ImageMagick 7.0.8-34 Q16 x86_64 2019-03-23 https://imagemagick.org
|
||||
preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
|
||||
if (isset($matches[2])) {
|
||||
$prettyVersion = "{$matches[1]}.{$matches[2]}";
|
||||
} else {
|
||||
$prettyVersion = $matches[1];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'libxml':
|
||||
|
|
|
@ -7,42 +7,81 @@ namespace Foo;
|
|||
*/
|
||||
class StripNoise
|
||||
{
|
||||
public function test()
|
||||
public function test_heredoc()
|
||||
{
|
||||
return <<<A
|
||||
class Fail2
|
||||
return <<<HEREDOC
|
||||
class FailHeredocBasic
|
||||
{
|
||||
|
||||
}
|
||||
A
|
||||
. <<< AB
|
||||
class Fail3
|
||||
HEREDOC . <<< WHITESPACE
|
||||
class FailHeredocWhitespace
|
||||
{
|
||||
|
||||
}
|
||||
AB
|
||||
. <<<'TEST'
|
||||
class Fail4
|
||||
WHITESPACE . <<<"DOUBLEQUOTES"
|
||||
class FailHeredocDoubleQuotes
|
||||
{
|
||||
|
||||
}
|
||||
TEST
|
||||
. <<< 'ANOTHER'
|
||||
class Fail5
|
||||
DOUBLEQUOTES . <<< "DOUBLEQUOTESTABBED"
|
||||
class FailHeredocDoubleQuotesTabbed
|
||||
{
|
||||
|
||||
}
|
||||
ANOTHER
|
||||
. <<< 'ONEMORE'
|
||||
class Fail6
|
||||
{
|
||||
|
||||
}
|
||||
ONEMORE;
|
||||
DOUBLEQUOTESTABBED . <<<HEREDOCPHP73
|
||||
class FailHeredocPHP73
|
||||
{
|
||||
}
|
||||
HEREDOCPHP73;
|
||||
}
|
||||
|
||||
public function test2()
|
||||
public function test_nowdoc()
|
||||
{
|
||||
$class = 'class Fail4 {}';
|
||||
return <<<'NOWDOC'
|
||||
class FailNowdocBasic
|
||||
{
|
||||
}
|
||||
NOWDOC . <<< 'WHITESPACE'
|
||||
class FailNowdocWhitespace
|
||||
{
|
||||
}
|
||||
WHITESPACE . <<< 'NOWDOCTABBED'
|
||||
class FailNowdocTabbed
|
||||
{
|
||||
}
|
||||
NOWDOCTABBED . <<<'NOWDOCPHP73'
|
||||
class FailNowdocPHP73
|
||||
{
|
||||
}
|
||||
NOWDOCPHP73;
|
||||
}
|
||||
|
||||
public function test_followed_by_parentheses()
|
||||
{
|
||||
return array(<<<PARENTHESES
|
||||
class FailParentheses
|
||||
{
|
||||
}
|
||||
PARENTHESES);
|
||||
}
|
||||
|
||||
public function test_followed_by_comma()
|
||||
{
|
||||
return array(1, 2, <<<COMMA
|
||||
class FailComma
|
||||
{
|
||||
}
|
||||
COMMA, 3, 4);
|
||||
}
|
||||
|
||||
public function test_followed_by_period()
|
||||
{
|
||||
return <<<PERIOD
|
||||
class FailPeriod
|
||||
{
|
||||
}
|
||||
PERIOD.'?>';
|
||||
}
|
||||
|
||||
public function test_simple_string()
|
||||
{
|
||||
return 'class FailSimpleString {}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue