Merge branch '4.4' into 5.2
* 4.4: cs fix [DependencyInjection][Console] tighten types [Lock] fix derivating semaphore from key
This commit is contained in:
commit
07060f46b7
@ -34,7 +34,7 @@ class InputArgument
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (for self::OPTIONAL mode only)
|
||||
* @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only)
|
||||
*
|
||||
* @throws InvalidArgumentException When argument mode is not valid
|
||||
*/
|
||||
@ -86,7 +86,7 @@ class InputArgument
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param mixed $default The default value
|
||||
* @param string|bool|int|float|array|null $default
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
*/
|
||||
@ -110,7 +110,7 @@ class InputArgument
|
||||
/**
|
||||
* Returns the default value.
|
||||
*
|
||||
* @return mixed
|
||||
* @return string|bool|int|float|array|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
@ -185,9 +185,7 @@ class InputDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default values.
|
||||
*
|
||||
* @return array An array of default values
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getArgumentDefaults()
|
||||
{
|
||||
@ -308,9 +306,7 @@ class InputDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of default values.
|
||||
*
|
||||
* @return array An array of all default values
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getOptionDefaults()
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ interface InputInterface
|
||||
* when multiple flags are combined in the same option.
|
||||
*
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param mixed $default The default value to return if no result is found
|
||||
* @param string|bool|int|float|array|null $default The default value to return if no result is found
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return mixed The option value
|
||||
@ -76,7 +76,7 @@ interface InputInterface
|
||||
/**
|
||||
* Returns all the given arguments merged with the default values.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getArguments();
|
||||
|
||||
@ -108,7 +108,7 @@ interface InputInterface
|
||||
/**
|
||||
* Returns all the given options merged with the default values.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getOptions();
|
||||
|
||||
|
@ -50,7 +50,7 @@ class InputOption
|
||||
/**
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the VALUE_* constants
|
||||
* @param mixed $default The default value (must be null for self::VALUE_NONE)
|
||||
* @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*/
|
||||
@ -160,11 +160,7 @@ class InputOption
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param mixed $default The default value
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
* @param string|bool|int|float|array|null $default
|
||||
*/
|
||||
public function setDefault($default = null)
|
||||
{
|
||||
@ -186,7 +182,7 @@ class InputOption
|
||||
/**
|
||||
* Returns the default value.
|
||||
*
|
||||
* @return mixed
|
||||
* @return string|bool|int|float|array|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
@ -24,12 +24,7 @@ class TrimmedBufferOutput extends Output
|
||||
private $maxLength;
|
||||
private $buffer = '';
|
||||
|
||||
public function __construct(
|
||||
int $maxLength,
|
||||
?int $verbosity = self::VERBOSITY_NORMAL,
|
||||
bool $decorated = false,
|
||||
OutputFormatterInterface $formatter = null
|
||||
) {
|
||||
public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) {
|
||||
if ($maxLength <= 0) {
|
||||
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class Question
|
||||
|
||||
/**
|
||||
* @param string $question The question to ask to the user
|
||||
* @param mixed $default The default answer to return if the user enters nothing
|
||||
* @param string|bool|int|float|null $default The default answer to return if the user enters nothing
|
||||
*/
|
||||
public function __construct(string $question, $default = null)
|
||||
{
|
||||
@ -55,7 +55,7 @@ class Question
|
||||
/**
|
||||
* Returns the default answer.
|
||||
*
|
||||
* @return mixed
|
||||
* @return string|bool|int|float|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ class Container implements ContainerInterface, ResetInterface
|
||||
/**
|
||||
* Gets a parameter.
|
||||
*
|
||||
* @return mixed
|
||||
* @return array|bool|string|int|float|null
|
||||
*
|
||||
* @throws InvalidArgumentException if the parameter is not defined
|
||||
*/
|
||||
@ -128,7 +128,7 @@ class Container implements ContainerInterface, ResetInterface
|
||||
* Sets a parameter.
|
||||
*
|
||||
* @param string $name The parameter name
|
||||
* @param mixed $value The parameter value
|
||||
* @param array|bool|string|int|float|null $value The parameter value
|
||||
*/
|
||||
public function setParameter(string $name, $value)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ interface ContainerInterface extends PsrContainerInterface
|
||||
public function initialized(string $id);
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return array|bool|string|int|float|null
|
||||
*
|
||||
* @throws InvalidArgumentException if the parameter is not defined
|
||||
*/
|
||||
@ -80,7 +80,7 @@ interface ContainerInterface extends PsrContainerInterface
|
||||
* Sets a parameter.
|
||||
*
|
||||
* @param string $name The parameter name
|
||||
* @param mixed $value The parameter value
|
||||
* @param array|bool|string|int|float|null $value The parameter value
|
||||
*/
|
||||
public function setParameter(string $name, $value);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class ContainerBag extends FrozenParameterBag implements ContainerBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
* @return array|bool|string|int|float|null
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ interface ParameterBagInterface
|
||||
/**
|
||||
* Gets a service container parameter.
|
||||
*
|
||||
* @return mixed The parameter value
|
||||
* @return array|bool|string|int|float|null
|
||||
*
|
||||
* @throws ParameterNotFoundException if the parameter is not defined
|
||||
*/
|
||||
@ -59,7 +59,7 @@ interface ParameterBagInterface
|
||||
/**
|
||||
* Sets a service container parameter.
|
||||
*
|
||||
* @param mixed $value The parameter value
|
||||
* @param array|bool|string|int|float|null $value The parameter value
|
||||
*
|
||||
* @throws LogicException if the parameter can not be set
|
||||
*/
|
||||
|
@ -51,7 +51,6 @@ use Symfony\Component\DependencyInjection\Tests\Fixtures\TestDefinition1;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber;
|
||||
use Symfony\Component\DependencyInjection\Tests\Fixtures\WitherStaticReturnType;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
use Symfony\Component\DependencyInjection\Variable;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
|
||||
@ -170,28 +169,6 @@ class PhpDumperTest extends TestCase
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/custom_container_class_with_mandatory_constructor_arguments.php', $dumper->dump(['base_class' => 'ConstructorWithMandatoryArgumentsContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Tests\Fixtures\Container']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidParameters
|
||||
*/
|
||||
public function testExportParameters($parameters)
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$container = new ContainerBuilder(new ParameterBag($parameters));
|
||||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$dumper->dump();
|
||||
}
|
||||
|
||||
public function provideInvalidParameters()
|
||||
{
|
||||
return [
|
||||
[['foo' => new Definition('stdClass')]],
|
||||
[['foo' => new Expression('service("foo").foo() ~ (container.hasParameter("foo") ? parameter("foo") : "default")')]],
|
||||
[['foo' => new Reference('foo')]],
|
||||
[['foo' => new Variable('foo')]],
|
||||
];
|
||||
}
|
||||
|
||||
public function testAddParameters()
|
||||
{
|
||||
$container = include self::$fixturesPath.'/containers/container8.php';
|
||||
|
@ -62,7 +62,7 @@ class SemaphoreStore implements BlockingStoreInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$keyId = crc32($key);
|
||||
$keyId = unpack('i', md5($key, true))[1];
|
||||
$resource = sem_get($keyId);
|
||||
$acquired = @sem_acquire($resource, !$blocking);
|
||||
|
||||
|
Reference in New Issue
Block a user