composer update sensio/distribution-bundle from ~3.0,>=3.0.12 to ~4.0

This commit is contained in:
Alexey Skobkin 2017-01-08 22:32:11 +03:00
parent 8f7343c8d8
commit 888af2ed52
4 changed files with 73 additions and 32 deletions

View file

@ -168,6 +168,9 @@ class PhpIniRequirement extends Requirement
*/ */
class RequirementCollection implements IteratorAggregate class RequirementCollection implements IteratorAggregate
{ {
/**
* @var Requirement[]
*/
private $requirements = array(); private $requirements = array();
/** /**
@ -265,7 +268,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns both requirements and recommendations. * Returns both requirements and recommendations.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function all() public function all()
{ {
@ -275,7 +278,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns all mandatory requirements. * Returns all mandatory requirements.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getRequirements() public function getRequirements()
{ {
@ -292,7 +295,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns the mandatory requirements that were not met. * Returns the mandatory requirements that were not met.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getFailedRequirements() public function getFailedRequirements()
{ {
@ -309,7 +312,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns all optional recommendations. * Returns all optional recommendations.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getRecommendations() public function getRecommendations()
{ {
@ -326,7 +329,7 @@ class RequirementCollection implements IteratorAggregate
/** /**
* Returns the recommendations that were not met. * Returns the recommendations that were not met.
* *
* @return array Array of Requirement instances * @return Requirement[]
*/ */
public function getFailedRecommendations() public function getFailedRecommendations()
{ {
@ -376,7 +379,8 @@ class RequirementCollection implements IteratorAggregate
*/ */
class SymfonyRequirements extends RequirementCollection class SymfonyRequirements extends RequirementCollection
{ {
const REQUIRED_PHP_VERSION = '5.3.3'; const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
const REQUIRED_PHP_VERSION = '5.5.9';
/** /**
* Constructor that initializes the requirements. * Constructor that initializes the requirements.
@ -386,16 +390,26 @@ class SymfonyRequirements extends RequirementCollection
/* mandatory requirements follow */ /* mandatory requirements follow */
$installedPhpVersion = phpversion(); $installedPhpVersion = phpversion();
$requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRequirement( $this->addRecommendation(
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='), $requiredPhpVersion,
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion), 'Vendors should be installed in order to check all requirements.',
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run. 'Run the <code>composer install</code> command.',
Before using Symfony, upgrade your PHP installation, preferably to the latest version.', 'Run the "composer install" command.'
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
); );
if (false !== $requiredPhpVersion) {
$this->addRequirement(
version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
$installedPhpVersion, $requiredPhpVersion),
sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
);
}
$this->addRequirement( $this->addRequirement(
version_compare($installedPhpVersion, '5.3.16', '!='), version_compare($installedPhpVersion, '5.3.16', '!='),
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it', 'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@ -431,7 +445,7 @@ class SymfonyRequirements extends RequirementCollection
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).' 'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
); );
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$timezones = array(); $timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) { foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) { foreach ($abbreviations as $abbreviation) {
@ -708,9 +722,9 @@ class SymfonyRequirements extends RequirementCollection
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$this->addRecommendation( $this->addRecommendation(
$this->getRealpathCacheSize() > 1000, $this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be above 1024 in php.ini', 'realpath_cache_size should be at least 5M in php.ini',
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.' 'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
); );
} }
@ -749,7 +763,11 @@ class SymfonyRequirements extends RequirementCollection
{ {
$size = ini_get('realpath_cache_size'); $size = ini_get('realpath_cache_size');
$size = trim($size); $size = trim($size);
$unit = strtolower(substr($size, -1, 1)); $unit = '';
if (!ctype_digit($size)) {
$unit = strtolower(substr($size, -1, 1));
$size = (int) substr($size, 0, -1);
}
switch ($unit) { switch ($unit) {
case 'g': case 'g':
return $size * 1024 * 1024 * 1024; return $size * 1024 * 1024 * 1024;
@ -761,4 +779,28 @@ class SymfonyRequirements extends RequirementCollection
return (int) $size; return (int) $size;
} }
} }
/**
* Defines PHP required version from Symfony version.
*
* @return string|false The PHP required version or false if it could not be guessed
*/
protected function getPhpRequiredVersion()
{
if (!file_exists($path = __DIR__.'/../composer.lock')) {
return false;
}
$composerLock = json_decode(file_get_contents($path), true);
foreach ($composerLock['packages'] as $package) {
$name = $package['name'];
if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
continue;
}
return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
}
return false;
}
} }

View file

@ -12,7 +12,7 @@ echo '> PHP is using the following php.ini file:'.PHP_EOL;
if ($iniPath) { if ($iniPath) {
echo_style('green', ' '.$iniPath); echo_style('green', ' '.$iniPath);
} else { } else {
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!'); echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!');
} }
echo PHP_EOL.PHP_EOL; echo PHP_EOL.PHP_EOL;
@ -21,7 +21,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.' ';
$messages = array(); $messages = array();
foreach ($symfonyRequirements->getRequirements() as $req) { foreach ($symfonyRequirements->getRequirements() as $req) {
/** @var $req Requirement */
if ($helpText = get_error_message($req, $lineSize)) { if ($helpText = get_error_message($req, $lineSize)) {
echo_style('red', 'E'); echo_style('red', 'E');
$messages['error'][] = $helpText; $messages['error'][] = $helpText;
@ -80,7 +79,7 @@ function get_error_message(Requirement $requirement, $lineSize)
return; return;
} }
$errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL;
$errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL;
return $errorMessage; return $errorMessage;
@ -121,8 +120,8 @@ function echo_block($style, $title, $message)
echo PHP_EOL.PHP_EOL; echo PHP_EOL.PHP_EOL;
echo_style($style, str_repeat(' ', $width).PHP_EOL); echo_style($style, str_repeat(' ', $width).PHP_EOL);
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL); echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL); echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
echo_style($style, str_repeat(' ', $width).PHP_EOL); echo_style($style, str_repeat(' ', $width).PHP_EOL);
} }

View file

@ -16,7 +16,7 @@
"symfony/assetic-bundle": "~2.3", "symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4", "symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12", "sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2", "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0", "incenteev/composer-parameter-handler": "~2.0",
"misd/guzzle-bundle": "~1.0", "misd/guzzle-bundle": "~1.0",

16
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f890dca974c5dbd0ada78afc457f249b", "content-hash": "43d10155891b65c47d20764dfd54617e",
"packages": [ "packages": [
{ {
"name": "csa/guzzle-bundle", "name": "csa/guzzle-bundle",
@ -2504,21 +2504,21 @@
}, },
{ {
"name": "sensio/distribution-bundle", "name": "sensio/distribution-bundle",
"version": "v3.0.36", "version": "v4.0.38",
"target-dir": "Sensio/Bundle/DistributionBundle", "target-dir": "Sensio/Bundle/DistributionBundle",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sensiolabs/SensioDistributionBundle.git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git",
"reference": "964a56e855acac38d4a81920b3a86543f7e8492f" "reference": "95469374e703f01b8e760023ac4f2f64da6a1dd9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/964a56e855acac38d4a81920b3a86543f7e8492f", "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/95469374e703f01b8e760023ac4f2f64da6a1dd9",
"reference": "964a56e855acac38d4a81920b3a86543f7e8492f", "reference": "95469374e703f01b8e760023ac4f2f64da6a1dd9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3", "php": ">=5.3.9",
"sensiolabs/security-checker": "~3.0", "sensiolabs/security-checker": "~3.0",
"symfony/class-loader": "~2.2", "symfony/class-loader": "~2.2",
"symfony/framework-bundle": "~2.3", "symfony/framework-bundle": "~2.3",
@ -2537,7 +2537,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0.x-dev" "dev-master": "4.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2560,7 +2560,7 @@
"configuration", "configuration",
"distribution" "distribution"
], ],
"time": "2016-04-25T20:46:43+00:00" "time": "2017-01-04T13:34:44+00:00"
}, },
{ {
"name": "sensio/framework-extra-bundle", "name": "sensio/framework-extra-bundle",