Merge branch '1.8'
commit
2b421a94cb
|
@ -162,7 +162,7 @@ class ClassMapGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip heredocs/nowdocs
|
// 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
|
// strip strings
|
||||||
$contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
|
$contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
|
||||||
// strip leading non-php code if needed
|
// strip leading non-php code if needed
|
||||||
|
|
|
@ -25,6 +25,7 @@ use Composer\Plugin\CommandEvent;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
use Composer\Repository\CompositeRepository;
|
use Composer\Repository\CompositeRepository;
|
||||||
use Composer\Repository\PlatformRepository;
|
use Composer\Repository\PlatformRepository;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jérémy Romey <jeremy@free-agent.fr>
|
* @author Jérémy Romey <jeremy@free-agent.fr>
|
||||||
|
@ -160,16 +161,27 @@ EOT
|
||||||
if ($input->getOption('no-update')) {
|
if ($input->getOption('no-update')) {
|
||||||
return 0;
|
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
|
// Update packages
|
||||||
$this->resetComposer();
|
$this->resetComposer();
|
||||||
$composer = $this->getComposer(true, $input->getOption('no-plugins'));
|
$composer = $this->getComposer(true, $input->getOption('no-plugins'));
|
||||||
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
|
$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);
|
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
|
||||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,14 @@ class PlatformRepository extends ArrayRepository
|
||||||
case 'imagick':
|
case 'imagick':
|
||||||
$imagick = new \Imagick();
|
$imagick = new \Imagick();
|
||||||
$imageMagickVersion = $imagick->getVersion();
|
$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
|
||||||
$prettyVersion = "{$matches[1]}.{$matches[2]}";
|
// 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;
|
break;
|
||||||
|
|
||||||
case 'libxml':
|
case 'libxml':
|
||||||
|
|
|
@ -7,42 +7,81 @@ namespace Foo;
|
||||||
*/
|
*/
|
||||||
class StripNoise
|
class StripNoise
|
||||||
{
|
{
|
||||||
public function test()
|
public function test_heredoc()
|
||||||
{
|
{
|
||||||
return <<<A
|
return <<<HEREDOC
|
||||||
class Fail2
|
class FailHeredocBasic
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
A
|
HEREDOC . <<< WHITESPACE
|
||||||
. <<< AB
|
class FailHeredocWhitespace
|
||||||
class Fail3
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
AB
|
WHITESPACE . <<<"DOUBLEQUOTES"
|
||||||
. <<<'TEST'
|
class FailHeredocDoubleQuotes
|
||||||
class Fail4
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
TEST
|
DOUBLEQUOTES . <<< "DOUBLEQUOTESTABBED"
|
||||||
. <<< 'ANOTHER'
|
class FailHeredocDoubleQuotesTabbed
|
||||||
class Fail5
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
ANOTHER
|
DOUBLEQUOTESTABBED . <<<HEREDOCPHP73
|
||||||
. <<< 'ONEMORE'
|
class FailHeredocPHP73
|
||||||
class Fail6
|
{
|
||||||
{
|
}
|
||||||
|
HEREDOCPHP73;
|
||||||
}
|
|
||||||
ONEMORE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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