]', $definition->getSynopsis(true), '->getSynopsis(true) groups options in [options]');
}
diff --git a/vendor/symfony/console/Tests/Input/InputOptionTest.php b/vendor/symfony/console/Tests/Input/InputOptionTest.php
index 66a6dd5a..ad1c043e 100644
--- a/vendor/symfony/console/Tests/Input/InputOptionTest.php
+++ b/vendor/symfony/console/Tests/Input/InputOptionTest.php
@@ -39,7 +39,7 @@ class InputOptionTest extends TestCase
$this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument');
$option = new InputOption('foo', '-f|-ff|fff');
$this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts');
- $option = new InputOption('foo', array('f', 'ff', '-fff'));
+ $option = new InputOption('foo', ['f', 'ff', '-fff']);
$this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts');
$option = new InputOption('foo');
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default');
@@ -132,7 +132,7 @@ class InputOptionTest extends TestCase
$this->assertNull($option->getDefault(), '->getDefault() returns null if no default value is configured');
$option = new InputOption('foo', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY);
- $this->assertEquals(array(), $option->getDefault(), '->getDefault() returns an empty array if option is an array');
+ $this->assertEquals([], $option->getDefault(), '->getDefault() returns an empty array if option is an array');
$option = new InputOption('foo', null, InputOption::VALUE_NONE);
$this->assertFalse($option->getDefault(), '->getDefault() returns false if the option does not take a value');
@@ -147,8 +147,8 @@ class InputOptionTest extends TestCase
$this->assertEquals('another', $option->getDefault(), '->setDefault() changes the default value');
$option = new InputOption('foo', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY);
- $option->setDefault(array(1, 2));
- $this->assertEquals(array(1, 2), $option->getDefault(), '->setDefault() changes the default value');
+ $option->setDefault([1, 2]);
+ $this->assertEquals([1, 2], $option->getDefault(), '->setDefault() changes the default value');
}
/**
diff --git a/vendor/symfony/console/Tests/Input/InputTest.php b/vendor/symfony/console/Tests/Input/InputTest.php
index 7cf1d244..61608bf2 100644
--- a/vendor/symfony/console/Tests/Input/InputTest.php
+++ b/vendor/symfony/console/Tests/Input/InputTest.php
@@ -21,30 +21,30 @@ class InputTest extends TestCase
{
public function testConstructor()
{
- $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'))));
+ $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')]));
$this->assertEquals('foo', $input->getArgument('name'), '->__construct() takes a InputDefinition as an argument');
}
public function testOptions()
{
- $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'))));
+ $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name')]));
$this->assertEquals('foo', $input->getOption('name'), '->getOption() returns the value for the given option');
$input->setOption('name', 'bar');
$this->assertEquals('bar', $input->getOption('name'), '->setOption() sets the value for a given option');
- $this->assertEquals(array('name' => 'bar'), $input->getOptions(), '->getOptions() returns all option values');
+ $this->assertEquals(['name' => 'bar'], $input->getOptions(), '->getOptions() returns all option values');
- $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$this->assertEquals('default', $input->getOption('bar'), '->getOption() returns the default value for optional options');
- $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getOptions(), '->getOptions() returns all option values, even optional ones');
+ $this->assertEquals(['name' => 'foo', 'bar' => 'default'], $input->getOptions(), '->getOptions() returns all option values, even optional ones');
- $input = new ArrayInput(array('--name' => 'foo', '--bar' => ''), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['--name' => 'foo', '--bar' => ''], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$this->assertEquals('', $input->getOption('bar'), '->getOption() returns null for options explicitly passed without value (or an empty value)');
- $this->assertEquals(array('name' => 'foo', 'bar' => ''), $input->getOptions(), '->getOptions() returns all option values.');
+ $this->assertEquals(['name' => 'foo', 'bar' => ''], $input->getOptions(), '->getOptions() returns all option values.');
- $input = new ArrayInput(array('--name' => 'foo', '--bar' => null), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['--name' => 'foo', '--bar' => null], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$this->assertNull($input->getOption('bar'), '->getOption() returns null for options explicitly passed without value (or an empty value)');
- $this->assertEquals(array('name' => 'foo', 'bar' => null), $input->getOptions(), '->getOptions() returns all option values');
+ $this->assertEquals(['name' => 'foo', 'bar' => null], $input->getOptions(), '->getOptions() returns all option values');
}
/**
@@ -53,7 +53,7 @@ class InputTest extends TestCase
*/
public function testSetInvalidOption()
{
- $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$input->setOption('foo', 'bar');
}
@@ -63,22 +63,22 @@ class InputTest extends TestCase
*/
public function testGetInvalidOption()
{
- $input = new ArrayInput(array('--name' => 'foo'), new InputDefinition(array(new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['--name' => 'foo'], new InputDefinition([new InputOption('name'), new InputOption('bar', '', InputOption::VALUE_OPTIONAL, '', 'default')]));
$input->getOption('foo');
}
public function testArguments()
{
- $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'))));
+ $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name')]));
$this->assertEquals('foo', $input->getArgument('name'), '->getArgument() returns the value for the given argument');
$input->setArgument('name', 'bar');
$this->assertEquals('bar', $input->getArgument('name'), '->setArgument() sets the value for a given argument');
- $this->assertEquals(array('name' => 'bar'), $input->getArguments(), '->getArguments() returns all argument values');
+ $this->assertEquals(['name' => 'bar'], $input->getArguments(), '->getArguments() returns all argument values');
- $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
$this->assertEquals('default', $input->getArgument('bar'), '->getArgument() returns the default value for optional arguments');
- $this->assertEquals(array('name' => 'foo', 'bar' => 'default'), $input->getArguments(), '->getArguments() returns all argument values, even optional ones');
+ $this->assertEquals(['name' => 'foo', 'bar' => 'default'], $input->getArguments(), '->getArguments() returns all argument values, even optional ones');
}
/**
@@ -87,7 +87,7 @@ class InputTest extends TestCase
*/
public function testSetInvalidArgument()
{
- $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
$input->setArgument('foo', 'bar');
}
@@ -97,7 +97,7 @@ class InputTest extends TestCase
*/
public function testGetInvalidArgument()
{
- $input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default'))));
+ $input = new ArrayInput(['name' => 'foo'], new InputDefinition([new InputArgument('name'), new InputArgument('bar', InputArgument::OPTIONAL, '', 'default')]));
$input->getArgument('foo');
}
@@ -107,8 +107,8 @@ class InputTest extends TestCase
*/
public function testValidateWithMissingArguments()
{
- $input = new ArrayInput(array());
- $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));
+ $input = new ArrayInput([]);
+ $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)]));
$input->validate();
}
@@ -118,22 +118,22 @@ class InputTest extends TestCase
*/
public function testValidateWithMissingRequiredArguments()
{
- $input = new ArrayInput(array('bar' => 'baz'));
- $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL))));
+ $input = new ArrayInput(['bar' => 'baz']);
+ $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED), new InputArgument('bar', InputArgument::OPTIONAL)]));
$input->validate();
}
public function testValidate()
{
- $input = new ArrayInput(array('name' => 'foo'));
- $input->bind(new InputDefinition(array(new InputArgument('name', InputArgument::REQUIRED))));
+ $input = new ArrayInput(['name' => 'foo']);
+ $input->bind(new InputDefinition([new InputArgument('name', InputArgument::REQUIRED)]));
$this->assertNull($input->validate());
}
public function testSetGetInteractive()
{
- $input = new ArrayInput(array());
+ $input = new ArrayInput([]);
$this->assertTrue($input->isInteractive(), '->isInteractive() returns whether the input should be interactive or not');
$input->setInteractive(false);
$this->assertFalse($input->isInteractive(), '->setInteractive() changes the interactive flag');
@@ -141,7 +141,7 @@ class InputTest extends TestCase
public function testSetGetStream()
{
- $input = new ArrayInput(array());
+ $input = new ArrayInput([]);
$stream = fopen('php://memory', 'r+', false);
$input->setStream($stream);
$this->assertSame($stream, $input->getStream());
diff --git a/vendor/symfony/console/Tests/Input/StringInputTest.php b/vendor/symfony/console/Tests/Input/StringInputTest.php
index f2e3467e..7f218945 100644
--- a/vendor/symfony/console/Tests/Input/StringInputTest.php
+++ b/vendor/symfony/console/Tests/Input/StringInputTest.php
@@ -33,7 +33,7 @@ class StringInputTest extends TestCase
public function testInputOptionWithGivenString()
{
$definition = new InputDefinition(
- array(new InputOption('foo', null, InputOption::VALUE_REQUIRED))
+ [new InputOption('foo', null, InputOption::VALUE_REQUIRED)]
);
// call to bind
@@ -44,33 +44,33 @@ class StringInputTest extends TestCase
public function getTokenizeData()
{
- return array(
- array('', array(), '->tokenize() parses an empty string'),
- array('foo', array('foo'), '->tokenize() parses arguments'),
- array(' foo bar ', array('foo', 'bar'), '->tokenize() ignores whitespaces between arguments'),
- array('"quoted"', array('quoted'), '->tokenize() parses quoted arguments'),
- array("'quoted'", array('quoted'), '->tokenize() parses quoted arguments'),
- array("'a\rb\nc\td'", array("a\rb\nc\td"), '->tokenize() parses whitespace chars in strings'),
- array("'a'\r'b'\n'c'\t'd'", array('a', 'b', 'c', 'd'), '->tokenize() parses whitespace chars between args as spaces'),
- array('\"quoted\"', array('"quoted"'), '->tokenize() parses escaped-quoted arguments'),
- array("\'quoted\'", array('\'quoted\''), '->tokenize() parses escaped-quoted arguments'),
- array('-a', array('-a'), '->tokenize() parses short options'),
- array('-azc', array('-azc'), '->tokenize() parses aggregated short options'),
- array('-awithavalue', array('-awithavalue'), '->tokenize() parses short options with a value'),
- array('-a"foo bar"', array('-afoo bar'), '->tokenize() parses short options with a value'),
- array('-a"foo bar""foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'),
- array('-a\'foo bar\'', array('-afoo bar'), '->tokenize() parses short options with a value'),
- array('-a\'foo bar\'\'foo bar\'', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'),
- array('-a\'foo bar\'"foo bar"', array('-afoo barfoo bar'), '->tokenize() parses short options with a value'),
- array('--long-option', array('--long-option'), '->tokenize() parses long options'),
- array('--long-option=foo', array('--long-option=foo'), '->tokenize() parses long options with a value'),
- array('--long-option="foo bar"', array('--long-option=foo bar'), '->tokenize() parses long options with a value'),
- array('--long-option="foo bar""another"', array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
- array('--long-option=\'foo bar\'', array('--long-option=foo bar'), '->tokenize() parses long options with a value'),
- array("--long-option='foo bar''another'", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
- array("--long-option='foo bar'\"another\"", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
- array('foo -a -ffoo --long bar', array('foo', '-a', '-ffoo', '--long', 'bar'), '->tokenize() parses when several arguments and options'),
- );
+ return [
+ ['', [], '->tokenize() parses an empty string'],
+ ['foo', ['foo'], '->tokenize() parses arguments'],
+ [' foo bar ', ['foo', 'bar'], '->tokenize() ignores whitespaces between arguments'],
+ ['"quoted"', ['quoted'], '->tokenize() parses quoted arguments'],
+ ["'quoted'", ['quoted'], '->tokenize() parses quoted arguments'],
+ ["'a\rb\nc\td'", ["a\rb\nc\td"], '->tokenize() parses whitespace chars in strings'],
+ ["'a'\r'b'\n'c'\t'd'", ['a', 'b', 'c', 'd'], '->tokenize() parses whitespace chars between args as spaces'],
+ ['\"quoted\"', ['"quoted"'], '->tokenize() parses escaped-quoted arguments'],
+ ["\'quoted\'", ['\'quoted\''], '->tokenize() parses escaped-quoted arguments'],
+ ['-a', ['-a'], '->tokenize() parses short options'],
+ ['-azc', ['-azc'], '->tokenize() parses aggregated short options'],
+ ['-awithavalue', ['-awithavalue'], '->tokenize() parses short options with a value'],
+ ['-a"foo bar"', ['-afoo bar'], '->tokenize() parses short options with a value'],
+ ['-a"foo bar""foo bar"', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'],
+ ['-a\'foo bar\'', ['-afoo bar'], '->tokenize() parses short options with a value'],
+ ['-a\'foo bar\'\'foo bar\'', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'],
+ ['-a\'foo bar\'"foo bar"', ['-afoo barfoo bar'], '->tokenize() parses short options with a value'],
+ ['--long-option', ['--long-option'], '->tokenize() parses long options'],
+ ['--long-option=foo', ['--long-option=foo'], '->tokenize() parses long options with a value'],
+ ['--long-option="foo bar"', ['--long-option=foo bar'], '->tokenize() parses long options with a value'],
+ ['--long-option="foo bar""another"', ['--long-option=foo baranother'], '->tokenize() parses long options with a value'],
+ ['--long-option=\'foo bar\'', ['--long-option=foo bar'], '->tokenize() parses long options with a value'],
+ ["--long-option='foo bar''another'", ['--long-option=foo baranother'], '->tokenize() parses long options with a value'],
+ ["--long-option='foo bar'\"another\"", ['--long-option=foo baranother'], '->tokenize() parses long options with a value'],
+ ['foo -a -ffoo --long bar', ['foo', '-a', '-ffoo', '--long', 'bar'], '->tokenize() parses when several arguments and options'],
+ ];
}
public function testToString()
diff --git a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php
index 95e78fc2..c99eb839 100644
--- a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php
+++ b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php
@@ -39,7 +39,7 @@ class ConsoleLoggerTest extends TestCase
{
$this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE);
- return new ConsoleLogger($this->output, array(
+ return new ConsoleLogger($this->output, [
LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
@@ -48,7 +48,7 @@ class ConsoleLoggerTest extends TestCase
LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,
LogLevel::DEBUG => OutputInterface::VERBOSITY_NORMAL,
- ));
+ ]);
}
/**
@@ -64,7 +64,7 @@ class ConsoleLoggerTest extends TestCase
/**
* @dataProvider provideOutputMappingParams
*/
- public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = array())
+ public function testOutputMapping($logLevel, $outputVerbosity, $isOutput, $addVerbosityLevelMap = [])
{
$out = new BufferedOutput($outputVerbosity);
$logger = new ConsoleLogger($out, $addVerbosityLevelMap);
@@ -75,22 +75,22 @@ class ConsoleLoggerTest extends TestCase
public function provideOutputMappingParams()
{
- $quietMap = array(LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET);
+ $quietMap = [LogLevel::EMERGENCY => OutputInterface::VERBOSITY_QUIET];
- return array(
- array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true),
- array(LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true),
- array(LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false),
- array(LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false),
- array(LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false),
- array(LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true),
- array(LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false),
- array(LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true),
- array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false),
- array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false),
- array(LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap),
- array(LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap),
- );
+ return [
+ [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_NORMAL, true],
+ [LogLevel::WARNING, OutputInterface::VERBOSITY_NORMAL, true],
+ [LogLevel::INFO, OutputInterface::VERBOSITY_NORMAL, false],
+ [LogLevel::DEBUG, OutputInterface::VERBOSITY_NORMAL, false],
+ [LogLevel::INFO, OutputInterface::VERBOSITY_VERBOSE, false],
+ [LogLevel::INFO, OutputInterface::VERBOSITY_VERY_VERBOSE, true],
+ [LogLevel::DEBUG, OutputInterface::VERBOSITY_VERY_VERBOSE, false],
+ [LogLevel::DEBUG, OutputInterface::VERBOSITY_DEBUG, true],
+ [LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false],
+ [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, false],
+ [LogLevel::ALERT, OutputInterface::VERBOSITY_QUIET, false, $quietMap],
+ [LogLevel::EMERGENCY, OutputInterface::VERBOSITY_QUIET, true, $quietMap],
+ ];
}
public function testHasErrored()
@@ -117,28 +117,28 @@ class ConsoleLoggerTest extends TestCase
public function testLogsAtAllLevels($level, $message)
{
$logger = $this->getLogger();
- $logger->{$level}($message, array('user' => 'Bob'));
- $logger->log($level, $message, array('user' => 'Bob'));
+ $logger->{$level}($message, ['user' => 'Bob']);
+ $logger->log($level, $message, ['user' => 'Bob']);
- $expected = array(
+ $expected = [
$level.' message of level '.$level.' with context: Bob',
$level.' message of level '.$level.' with context: Bob',
- );
+ ];
$this->assertEquals($expected, $this->getLogs());
}
public function provideLevelsAndMessages()
{
- return array(
- LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
- LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
- LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
- LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
- LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
- LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
- LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
- LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
- );
+ return [
+ LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'],
+ LogLevel::ALERT => [LogLevel::ALERT, 'message of level alert with context: {user}'],
+ LogLevel::CRITICAL => [LogLevel::CRITICAL, 'message of level critical with context: {user}'],
+ LogLevel::ERROR => [LogLevel::ERROR, 'message of level error with context: {user}'],
+ LogLevel::WARNING => [LogLevel::WARNING, 'message of level warning with context: {user}'],
+ LogLevel::NOTICE => [LogLevel::NOTICE, 'message of level notice with context: {user}'],
+ LogLevel::INFO => [LogLevel::INFO, 'message of level info with context: {user}'],
+ LogLevel::DEBUG => [LogLevel::DEBUG, 'message of level debug with context: {user}'],
+ ];
}
/**
@@ -153,56 +153,56 @@ class ConsoleLoggerTest extends TestCase
public function testContextReplacement()
{
$logger = $this->getLogger();
- $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
+ $logger->info('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']);
- $expected = array('info {Message {nothing} Bob Bar a}');
+ $expected = ['info {Message {nothing} Bob Bar a}'];
$this->assertEquals($expected, $this->getLogs());
}
public function testObjectCastToString()
{
if (method_exists($this, 'createPartialMock')) {
- $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
+ $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
} else {
- $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', array('__toString'));
+ $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']);
}
- $dummy->method('__toString')->will($this->returnValue('DUMMY'));
+ $dummy->method('__toString')->willReturn('DUMMY');
$this->getLogger()->warning($dummy);
- $expected = array('warning DUMMY');
+ $expected = ['warning DUMMY'];
$this->assertEquals($expected, $this->getLogs());
}
public function testContextCanContainAnything()
{
- $context = array(
+ $context = [
'bool' => true,
'null' => null,
'string' => 'Foo',
'int' => 0,
'float' => 0.5,
- 'nested' => array('with object' => new DummyTest()),
+ 'nested' => ['with object' => new DummyTest()],
'object' => new \DateTime(),
'resource' => fopen('php://memory', 'r'),
- );
+ ];
$this->getLogger()->warning('Crazy context data', $context);
- $expected = array('warning Crazy context data');
+ $expected = ['warning Crazy context data'];
$this->assertEquals($expected, $this->getLogs());
}
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
{
$logger = $this->getLogger();
- $logger->warning('Random message', array('exception' => 'oops'));
- $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
+ $logger->warning('Random message', ['exception' => 'oops']);
+ $logger->critical('Uncaught Exception!', ['exception' => new \LogicException('Fail')]);
- $expected = array(
+ $expected = [
'warning Random message',
'critical Uncaught Exception!',
- );
+ ];
$this->assertEquals($expected, $this->getLogs());
}
}
diff --git a/vendor/symfony/console/Tests/Output/ConsoleSectionOutputTest.php b/vendor/symfony/console/Tests/Output/ConsoleSectionOutputTest.php
index e5cd0597..4c292c2c 100644
--- a/vendor/symfony/console/Tests/Output/ConsoleSectionOutputTest.php
+++ b/vendor/symfony/console/Tests/Output/ConsoleSectionOutputTest.php
@@ -36,7 +36,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testClearAll()
{
- $sections = array();
+ $sections = [];
$output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output->writeln('Foo'.PHP_EOL.'Bar');
@@ -48,7 +48,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testClearNumberOfLines()
{
- $sections = array();
+ $sections = [];
$output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output->writeln("Foo\nBar\nBaz\nFooBar");
@@ -61,7 +61,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testClearNumberOfLinesWithMultipleSections()
{
$output = new StreamOutput($this->stream);
- $sections = array();
+ $sections = [];
$output1 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output2 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
@@ -78,7 +78,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testClearPreservingEmptyLines()
{
$output = new StreamOutput($this->stream);
- $sections = array();
+ $sections = [];
$output1 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output2 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
@@ -93,7 +93,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testOverwrite()
{
- $sections = array();
+ $sections = [];
$output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output->writeln('Foo');
@@ -105,7 +105,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testOverwriteMultipleLines()
{
- $sections = array();
+ $sections = [];
$output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output->writeln('Foo'.PHP_EOL.'Bar'.PHP_EOL.'Baz');
@@ -117,7 +117,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testAddingMultipleSections()
{
- $sections = array();
+ $sections = [];
$output1 = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output2 = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
@@ -127,7 +127,7 @@ class ConsoleSectionOutputTest extends TestCase
public function testMultipleSectionsOutput()
{
$output = new StreamOutput($this->stream);
- $sections = array();
+ $sections = [];
$output1 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
$output2 = new ConsoleSectionOutput($output->getStream(), $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
@@ -151,7 +151,7 @@ class ConsoleSectionOutputTest extends TestCase
$input->expects($this->once())->method('isInteractive')->willReturn(true);
$input->expects($this->once())->method('getStream')->willReturn($inputStream);
- $sections = array();
+ $sections = [];
$output = new ConsoleSectionOutput($this->stream, $sections, OutputInterface::VERBOSITY_NORMAL, true, new OutputFormatter());
(new QuestionHelper())->ask($input, $output, new Question('What\'s your favorite super hero?'));
diff --git a/vendor/symfony/console/Tests/Output/OutputTest.php b/vendor/symfony/console/Tests/Output/OutputTest.php
index 24347f62..7cfa6cdc 100644
--- a/vendor/symfony/console/Tests/Output/OutputTest.php
+++ b/vendor/symfony/console/Tests/Output/OutputTest.php
@@ -77,7 +77,7 @@ class OutputTest extends TestCase
public function testWriteAnArrayOfMessages()
{
$output = new TestOutput();
- $output->writeln(array('foo', 'bar'));
+ $output->writeln(['foo', 'bar']);
$this->assertEquals("foo\nbar\n", $output->output, '->writeln() can take an array of messages to output');
}
@@ -106,10 +106,10 @@ class OutputTest extends TestCase
public function provideWriteArguments()
{
- return array(
- array('foo', Output::OUTPUT_RAW, "foo\n"),
- array('foo', Output::OUTPUT_PLAIN, "foo\n"),
- );
+ return [
+ ['foo', Output::OUTPUT_RAW, "foo\n"],
+ ['foo', Output::OUTPUT_PLAIN, "foo\n"],
+ ];
}
public function testWriteWithDecorationTurnedOff()
@@ -122,7 +122,7 @@ class OutputTest extends TestCase
public function testWriteDecoratedMessage()
{
- $fooStyle = new OutputFormatterStyle('yellow', 'red', array('blink'));
+ $fooStyle = new OutputFormatterStyle('yellow', 'red', ['blink']);
$output = new TestOutput();
$output->getFormatter()->setStyle('FOO', $fooStyle);
$output->setDecorated(true);
@@ -163,13 +163,13 @@ class OutputTest extends TestCase
public function verbosityProvider()
{
- return array(
- array(Output::VERBOSITY_QUIET, '2', '->write() in QUIET mode only outputs when an explicit QUIET verbosity is passed'),
- array(Output::VERBOSITY_NORMAL, '123', '->write() in NORMAL mode outputs anything below an explicit VERBOSE verbosity'),
- array(Output::VERBOSITY_VERBOSE, '1234', '->write() in VERBOSE mode outputs anything below an explicit VERY_VERBOSE verbosity'),
- array(Output::VERBOSITY_VERY_VERBOSE, '12345', '->write() in VERY_VERBOSE mode outputs anything below an explicit DEBUG verbosity'),
- array(Output::VERBOSITY_DEBUG, '123456', '->write() in DEBUG mode outputs everything'),
- );
+ return [
+ [Output::VERBOSITY_QUIET, '2', '->write() in QUIET mode only outputs when an explicit QUIET verbosity is passed'],
+ [Output::VERBOSITY_NORMAL, '123', '->write() in NORMAL mode outputs anything below an explicit VERBOSE verbosity'],
+ [Output::VERBOSITY_VERBOSE, '1234', '->write() in VERBOSE mode outputs anything below an explicit VERY_VERBOSE verbosity'],
+ [Output::VERBOSITY_VERY_VERBOSE, '12345', '->write() in VERY_VERBOSE mode outputs anything below an explicit DEBUG verbosity'],
+ [Output::VERBOSITY_DEBUG, '123456', '->write() in DEBUG mode outputs everything'],
+ ];
}
}
diff --git a/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php b/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php
new file mode 100644
index 00000000..83899772
--- /dev/null
+++ b/vendor/symfony/console/Tests/Question/ConfirmationQuestionTest.php
@@ -0,0 +1,62 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Console\Tests\Question;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Console\Question\ConfirmationQuestion;
+
+class ConfirmationQuestionTest extends TestCase
+{
+ /**
+ * @dataProvider normalizerUsecases
+ */
+ public function testDefaultRegexUsecases($default, $answers, $expected, $message)
+ {
+ $sut = new ConfirmationQuestion('A question', $default);
+
+ foreach ($answers as $answer) {
+ $normalizer = $sut->getNormalizer();
+ $actual = $normalizer($answer);
+ $this->assertEquals($expected, $actual, sprintf($message, $answer));
+ }
+ }
+
+ public function normalizerUsecases()
+ {
+ return [
+ [
+ true,
+ ['y', 'Y', 'yes', 'YES', 'yEs', ''],
+ true,
+ 'When default is true, the normalizer must return true for "%s"',
+ ],
+ [
+ true,
+ ['n', 'N', 'no', 'NO', 'nO', 'foo', '1', '0'],
+ false,
+ 'When default is true, the normalizer must return false for "%s"',
+ ],
+ [
+ false,
+ ['y', 'Y', 'yes', 'YES', 'yEs'],
+ true,
+ 'When default is false, the normalizer must return true for "%s"',
+ ],
+ [
+ false,
+ ['n', 'N', 'no', 'NO', 'nO', 'foo', '1', '0', ''],
+ false,
+ 'When default is false, the normalizer must return false for "%s"',
+ ],
+ ];
+ }
+}
diff --git a/vendor/symfony/console/Tests/Question/QuestionTest.php b/vendor/symfony/console/Tests/Question/QuestionTest.php
new file mode 100644
index 00000000..13c8e362
--- /dev/null
+++ b/vendor/symfony/console/Tests/Question/QuestionTest.php
@@ -0,0 +1,304 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Console\Tests\Question;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Question\Question;
+
+class QuestionTest extends TestCase
+{
+ private $question;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->question = new Question('Test question');
+ }
+
+ public function providerTrueFalse()
+ {
+ return [[true], [false]];
+ }
+
+ public function testGetQuestion()
+ {
+ self::assertSame('Test question', $this->question->getQuestion());
+ }
+
+ public function testGetDefault()
+ {
+ $question = new Question('Test question', 'Default value');
+ self::assertSame('Default value', $question->getDefault());
+ }
+
+ public function testGetDefaultDefault()
+ {
+ self::assertNull($this->question->getDefault());
+ }
+
+ /**
+ * @dataProvider providerTrueFalse
+ */
+ public function testIsSetHidden(bool $hidden)
+ {
+ $this->question->setHidden($hidden);
+ self::assertSame($hidden, $this->question->isHidden());
+ }
+
+ public function testIsHiddenDefault()
+ {
+ self::assertFalse($this->question->isHidden());
+ }
+
+ public function testSetHiddenWithAutocompleterCallback()
+ {
+ $this->question->setAutocompleterCallback(
+ function (string $input): array { return []; }
+ );
+
+ $this->expectException(\LogicException::class);
+ $this->expectExceptionMessage(
+ 'A hidden question cannot use the autocompleter.'
+ );
+
+ $this->question->setHidden(true);
+ }
+
+ public function testSetHiddenWithNoAutocompleterCallback()
+ {
+ $this->question->setAutocompleterCallback(
+ function (string $input): array { return []; }
+ );
+ $this->question->setAutocompleterCallback(null);
+
+ $exception = null;
+ try {
+ $this->question->setHidden(true);
+ } catch (\Exception $exception) {
+ // Do nothing
+ }
+
+ $this->assertNull($exception);
+ }
+
+ /**
+ * @dataProvider providerTrueFalse
+ */
+ public function testIsSetHiddenFallback(bool $hidden)
+ {
+ $this->question->setHiddenFallback($hidden);
+ self::assertSame($hidden, $this->question->isHiddenFallback());
+ }
+
+ public function testIsHiddenFallbackDefault()
+ {
+ self::assertTrue($this->question->isHiddenFallback());
+ }
+
+ public function providerGetSetAutocompleterValues()
+ {
+ return [
+ 'array' => [
+ ['a', 'b', 'c', 'd'],
+ ['a', 'b', 'c', 'd'],
+ ],
+ 'associative array' => [
+ ['a' => 'c', 'b' => 'd'],
+ ['a', 'b', 'c', 'd'],
+ ],
+ 'iterator' => [
+ new \ArrayIterator(['a', 'b', 'c', 'd']),
+ ['a', 'b', 'c', 'd'],
+ ],
+ 'null' => [null, null],
+ ];
+ }
+
+ /**
+ * @dataProvider providerGetSetAutocompleterValues
+ */
+ public function testGetSetAutocompleterValues($values, $expectValues)
+ {
+ $this->question->setAutocompleterValues($values);
+ self::assertSame(
+ $expectValues,
+ $this->question->getAutocompleterValues()
+ );
+ }
+
+ public function providerSetAutocompleterValuesInvalid()
+ {
+ return [
+ ['Potato'],
+ [new \stdclass()],
+ [false],
+ ];
+ }
+
+ /**
+ * @dataProvider providerSetAutocompleterValuesInvalid
+ */
+ public function testSetAutocompleterValuesInvalid($values)
+ {
+ self::expectException(InvalidArgumentException::class);
+ self::expectExceptionMessage(
+ 'Autocompleter values can be either an array, "null" or a "Traversable" object.'
+ );
+
+ $this->question->setAutocompleterValues($values);
+ }
+
+ public function testSetAutocompleterValuesWithTraversable()
+ {
+ $question1 = new Question('Test question 1');
+ $iterator1 = $this->getMockForAbstractClass(\IteratorAggregate::class);
+ $iterator1
+ ->expects($this->once())
+ ->method('getIterator')
+ ->willReturn(new \ArrayIterator(['Potato']));
+ $question1->setAutocompleterValues($iterator1);
+
+ $question2 = new Question('Test question 2');
+ $iterator2 = $this->getMockForAbstractClass(\IteratorAggregate::class);
+ $iterator2
+ ->expects($this->once())
+ ->method('getIterator')
+ ->willReturn(new \ArrayIterator(['Carrot']));
+ $question2->setAutocompleterValues($iterator2);
+
+ // Call multiple times to verify that Traversable result is cached, and
+ // that there is no crosstalk between cached copies.
+ self::assertSame(['Potato'], $question1->getAutocompleterValues());
+ self::assertSame(['Carrot'], $question2->getAutocompleterValues());
+ self::assertSame(['Potato'], $question1->getAutocompleterValues());
+ self::assertSame(['Carrot'], $question2->getAutocompleterValues());
+ }
+
+ public function testGetAutocompleterValuesDefault()
+ {
+ self::assertNull($this->question->getAutocompleterValues());
+ }
+
+ public function testGetSetAutocompleterCallback()
+ {
+ $callback = function (string $input): array { return []; };
+
+ $this->question->setAutocompleterCallback($callback);
+ self::assertSame($callback, $this->question->getAutocompleterCallback());
+ }
+
+ public function testGetAutocompleterCallbackDefault()
+ {
+ self::assertNull($this->question->getAutocompleterCallback());
+ }
+
+ public function testSetAutocompleterCallbackWhenHidden()
+ {
+ $this->question->setHidden(true);
+
+ $this->expectException(\LogicException::class);
+ $this->expectExceptionMessage(
+ 'A hidden question cannot use the autocompleter.'
+ );
+
+ $this->question->setAutocompleterCallback(
+ function (string $input): array { return []; }
+ );
+ }
+
+ public function testSetAutocompleterCallbackWhenNotHidden()
+ {
+ $this->question->setHidden(true);
+ $this->question->setHidden(false);
+
+ $exception = null;
+ try {
+ $this->question->setAutocompleterCallback(
+ function (string $input): array { return []; }
+ );
+ } catch (\Exception $exception) {
+ // Do nothing
+ }
+
+ $this->assertNull($exception);
+ }
+
+ public function providerGetSetValidator()
+ {
+ return [
+ [function ($input) { return $input; }],
+ [null],
+ ];
+ }
+
+ /**
+ * @dataProvider providerGetSetValidator
+ */
+ public function testGetSetValidator($callback)
+ {
+ $this->question->setValidator($callback);
+ self::assertSame($callback, $this->question->getValidator());
+ }
+
+ public function testGetValidatorDefault()
+ {
+ self::assertNull($this->question->getValidator());
+ }
+
+ public function providerGetSetMaxAttempts()
+ {
+ return [[1], [5], [null]];
+ }
+
+ /**
+ * @dataProvider providerGetSetMaxAttempts
+ */
+ public function testGetSetMaxAttempts($attempts)
+ {
+ $this->question->setMaxAttempts($attempts);
+ self::assertSame($attempts, $this->question->getMaxAttempts());
+ }
+
+ public function providerSetMaxAttemptsInvalid()
+ {
+ return [['Potato'], [0], [-1]];
+ }
+
+ /**
+ * @dataProvider providerSetMaxAttemptsInvalid
+ */
+ public function testSetMaxAttemptsInvalid($attempts)
+ {
+ self::expectException(\InvalidArgumentException::class);
+ self::expectExceptionMessage('Maximum number of attempts must be a positive value.');
+
+ $this->question->setMaxAttempts($attempts);
+ }
+
+ public function testGetMaxAttemptsDefault()
+ {
+ self::assertNull($this->question->getMaxAttempts());
+ }
+
+ public function testGetSetNormalizer()
+ {
+ $normalizer = function ($input) { return $input; };
+ $this->question->setNormalizer($normalizer);
+ self::assertSame($normalizer, $this->question->getNormalizer());
+ }
+
+ public function testGetNormalizerDefault()
+ {
+ self::assertNull($this->question->getNormalizer());
+ }
+}
diff --git a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
index 308030bb..88d00c8a 100644
--- a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
+++ b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
@@ -26,9 +26,11 @@ class SymfonyStyleTest extends TestCase
protected $command;
/** @var CommandTester */
protected $tester;
+ private $colSize;
protected function setUp()
{
+ $this->colSize = getenv('COLUMNS');
putenv('COLUMNS=121');
$this->command = new Command('sfstyle');
$this->tester = new CommandTester($this->command);
@@ -36,7 +38,7 @@ class SymfonyStyleTest extends TestCase
protected function tearDown()
{
- putenv('COLUMNS');
+ putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
$this->command = null;
$this->tester = null;
}
@@ -48,7 +50,7 @@ class SymfonyStyleTest extends TestCase
{
$code = require $inputCommandFilepath;
$this->command->setCode($code);
- $this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
+ $this->tester->execute([], ['interactive' => false, 'decorated' => false]);
$this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true));
}
@@ -59,7 +61,7 @@ class SymfonyStyleTest extends TestCase
{
$code = require $inputCommandFilepath;
$this->command->setCode($code);
- $this->tester->execute(array(), array('interactive' => true, 'decorated' => false));
+ $this->tester->execute([], ['interactive' => true, 'decorated' => false]);
$this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true));
}
diff --git a/vendor/symfony/console/Tests/TerminalTest.php b/vendor/symfony/console/Tests/TerminalTest.php
index 91af1d0a..93b8c44a 100644
--- a/vendor/symfony/console/Tests/TerminalTest.php
+++ b/vendor/symfony/console/Tests/TerminalTest.php
@@ -16,6 +16,21 @@ use Symfony\Component\Console\Terminal;
class TerminalTest extends TestCase
{
+ private $colSize;
+ private $lineSize;
+
+ protected function setUp()
+ {
+ $this->colSize = getenv('COLUMNS');
+ $this->lineSize = getenv('LINES');
+ }
+
+ protected function tearDown()
+ {
+ putenv($this->colSize ? 'COLUMNS='.$this->colSize : 'COLUMNS');
+ putenv($this->lineSize ? 'LINES' : 'LINES='.$this->lineSize);
+ }
+
public function test()
{
putenv('COLUMNS=100');
diff --git a/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php b/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php
index 49ef8029..75227315 100644
--- a/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php
+++ b/vendor/symfony/console/Tests/Tester/ApplicationTesterTest.php
@@ -35,7 +35,7 @@ class ApplicationTesterTest extends TestCase
;
$this->tester = new ApplicationTester($this->application);
- $this->tester->run(array('command' => 'foo', 'foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE));
+ $this->tester->run(['command' => 'foo', 'foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
protected function tearDown()
@@ -79,8 +79,8 @@ class ApplicationTesterTest extends TestCase
});
$tester = new ApplicationTester($application);
- $tester->setInputs(array('I1', 'I2', 'I3'));
- $tester->run(array('command' => 'foo'));
+ $tester->setInputs(['I1', 'I2', 'I3']);
+ $tester->run(['command' => 'foo']);
$this->assertSame(0, $tester->getStatusCode());
$this->assertEquals('Q1Q2Q3', $tester->getDisplay(true));
@@ -104,8 +104,8 @@ class ApplicationTesterTest extends TestCase
$tester = new ApplicationTester($application);
$tester->run(
- array('command' => 'foo', 'foo' => 'bar'),
- array('capture_stderr_separately' => true)
+ ['command' => 'foo', 'foo' => 'bar'],
+ ['capture_stderr_separately' => true]
);
$this->assertSame('foo', $tester->getErrorOutput());
diff --git a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php
index f4fe32a5..70662967 100644
--- a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php
+++ b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Output\Output;
+use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Tester\CommandTester;
@@ -34,7 +35,7 @@ class CommandTesterTest extends TestCase
$this->command->setCode(function ($input, $output) { $output->writeln('foo'); });
$this->tester = new CommandTester($this->command);
- $this->tester->execute(array('foo' => 'bar'), array('interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE));
+ $this->tester->execute(['foo' => 'bar'], ['interactive' => false, 'decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]);
}
protected function tearDown()
@@ -84,19 +85,19 @@ class CommandTesterTest extends TestCase
$tester = new CommandTester($application->find('foo'));
// check that there is no need to pass the command name here
- $this->assertEquals(0, $tester->execute(array()));
+ $this->assertEquals(0, $tester->execute([]));
}
public function testCommandWithInputs()
{
- $questions = array(
+ $questions = [
'What\'s your name?',
'How are you?',
'Where do you come from?',
- );
+ ];
$command = new Command('foo');
- $command->setHelperSet(new HelperSet(array(new QuestionHelper())));
+ $command->setHelperSet(new HelperSet([new QuestionHelper()]));
$command->setCode(function ($input, $output) use ($questions, $command) {
$helper = $command->getHelper('question');
$helper->ask($input, $output, new Question($questions[0]));
@@ -105,8 +106,8 @@ class CommandTesterTest extends TestCase
});
$tester = new CommandTester($command);
- $tester->setInputs(array('Bobby', 'Fine', 'France'));
- $tester->execute(array());
+ $tester->setInputs(['Bobby', 'Fine', 'France']);
+ $tester->execute([]);
$this->assertEquals(0, $tester->getStatusCode());
$this->assertEquals(implode('', $questions), $tester->getDisplay(true));
@@ -114,14 +115,14 @@ class CommandTesterTest extends TestCase
public function testCommandWithDefaultInputs()
{
- $questions = array(
+ $questions = [
'What\'s your name?',
'How are you?',
'Where do you come from?',
- );
+ ];
$command = new Command('foo');
- $command->setHelperSet(new HelperSet(array(new QuestionHelper())));
+ $command->setHelperSet(new HelperSet([new QuestionHelper()]));
$command->setCode(function ($input, $output) use ($questions, $command) {
$helper = $command->getHelper('question');
$helper->ask($input, $output, new Question($questions[0], 'Bobby'));
@@ -130,8 +131,8 @@ class CommandTesterTest extends TestCase
});
$tester = new CommandTester($command);
- $tester->setInputs(array('', '', ''));
- $tester->execute(array());
+ $tester->setInputs(['', '', '']);
+ $tester->execute([]);
$this->assertEquals(0, $tester->getStatusCode());
$this->assertEquals(implode('', $questions), $tester->getDisplay(true));
@@ -139,37 +140,64 @@ class CommandTesterTest extends TestCase
/**
* @expectedException \RuntimeException
- * @expectedMessage Aborted
+ * @expectedExceptionMessage Aborted.
*/
public function testCommandWithWrongInputsNumber()
{
- $questions = array(
+ $questions = [
'What\'s your name?',
'How are you?',
'Where do you come from?',
- );
+ ];
$command = new Command('foo');
- $command->setHelperSet(new HelperSet(array(new QuestionHelper())));
+ $command->setHelperSet(new HelperSet([new QuestionHelper()]));
$command->setCode(function ($input, $output) use ($questions, $command) {
$helper = $command->getHelper('question');
+ $helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b']));
$helper->ask($input, $output, new Question($questions[0]));
$helper->ask($input, $output, new Question($questions[1]));
$helper->ask($input, $output, new Question($questions[2]));
});
$tester = new CommandTester($command);
- $tester->setInputs(array('Bobby', 'Fine'));
- $tester->execute(array());
+ $tester->setInputs(['a', 'Bobby', 'Fine']);
+ $tester->execute([]);
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ * @expectedExceptionMessage Aborted.
+ */
+ public function testCommandWithQuestionsButNoInputs()
+ {
+ $questions = [
+ 'What\'s your name?',
+ 'How are you?',
+ 'Where do you come from?',
+ ];
+
+ $command = new Command('foo');
+ $command->setHelperSet(new HelperSet([new QuestionHelper()]));
+ $command->setCode(function ($input, $output) use ($questions, $command) {
+ $helper = $command->getHelper('question');
+ $helper->ask($input, $output, new ChoiceQuestion('choice', ['a', 'b']));
+ $helper->ask($input, $output, new Question($questions[0]));
+ $helper->ask($input, $output, new Question($questions[1]));
+ $helper->ask($input, $output, new Question($questions[2]));
+ });
+
+ $tester = new CommandTester($command);
+ $tester->execute([]);
}
public function testSymfonyStyleCommandWithInputs()
{
- $questions = array(
+ $questions = [
'What\'s your name?',
'How are you?',
'Where do you come from?',
- );
+ ];
$command = new Command('foo');
$command->setCode(function ($input, $output) use ($questions, $command) {
@@ -180,8 +208,8 @@ class CommandTesterTest extends TestCase
});
$tester = new CommandTester($command);
- $tester->setInputs(array('Bobby', 'Fine', 'France'));
- $tester->execute(array());
+ $tester->setInputs(['Bobby', 'Fine', 'France']);
+ $tester->execute([]);
$this->assertEquals(0, $tester->getStatusCode());
}
@@ -198,8 +226,8 @@ class CommandTesterTest extends TestCase
$tester = new CommandTester($command);
$tester->execute(
- array('foo' => 'bar'),
- array('capture_stderr_separately' => true)
+ ['foo' => 'bar'],
+ ['capture_stderr_separately' => true]
);
$this->assertSame('foo', $tester->getErrorOutput());
diff --git a/vendor/symfony/console/composer.json b/vendor/symfony/console/composer.json
index ca1a9269..5613467f 100644
--- a/vendor/symfony/console/composer.json
+++ b/vendor/symfony/console/composer.json
@@ -17,25 +17,31 @@
],
"require": {
"php": "^7.1.3",
- "symfony/contracts": "^1.0",
- "symfony/polyfill-mbstring": "~1.0"
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/polyfill-php73": "^1.8",
+ "symfony/service-contracts": "^1.1"
},
"require-dev": {
"symfony/config": "~3.4|~4.0",
- "symfony/event-dispatcher": "~3.4|~4.0",
+ "symfony/event-dispatcher": "^4.3",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/lock": "~3.4|~4.0",
"symfony/process": "~3.4|~4.0",
+ "symfony/var-dumper": "^4.3",
"psr/log": "~1.0"
},
+ "provide": {
+ "psr/log-implementation": "1.0"
+ },
"suggest": {
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": "",
- "psr/log-implementation": "For using the console logger"
+ "psr/log": "For using the console logger"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
+ "symfony/event-dispatcher": "<4.3",
"symfony/process": "<3.3"
},
"autoload": {
@@ -47,7 +53,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/contracts/CHANGELOG.md b/vendor/symfony/contracts/CHANGELOG.md
deleted file mode 100644
index fba42d59..00000000
--- a/vendor/symfony/contracts/CHANGELOG.md
+++ /dev/null
@@ -1,12 +0,0 @@
-CHANGELOG
-=========
-
-1.0.0
------
-
- * added `Service\ResetInterface` to provide a way to reset an object to its initial state
- * added `Translation\TranslatorInterface` and `Translation\TranslatorTrait`
- * added `Cache` contract to extend PSR-6 with tag invalidation, callback-based computation and stampede protection
- * added `Service\ServiceSubscriberInterface` to declare the dependencies of a class that consumes a service locator
- * added `Service\ServiceSubscriberTrait` to implement `Service\ServiceSubscriberInterface` using methods' return types
- * added `Service\ServiceLocatorTrait` to help implement PSR-11 service locators
diff --git a/vendor/symfony/contracts/Cache/CacheInterface.php b/vendor/symfony/contracts/Cache/CacheInterface.php
deleted file mode 100644
index 4b1686b8..00000000
--- a/vendor/symfony/contracts/Cache/CacheInterface.php
+++ /dev/null
@@ -1,57 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Cache;
-
-use Psr\Cache\CacheItemInterface;
-use Psr\Cache\InvalidArgumentException;
-
-/**
- * Covers most simple to advanced caching needs.
- *
- * @author Nicolas Grekas
- */
-interface CacheInterface
-{
- /**
- * Fetches a value from the pool or computes it if not found.
- *
- * On cache misses, a callback is called that should return the missing value.
- * This callback is given a PSR-6 CacheItemInterface instance corresponding to the
- * requested key, that could be used e.g. for expiration control. It could also
- * be an ItemInterface instance when its additional features are needed.
- *
- * @param string $key The key of the item to retrieve from the cache
- * @param callable|CallbackInterface $callback Should return the computed value for the given key/item
- * @param float|null $beta A float that, as it grows, controls the likeliness of triggering
- * early expiration. 0 disables it, INF forces immediate expiration.
- * The default (or providing null) is implementation dependent but should
- * typically be 1.0, which should provide optimal stampede protection.
- * See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration
- * @param array &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()}
- *
- * @return mixed The value corresponding to the provided key
- *
- * @throws InvalidArgumentException When $key is not valid or when $beta is negative
- */
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null);
-
- /**
- * Removes an item from the pool.
- *
- * @param string $key The key to delete
- *
- * @throws InvalidArgumentException When $key is not valid
- *
- * @return bool True if the item was successfully removed, false if there was any error
- */
- public function delete(string $key): bool;
-}
diff --git a/vendor/symfony/contracts/Cache/CacheTrait.php b/vendor/symfony/contracts/Cache/CacheTrait.php
deleted file mode 100644
index d82d9653..00000000
--- a/vendor/symfony/contracts/Cache/CacheTrait.php
+++ /dev/null
@@ -1,71 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Cache;
-
-use Psr\Cache\CacheItemPoolInterface;
-use Psr\Cache\InvalidArgumentException;
-
-/**
- * An implementation of CacheInterface for PSR-6 CacheItemPoolInterface classes.
- *
- * @author Nicolas Grekas
- */
-trait CacheTrait
-{
- /**
- * {@inheritdoc}
- */
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
- {
- return $this->doGet($this, $key, $callback, $beta, $metadata);
- }
-
- /**
- * {@inheritdoc}
- */
- public function delete(string $key): bool
- {
- return $this->deleteItem($key);
- }
-
- private function doGet(CacheItemPoolInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null)
- {
- if (0 > $beta = $beta ?? 1.0) {
- throw new class(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', \get_class($this), $beta)) extends \InvalidArgumentException implements InvalidArgumentException {
- };
- }
-
- $item = $pool->getItem($key);
- $recompute = !$item->isHit() || INF === $beta;
- $metadata = $item instanceof ItemInterface ? $item->getMetadata() : array();
-
- if (!$recompute && $metadata) {
- $expiry = $metadata[ItemInterface::METADATA_EXPIRY] ?? false;
- $ctime = $metadata[ItemInterface::METADATA_CTIME] ?? false;
-
- if ($recompute = $ctime && $expiry && $expiry <= microtime(true) - $ctime / 1000 * $beta * log(random_int(1, PHP_INT_MAX) / PHP_INT_MAX)) {
- // force applying defaultLifetime to expiry
- $item->expiresAt(null);
- }
- }
-
- if ($recompute) {
- $save = true;
- $item->set($callback($item, $save));
- if ($save) {
- $pool->save($item);
- }
- }
-
- return $item->get();
- }
-}
diff --git a/vendor/symfony/contracts/Cache/CallbackInterface.php b/vendor/symfony/contracts/Cache/CallbackInterface.php
deleted file mode 100644
index 7dae2aac..00000000
--- a/vendor/symfony/contracts/Cache/CallbackInterface.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Cache;
-
-use Psr\Cache\CacheItemInterface;
-
-/**
- * Computes and returns the cached value of an item.
- *
- * @author Nicolas Grekas
- */
-interface CallbackInterface
-{
- /**
- * @param CacheItemInterface|ItemInterface $item The item to compute the value for
- * @param bool &$save Should be set to false when the value should not be saved in the pool
- *
- * @return mixed The computed value for the passed item
- */
- public function __invoke(CacheItemInterface $item, bool &$save);
-}
diff --git a/vendor/symfony/contracts/Cache/ItemInterface.php b/vendor/symfony/contracts/Cache/ItemInterface.php
deleted file mode 100644
index 4884a2ff..00000000
--- a/vendor/symfony/contracts/Cache/ItemInterface.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Cache;
-
-use Psr\Cache\CacheException;
-use Psr\Cache\CacheItemInterface;
-use Psr\Cache\InvalidArgumentException;
-
-/**
- * Augments PSR-6's CacheItemInterface with support for tags and metadata.
- *
- * @author Nicolas Grekas
- */
-interface ItemInterface extends CacheItemInterface
-{
- /**
- * References the Unix timestamp stating when the item will expire.
- */
- const METADATA_EXPIRY = 'expiry';
-
- /**
- * References the time the item took to be created, in milliseconds.
- */
- const METADATA_CTIME = 'ctime';
-
- /**
- * References the list of tags that were assigned to the item, as string[].
- */
- const METADATA_TAGS = 'tags';
-
- /**
- * Adds a tag to a cache item.
- *
- * Tags are strings that follow the same validation rules as keys.
- *
- * @param string|string[] $tags A tag or array of tags
- *
- * @return $this
- *
- * @throws InvalidArgumentException When $tag is not valid
- * @throws CacheException When the item comes from a pool that is not tag-aware
- */
- public function tag($tags): self;
-
- /**
- * Returns a list of metadata info that were saved alongside with the cached value.
- *
- * See ItemInterface::METADATA_* consts for keys potentially found in the returned array.
- */
- public function getMetadata(): array;
-}
diff --git a/vendor/symfony/contracts/Cache/TagAwareCacheInterface.php b/vendor/symfony/contracts/Cache/TagAwareCacheInterface.php
deleted file mode 100644
index 7c4cf111..00000000
--- a/vendor/symfony/contracts/Cache/TagAwareCacheInterface.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Cache;
-
-use Psr\Cache\InvalidArgumentException;
-
-/**
- * Allows invalidating cached items using tags.
- *
- * @author Nicolas Grekas
- */
-interface TagAwareCacheInterface extends CacheInterface
-{
- /**
- * Invalidates cached items using tags.
- *
- * When implemented on a PSR-6 pool, invalidation should not apply
- * to deferred items. Instead, they should be committed as usual.
- * This allows replacing old tagged values by new ones without
- * race conditions.
- *
- * @param string[] $tags An array of tags to invalidate
- *
- * @return bool True on success
- *
- * @throws InvalidArgumentException When $tags is not valid
- */
- public function invalidateTags(array $tags);
-}
diff --git a/vendor/symfony/contracts/README.md b/vendor/symfony/contracts/README.md
deleted file mode 100644
index 9cb73af2..00000000
--- a/vendor/symfony/contracts/README.md
+++ /dev/null
@@ -1,70 +0,0 @@
-Symfony Contracts
-=================
-
-A set of abstractions extracted out of the Symfony components.
-
-Can be used to build on semantics that the Symfony components proved useful - and
-that already have battle tested implementations.
-
-Design Principles
------------------
-
- * contracts are split by domain, each into their own sub-namespaces;
- * contracts are small and consistent sets of PHP interfaces, traits, normative
- docblocks and reference test suites when applicable, etc.;
- * all contracts must have a proven implementation to enter this repository;
- * they must be backward compatible with existing Symfony components.
-
-Packages that implement specific contracts should list them in the "provide"
-section of their "composer.json" file, using the `symfony/*-contracts-implementation`
-convention (e.g. `"provide": { "symfony/cache-contracts-implementation": "1.0" }`).
-
-FAQ
----
-
-### How to use this package?
-
-The abstractions in this package are useful to achieve loose coupling and
-interoperability. By using the provided interfaces as type hints, you are able
-to reuse any implementations that match their contracts. It could be a Symfony
-component, or another one provided by the PHP community at large.
-
-Depending on their semantics, some interfaces can be combined with autowiring to
-seamlessly inject a service in your classes.
-
-Others might be useful as labeling interfaces, to hint about a specific behavior
-that could be enabled when using autoconfiguration or manual service tagging (or
-any other means provided by your framework.)
-
-### How is this different from PHP-FIG's PSRs?
-
-When applicable, the provided contracts are built on top of PHP-FIG's PSRs. But
-the group has different goals and different processes. Here, we're focusing on
-providing abstractions that are useful on their own while still compatible with
-implementations provided by Symfony. Although not the main target, we hope that
-the declared contracts will directly or indirectly contribute to the PHP-FIG.
-
-### Why isn't this package split into several packages?
-
-Putting all interfaces in one package eases discoverability and dependency
-management. Instead of dealing with a myriad of small packages and the
-corresponding matrix of versions, you just need to deal with one package and one
-version. Also when using IDE autocompletion or just reading the source code, it
-makes it easier to figure out which contracts are provided.
-
-There are two downsides to this approach: you may have unused files in your
-`vendor/` directory, and in the future, it will be impossible to use two
-different sub-namespaces in different major versions of the package. For the
-"unused files" downside, it has no practical consequences: their file sizes are
-very small, and there is no performance overhead at all since they are never
-loaded. For major versions, this package follows the Symfony BC + deprecation
-policies, with an additional restriction to never remove deprecated interfaces.
-
-Resources
----------
-
- * [Documentation](https://symfony.com/doc/current/components/contracts.html)
- * [Contributing](https://symfony.com/doc/current/contributing/index.html)
- * [Report issues](https://github.com/symfony/symfony/issues) and
- [send Pull Requests](https://github.com/symfony/symfony/pulls)
- in the [main Symfony repository](https://github.com/symfony/symfony)
diff --git a/vendor/symfony/contracts/Tests/Cache/CacheTraitTest.php b/vendor/symfony/contracts/Tests/Cache/CacheTraitTest.php
deleted file mode 100644
index 5134a933..00000000
--- a/vendor/symfony/contracts/Tests/Cache/CacheTraitTest.php
+++ /dev/null
@@ -1,165 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Tests\Cache;
-
-use PHPUnit\Framework\TestCase;
-use Psr\Cache\CacheItemInterface;
-use Psr\Cache\CacheItemPoolInterface;
-use Symfony\Contracts\Cache\CacheTrait;
-
-/**
- * @author Tobias Nyholm
- */
-class CacheTraitTest extends TestCase
-{
- public function testSave()
- {
- $item = $this->getMockBuilder(CacheItemInterface::class)->getMock();
- $item->method('set')
- ->willReturn($item);
- $item->method('isHit')
- ->willReturn(false);
-
- $item->expects($this->once())
- ->method('set')
- ->with('computed data');
-
- $cache = $this->getMockBuilder(TestPool::class)
- ->setMethods(array('getItem', 'save'))
- ->getMock();
- $cache->expects($this->once())
- ->method('getItem')
- ->with('key')
- ->willReturn($item);
- $cache->expects($this->once())
- ->method('save');
-
- $callback = function (CacheItemInterface $item) {
- return 'computed data';
- };
-
- $cache->get('key', $callback);
- }
-
- public function testNoCallbackCallOnHit()
- {
- $item = $this->getMockBuilder(CacheItemInterface::class)->getMock();
- $item->method('isHit')
- ->willReturn(true);
-
- $item->expects($this->never())
- ->method('set');
-
- $cache = $this->getMockBuilder(TestPool::class)
- ->setMethods(array('getItem', 'save'))
- ->getMock();
-
- $cache->expects($this->once())
- ->method('getItem')
- ->with('key')
- ->willReturn($item);
- $cache->expects($this->never())
- ->method('save');
-
- $callback = function (CacheItemInterface $item) {
- $this->assertTrue(false, 'This code should never be reached');
- };
-
- $cache->get('key', $callback);
- }
-
- public function testRecomputeOnBetaInf()
- {
- $item = $this->getMockBuilder(CacheItemInterface::class)->getMock();
- $item->method('set')
- ->willReturn($item);
- $item->method('isHit')
- // We want to recompute even if it is a hit
- ->willReturn(true);
-
- $item->expects($this->once())
- ->method('set')
- ->with('computed data');
-
- $cache = $this->getMockBuilder(TestPool::class)
- ->setMethods(array('getItem', 'save'))
- ->getMock();
-
- $cache->expects($this->once())
- ->method('getItem')
- ->with('key')
- ->willReturn($item);
- $cache->expects($this->once())
- ->method('save');
-
- $callback = function (CacheItemInterface $item) {
- return 'computed data';
- };
-
- $cache->get('key', $callback, INF);
- }
-
- public function testExceptionOnNegativeBeta()
- {
- $cache = $this->getMockBuilder(TestPool::class)
- ->setMethods(array('getItem', 'save'))
- ->getMock();
-
- $callback = function (CacheItemInterface $item) {
- return 'computed data';
- };
-
- $this->expectException(\InvalidArgumentException::class);
- $cache->get('key', $callback, -2);
- }
-}
-
-class TestPool implements CacheItemPoolInterface
-{
- use CacheTrait;
-
- public function hasItem($key)
- {
- }
-
- public function deleteItem($key)
- {
- }
-
- public function deleteItems(array $keys = array())
- {
- }
-
- public function getItem($key)
- {
- }
-
- public function getItems(array $key = array())
- {
- }
-
- public function saveDeferred(CacheItemInterface $item)
- {
- }
-
- public function save(CacheItemInterface $item)
- {
- }
-
- public function commit()
- {
- }
-
- public function clear()
- {
- }
-}
diff --git a/vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php b/vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php
deleted file mode 100644
index c7742c65..00000000
--- a/vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php
+++ /dev/null
@@ -1,65 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Contracts\Tests\Service;
-
-use PHPUnit\Framework\TestCase;
-use Psr\Container\ContainerInterface;
-use Symfony\Contracts\Service\ServiceLocatorTrait;
-use Symfony\Contracts\Service\ServiceSubscriberInterface;
-use Symfony\Contracts\Service\ServiceSubscriberTrait;
-
-class ServiceSubscriberTraitTest extends TestCase
-{
- public function testMethodsOnParentsAndChildrenAreIgnoredInGetSubscribedServices()
- {
- $expected = array(TestService::class.'::aService' => '?Symfony\Contracts\Tests\Service\Service2');
-
- $this->assertEquals($expected, ChildTestService::getSubscribedServices());
- }
-
- public function testSetContainerIsCalledOnParent()
- {
- $container = new class(array()) implements ContainerInterface {
- use ServiceLocatorTrait;
- };
-
- $this->assertSame($container, (new TestService())->setContainer($container));
- }
-}
-
-class ParentTestService
-{
- public function aParentService(): Service1
- {
- }
-
- public function setContainer(ContainerInterface $container)
- {
- return $container;
- }
-}
-
-class TestService extends ParentTestService implements ServiceSubscriberInterface
-{
- use ServiceSubscriberTrait;
-
- public function aService(): Service2
- {
- }
-}
-
-class ChildTestService extends TestService
-{
- public function aChildService(): Service3
- {
- }
-}
diff --git a/vendor/symfony/contracts/composer.json b/vendor/symfony/contracts/composer.json
deleted file mode 100644
index 2f198a0c..00000000
--- a/vendor/symfony/contracts/composer.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "name": "symfony/contracts",
- "type": "library",
- "description": "A set of abstractions extracted out of the Symfony components",
- "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"],
- "homepage": "https://symfony.com",
- "license": "MIT",
- "authors": [
- {
- "name": "Nicolas Grekas",
- "email": "p@tchwork.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "require": {
- "php": "^7.1.3"
- },
- "require-dev": {
- "psr/cache": "^1.0",
- "psr/container": "^1.0"
- },
- "suggest": {
- "psr/cache": "When using the Cache contracts",
- "psr/container": "When using the Service contracts",
- "symfony/cache-contracts-implementation": "",
- "symfony/service-contracts-implementation": "",
- "symfony/translation-contracts-implementation": ""
- },
- "autoload": {
- "psr-4": { "Symfony\\Contracts\\": "" },
- "exclude-from-classmap": [
- "**/Tests/"
- ]
- },
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- }
-}
diff --git a/vendor/symfony/css-selector/Node/FunctionNode.php b/vendor/symfony/css-selector/Node/FunctionNode.php
index 89b64378..063f8a27 100644
--- a/vendor/symfony/css-selector/Node/FunctionNode.php
+++ b/vendor/symfony/css-selector/Node/FunctionNode.php
@@ -34,7 +34,7 @@ class FunctionNode extends AbstractNode
* @param string $name
* @param Token[] $arguments
*/
- public function __construct(NodeInterface $selector, string $name, array $arguments = array())
+ public function __construct(NodeInterface $selector, string $name, array $arguments = [])
{
$this->selector = $selector;
$this->name = strtolower($name);
diff --git a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
index eea1aa9b..38c8dc15 100644
--- a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
@@ -47,7 +47,7 @@ class StringHandler implements HandlerInterface
{
$quote = $reader->getSubstring(1);
- if (!\in_array($quote, array("'", '"'))) {
+ if (!\in_array($quote, ["'", '"'])) {
return false;
}
diff --git a/vendor/symfony/css-selector/Parser/Parser.php b/vendor/symfony/css-selector/Parser/Parser.php
index d42bdca6..e8a46c06 100644
--- a/vendor/symfony/css-selector/Parser/Parser.php
+++ b/vendor/symfony/css-selector/Parser/Parser.php
@@ -74,33 +74,33 @@ class Parser implements ParserInterface
switch (true) {
case 'odd' === $joined:
- return array(2, 1);
+ return [2, 1];
case 'even' === $joined:
- return array(2, 0);
+ return [2, 0];
case 'n' === $joined:
- return array(1, 0);
+ return [1, 0];
case false === strpos($joined, 'n'):
- return array(0, $int($joined));
+ return [0, $int($joined)];
}
$split = explode('n', $joined);
$first = isset($split[0]) ? $split[0] : null;
- return array(
+ return [
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
isset($split[1]) && $split[1] ? $int($split[1]) : 0,
- );
+ ];
}
private function parseSelectorList(TokenStream $stream): array
{
$stream->skipWhitespace();
- $selectors = array();
+ $selectors = [];
while (true) {
$selectors[] = $this->parserSelectorNode($stream);
- if ($stream->getPeek()->isDelimiter(array(','))) {
+ if ($stream->getPeek()->isDelimiter([','])) {
$stream->getNext();
$stream->skipWhitespace();
} else {
@@ -119,7 +119,7 @@ class Parser implements ParserInterface
$stream->skipWhitespace();
$peek = $stream->getPeek();
- if ($peek->isFileEnd() || $peek->isDelimiter(array(','))) {
+ if ($peek->isFileEnd() || $peek->isDelimiter([','])) {
break;
}
@@ -127,7 +127,7 @@ class Parser implements ParserInterface
throw SyntaxErrorException::pseudoElementFound($pseudoElement, 'not at the end of a selector');
}
- if ($peek->isDelimiter(array('+', '>', '~'))) {
+ if ($peek->isDelimiter(['+', '>', '~'])) {
$combinator = $stream->getNext()->getValue();
$stream->skipWhitespace();
} else {
@@ -158,8 +158,8 @@ class Parser implements ParserInterface
$peek = $stream->getPeek();
if ($peek->isWhitespace()
|| $peek->isFileEnd()
- || $peek->isDelimiter(array(',', '+', '>', '~'))
- || ($insideNegation && $peek->isDelimiter(array(')')))
+ || $peek->isDelimiter([',', '+', '>', '~'])
+ || ($insideNegation && $peek->isDelimiter([')']))
) {
break;
}
@@ -170,16 +170,16 @@ class Parser implements ParserInterface
if ($peek->isHash()) {
$result = new Node\HashNode($result, $stream->getNext()->getValue());
- } elseif ($peek->isDelimiter(array('.'))) {
+ } elseif ($peek->isDelimiter(['.'])) {
$stream->getNext();
$result = new Node\ClassNode($result, $stream->getNextIdentifier());
- } elseif ($peek->isDelimiter(array('['))) {
+ } elseif ($peek->isDelimiter(['['])) {
$stream->getNext();
$result = $this->parseAttributeNode($result, $stream);
- } elseif ($peek->isDelimiter(array(':'))) {
+ } elseif ($peek->isDelimiter([':'])) {
$stream->getNext();
- if ($stream->getPeek()->isDelimiter(array(':'))) {
+ if ($stream->getPeek()->isDelimiter([':'])) {
$stream->getNext();
$pseudoElement = $stream->getNextIdentifier();
@@ -187,7 +187,7 @@ class Parser implements ParserInterface
}
$identifier = $stream->getNextIdentifier();
- if (\in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) {
+ if (\in_array(strtolower($identifier), ['first-line', 'first-letter', 'before', 'after'])) {
// Special case: CSS 2.1 pseudo-elements can have a single ':'.
// Any new pseudo-element must have two.
$pseudoElement = $identifier;
@@ -195,7 +195,7 @@ class Parser implements ParserInterface
continue;
}
- if (!$stream->getPeek()->isDelimiter(array('('))) {
+ if (!$stream->getPeek()->isDelimiter(['('])) {
$result = new Node\PseudoNode($result, $identifier);
continue;
@@ -216,13 +216,13 @@ class Parser implements ParserInterface
throw SyntaxErrorException::pseudoElementFound($argumentPseudoElement, 'inside ::not()');
}
- if (!$next->isDelimiter(array(')'))) {
+ if (!$next->isDelimiter([')'])) {
throw SyntaxErrorException::unexpectedToken('")"', $next);
}
$result = new Node\NegationNode($result, $argument);
} else {
- $arguments = array();
+ $arguments = [];
$next = null;
while (true) {
@@ -232,10 +232,10 @@ class Parser implements ParserInterface
if ($next->isIdentifier()
|| $next->isString()
|| $next->isNumber()
- || $next->isDelimiter(array('+', '-'))
+ || $next->isDelimiter(['+', '-'])
) {
$arguments[] = $next;
- } elseif ($next->isDelimiter(array(')'))) {
+ } elseif ($next->isDelimiter([')'])) {
break;
} else {
throw SyntaxErrorException::unexpectedToken('an argument', $next);
@@ -257,14 +257,14 @@ class Parser implements ParserInterface
throw SyntaxErrorException::unexpectedToken('selector', $stream->getPeek());
}
- return array($result, $pseudoElement);
+ return [$result, $pseudoElement];
}
private function parseElementNode(TokenStream $stream): Node\ElementNode
{
$peek = $stream->getPeek();
- if ($peek->isIdentifier() || $peek->isDelimiter(array('*'))) {
+ if ($peek->isIdentifier() || $peek->isDelimiter(['*'])) {
if ($peek->isIdentifier()) {
$namespace = $stream->getNext()->getValue();
} else {
@@ -272,7 +272,7 @@ class Parser implements ParserInterface
$namespace = null;
}
- if ($stream->getPeek()->isDelimiter(array('|'))) {
+ if ($stream->getPeek()->isDelimiter(['|'])) {
$stream->getNext();
$element = $stream->getNextIdentifierOrStar();
} else {
@@ -291,14 +291,14 @@ class Parser implements ParserInterface
$stream->skipWhitespace();
$attribute = $stream->getNextIdentifierOrStar();
- if (null === $attribute && !$stream->getPeek()->isDelimiter(array('|'))) {
+ if (null === $attribute && !$stream->getPeek()->isDelimiter(['|'])) {
throw SyntaxErrorException::unexpectedToken('"|"', $stream->getPeek());
}
- if ($stream->getPeek()->isDelimiter(array('|'))) {
+ if ($stream->getPeek()->isDelimiter(['|'])) {
$stream->getNext();
- if ($stream->getPeek()->isDelimiter(array('='))) {
+ if ($stream->getPeek()->isDelimiter(['='])) {
$namespace = null;
$stream->getNext();
$operator = '|=';
@@ -315,12 +315,12 @@ class Parser implements ParserInterface
$stream->skipWhitespace();
$next = $stream->getNext();
- if ($next->isDelimiter(array(']'))) {
+ if ($next->isDelimiter([']'])) {
return new Node\AttributeNode($selector, $namespace, $attribute, 'exists', null);
- } elseif ($next->isDelimiter(array('='))) {
+ } elseif ($next->isDelimiter(['='])) {
$operator = '=';
- } elseif ($next->isDelimiter(array('^', '$', '*', '~', '|', '!'))
- && $stream->getPeek()->isDelimiter(array('='))
+ } elseif ($next->isDelimiter(['^', '$', '*', '~', '|', '!'])
+ && $stream->getPeek()->isDelimiter(['='])
) {
$operator = $next->getValue().'=';
$stream->getNext();
@@ -344,7 +344,7 @@ class Parser implements ParserInterface
$stream->skipWhitespace();
$next = $stream->getNext();
- if (!$next->isDelimiter(array(']'))) {
+ if (!$next->isDelimiter([']'])) {
throw SyntaxErrorException::unexpectedToken('"]"', $next);
}
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php b/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
index ce7b20ef..17fa8c27 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
@@ -41,11 +41,11 @@ class ClassParser implements ParserInterface
// 2 => string 'input' (length=5)
// 3 => string 'ab6bd_field' (length=11)
if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+\.([\w-]++)$/i', trim($source), $matches)) {
- return array(
+ return [
new SelectorNode(new ClassNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])),
- );
+ ];
}
- return array();
+ return [];
}
}
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php b/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
index 3b93f006..8b9a8638 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
@@ -39,9 +39,9 @@ class ElementParser implements ParserInterface
// 1 => string 'testns' (length=6)
// 2 => string 'testel' (length=6)
if (preg_match('/^(?:([a-z]++)\|)?([\w-]++|\*)$/i', trim($source), $matches)) {
- return array(new SelectorNode(new ElementNode($matches[1] ?: null, $matches[2])));
+ return [new SelectorNode(new ElementNode($matches[1] ?: null, $matches[2]))];
}
- return array();
+ return [];
}
}
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php b/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
index e8a89cc4..222df5cd 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
@@ -38,9 +38,9 @@ class EmptyStringParser implements ParserInterface
{
// Matches an empty string
if ('' == $source) {
- return array(new SelectorNode(new ElementNode(null, '*')));
+ return [new SelectorNode(new ElementNode(null, '*'))];
}
- return array();
+ return [];
}
}
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php b/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
index e94ce0a4..fb07ee6c 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
@@ -41,11 +41,11 @@ class HashParser implements ParserInterface
// 2 => string 'input' (length=5)
// 3 => string 'ab6bd_field' (length=11)
if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+#([\w-]++)$/i', trim($source), $matches)) {
- return array(
+ return [
new SelectorNode(new HashNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])),
- );
+ ];
}
- return array();
+ return [];
}
}
diff --git a/vendor/symfony/css-selector/Parser/Token.php b/vendor/symfony/css-selector/Parser/Token.php
index 91a98f71..9a324854 100644
--- a/vendor/symfony/css-selector/Parser/Token.php
+++ b/vendor/symfony/css-selector/Parser/Token.php
@@ -62,7 +62,7 @@ class Token
return self::TYPE_FILE_END === $this->type;
}
- public function isDelimiter(array $values = array()): bool
+ public function isDelimiter(array $values = []): bool
{
if (self::TYPE_DELIMITER !== $this->type) {
return false;
diff --git a/vendor/symfony/css-selector/Parser/TokenStream.php b/vendor/symfony/css-selector/Parser/TokenStream.php
index d2aee541..843e330b 100644
--- a/vendor/symfony/css-selector/Parser/TokenStream.php
+++ b/vendor/symfony/css-selector/Parser/TokenStream.php
@@ -29,12 +29,12 @@ class TokenStream
/**
* @var Token[]
*/
- private $tokens = array();
+ private $tokens = [];
/**
* @var Token[]
*/
- private $used = array();
+ private $used = [];
/**
* @var int
@@ -154,7 +154,7 @@ class TokenStream
return $next->getValue();
}
- if ($next->isDelimiter(array('*'))) {
+ if ($next->isDelimiter(['*'])) {
return;
}
diff --git a/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php b/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php
index e32b4d20..fc65bc68 100644
--- a/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php
+++ b/vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php
@@ -38,14 +38,14 @@ class Tokenizer
$patterns = new TokenizerPatterns();
$escaping = new TokenizerEscaping($patterns);
- $this->handlers = array(
+ $this->handlers = [
new Handler\WhitespaceHandler(),
new Handler\IdentifierHandler($patterns, $escaping),
new Handler\HashHandler($patterns, $escaping),
new Handler\StringHandler($patterns, $escaping),
new Handler\NumberHandler($patterns),
new Handler\CommentHandler(),
- );
+ ];
}
/**
diff --git a/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php b/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
index a3eea7ad..cd0fd785 100644
--- a/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
+++ b/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
@@ -55,22 +55,22 @@ class CssSelectorConverterTest extends TestCase
public function getCssToXPathWithoutPrefixTestData()
{
- return array(
- array('h1', 'h1'),
- array('foo|h1', 'foo:h1'),
- array('h1, h2, h3', 'h1 | h2 | h3'),
- array('h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
- array('h1 > p', 'h1/p'),
- array('h1#foo', "h1[@id = 'foo']"),
- array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
- array('h1[class*="foo bar"]', "h1[@class and contains(@class, 'foo bar')]"),
- array('h1[foo|class*="foo bar"]', "h1[@foo:class and contains(@foo:class, 'foo bar')]"),
- array('h1[class]', 'h1[@class]'),
- array('h1 .foo', "h1/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
- array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"),
- array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"),
- array('div>.foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
- array('div > .foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
- );
+ return [
+ ['h1', 'h1'],
+ ['foo|h1', 'foo:h1'],
+ ['h1, h2, h3', 'h1 | h2 | h3'],
+ ['h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"],
+ ['h1 > p', 'h1/p'],
+ ['h1#foo', "h1[@id = 'foo']"],
+ ['h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"],
+ ['h1[class*="foo bar"]', "h1[@class and contains(@class, 'foo bar')]"],
+ ['h1[foo|class*="foo bar"]', "h1[@foo:class and contains(@foo:class, 'foo bar')]"],
+ ['h1[class]', 'h1[@class]'],
+ ['h1 .foo', "h1/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"],
+ ['h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"],
+ ['h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"],
+ ['div>.foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"],
+ ['div > .foo', "div/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php b/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php
index 1fd090f5..4d600740 100644
--- a/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/AttributeNodeTest.php
@@ -18,20 +18,20 @@ class AttributeNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'),
- array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), "Attribute[Element[*][attribute $= 'value']]"),
- array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), "Attribute[Element[*][namespace|attribute $= 'value']]"),
- );
+ return [
+ [new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 'Attribute[Element[*][attribute]]'],
+ [new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), "Attribute[Element[*][attribute $= 'value']]"],
+ [new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), "Attribute[Element[*][namespace|attribute $= 'value']]"],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 10),
- array(new AttributeNode(new ElementNode(null, 'element'), null, 'attribute', 'exists', null), 11),
- array(new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), 10),
- array(new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), 10),
- );
+ return [
+ [new AttributeNode(new ElementNode(), null, 'attribute', 'exists', null), 10],
+ [new AttributeNode(new ElementNode(null, 'element'), null, 'attribute', 'exists', null), 11],
+ [new AttributeNode(new ElementNode(), null, 'attribute', '$=', 'value'), 10],
+ [new AttributeNode(new ElementNode(), 'namespace', 'attribute', '$=', 'value'), 10],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php b/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php
index e0ab45ac..aa80c927 100644
--- a/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/ClassNodeTest.php
@@ -18,16 +18,16 @@ class ClassNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new ClassNode(new ElementNode(), 'class'), 'Class[Element[*].class]'),
- );
+ return [
+ [new ClassNode(new ElementNode(), 'class'), 'Class[Element[*].class]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new ClassNode(new ElementNode(), 'class'), 10),
- array(new ClassNode(new ElementNode(null, 'element'), 'class'), 11),
- );
+ return [
+ [new ClassNode(new ElementNode(), 'class'), 10],
+ [new ClassNode(new ElementNode(null, 'element'), 'class'), 11],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php b/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php
index 9547298a..435eaa6a 100644
--- a/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/CombinedSelectorNodeTest.php
@@ -18,18 +18,18 @@ class CombinedSelectorNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 'CombinedSelector[Element[*] > Element[*]]'),
- array(new CombinedSelectorNode(new ElementNode(), ' ', new ElementNode()), 'CombinedSelector[Element[*] Element[*]]'),
- );
+ return [
+ [new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 'CombinedSelector[Element[*] > Element[*]]'],
+ [new CombinedSelectorNode(new ElementNode(), ' ', new ElementNode()), 'CombinedSelector[Element[*] Element[*]]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 0),
- array(new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode()), 1),
- array(new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode(null, 'element')), 2),
- );
+ return [
+ [new CombinedSelectorNode(new ElementNode(), '>', new ElementNode()), 0],
+ [new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode()), 1],
+ [new CombinedSelectorNode(new ElementNode(null, 'element'), '>', new ElementNode(null, 'element')), 2],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php b/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php
index 6d247893..e0797ff0 100644
--- a/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/ElementNodeTest.php
@@ -17,19 +17,19 @@ class ElementNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new ElementNode(), 'Element[*]'),
- array(new ElementNode(null, 'element'), 'Element[element]'),
- array(new ElementNode('namespace', 'element'), 'Element[namespace|element]'),
- );
+ return [
+ [new ElementNode(), 'Element[*]'],
+ [new ElementNode(null, 'element'), 'Element[element]'],
+ [new ElementNode('namespace', 'element'), 'Element[namespace|element]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new ElementNode(), 0),
- array(new ElementNode(null, 'element'), 1),
- array(new ElementNode('namespace', 'element'), 1),
- );
+ return [
+ [new ElementNode(), 0],
+ [new ElementNode(null, 'element'), 1],
+ [new ElementNode('namespace', 'element'), 1],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php b/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php
index ee3ce51b..0932393e 100644
--- a/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/FunctionNodeTest.php
@@ -19,29 +19,29 @@ class FunctionNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'),
- array(new FunctionNode(new ElementNode(), 'function', array(
+ return [
+ [new FunctionNode(new ElementNode(), 'function'), 'Function[Element[*]:function()]'],
+ [new FunctionNode(new ElementNode(), 'function', [
new Token(Token::TYPE_IDENTIFIER, 'value', 0),
- )), "Function[Element[*]:function(['value'])]"),
- array(new FunctionNode(new ElementNode(), 'function', array(
+ ]), "Function[Element[*]:function(['value'])]"],
+ [new FunctionNode(new ElementNode(), 'function', [
new Token(Token::TYPE_STRING, 'value1', 0),
new Token(Token::TYPE_NUMBER, 'value2', 0),
- )), "Function[Element[*]:function(['value1', 'value2'])]"),
- );
+ ]), "Function[Element[*]:function(['value1', 'value2'])]"],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new FunctionNode(new ElementNode(), 'function'), 10),
- array(new FunctionNode(new ElementNode(), 'function', array(
+ return [
+ [new FunctionNode(new ElementNode(), 'function'), 10],
+ [new FunctionNode(new ElementNode(), 'function', [
new Token(Token::TYPE_IDENTIFIER, 'value', 0),
- )), 10),
- array(new FunctionNode(new ElementNode(), 'function', array(
+ ]), 10],
+ [new FunctionNode(new ElementNode(), 'function', [
new Token(Token::TYPE_STRING, 'value1', 0),
new Token(Token::TYPE_NUMBER, 'value2', 0),
- )), 10),
- );
+ ]), 10],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php b/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php
index 3bc74da9..ad6765b8 100644
--- a/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php
@@ -18,16 +18,16 @@ class HashNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new HashNode(new ElementNode(), 'id'), 'Hash[Element[*]#id]'),
- );
+ return [
+ [new HashNode(new ElementNode(), 'id'), 'Hash[Element[*]#id]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new HashNode(new ElementNode(), 'id'), 100),
- array(new HashNode(new ElementNode(null, 'id'), 'class'), 101),
- );
+ return [
+ [new HashNode(new ElementNode(), 'id'), 100],
+ [new HashNode(new ElementNode(null, 'id'), 'class'), 101],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php b/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php
index ed4d2482..90b684ce 100644
--- a/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php
@@ -19,15 +19,15 @@ class NegationNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 'Negation[Element[*]:not(Class[Element[*].class])]'),
- );
+ return [
+ [new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 'Negation[Element[*]:not(Class[Element[*].class])]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 10),
- );
+ return [
+ [new NegationNode(new ElementNode(), new ClassNode(new ElementNode(), 'class')), 10],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php b/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php
index bc57813c..4e78776c 100644
--- a/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/PseudoNodeTest.php
@@ -18,15 +18,15 @@ class PseudoNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'),
- );
+ return [
+ [new PseudoNode(new ElementNode(), 'pseudo'), 'Pseudo[Element[*]:pseudo]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new PseudoNode(new ElementNode(), 'pseudo'), 10),
- );
+ return [
+ [new PseudoNode(new ElementNode(), 'pseudo'), 10],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php b/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php
index 5badf71d..85e3bdac 100644
--- a/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/SelectorNodeTest.php
@@ -18,17 +18,17 @@ class SelectorNodeTest extends AbstractNodeTest
{
public function getToStringConversionTestData()
{
- return array(
- array(new SelectorNode(new ElementNode()), 'Selector[Element[*]]'),
- array(new SelectorNode(new ElementNode(), 'pseudo'), 'Selector[Element[*]::pseudo]'),
- );
+ return [
+ [new SelectorNode(new ElementNode()), 'Selector[Element[*]]'],
+ [new SelectorNode(new ElementNode(), 'pseudo'), 'Selector[Element[*]::pseudo]'],
+ ];
}
public function getSpecificityValueTestData()
{
- return array(
- array(new SelectorNode(new ElementNode()), 0),
- array(new SelectorNode(new ElementNode(), 'pseudo'), 1),
- );
+ return [
+ [new SelectorNode(new ElementNode()), 0],
+ [new SelectorNode(new ElementNode(), 'pseudo'), 1],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php b/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php
index b58eb892..bf48d49f 100644
--- a/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php
+++ b/vendor/symfony/css-selector/Tests/Node/SpecificityTest.php
@@ -30,13 +30,13 @@ class SpecificityTest extends TestCase
public function getValueTestData()
{
- return array(
- array(new Specificity(0, 0, 0), 0),
- array(new Specificity(0, 0, 2), 2),
- array(new Specificity(0, 3, 0), 30),
- array(new Specificity(4, 0, 0), 400),
- array(new Specificity(4, 3, 2), 432),
- );
+ return [
+ [new Specificity(0, 0, 0), 0],
+ [new Specificity(0, 0, 2), 2],
+ [new Specificity(0, 3, 0), 30],
+ [new Specificity(4, 0, 0), 400],
+ [new Specificity(4, 3, 2), 432],
+ ];
}
/** @dataProvider getCompareTestData */
@@ -47,17 +47,17 @@ class SpecificityTest extends TestCase
public function getCompareTestData()
{
- return array(
- array(new Specificity(0, 0, 0), new Specificity(0, 0, 0), 0),
- array(new Specificity(0, 0, 1), new Specificity(0, 0, 1), 0),
- array(new Specificity(0, 0, 2), new Specificity(0, 0, 1), 1),
- array(new Specificity(0, 0, 2), new Specificity(0, 0, 3), -1),
- array(new Specificity(0, 4, 0), new Specificity(0, 4, 0), 0),
- array(new Specificity(0, 6, 0), new Specificity(0, 5, 11), 1),
- array(new Specificity(0, 7, 0), new Specificity(0, 8, 0), -1),
- array(new Specificity(9, 0, 0), new Specificity(9, 0, 0), 0),
- array(new Specificity(11, 0, 0), new Specificity(10, 11, 0), 1),
- array(new Specificity(12, 11, 0), new Specificity(13, 0, 0), -1),
- );
+ return [
+ [new Specificity(0, 0, 0), new Specificity(0, 0, 0), 0],
+ [new Specificity(0, 0, 1), new Specificity(0, 0, 1), 0],
+ [new Specificity(0, 0, 2), new Specificity(0, 0, 1), 1],
+ [new Specificity(0, 0, 2), new Specificity(0, 0, 3), -1],
+ [new Specificity(0, 4, 0), new Specificity(0, 4, 0), 0],
+ [new Specificity(0, 6, 0), new Specificity(0, 5, 11), 1],
+ [new Specificity(0, 7, 0), new Specificity(0, 8, 0), -1],
+ [new Specificity(9, 0, 0), new Specificity(9, 0, 0), 0],
+ [new Specificity(11, 0, 0), new Specificity(10, 11, 0), 1],
+ [new Specificity(12, 11, 0), new Specificity(13, 0, 0), -1],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php
index f5c9dc8b..aaed55c2 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php
@@ -54,7 +54,7 @@ abstract class AbstractHandlerTest extends TestCase
$property = new \ReflectionProperty($stream, 'tokens');
$property->setAccessible(true);
- $this->assertEquals(array(), $property->getValue($stream));
+ $this->assertEquals([], $property->getValue($stream));
}
protected function assertRemainingContent(Reader $reader, $remainingContent)
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php
index 3961bf7d..de400478 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/CommentHandlerTest.php
@@ -32,20 +32,20 @@ class CommentHandlerTest extends AbstractHandlerTest
public function getHandleValueTestData()
{
- return array(
+ return [
// 2nd argument only exists for inherited method compatibility
- array('/* comment */', new Token(null, null, null), ''),
- array('/* comment */foo', new Token(null, null, null), 'foo'),
- );
+ ['/* comment */', new Token(null, null, null), ''],
+ ['/* comment */foo', new Token(null, null, null), 'foo'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('>'),
- array('+'),
- array(' '),
- );
+ return [
+ ['>'],
+ ['+'],
+ [' '],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php
index 5730120b..9444f510 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php
@@ -20,24 +20,24 @@ class HashHandlerTest extends AbstractHandlerTest
{
public function getHandleValueTestData()
{
- return array(
- array('#id', new Token(Token::TYPE_HASH, 'id', 0), ''),
- array('#123', new Token(Token::TYPE_HASH, '123', 0), ''),
+ return [
+ ['#id', new Token(Token::TYPE_HASH, 'id', 0), ''],
+ ['#123', new Token(Token::TYPE_HASH, '123', 0), ''],
- array('#id.class', new Token(Token::TYPE_HASH, 'id', 0), '.class'),
- array('#id element', new Token(Token::TYPE_HASH, 'id', 0), ' element'),
- );
+ ['#id.class', new Token(Token::TYPE_HASH, 'id', 0), '.class'],
+ ['#id element', new Token(Token::TYPE_HASH, 'id', 0), ' element'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('id'),
- array('123'),
- array('<'),
- array('<'),
- array('#'),
- );
+ return [
+ ['id'],
+ ['123'],
+ ['<'],
+ ['<'],
+ ['#'],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php
index f56430c7..c54ba537 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php
@@ -20,24 +20,24 @@ class IdentifierHandlerTest extends AbstractHandlerTest
{
public function getHandleValueTestData()
{
- return array(
- array('foo', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ''),
- array('foo|bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '|bar'),
- array('foo.class', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '.class'),
- array('foo[attr]', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '[attr]'),
- array('foo bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ' bar'),
- );
+ return [
+ ['foo', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ''],
+ ['foo|bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '|bar'],
+ ['foo.class', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '.class'],
+ ['foo[attr]', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), '[attr]'],
+ ['foo bar', new Token(Token::TYPE_IDENTIFIER, 'foo', 0), ' bar'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('>'),
- array('+'),
- array(' '),
- array('*|foo'),
- array('/* comment */'),
- );
+ return [
+ ['>'],
+ ['+'],
+ [' '],
+ ['*|foo'],
+ ['/* comment */'],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php
index 675fd05b..b43d3694 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/NumberHandlerTest.php
@@ -19,26 +19,26 @@ class NumberHandlerTest extends AbstractHandlerTest
{
public function getHandleValueTestData()
{
- return array(
- array('12', new Token(Token::TYPE_NUMBER, '12', 0), ''),
- array('12.34', new Token(Token::TYPE_NUMBER, '12.34', 0), ''),
- array('+12.34', new Token(Token::TYPE_NUMBER, '+12.34', 0), ''),
- array('-12.34', new Token(Token::TYPE_NUMBER, '-12.34', 0), ''),
+ return [
+ ['12', new Token(Token::TYPE_NUMBER, '12', 0), ''],
+ ['12.34', new Token(Token::TYPE_NUMBER, '12.34', 0), ''],
+ ['+12.34', new Token(Token::TYPE_NUMBER, '+12.34', 0), ''],
+ ['-12.34', new Token(Token::TYPE_NUMBER, '-12.34', 0), ''],
- array('12 arg', new Token(Token::TYPE_NUMBER, '12', 0), ' arg'),
- array('12]', new Token(Token::TYPE_NUMBER, '12', 0), ']'),
- );
+ ['12 arg', new Token(Token::TYPE_NUMBER, '12', 0), ' arg'],
+ ['12]', new Token(Token::TYPE_NUMBER, '12', 0), ']'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('hello'),
- array('>'),
- array('+'),
- array(' '),
- array('/* comment */'),
- );
+ return [
+ ['hello'],
+ ['>'],
+ ['+'],
+ [' '],
+ ['/* comment */'],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php
index 8ea5d4d5..baa72735 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php
@@ -20,25 +20,25 @@ class StringHandlerTest extends AbstractHandlerTest
{
public function getHandleValueTestData()
{
- return array(
- array('"hello"', new Token(Token::TYPE_STRING, 'hello', 1), ''),
- array('"1"', new Token(Token::TYPE_STRING, '1', 1), ''),
- array('" "', new Token(Token::TYPE_STRING, ' ', 1), ''),
- array('""', new Token(Token::TYPE_STRING, '', 1), ''),
- array("'hello'", new Token(Token::TYPE_STRING, 'hello', 1), ''),
+ return [
+ ['"hello"', new Token(Token::TYPE_STRING, 'hello', 1), ''],
+ ['"1"', new Token(Token::TYPE_STRING, '1', 1), ''],
+ ['" "', new Token(Token::TYPE_STRING, ' ', 1), ''],
+ ['""', new Token(Token::TYPE_STRING, '', 1), ''],
+ ["'hello'", new Token(Token::TYPE_STRING, 'hello', 1), ''],
- array("'foo'bar", new Token(Token::TYPE_STRING, 'foo', 1), 'bar'),
- );
+ ["'foo'bar", new Token(Token::TYPE_STRING, 'foo', 1), 'bar'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('hello'),
- array('>'),
- array('1'),
- array(' '),
- );
+ return [
+ ['hello'],
+ ['>'],
+ ['1'],
+ [' '],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php
index f5f9e71d..67509ef1 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Handler/WhitespaceHandlerTest.php
@@ -18,23 +18,23 @@ class WhitespaceHandlerTest extends AbstractHandlerTest
{
public function getHandleValueTestData()
{
- return array(
- array(' ', new Token(Token::TYPE_WHITESPACE, ' ', 0), ''),
- array("\n", new Token(Token::TYPE_WHITESPACE, "\n", 0), ''),
- array("\t", new Token(Token::TYPE_WHITESPACE, "\t", 0), ''),
+ return [
+ [' ', new Token(Token::TYPE_WHITESPACE, ' ', 0), ''],
+ ["\n", new Token(Token::TYPE_WHITESPACE, "\n", 0), ''],
+ ["\t", new Token(Token::TYPE_WHITESPACE, "\t", 0), ''],
- array(' foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), 'foo'),
- array(' .foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), '.foo'),
- );
+ [' foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), 'foo'],
+ [' .foo', new Token(Token::TYPE_WHITESPACE, ' ', 0), '.foo'],
+ ];
}
public function getDontHandleValueTestData()
{
- return array(
- array('>'),
- array('1'),
- array('a'),
- );
+ return [
+ ['>'],
+ ['1'],
+ ['a'],
+ ];
}
protected function generateHandler()
diff --git a/vendor/symfony/css-selector/Tests/Parser/ParserTest.php b/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
index 024be810..f63a15e0 100644
--- a/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
@@ -77,7 +77,7 @@ class ParserTest extends TestCase
/** @var FunctionNode $function */
$function = $selectors[0]->getTree();
- $this->assertEquals(array($a, $b), Parser::parseSeries($function->getArguments()));
+ $this->assertEquals([$a, $b], Parser::parseSeries($function->getArguments()));
}
/** @dataProvider getParseSeriesExceptionTestData */
@@ -89,165 +89,165 @@ class ParserTest extends TestCase
/** @var FunctionNode $function */
$function = $selectors[0]->getTree();
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
Parser::parseSeries($function->getArguments());
}
public function getParserTestData()
{
- return array(
- array('*', array('Element[*]')),
- array('*|*', array('Element[*]')),
- array('*|foo', array('Element[foo]')),
- array('foo|*', array('Element[foo|*]')),
- array('foo|bar', array('Element[foo|bar]')),
- array('#foo#bar', array('Hash[Hash[Element[*]#foo]#bar]')),
- array('div>.foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')),
- array('div> .foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')),
- array('div >.foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')),
- array('div > .foo', array('CombinedSelector[Element[div] > Class[Element[*].foo]]')),
- array("div \n> \t \t .foo", array('CombinedSelector[Element[div] > Class[Element[*].foo]]')),
- array('td.foo,.bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array('td.foo, .bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array("td.foo\t\r\n\f ,\t\r\n\f .bar", array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array('td.foo,.bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array('td.foo, .bar', array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array("td.foo\t\r\n\f ,\t\r\n\f .bar", array('Class[Element[td].foo]', 'Class[Element[*].bar]')),
- array('div, td.foo, div.bar span', array('Element[div]', 'Class[Element[td].foo]', 'CombinedSelector[Class[Element[div].bar] Element[span]]')),
- array('div > p', array('CombinedSelector[Element[div] > Element[p]]')),
- array('td:first', array('Pseudo[Element[td]:first]')),
- array('td :first', array('CombinedSelector[Element[td] Pseudo[Element[*]:first]]')),
- array('a[name]', array('Attribute[Element[a][name]]')),
- array("a[ name\t]", array('Attribute[Element[a][name]]')),
- array('a [name]', array('CombinedSelector[Element[a] Attribute[Element[*][name]]]')),
- array('[name="foo"]', array("Attribute[Element[*][name = 'foo']]")),
- array("[name='foo[1]']", array("Attribute[Element[*][name = 'foo[1]']]")),
- array("[name='foo[0][bar]']", array("Attribute[Element[*][name = 'foo[0][bar]']]")),
- array('a[rel="include"]', array("Attribute[Element[a][rel = 'include']]")),
- array('a[rel = include]', array("Attribute[Element[a][rel = 'include']]")),
- array("a[hreflang |= 'en']", array("Attribute[Element[a][hreflang |= 'en']]")),
- array('a[hreflang|=en]', array("Attribute[Element[a][hreflang |= 'en']]")),
- array('div:nth-child(10)', array("Function[Element[div]:nth-child(['10'])]")),
- array(':nth-child(2n+2)', array("Function[Element[*]:nth-child(['2', 'n', '+2'])]")),
- array('div:nth-of-type(10)', array("Function[Element[div]:nth-of-type(['10'])]")),
- array('div div:nth-of-type(10) .aclass', array("CombinedSelector[CombinedSelector[Element[div] Function[Element[div]:nth-of-type(['10'])]] Class[Element[*].aclass]]")),
- array('label:only', array('Pseudo[Element[label]:only]')),
- array('a:lang(fr)', array("Function[Element[a]:lang(['fr'])]")),
- array('div:contains("foo")', array("Function[Element[div]:contains(['foo'])]")),
- array('div#foobar', array('Hash[Element[div]#foobar]')),
- array('div:not(div.foo)', array('Negation[Element[div]:not(Class[Element[div].foo])]')),
- array('td ~ th', array('CombinedSelector[Element[td] ~ Element[th]]')),
- array('.foo[data-bar][data-baz=0]', array("Attribute[Attribute[Class[Element[*].foo][data-bar]][data-baz = '0']]")),
- );
+ return [
+ ['*', ['Element[*]']],
+ ['*|*', ['Element[*]']],
+ ['*|foo', ['Element[foo]']],
+ ['foo|*', ['Element[foo|*]']],
+ ['foo|bar', ['Element[foo|bar]']],
+ ['#foo#bar', ['Hash[Hash[Element[*]#foo]#bar]']],
+ ['div>.foo', ['CombinedSelector[Element[div] > Class[Element[*].foo]]']],
+ ['div> .foo', ['CombinedSelector[Element[div] > Class[Element[*].foo]]']],
+ ['div >.foo', ['CombinedSelector[Element[div] > Class[Element[*].foo]]']],
+ ['div > .foo', ['CombinedSelector[Element[div] > Class[Element[*].foo]]']],
+ ["div \n> \t \t .foo", ['CombinedSelector[Element[div] > Class[Element[*].foo]]']],
+ ['td.foo,.bar', ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ['td.foo, .bar', ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ["td.foo\t\r\n\f ,\t\r\n\f .bar", ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ['td.foo,.bar', ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ['td.foo, .bar', ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ["td.foo\t\r\n\f ,\t\r\n\f .bar", ['Class[Element[td].foo]', 'Class[Element[*].bar]']],
+ ['div, td.foo, div.bar span', ['Element[div]', 'Class[Element[td].foo]', 'CombinedSelector[Class[Element[div].bar] Element[span]]']],
+ ['div > p', ['CombinedSelector[Element[div] > Element[p]]']],
+ ['td:first', ['Pseudo[Element[td]:first]']],
+ ['td :first', ['CombinedSelector[Element[td] Pseudo[Element[*]:first]]']],
+ ['a[name]', ['Attribute[Element[a][name]]']],
+ ["a[ name\t]", ['Attribute[Element[a][name]]']],
+ ['a [name]', ['CombinedSelector[Element[a] Attribute[Element[*][name]]]']],
+ ['[name="foo"]', ["Attribute[Element[*][name = 'foo']]"]],
+ ["[name='foo[1]']", ["Attribute[Element[*][name = 'foo[1]']]"]],
+ ["[name='foo[0][bar]']", ["Attribute[Element[*][name = 'foo[0][bar]']]"]],
+ ['a[rel="include"]', ["Attribute[Element[a][rel = 'include']]"]],
+ ['a[rel = include]', ["Attribute[Element[a][rel = 'include']]"]],
+ ["a[hreflang |= 'en']", ["Attribute[Element[a][hreflang |= 'en']]"]],
+ ['a[hreflang|=en]', ["Attribute[Element[a][hreflang |= 'en']]"]],
+ ['div:nth-child(10)', ["Function[Element[div]:nth-child(['10'])]"]],
+ [':nth-child(2n+2)', ["Function[Element[*]:nth-child(['2', 'n', '+2'])]"]],
+ ['div:nth-of-type(10)', ["Function[Element[div]:nth-of-type(['10'])]"]],
+ ['div div:nth-of-type(10) .aclass', ["CombinedSelector[CombinedSelector[Element[div] Function[Element[div]:nth-of-type(['10'])]] Class[Element[*].aclass]]"]],
+ ['label:only', ['Pseudo[Element[label]:only]']],
+ ['a:lang(fr)', ["Function[Element[a]:lang(['fr'])]"]],
+ ['div:contains("foo")', ["Function[Element[div]:contains(['foo'])]"]],
+ ['div#foobar', ['Hash[Element[div]#foobar]']],
+ ['div:not(div.foo)', ['Negation[Element[div]:not(Class[Element[div].foo])]']],
+ ['td ~ th', ['CombinedSelector[Element[td] ~ Element[th]]']],
+ ['.foo[data-bar][data-baz=0]', ["Attribute[Attribute[Class[Element[*].foo][data-bar]][data-baz = '0']]"]],
+ ];
}
public function getParserExceptionTestData()
{
- return array(
- array('attributes(href)/html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()),
- array('attributes(href)', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()),
- array('html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '/', 4))->getMessage()),
- array(' ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 1))->getMessage()),
- array('div, ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 5))->getMessage()),
- array(' , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 1))->getMessage()),
- array('p, , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 3))->getMessage()),
- array('div > ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 6))->getMessage()),
- array(' > div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '>', 2))->getMessage()),
- array('foo|#bar', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_HASH, 'bar', 4))->getMessage()),
- array('#.foo', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '#', 0))->getMessage()),
- array('.#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()),
- array(':#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()),
- array('[*]', SyntaxErrorException::unexpectedToken('"|"', new Token(Token::TYPE_DELIMITER, ']', 2))->getMessage()),
- array('[foo|]', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_DELIMITER, ']', 5))->getMessage()),
- array('[#]', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_DELIMITER, '#', 1))->getMessage()),
- array('[foo=#]', SyntaxErrorException::unexpectedToken('string or identifier', new Token(Token::TYPE_DELIMITER, '#', 5))->getMessage()),
- array(':nth-child()', SyntaxErrorException::unexpectedToken('at least one argument', new Token(Token::TYPE_DELIMITER, ')', 11))->getMessage()),
- array('[href]a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_IDENTIFIER, 'a', 6))->getMessage()),
- array('[rel:stylesheet]', SyntaxErrorException::unexpectedToken('operator', new Token(Token::TYPE_DELIMITER, ':', 4))->getMessage()),
- array('[rel=stylesheet', SyntaxErrorException::unexpectedToken('"]"', new Token(Token::TYPE_FILE_END, '', 15))->getMessage()),
- array(':lang(fr', SyntaxErrorException::unexpectedToken('an argument', new Token(Token::TYPE_FILE_END, '', 8))->getMessage()),
- array(':contains("foo', SyntaxErrorException::unclosedString(10)->getMessage()),
- array('foo!', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '!', 3))->getMessage()),
- );
+ return [
+ ['attributes(href)/html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()],
+ ['attributes(href)', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '(', 10))->getMessage()],
+ ['html/body/a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '/', 4))->getMessage()],
+ [' ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 1))->getMessage()],
+ ['div, ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 5))->getMessage()],
+ [' , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 1))->getMessage()],
+ ['p, , div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, ',', 3))->getMessage()],
+ ['div > ', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_FILE_END, '', 6))->getMessage()],
+ [' > div', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '>', 2))->getMessage()],
+ ['foo|#bar', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_HASH, 'bar', 4))->getMessage()],
+ ['#.foo', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '#', 0))->getMessage()],
+ ['.#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()],
+ [':#foo', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_HASH, 'foo', 1))->getMessage()],
+ ['[*]', SyntaxErrorException::unexpectedToken('"|"', new Token(Token::TYPE_DELIMITER, ']', 2))->getMessage()],
+ ['[foo|]', SyntaxErrorException::unexpectedToken('identifier', new Token(Token::TYPE_DELIMITER, ']', 5))->getMessage()],
+ ['[#]', SyntaxErrorException::unexpectedToken('identifier or "*"', new Token(Token::TYPE_DELIMITER, '#', 1))->getMessage()],
+ ['[foo=#]', SyntaxErrorException::unexpectedToken('string or identifier', new Token(Token::TYPE_DELIMITER, '#', 5))->getMessage()],
+ [':nth-child()', SyntaxErrorException::unexpectedToken('at least one argument', new Token(Token::TYPE_DELIMITER, ')', 11))->getMessage()],
+ ['[href]a', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_IDENTIFIER, 'a', 6))->getMessage()],
+ ['[rel:stylesheet]', SyntaxErrorException::unexpectedToken('operator', new Token(Token::TYPE_DELIMITER, ':', 4))->getMessage()],
+ ['[rel=stylesheet', SyntaxErrorException::unexpectedToken('"]"', new Token(Token::TYPE_FILE_END, '', 15))->getMessage()],
+ [':lang(fr', SyntaxErrorException::unexpectedToken('an argument', new Token(Token::TYPE_FILE_END, '', 8))->getMessage()],
+ [':contains("foo', SyntaxErrorException::unclosedString(10)->getMessage()],
+ ['foo!', SyntaxErrorException::unexpectedToken('selector', new Token(Token::TYPE_DELIMITER, '!', 3))->getMessage()],
+ ];
}
public function getPseudoElementsTestData()
{
- return array(
- array('foo', 'Element[foo]', ''),
- array('*', 'Element[*]', ''),
- array(':empty', 'Pseudo[Element[*]:empty]', ''),
- array(':BEfore', 'Element[*]', 'before'),
- array(':aftER', 'Element[*]', 'after'),
- array(':First-Line', 'Element[*]', 'first-line'),
- array(':First-Letter', 'Element[*]', 'first-letter'),
- array('::befoRE', 'Element[*]', 'before'),
- array('::AFter', 'Element[*]', 'after'),
- array('::firsT-linE', 'Element[*]', 'first-line'),
- array('::firsT-letteR', 'Element[*]', 'first-letter'),
- array('::Selection', 'Element[*]', 'selection'),
- array('foo:after', 'Element[foo]', 'after'),
- array('foo::selection', 'Element[foo]', 'selection'),
- array('lorem#ipsum ~ a#b.c[href]:empty::selection', 'CombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attribute[Class[Hash[Element[a]#b].c][href]]:empty]]', 'selection'),
- array('video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'),
- );
+ return [
+ ['foo', 'Element[foo]', ''],
+ ['*', 'Element[*]', ''],
+ [':empty', 'Pseudo[Element[*]:empty]', ''],
+ [':BEfore', 'Element[*]', 'before'],
+ [':aftER', 'Element[*]', 'after'],
+ [':First-Line', 'Element[*]', 'first-line'],
+ [':First-Letter', 'Element[*]', 'first-letter'],
+ ['::befoRE', 'Element[*]', 'before'],
+ ['::AFter', 'Element[*]', 'after'],
+ ['::firsT-linE', 'Element[*]', 'first-line'],
+ ['::firsT-letteR', 'Element[*]', 'first-letter'],
+ ['::Selection', 'Element[*]', 'selection'],
+ ['foo:after', 'Element[foo]', 'after'],
+ ['foo::selection', 'Element[foo]', 'selection'],
+ ['lorem#ipsum ~ a#b.c[href]:empty::selection', 'CombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attribute[Class[Hash[Element[a]#b].c][href]]:empty]]', 'selection'],
+ ['video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'],
+ ];
}
public function getSpecificityTestData()
{
- return array(
- array('*', 0),
- array(' foo', 1),
- array(':empty ', 10),
- array(':before', 1),
- array('*:before', 1),
- array(':nth-child(2)', 10),
- array('.bar', 10),
- array('[baz]', 10),
- array('[baz="4"]', 10),
- array('[baz^="4"]', 10),
- array('#lipsum', 100),
- array(':not(*)', 0),
- array(':not(foo)', 1),
- array(':not(.foo)', 10),
- array(':not([foo])', 10),
- array(':not(:empty)', 10),
- array(':not(#foo)', 100),
- array('foo:empty', 11),
- array('foo:before', 2),
- array('foo::before', 2),
- array('foo:empty::before', 12),
- array('#lorem + foo#ipsum:first-child > bar:first-line', 213),
- );
+ return [
+ ['*', 0],
+ [' foo', 1],
+ [':empty ', 10],
+ [':before', 1],
+ ['*:before', 1],
+ [':nth-child(2)', 10],
+ ['.bar', 10],
+ ['[baz]', 10],
+ ['[baz="4"]', 10],
+ ['[baz^="4"]', 10],
+ ['#lipsum', 100],
+ [':not(*)', 0],
+ [':not(foo)', 1],
+ [':not(.foo)', 10],
+ [':not([foo])', 10],
+ [':not(:empty)', 10],
+ [':not(#foo)', 100],
+ ['foo:empty', 11],
+ ['foo:before', 2],
+ ['foo::before', 2],
+ ['foo:empty::before', 12],
+ ['#lorem + foo#ipsum:first-child > bar:first-line', 213],
+ ];
}
public function getParseSeriesTestData()
{
- return array(
- array('1n+3', 1, 3),
- array('1n +3', 1, 3),
- array('1n + 3', 1, 3),
- array('1n+ 3', 1, 3),
- array('1n-3', 1, -3),
- array('1n -3', 1, -3),
- array('1n - 3', 1, -3),
- array('1n- 3', 1, -3),
- array('n-5', 1, -5),
- array('odd', 2, 1),
- array('even', 2, 0),
- array('3n', 3, 0),
- array('n', 1, 0),
- array('+n', 1, 0),
- array('-n', -1, 0),
- array('5', 0, 5),
- );
+ return [
+ ['1n+3', 1, 3],
+ ['1n +3', 1, 3],
+ ['1n + 3', 1, 3],
+ ['1n+ 3', 1, 3],
+ ['1n-3', 1, -3],
+ ['1n -3', 1, -3],
+ ['1n - 3', 1, -3],
+ ['1n- 3', 1, -3],
+ ['n-5', 1, -5],
+ ['odd', 2, 1],
+ ['even', 2, 0],
+ ['3n', 3, 0],
+ ['n', 1, 0],
+ ['+n', 1, 0],
+ ['-n', -1, 0],
+ ['5', 0, 5],
+ ];
}
public function getParseSeriesExceptionTestData()
{
- return array(
- array('foo'),
- array('n+'),
- );
+ return [
+ ['foo'],
+ ['n+'],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php b/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php
index 21eb6084..ff9ea909 100644
--- a/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/ReaderTest.php
@@ -70,11 +70,11 @@ class ReaderTest extends TestCase
$reader = new Reader('hello');
$this->assertFalse($reader->findPattern('/world/'));
- $this->assertEquals(array('hello', 'h'), $reader->findPattern('/^([a-z]).*/'));
+ $this->assertEquals(['hello', 'h'], $reader->findPattern('/^([a-z]).*/'));
$this->assignPosition($reader, 2);
$this->assertFalse($reader->findPattern('/^h.*/'));
- $this->assertEquals(array('llo'), $reader->findPattern('/^llo$/'));
+ $this->assertEquals(['llo'], $reader->findPattern('/^llo$/'));
}
public function testMoveForward()
diff --git a/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php b/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php
index 7e92f5ba..29d9d5f1 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Shortcut/ClassParserTest.php
@@ -34,12 +34,12 @@ class ClassParserTest extends TestCase
public function getParseTestData()
{
- return array(
- array('.testclass', 'Class[Element[*].testclass]'),
- array('testel.testclass', 'Class[Element[testel].testclass]'),
- array('testns|.testclass', 'Class[Element[testns|*].testclass]'),
- array('testns|*.testclass', 'Class[Element[testns|*].testclass]'),
- array('testns|testel.testclass', 'Class[Element[testns|testel].testclass]'),
- );
+ return [
+ ['.testclass', 'Class[Element[*].testclass]'],
+ ['testel.testclass', 'Class[Element[testel].testclass]'],
+ ['testns|.testclass', 'Class[Element[testns|*].testclass]'],
+ ['testns|*.testclass', 'Class[Element[testns|*].testclass]'],
+ ['testns|testel.testclass', 'Class[Element[testns|testel].testclass]'],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php b/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php
index 05a730fd..79cc2270 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Shortcut/ElementParserTest.php
@@ -34,11 +34,11 @@ class ElementParserTest extends TestCase
public function getParseTestData()
{
- return array(
- array('*', 'Element[*]'),
- array('testel', 'Element[testel]'),
- array('testns|*', 'Element[testns|*]'),
- array('testns|testel', 'Element[testns|testel]'),
- );
+ return [
+ ['*', 'Element[*]'],
+ ['testel', 'Element[testel]'],
+ ['testns|*', 'Element[testns|*]'],
+ ['testns|testel', 'Element[testns|testel]'],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php b/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php
index 82f555d9..a7c79d69 100644
--- a/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/Shortcut/HashParserTest.php
@@ -34,12 +34,12 @@ class HashParserTest extends TestCase
public function getParseTestData()
{
- return array(
- array('#testid', 'Hash[Element[*]#testid]'),
- array('testel#testid', 'Hash[Element[testel]#testid]'),
- array('testns|#testid', 'Hash[Element[testns|*]#testid]'),
- array('testns|*#testid', 'Hash[Element[testns|*]#testid]'),
- array('testns|testel#testid', 'Hash[Element[testns|testel]#testid]'),
- );
+ return [
+ ['#testid', 'Hash[Element[*]#testid]'],
+ ['testel#testid', 'Hash[Element[testel]#testid]'],
+ ['testns|#testid', 'Hash[Element[testns|*]#testid]'],
+ ['testns|*#testid', 'Hash[Element[testns|*]#testid]'],
+ ['testns|testel#testid', 'Hash[Element[testns|testel]#testid]'],
+ ];
}
}
diff --git a/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php b/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php
index 44c751ac..fb47625a 100644
--- a/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/TokenStreamTest.php
@@ -53,7 +53,7 @@ class TokenStreamTest extends TestCase
public function testFailToGetNextIdentifier()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
@@ -73,7 +73,7 @@ class TokenStreamTest extends TestCase
public function testFailToGetNextIdentifierOrStar()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
+ $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException');
$stream = new TokenStream();
$stream->push(new Token(Token::TYPE_DELIMITER, '.', 2));
diff --git a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
index 61045829..a9ab29e2 100644
--- a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
+++ b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
@@ -12,8 +12,12 @@
namespace Symfony\Component\CssSelector\Tests\XPath;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\CssSelector\Node\ElementNode;
+use Symfony\Component\CssSelector\Node\FunctionNode;
+use Symfony\Component\CssSelector\Parser\Parser;
use Symfony\Component\CssSelector\XPath\Extension\HtmlExtension;
use Symfony\Component\CssSelector\XPath\Translator;
+use Symfony\Component\CssSelector\XPath\XPathExpr;
class TranslatorTest extends TestCase
{
@@ -31,6 +35,73 @@ class TranslatorTest extends TestCase
$this->assertEquals($xpath, $translator->cssToXPath($css, ''));
}
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testCssToXPathPseudoElement()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $translator->cssToXPath('e::first-line');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testGetExtensionNotExistsExtension()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $translator->getExtension('fake');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testAddCombinationNotExistsExtension()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $parser = new Parser();
+ $xpath = $parser->parse('*')[0];
+ $combinedXpath = $parser->parse('*')[0];
+ $translator->addCombination('fake', $xpath, $combinedXpath);
+ }
+
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testAddFunctionNotExistsFunction()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $xpath = new XPathExpr();
+ $function = new FunctionNode(new ElementNode(), 'fake');
+ $translator->addFunction($xpath, $function);
+ }
+
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testAddPseudoClassNotExistsClass()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $xpath = new XPathExpr();
+ $translator->addPseudoClass($xpath, 'fake');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\CssSelector\Exception\ExpressionErrorException
+ */
+ public function testAddAttributeMatchingClassNotExistsClass()
+ {
+ $translator = new Translator();
+ $translator->registerExtension(new HtmlExtension($translator));
+ $xpath = new XPathExpr();
+ $translator->addAttributeMatching($xpath, '', '', '');
+ }
+
/** @dataProvider getXmlLangTestData */
public function testXmlLang($css, array $elementsId)
{
@@ -80,248 +151,248 @@ class TranslatorTest extends TestCase
public function getXpathLiteralTestData()
{
- return array(
- array('foo', "'foo'"),
- array("foo's bar", '"foo\'s bar"'),
- array("foo's \"middle\" bar", 'concat(\'foo\', "\'", \'s "middle" bar\')'),
- array("foo's 'middle' \"bar\"", 'concat(\'foo\', "\'", \'s \', "\'", \'middle\', "\'", \' "bar"\')'),
- );
+ return [
+ ['foo', "'foo'"],
+ ["foo's bar", '"foo\'s bar"'],
+ ["foo's \"middle\" bar", 'concat(\'foo\', "\'", \'s "middle" bar\')'],
+ ["foo's 'middle' \"bar\"", 'concat(\'foo\', "\'", \'s \', "\'", \'middle\', "\'", \' "bar"\')'],
+ ];
}
public function getCssToXPathTestData()
{
- return array(
- array('*', '*'),
- array('e', 'e'),
- array('*|e', 'e'),
- array('e|f', 'e:f'),
- array('e[foo]', 'e[@foo]'),
- array('e[foo|bar]', 'e[@foo:bar]'),
- array('e[foo="bar"]', "e[@foo = 'bar']"),
- array('e[foo~="bar"]', "e[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"),
- array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"),
- array('e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"),
- array('e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"),
- array('e[foo!="bar"]', "e[not(@foo) or @foo != 'bar']"),
- array('e[foo!="bar"][foo!="baz"]', "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')]"),
- array('e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"),
- array('e:nth-child(1)', "*/*[(name() = 'e') and (position() = 1)]"),
- array('e:nth-last-child(1)', "*/*[(name() = 'e') and (position() = last() - 0)]"),
- array('e:nth-last-child(2n+2)', "*/*[(name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
- array('e:nth-of-type(1)', '*/e[position() = 1]'),
- array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'),
- array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"),
- array('e:first-child', "*/*[(name() = 'e') and (position() = 1)]"),
- array('e:last-child', "*/*[(name() = 'e') and (position() = last())]"),
- array('e:first-of-type', '*/e[position() = 1]'),
- array('e:last-of-type', '*/e[position() = last()]'),
- array('e:only-child', "*/*[(name() = 'e') and (last() = 1)]"),
- array('e:only-of-type', 'e[last() = 1]'),
- array('e:empty', 'e[not(*) and not(string-length())]'),
- array('e:EmPTY', 'e[not(*) and not(string-length())]'),
- array('e:root', 'e[not(parent::*)]'),
- array('e:hover', 'e[0]'),
- array('e:contains("foo")', "e[contains(string(.), 'foo')]"),
- array('e:ConTains(foo)', "e[contains(string(.), 'foo')]"),
- array('e.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"),
- array('e#myid', "e[@id = 'myid']"),
- array('e:not(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'),
- array('e:nOT(*)', 'e[0]'),
- array('e f', 'e/descendant-or-self::*/f'),
- array('e > f', 'e/f'),
- array('e + f', "e/following-sibling::*[(name() = 'f') and (position() = 1)]"),
- array('e ~ f', 'e/following-sibling::f'),
- array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"),
- );
+ return [
+ ['*', '*'],
+ ['e', 'e'],
+ ['*|e', 'e'],
+ ['e|f', 'e:f'],
+ ['e[foo]', 'e[@foo]'],
+ ['e[foo|bar]', 'e[@foo:bar]'],
+ ['e[foo="bar"]', "e[@foo = 'bar']"],
+ ['e[foo~="bar"]', "e[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"],
+ ['e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"],
+ ['e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"],
+ ['e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"],
+ ['e[foo!="bar"]', "e[not(@foo) or @foo != 'bar']"],
+ ['e[foo!="bar"][foo!="baz"]', "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')]"],
+ ['e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"],
+ ['e:nth-child(1)', "*/*[(name() = 'e') and (position() = 1)]"],
+ ['e:nth-last-child(1)', "*/*[(name() = 'e') and (position() = last() - 0)]"],
+ ['e:nth-last-child(2n+2)', "*/*[(name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"],
+ ['e:nth-of-type(1)', '*/e[position() = 1]'],
+ ['e:nth-last-of-type(1)', '*/e[position() = last() - 0]'],
+ ['div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"],
+ ['e:first-child', "*/*[(name() = 'e') and (position() = 1)]"],
+ ['e:last-child', "*/*[(name() = 'e') and (position() = last())]"],
+ ['e:first-of-type', '*/e[position() = 1]'],
+ ['e:last-of-type', '*/e[position() = last()]'],
+ ['e:only-child', "*/*[(name() = 'e') and (last() = 1)]"],
+ ['e:only-of-type', 'e[last() = 1]'],
+ ['e:empty', 'e[not(*) and not(string-length())]'],
+ ['e:EmPTY', 'e[not(*) and not(string-length())]'],
+ ['e:root', 'e[not(parent::*)]'],
+ ['e:hover', 'e[0]'],
+ ['e:contains("foo")', "e[contains(string(.), 'foo')]"],
+ ['e:ConTains(foo)', "e[contains(string(.), 'foo')]"],
+ ['e.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"],
+ ['e#myid', "e[@id = 'myid']"],
+ ['e:not(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'],
+ ['e:nOT(*)', 'e[0]'],
+ ['e f', 'e/descendant-or-self::*/f'],
+ ['e > f', 'e/f'],
+ ['e + f', "e/following-sibling::*[(name() = 'f') and (position() = 1)]"],
+ ['e ~ f', 'e/following-sibling::f'],
+ ['div#container p', "div[@id = 'container']/descendant-or-self::*/p"],
+ ];
}
public function getXmlLangTestData()
{
- return array(
- array(':lang("EN")', array('first', 'second', 'third', 'fourth')),
- array(':lang("en-us")', array('second', 'fourth')),
- array(':lang(en-nz)', array('third')),
- array(':lang(fr)', array('fifth')),
- array(':lang(ru)', array('sixth')),
- array(":lang('ZH')", array('eighth')),
- array(':lang(de) :lang(zh)', array('eighth')),
- array(':lang(en), :lang(zh)', array('first', 'second', 'third', 'fourth', 'eighth')),
- array(':lang(es)', array()),
- );
+ return [
+ [':lang("EN")', ['first', 'second', 'third', 'fourth']],
+ [':lang("en-us")', ['second', 'fourth']],
+ [':lang(en-nz)', ['third']],
+ [':lang(fr)', ['fifth']],
+ [':lang(ru)', ['sixth']],
+ [":lang('ZH')", ['eighth']],
+ [':lang(de) :lang(zh)', ['eighth']],
+ [':lang(en), :lang(zh)', ['first', 'second', 'third', 'fourth', 'eighth']],
+ [':lang(es)', []],
+ ];
}
public function getHtmlIdsTestData()
{
- return array(
- array('div', array('outer-div', 'li-div', 'foobar-div')),
- array('DIV', array('outer-div', 'li-div', 'foobar-div')), // case-insensitive in HTML
- array('div div', array('li-div')),
- array('div, div div', array('outer-div', 'li-div', 'foobar-div')),
- array('a[name]', array('name-anchor')),
- array('a[NAme]', array('name-anchor')), // case-insensitive in HTML:
- array('a[rel]', array('tag-anchor', 'nofollow-anchor')),
- array('a[rel="tag"]', array('tag-anchor')),
- array('a[href*="localhost"]', array('tag-anchor')),
- array('a[href*=""]', array()),
- array('a[href^="http"]', array('tag-anchor', 'nofollow-anchor')),
- array('a[href^="http:"]', array('tag-anchor')),
- array('a[href^=""]', array()),
- array('a[href$="org"]', array('nofollow-anchor')),
- array('a[href$=""]', array()),
- array('div[foobar~="bc"]', array('foobar-div')),
- array('div[foobar~="cde"]', array('foobar-div')),
- array('[foobar~="ab bc"]', array('foobar-div')),
- array('[foobar~=""]', array()),
- array('[foobar~=" \t"]', array()),
- array('div[foobar~="cd"]', array()),
- array('*[lang|="En"]', array('second-li')),
- array('[lang|="En-us"]', array('second-li')),
+ return [
+ ['div', ['outer-div', 'li-div', 'foobar-div']],
+ ['DIV', ['outer-div', 'li-div', 'foobar-div']], // case-insensitive in HTML
+ ['div div', ['li-div']],
+ ['div, div div', ['outer-div', 'li-div', 'foobar-div']],
+ ['a[name]', ['name-anchor']],
+ ['a[NAme]', ['name-anchor']], // case-insensitive in HTML:
+ ['a[rel]', ['tag-anchor', 'nofollow-anchor']],
+ ['a[rel="tag"]', ['tag-anchor']],
+ ['a[href*="localhost"]', ['tag-anchor']],
+ ['a[href*=""]', []],
+ ['a[href^="http"]', ['tag-anchor', 'nofollow-anchor']],
+ ['a[href^="http:"]', ['tag-anchor']],
+ ['a[href^=""]', []],
+ ['a[href$="org"]', ['nofollow-anchor']],
+ ['a[href$=""]', []],
+ ['div[foobar~="bc"]', ['foobar-div']],
+ ['div[foobar~="cde"]', ['foobar-div']],
+ ['[foobar~="ab bc"]', ['foobar-div']],
+ ['[foobar~=""]', []],
+ ['[foobar~=" \t"]', []],
+ ['div[foobar~="cd"]', []],
+ ['*[lang|="En"]', ['second-li']],
+ ['[lang|="En-us"]', ['second-li']],
// Attribute values are case sensitive
- array('*[lang|="en"]', array()),
- array('[lang|="en-US"]', array()),
- array('*[lang|="e"]', array()),
+ ['*[lang|="en"]', []],
+ ['[lang|="en-US"]', []],
+ ['*[lang|="e"]', []],
// ... :lang() is not.
- array(':lang("EN")', array('second-li', 'li-div')),
- array('*:lang(en-US)', array('second-li', 'li-div')),
- array(':lang("e")', array()),
- array('li:nth-child(3)', array('third-li')),
- array('li:nth-child(10)', array()),
- array('li:nth-child(2n)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-child(even)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-child(2n+0)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-child(+2n+1)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')),
- array('li:nth-child(odd)', array('first-li', 'third-li', 'fifth-li', 'seventh-li')),
- array('li:nth-child(2n+4)', array('fourth-li', 'sixth-li')),
- array('li:nth-child(3n+1)', array('first-li', 'fourth-li', 'seventh-li')),
- array('li:nth-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-child(n+3)', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-child(-n)', array()),
- array('li:nth-child(-n-1)', array()),
- array('li:nth-child(-n+1)', array('first-li')),
- array('li:nth-child(-n+3)', array('first-li', 'second-li', 'third-li')),
- array('li:nth-last-child(0)', array()),
- array('li:nth-last-child(2n)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-last-child(even)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-last-child(2n+2)', array('second-li', 'fourth-li', 'sixth-li')),
- array('li:nth-last-child(n)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-last-child(n-1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-last-child(n-3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-last-child(n+1)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li')),
- array('li:nth-last-child(n+3)', array('first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li')),
- array('li:nth-last-child(-n)', array()),
- array('li:nth-last-child(-n-1)', array()),
- array('li:nth-last-child(-n+1)', array('seventh-li')),
- array('li:nth-last-child(-n+3)', array('fifth-li', 'sixth-li', 'seventh-li')),
- array('ol:first-of-type', array('first-ol')),
- array('ol:nth-child(1)', array('first-ol')),
- array('ol:nth-of-type(2)', array('second-ol')),
- array('ol:nth-last-of-type(1)', array('second-ol')),
- array('span:only-child', array('foobar-span')),
- array('li div:only-child', array('li-div')),
- array('div *:only-child', array('li-div', 'foobar-span')),
- array('p:only-of-type', array('paragraph')),
- array('a:empty', array('name-anchor')),
- array('a:EMpty', array('name-anchor')),
- array('li:empty', array('third-li', 'fourth-li', 'fifth-li', 'sixth-li')),
- array(':root', array('html')),
- array('html:root', array('html')),
- array('li:root', array()),
- array('* :root', array()),
- array('*:contains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')),
- array(':CONtains("link")', array('html', 'outer-div', 'tag-anchor', 'nofollow-anchor')),
- array('*:contains("LInk")', array()), // case sensitive
- array('*:contains("e")', array('html', 'nil', 'outer-div', 'first-ol', 'first-li', 'paragraph', 'p-em')),
- array('*:contains("E")', array()), // case-sensitive
- array('.a', array('first-ol')),
- array('.b', array('first-ol')),
- array('*.a', array('first-ol')),
- array('ol.a', array('first-ol')),
- array('.c', array('first-ol', 'third-li', 'fourth-li')),
- array('*.c', array('first-ol', 'third-li', 'fourth-li')),
- array('ol *.c', array('third-li', 'fourth-li')),
- array('ol li.c', array('third-li', 'fourth-li')),
- array('li ~ li.c', array('third-li', 'fourth-li')),
- array('ol > li.c', array('third-li', 'fourth-li')),
- array('#first-li', array('first-li')),
- array('li#first-li', array('first-li')),
- array('*#first-li', array('first-li')),
- array('li div', array('li-div')),
- array('li > div', array('li-div')),
- array('div div', array('li-div')),
- array('div > div', array()),
- array('div>.c', array('first-ol')),
- array('div > .c', array('first-ol')),
- array('div + div', array('foobar-div')),
- array('a ~ a', array('tag-anchor', 'nofollow-anchor')),
- array('a[rel="tag"] ~ a', array('nofollow-anchor')),
- array('ol#first-ol li:last-child', array('seventh-li')),
- array('ol#first-ol *:last-child', array('li-div', 'seventh-li')),
- array('#outer-div:first-child', array('outer-div')),
- array('#outer-div :first-child', array('name-anchor', 'first-li', 'li-div', 'p-b', 'checkbox-fieldset-disabled', 'area-href')),
- array('a[href]', array('tag-anchor', 'nofollow-anchor')),
- array(':not(*)', array()),
- array('a:not([href])', array('name-anchor')),
- array('ol :Not(li[class])', array('first-li', 'second-li', 'li-div', 'fifth-li', 'sixth-li', 'seventh-li')),
+ [':lang("EN")', ['second-li', 'li-div']],
+ ['*:lang(en-US)', ['second-li', 'li-div']],
+ [':lang("e")', []],
+ ['li:nth-child(3)', ['third-li']],
+ ['li:nth-child(10)', []],
+ ['li:nth-child(2n)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-child(even)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-child(2n+0)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-child(+2n+1)', ['first-li', 'third-li', 'fifth-li', 'seventh-li']],
+ ['li:nth-child(odd)', ['first-li', 'third-li', 'fifth-li', 'seventh-li']],
+ ['li:nth-child(2n+4)', ['fourth-li', 'sixth-li']],
+ ['li:nth-child(3n+1)', ['first-li', 'fourth-li', 'seventh-li']],
+ ['li:nth-child(n)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-child(n-1)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-child(n+1)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-child(n+3)', ['third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-child(-n)', []],
+ ['li:nth-child(-n-1)', []],
+ ['li:nth-child(-n+1)', ['first-li']],
+ ['li:nth-child(-n+3)', ['first-li', 'second-li', 'third-li']],
+ ['li:nth-last-child(0)', []],
+ ['li:nth-last-child(2n)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-last-child(even)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-last-child(2n+2)', ['second-li', 'fourth-li', 'sixth-li']],
+ ['li:nth-last-child(n)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-last-child(n-1)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-last-child(n-3)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-last-child(n+1)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']],
+ ['li:nth-last-child(n+3)', ['first-li', 'second-li', 'third-li', 'fourth-li', 'fifth-li']],
+ ['li:nth-last-child(-n)', []],
+ ['li:nth-last-child(-n-1)', []],
+ ['li:nth-last-child(-n+1)', ['seventh-li']],
+ ['li:nth-last-child(-n+3)', ['fifth-li', 'sixth-li', 'seventh-li']],
+ ['ol:first-of-type', ['first-ol']],
+ ['ol:nth-child(1)', ['first-ol']],
+ ['ol:nth-of-type(2)', ['second-ol']],
+ ['ol:nth-last-of-type(1)', ['second-ol']],
+ ['span:only-child', ['foobar-span']],
+ ['li div:only-child', ['li-div']],
+ ['div *:only-child', ['li-div', 'foobar-span']],
+ ['p:only-of-type', ['paragraph']],
+ ['a:empty', ['name-anchor']],
+ ['a:EMpty', ['name-anchor']],
+ ['li:empty', ['third-li', 'fourth-li', 'fifth-li', 'sixth-li']],
+ [':root', ['html']],
+ ['html:root', ['html']],
+ ['li:root', []],
+ ['* :root', []],
+ ['*:contains("link")', ['html', 'outer-div', 'tag-anchor', 'nofollow-anchor']],
+ [':CONtains("link")', ['html', 'outer-div', 'tag-anchor', 'nofollow-anchor']],
+ ['*:contains("LInk")', []], // case sensitive
+ ['*:contains("e")', ['html', 'nil', 'outer-div', 'first-ol', 'first-li', 'paragraph', 'p-em']],
+ ['*:contains("E")', []], // case-sensitive
+ ['.a', ['first-ol']],
+ ['.b', ['first-ol']],
+ ['*.a', ['first-ol']],
+ ['ol.a', ['first-ol']],
+ ['.c', ['first-ol', 'third-li', 'fourth-li']],
+ ['*.c', ['first-ol', 'third-li', 'fourth-li']],
+ ['ol *.c', ['third-li', 'fourth-li']],
+ ['ol li.c', ['third-li', 'fourth-li']],
+ ['li ~ li.c', ['third-li', 'fourth-li']],
+ ['ol > li.c', ['third-li', 'fourth-li']],
+ ['#first-li', ['first-li']],
+ ['li#first-li', ['first-li']],
+ ['*#first-li', ['first-li']],
+ ['li div', ['li-div']],
+ ['li > div', ['li-div']],
+ ['div div', ['li-div']],
+ ['div > div', []],
+ ['div>.c', ['first-ol']],
+ ['div > .c', ['first-ol']],
+ ['div + div', ['foobar-div']],
+ ['a ~ a', ['tag-anchor', 'nofollow-anchor']],
+ ['a[rel="tag"] ~ a', ['nofollow-anchor']],
+ ['ol#first-ol li:last-child', ['seventh-li']],
+ ['ol#first-ol *:last-child', ['li-div', 'seventh-li']],
+ ['#outer-div:first-child', ['outer-div']],
+ ['#outer-div :first-child', ['name-anchor', 'first-li', 'li-div', 'p-b', 'checkbox-fieldset-disabled', 'area-href']],
+ ['a[href]', ['tag-anchor', 'nofollow-anchor']],
+ [':not(*)', []],
+ ['a:not([href])', ['name-anchor']],
+ ['ol :Not(li[class])', ['first-li', 'second-li', 'li-div', 'fifth-li', 'sixth-li', 'seventh-li']],
// HTML-specific
- array(':link', array('link-href', 'tag-anchor', 'nofollow-anchor', 'area-href')),
- array(':visited', array()),
- array(':enabled', array('link-href', 'tag-anchor', 'nofollow-anchor', 'checkbox-unchecked', 'text-checked', 'checkbox-checked', 'area-href')),
- array(':disabled', array('checkbox-disabled', 'checkbox-disabled-checked', 'fieldset', 'checkbox-fieldset-disabled')),
- array(':checked', array('checkbox-checked', 'checkbox-disabled-checked')),
- );
+ [':link', ['link-href', 'tag-anchor', 'nofollow-anchor', 'area-href']],
+ [':visited', []],
+ [':enabled', ['link-href', 'tag-anchor', 'nofollow-anchor', 'checkbox-unchecked', 'text-checked', 'checkbox-checked', 'area-href']],
+ [':disabled', ['checkbox-disabled', 'checkbox-disabled-checked', 'fieldset', 'checkbox-fieldset-disabled']],
+ [':checked', ['checkbox-checked', 'checkbox-disabled-checked']],
+ ];
}
public function getHtmlShakespearTestData()
{
- return array(
- array('*', 246),
- array('div:contains(CELIA)', 26),
- array('div:only-child', 22), // ?
- array('div:nth-child(even)', 106),
- array('div:nth-child(2n)', 106),
- array('div:nth-child(odd)', 137),
- array('div:nth-child(2n+1)', 137),
- array('div:nth-child(n)', 243),
- array('div:last-child', 53),
- array('div:first-child', 51),
- array('div > div', 242),
- array('div + div', 190),
- array('div ~ div', 190),
- array('body', 1),
- array('body div', 243),
- array('div', 243),
- array('div div', 242),
- array('div div div', 241),
- array('div, div, div', 243),
- array('div, a, span', 243),
- array('.dialog', 51),
- array('div.dialog', 51),
- array('div .dialog', 51),
- array('div.character, div.dialog', 99),
- array('div.direction.dialog', 0),
- array('div.dialog.direction', 0),
- array('div.dialog.scene', 1),
- array('div.scene.scene', 1),
- array('div.scene .scene', 0),
- array('div.direction .dialog ', 0),
- array('div .dialog .direction', 4),
- array('div.dialog .dialog .direction', 4),
- array('#speech5', 1),
- array('div#speech5', 1),
- array('div #speech5', 1),
- array('div.scene div.dialog', 49),
- array('div#scene1 div.dialog div', 142),
- array('#scene1 #speech1', 1),
- array('div[class]', 103),
- array('div[class=dialog]', 50),
- array('div[class^=dia]', 51),
- array('div[class$=log]', 50),
- array('div[class*=sce]', 1),
- array('div[class|=dialog]', 50), // ? Seems right
- array('div[class!=madeup]', 243), // ? Seems right
- array('div[class~=dialog]', 51), // ? Seems right
- );
+ return [
+ ['*', 246],
+ ['div:contains(CELIA)', 26],
+ ['div:only-child', 22], // ?
+ ['div:nth-child(even)', 106],
+ ['div:nth-child(2n)', 106],
+ ['div:nth-child(odd)', 137],
+ ['div:nth-child(2n+1)', 137],
+ ['div:nth-child(n)', 243],
+ ['div:last-child', 53],
+ ['div:first-child', 51],
+ ['div > div', 242],
+ ['div + div', 190],
+ ['div ~ div', 190],
+ ['body', 1],
+ ['body div', 243],
+ ['div', 243],
+ ['div div', 242],
+ ['div div div', 241],
+ ['div, div, div', 243],
+ ['div, a, span', 243],
+ ['.dialog', 51],
+ ['div.dialog', 51],
+ ['div .dialog', 51],
+ ['div.character, div.dialog', 99],
+ ['div.direction.dialog', 0],
+ ['div.dialog.direction', 0],
+ ['div.dialog.scene', 1],
+ ['div.scene.scene', 1],
+ ['div.scene .scene', 0],
+ ['div.direction .dialog ', 0],
+ ['div .dialog .direction', 4],
+ ['div.dialog .dialog .direction', 4],
+ ['#speech5', 1],
+ ['div#speech5', 1],
+ ['div #speech5', 1],
+ ['div.scene div.dialog', 49],
+ ['div#scene1 div.dialog div', 142],
+ ['#scene1 #speech1', 1],
+ ['div[class]', 103],
+ ['div[class=dialog]', 50],
+ ['div[class^=dia]', 51],
+ ['div[class$=log]', 50],
+ ['div[class*=sce]', 1],
+ ['div[class|=dialog]', 50], // ? Seems right
+ ['div[class!=madeup]', 243], // ? Seems right
+ ['div[class~=dialog]', 51], // ? Seems right
+ ];
}
}
diff --git a/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php b/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php
index 026ac06c..1dce1edd 100644
--- a/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/AbstractExtension.php
@@ -28,7 +28,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getNodeTranslators()
{
- return array();
+ return [];
}
/**
@@ -36,7 +36,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getCombinationTranslators()
{
- return array();
+ return [];
}
/**
@@ -44,7 +44,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getFunctionTranslators()
{
- return array();
+ return [];
}
/**
@@ -52,7 +52,7 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getPseudoClassTranslators()
{
- return array();
+ return [];
}
/**
@@ -60,6 +60,6 @@ abstract class AbstractExtension implements ExtensionInterface
*/
public function getAttributeMatchingTranslators()
{
- return array();
+ return [];
}
}
diff --git a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
index 8a4d8842..e636ea3d 100644
--- a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
@@ -31,16 +31,16 @@ class AttributeMatchingExtension extends AbstractExtension
*/
public function getAttributeMatchingTranslators()
{
- return array(
- 'exists' => array($this, 'translateExists'),
- '=' => array($this, 'translateEquals'),
- '~=' => array($this, 'translateIncludes'),
- '|=' => array($this, 'translateDashMatch'),
- '^=' => array($this, 'translatePrefixMatch'),
- '$=' => array($this, 'translateSuffixMatch'),
- '*=' => array($this, 'translateSubstringMatch'),
- '!=' => array($this, 'translateDifferent'),
- );
+ return [
+ 'exists' => [$this, 'translateExists'],
+ '=' => [$this, 'translateEquals'],
+ '~=' => [$this, 'translateIncludes'],
+ '|=' => [$this, 'translateDashMatch'],
+ '^=' => [$this, 'translatePrefixMatch'],
+ '$=' => [$this, 'translateSuffixMatch'],
+ '*=' => [$this, 'translateSubstringMatch'],
+ '!=' => [$this, 'translateDifferent'],
+ ];
}
public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
diff --git a/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php b/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
index 85181fd9..6a0f4165 100644
--- a/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
@@ -30,12 +30,12 @@ class CombinationExtension extends AbstractExtension
*/
public function getCombinationTranslators(): array
{
- return array(
- ' ' => array($this, 'translateDescendant'),
- '>' => array($this, 'translateChild'),
- '+' => array($this, 'translateDirectAdjacent'),
- '~' => array($this, 'translateIndirectAdjacent'),
- );
+ return [
+ ' ' => [$this, 'translateDescendant'],
+ '>' => [$this, 'translateChild'],
+ '+' => [$this, 'translateDirectAdjacent'],
+ '~' => [$this, 'translateIndirectAdjacent'],
+ ];
}
/**
diff --git a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
index ebe508fe..5d032df1 100644
--- a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
@@ -35,14 +35,14 @@ class FunctionExtension extends AbstractExtension
*/
public function getFunctionTranslators()
{
- return array(
- 'nth-child' => array($this, 'translateNthChild'),
- 'nth-last-child' => array($this, 'translateNthLastChild'),
- 'nth-of-type' => array($this, 'translateNthOfType'),
- 'nth-last-of-type' => array($this, 'translateNthLastOfType'),
- 'contains' => array($this, 'translateContains'),
- 'lang' => array($this, 'translateLang'),
- );
+ return [
+ 'nth-child' => [$this, 'translateNthChild'],
+ 'nth-last-child' => [$this, 'translateNthLastChild'],
+ 'nth-of-type' => [$this, 'translateNthOfType'],
+ 'nth-last-of-type' => [$this, 'translateNthLastOfType'],
+ 'contains' => [$this, 'translateContains'],
+ 'lang' => [$this, 'translateLang'],
+ ];
}
/**
@@ -86,7 +86,7 @@ class FunctionExtension extends AbstractExtension
$expr .= ' - '.$b;
}
- $conditions = array(sprintf('%s %s 0', $expr, $sign));
+ $conditions = [sprintf('%s %s 0', $expr, $sign)];
if (1 !== $a && -1 !== $a) {
$conditions[] = sprintf('(%s) mod %d = 0', $expr, $a);
diff --git a/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php b/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php
index cd8e0d5f..99c1166c 100644
--- a/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php
@@ -41,16 +41,16 @@ class HtmlExtension extends AbstractExtension
*/
public function getPseudoClassTranslators()
{
- return array(
- 'checked' => array($this, 'translateChecked'),
- 'link' => array($this, 'translateLink'),
- 'disabled' => array($this, 'translateDisabled'),
- 'enabled' => array($this, 'translateEnabled'),
- 'selected' => array($this, 'translateSelected'),
- 'invalid' => array($this, 'translateInvalid'),
- 'hover' => array($this, 'translateHover'),
- 'visited' => array($this, 'translateVisited'),
- );
+ return [
+ 'checked' => [$this, 'translateChecked'],
+ 'link' => [$this, 'translateLink'],
+ 'disabled' => [$this, 'translateDisabled'],
+ 'enabled' => [$this, 'translateEnabled'],
+ 'selected' => [$this, 'translateSelected'],
+ 'invalid' => [$this, 'translateInvalid'],
+ 'hover' => [$this, 'translateHover'],
+ 'visited' => [$this, 'translateVisited'],
+ ];
}
/**
@@ -58,9 +58,9 @@ class HtmlExtension extends AbstractExtension
*/
public function getFunctionTranslators()
{
- return array(
- 'lang' => array($this, 'translateLang'),
- );
+ return [
+ 'lang' => [$this, 'translateLang'],
+ ];
}
/**
diff --git a/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php b/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
index 61442b6f..4d86cb87 100644
--- a/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
@@ -64,17 +64,17 @@ class NodeExtension extends AbstractExtension
*/
public function getNodeTranslators()
{
- return array(
- 'Selector' => array($this, 'translateSelector'),
- 'CombinedSelector' => array($this, 'translateCombinedSelector'),
- 'Negation' => array($this, 'translateNegation'),
- 'Function' => array($this, 'translateFunction'),
- 'Pseudo' => array($this, 'translatePseudo'),
- 'Attribute' => array($this, 'translateAttribute'),
- 'Class' => array($this, 'translateClass'),
- 'Hash' => array($this, 'translateHash'),
- 'Element' => array($this, 'translateElement'),
- );
+ return [
+ 'Selector' => [$this, 'translateSelector'],
+ 'CombinedSelector' => [$this, 'translateCombinedSelector'],
+ 'Negation' => [$this, 'translateNegation'],
+ 'Function' => [$this, 'translateFunction'],
+ 'Pseudo' => [$this, 'translatePseudo'],
+ 'Attribute' => [$this, 'translateAttribute'],
+ 'Class' => [$this, 'translateClass'],
+ 'Hash' => [$this, 'translateHash'],
+ 'Element' => [$this, 'translateElement'],
+ ];
}
public function translateSelector(Node\SelectorNode $node, Translator $translator): XPathExpr
diff --git a/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php b/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php
index 378dfb7d..27fe47f9 100644
--- a/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/PseudoClassExtension.php
@@ -31,16 +31,16 @@ class PseudoClassExtension extends AbstractExtension
*/
public function getPseudoClassTranslators()
{
- return array(
- 'root' => array($this, 'translateRoot'),
- 'first-child' => array($this, 'translateFirstChild'),
- 'last-child' => array($this, 'translateLastChild'),
- 'first-of-type' => array($this, 'translateFirstOfType'),
- 'last-of-type' => array($this, 'translateLastOfType'),
- 'only-child' => array($this, 'translateOnlyChild'),
- 'only-of-type' => array($this, 'translateOnlyOfType'),
- 'empty' => array($this, 'translateEmpty'),
- );
+ return [
+ 'root' => [$this, 'translateRoot'],
+ 'first-child' => [$this, 'translateFirstChild'],
+ 'last-child' => [$this, 'translateLastChild'],
+ 'first-of-type' => [$this, 'translateFirstOfType'],
+ 'last-of-type' => [$this, 'translateLastOfType'],
+ 'only-child' => [$this, 'translateOnlyChild'],
+ 'only-of-type' => [$this, 'translateOnlyOfType'],
+ 'empty' => [$this, 'translateEmpty'],
+ ];
}
/**
diff --git a/vendor/symfony/css-selector/XPath/Translator.php b/vendor/symfony/css-selector/XPath/Translator.php
index 6426aeab..5a568dad 100644
--- a/vendor/symfony/css-selector/XPath/Translator.php
+++ b/vendor/symfony/css-selector/XPath/Translator.php
@@ -35,18 +35,18 @@ class Translator implements TranslatorInterface
/**
* @var ParserInterface[]
*/
- private $shortcutParsers = array();
+ private $shortcutParsers = [];
/**
* @var Extension\ExtensionInterface[]
*/
- private $extensions = array();
+ private $extensions = [];
- private $nodeTranslators = array();
- private $combinationTranslators = array();
- private $functionTranslators = array();
- private $pseudoClassTranslators = array();
- private $attributeMatchingTranslators = array();
+ private $nodeTranslators = [];
+ private $combinationTranslators = [];
+ private $functionTranslators = [];
+ private $pseudoClassTranslators = [];
+ private $attributeMatchingTranslators = [];
public function __construct(ParserInterface $parser = null)
{
@@ -72,7 +72,7 @@ class Translator implements TranslatorInterface
}
$string = $element;
- $parts = array();
+ $parts = [];
while (true) {
if (false !== $pos = strpos($string, "'")) {
$parts[] = sprintf("'%s'", substr($string, 0, $pos));
diff --git a/vendor/symfony/css-selector/composer.json b/vendor/symfony/css-selector/composer.json
index ebe7d0d5..91e64f27 100644
--- a/vendor/symfony/css-selector/composer.json
+++ b/vendor/symfony/css-selector/composer.json
@@ -31,7 +31,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/debug/BufferingLogger.php b/vendor/symfony/debug/BufferingLogger.php
index a2ed75b9..e7db3a4c 100644
--- a/vendor/symfony/debug/BufferingLogger.php
+++ b/vendor/symfony/debug/BufferingLogger.php
@@ -20,17 +20,17 @@ use Psr\Log\AbstractLogger;
*/
class BufferingLogger extends AbstractLogger
{
- private $logs = array();
+ private $logs = [];
- public function log($level, $message, array $context = array())
+ public function log($level, $message, array $context = [])
{
- $this->logs[] = array($level, $message, $context);
+ $this->logs[] = [$level, $message, $context];
}
public function cleanLogs()
{
$logs = $this->logs;
- $this->logs = array();
+ $this->logs = [];
return $logs;
}
diff --git a/vendor/symfony/debug/CHANGELOG.md b/vendor/symfony/debug/CHANGELOG.md
index 122af731..367e834f 100644
--- a/vendor/symfony/debug/CHANGELOG.md
+++ b/vendor/symfony/debug/CHANGELOG.md
@@ -1,6 +1,14 @@
CHANGELOG
=========
+4.3.0
+-----
+
+* made the `ErrorHandler` and `ExceptionHandler` classes final
+* added `Exception\FlattenException::getAsString` and
+`Exception\FlattenException::getTraceAsString` to increase compatibility to php
+exception objects
+
4.0.0
-----
diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php
index a31d71e6..5d2d55cf 100644
--- a/vendor/symfony/debug/Debug.php
+++ b/vendor/symfony/debug/Debug.php
@@ -42,7 +42,7 @@ class Debug
error_reporting(E_ALL);
}
- if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
+ if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
ini_set('display_errors', 0);
ExceptionHandler::register();
} elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php
index 19e80af7..db92f5ad 100644
--- a/vendor/symfony/debug/DebugClassLoader.php
+++ b/vendor/symfony/debug/DebugClassLoader.php
@@ -29,16 +29,17 @@ class DebugClassLoader
{
private $classLoader;
private $isFinder;
- private $loaded = array();
+ private $loaded = [];
private static $caseCheck;
- private static $checkedClasses = array();
- private static $final = array();
- private static $finalMethods = array();
- private static $deprecated = array();
- private static $internal = array();
- private static $internalMethods = array();
- private static $annotatedParameters = array();
- private static $darwinCache = array('/' => array('/', array()));
+ private static $checkedClasses = [];
+ private static $final = [];
+ private static $finalMethods = [];
+ private static $deprecated = [];
+ private static $internal = [];
+ private static $internalMethods = [];
+ private static $annotatedParameters = [];
+ private static $darwinCache = ['/' => ['/', []]];
+ private static $method = [];
public function __construct(callable $classLoader)
{
@@ -98,7 +99,7 @@ class DebugClassLoader
foreach ($functions as $function) {
if (!\is_array($function) || !$function[0] instanceof self) {
- $function = array(new static($function), 'loadClass');
+ $function = [new static($function), 'loadClass'];
}
spl_autoload_register($function);
@@ -127,6 +128,14 @@ class DebugClassLoader
}
}
+ /**
+ * @return string|null
+ */
+ public function findFile($class)
+ {
+ return $this->isFinder ? $this->classLoader[0]->findFile($class) ?: null : null;
+ }
+
/**
* Loads the given class or interface.
*
@@ -211,7 +220,7 @@ class DebugClassLoader
public function checkAnnotations(\ReflectionClass $refl, $class)
{
- $deprecations = array();
+ $deprecations = [];
// Don't trigger deprecations for classes in the same vendor
if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) {
@@ -223,9 +232,27 @@ class DebugClassLoader
// Detect annotations on the class
if (false !== $doc = $refl->getDocComment()) {
- foreach (array('final', 'deprecated', 'internal') as $annotation) {
- if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) {
- self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
+ foreach (['final', 'deprecated', 'internal'] as $annotation) {
+ if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
+ self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
+ }
+ }
+
+ if ($refl->isInterface() && false !== \strpos($doc, 'method') && preg_match_all('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\]\\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))#', $doc, $notice, PREG_SET_ORDER)) {
+ foreach ($notice as $method) {
+ $static = '' !== $method[1];
+ $name = $method[2];
+ $description = $method[3] ?? null;
+ if (false === strpos($name, '(')) {
+ $name .= '()';
+ }
+ if (null !== $description) {
+ $description = trim($description);
+ if (!isset($method[4])) {
+ $description .= '.';
+ }
+ }
+ self::$method[$class][] = [$class, $name, $static, $description];
}
}
}
@@ -249,7 +276,7 @@ class DebugClassLoader
if (!isset(self::$checkedClasses[$use])) {
$this->checkClass($use);
}
- if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
+ if (isset(self::$deprecated[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) {
$type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait');
$verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses');
@@ -258,6 +285,28 @@ class DebugClassLoader
if (isset(self::$internal[$use]) && \strncmp($ns, \str_replace('_', '\\', $use), $len)) {
$deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class);
}
+ if (isset(self::$method[$use])) {
+ if ($refl->isAbstract()) {
+ if (isset(self::$method[$class])) {
+ self::$method[$class] = array_merge(self::$method[$class], self::$method[$use]);
+ } else {
+ self::$method[$class] = self::$method[$use];
+ }
+ } elseif (!$refl->isInterface()) {
+ $hasCall = $refl->hasMethod('__call');
+ $hasStaticCall = $refl->hasMethod('__callStatic');
+ foreach (self::$method[$use] as $method) {
+ list($interface, $name, $static, $description) = $method;
+ if ($static ? $hasStaticCall : $hasCall) {
+ continue;
+ }
+ $realName = substr($name, 0, strpos($name, '('));
+ if (!$refl->hasMethod($realName) || !($methodRefl = $refl->getMethod($realName))->isPublic() || ($static && !$methodRefl->isStatic()) || (!$static && $methodRefl->isStatic())) {
+ $deprecations[] = sprintf('Class "%s" should implement method "%s::%s"%s', $class, ($static ? 'static ' : '').$interface, $name, null == $description ? '.' : ': '.$description);
+ }
+ }
+ }
+ }
}
if (\trait_exists($class)) {
@@ -265,11 +314,11 @@ class DebugClassLoader
}
// Inherit @final, @internal and @param annotations for methods
- self::$finalMethods[$class] = array();
- self::$internalMethods[$class] = array();
- self::$annotatedParameters[$class] = array();
+ self::$finalMethods[$class] = [];
+ self::$internalMethods[$class] = [];
+ self::$annotatedParameters[$class] = [];
foreach ($parentAndOwnInterfaces as $use) {
- foreach (array('finalMethods', 'internalMethods', 'annotatedParameters') as $property) {
+ foreach (['finalMethods', 'internalMethods', 'annotatedParameters'] as $property) {
if (isset(self::${$property}[$use])) {
self::${$property}[$class] = self::${$property}[$class] ? self::${$property}[$use] + self::${$property}[$class] : self::${$property}[$use];
}
@@ -297,13 +346,13 @@ class DebugClassLoader
$doc = $method->getDocComment();
if (isset(self::$annotatedParameters[$class][$method->name])) {
- $definedParameters = array();
+ $definedParameters = [];
foreach ($method->getParameters() as $parameter) {
$definedParameters[$parameter->name] = true;
}
foreach (self::$annotatedParameters[$class][$method->name] as $parameterName => $deprecation) {
- if (!isset($definedParameters[$parameterName]) && !($doc && preg_match("/\\n\\s+\\* @param (.*?)(?<= )\\\${$parameterName}\\b/", $doc))) {
+ if (!isset($definedParameters[$parameterName]) && !($doc && preg_match("/\\n\\s+\\* @param +((?(?!callable *\().*?|callable *\(.*\).*?))(?<= )\\\${$parameterName}\\b/", $doc))) {
$deprecations[] = sprintf($deprecation, $class);
}
}
@@ -315,10 +364,10 @@ class DebugClassLoader
$finalOrInternal = false;
- foreach (array('final', 'internal') as $annotation) {
- if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) {
- $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : '';
- self::${$annotation.'Methods'}[$class][$method->name] = array($class, $message);
+ foreach (['final', 'internal'] as $annotation) {
+ if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
+ $message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
+ self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
$finalOrInternal = true;
}
}
@@ -326,11 +375,11 @@ class DebugClassLoader
if ($finalOrInternal || $method->isConstructor() || false === \strpos($doc, '@param') || StatelessInvocation::class === $class) {
continue;
}
- if (!preg_match_all('#\n\s+\* @param (.*?)(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, PREG_SET_ORDER)) {
+ if (!preg_match_all('#\n\s+\* @param +((?(?!callable *\().*?|callable *\(.*\).*?))(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, PREG_SET_ORDER)) {
continue;
}
if (!isset(self::$annotatedParameters[$class][$method->name])) {
- $definedParameters = array();
+ $definedParameters = [];
foreach ($method->getParameters() as $parameter) {
$definedParameters[$parameter->name] = true;
}
@@ -376,7 +425,7 @@ class DebugClassLoader
if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
&& 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
) {
- return array(substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1));
+ return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)];
}
}
@@ -406,7 +455,7 @@ class DebugClassLoader
$k = $kDir;
$i = \strlen($dir) - 1;
while (!isset(self::$darwinCache[$k])) {
- self::$darwinCache[$k] = array($dir, array());
+ self::$darwinCache[$k] = [$dir, []];
self::$darwinCache[$dir] = &self::$darwinCache[$k];
while ('/' !== $dir[--$i]) {
@@ -419,6 +468,11 @@ class DebugClassLoader
$dirFiles = self::$darwinCache[$kDir][1];
+ if (!isset($dirFiles[$file]) && ') : eval()\'d code' === substr($file, -17)) {
+ // Get the file name from "file_name.php(123) : eval()'d code"
+ $file = substr($file, 0, strrpos($file, '(', -17));
+ }
+
if (isset($dirFiles[$file])) {
return $real .= $dirFiles[$file];
}
diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php
index 2eb058eb..2f250cba 100644
--- a/vendor/symfony/debug/ErrorHandler.php
+++ b/vendor/symfony/debug/ErrorHandler.php
@@ -45,10 +45,12 @@ use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
*
* @author Nicolas Grekas
* @author Grégoire Pineau
+ *
+ * @final since Symfony 4.3
*/
class ErrorHandler
{
- private $levels = array(
+ private $levels = [
E_DEPRECATED => 'Deprecated',
E_USER_DEPRECATED => 'User Deprecated',
E_NOTICE => 'Notice',
@@ -64,25 +66,25 @@ class ErrorHandler
E_PARSE => 'Parse Error',
E_ERROR => 'Error',
E_CORE_ERROR => 'Core Error',
- );
+ ];
- private $loggers = array(
- E_DEPRECATED => array(null, LogLevel::INFO),
- E_USER_DEPRECATED => array(null, LogLevel::INFO),
- E_NOTICE => array(null, LogLevel::WARNING),
- E_USER_NOTICE => array(null, LogLevel::WARNING),
- E_STRICT => array(null, LogLevel::WARNING),
- E_WARNING => array(null, LogLevel::WARNING),
- E_USER_WARNING => array(null, LogLevel::WARNING),
- E_COMPILE_WARNING => array(null, LogLevel::WARNING),
- E_CORE_WARNING => array(null, LogLevel::WARNING),
- E_USER_ERROR => array(null, LogLevel::CRITICAL),
- E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
- E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
- E_PARSE => array(null, LogLevel::CRITICAL),
- E_ERROR => array(null, LogLevel::CRITICAL),
- E_CORE_ERROR => array(null, LogLevel::CRITICAL),
- );
+ private $loggers = [
+ E_DEPRECATED => [null, LogLevel::INFO],
+ E_USER_DEPRECATED => [null, LogLevel::INFO],
+ E_NOTICE => [null, LogLevel::WARNING],
+ E_USER_NOTICE => [null, LogLevel::WARNING],
+ E_STRICT => [null, LogLevel::WARNING],
+ E_WARNING => [null, LogLevel::WARNING],
+ E_USER_WARNING => [null, LogLevel::WARNING],
+ E_COMPILE_WARNING => [null, LogLevel::WARNING],
+ E_CORE_WARNING => [null, LogLevel::WARNING],
+ E_USER_ERROR => [null, LogLevel::CRITICAL],
+ E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL],
+ E_COMPILE_ERROR => [null, LogLevel::CRITICAL],
+ E_PARSE => [null, LogLevel::CRITICAL],
+ E_ERROR => [null, LogLevel::CRITICAL],
+ E_CORE_ERROR => [null, LogLevel::CRITICAL],
+ ];
private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED
private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED
@@ -98,7 +100,7 @@ class ErrorHandler
private static $reservedMemory;
private static $toStringException = null;
- private static $silencedErrorCache = array();
+ private static $silencedErrorCache = [];
private static $silencedErrorCount = 0;
private static $exitCode = 0;
@@ -121,10 +123,10 @@ class ErrorHandler
$handler = new static();
}
- if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
+ if (null === $prev = set_error_handler([$handler, 'handleError'])) {
restore_error_handler();
// Specifying the error types earlier would expose us to https://bugs.php.net/63206
- set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
+ set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors);
$handler->isRoot = true;
}
@@ -138,12 +140,12 @@ class ErrorHandler
} else {
$handlerIsRegistered = true;
}
- if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
+ if (\is_array($prev = set_exception_handler([$handler, 'handleException'])) && $prev[0] instanceof self) {
restore_exception_handler();
if (!$handlerIsRegistered) {
$handler = $prev[0];
} elseif ($handler !== $prev[0] && $replace) {
- set_exception_handler(array($handler, 'handleException'));
+ set_exception_handler([$handler, 'handleException']);
$p = $prev[0]->setExceptionHandler(null);
$handler->setExceptionHandler($p);
$prev[0]->setExceptionHandler($p);
@@ -176,12 +178,12 @@ class ErrorHandler
*/
public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
{
- $loggers = array();
+ $loggers = [];
if (\is_array($levels)) {
foreach ($levels as $type => $logLevel) {
if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
- $loggers[$type] = array($logger, $logLevel);
+ $loggers[$type] = [$logger, $logLevel];
}
}
} else {
@@ -212,15 +214,15 @@ class ErrorHandler
{
$prevLogged = $this->loggedErrors;
$prev = $this->loggers;
- $flush = array();
+ $flush = [];
foreach ($loggers as $type => $log) {
if (!isset($prev[$type])) {
throw new \InvalidArgumentException('Unknown error type: '.$type);
}
if (!\is_array($log)) {
- $log = array($log);
- } elseif (!array_key_exists(0, $log)) {
+ $log = [$log];
+ } elseif (!\array_key_exists(0, $log)) {
throw new \InvalidArgumentException('No logger provided');
}
if (null === $log[0]) {
@@ -356,9 +358,9 @@ class ErrorHandler
if ($handler === $this) {
restore_error_handler();
if ($this->isRoot) {
- set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
+ set_error_handler([$this, 'handleError'], $this->thrownErrors | $this->loggedErrors);
} else {
- set_error_handler(array($this, 'handleError'));
+ set_error_handler([$this, 'handleError']);
}
}
}
@@ -395,9 +397,9 @@ class ErrorHandler
$scope = $this->scopedErrors & $type;
if (4 < $numArgs = \func_num_args()) {
- $context = $scope ? (func_get_arg(4) ?: array()) : array();
+ $context = $scope ? (func_get_arg(4) ?: []) : [];
} else {
- $context = array();
+ $context = [];
}
if (isset($context['GLOBALS']) && $scope) {
@@ -417,19 +419,19 @@ class ErrorHandler
self::$toStringException = null;
} elseif (!$throw && !($type & $level)) {
if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) {
- $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : array();
- $errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? array($lightTrace[0]) : $lightTrace);
+ $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : [];
+ $errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? [$lightTrace[0]] : $lightTrace);
} elseif (isset(self::$silencedErrorCache[$id][$message])) {
$lightTrace = null;
$errorAsException = self::$silencedErrorCache[$id][$message];
++$errorAsException->count;
} else {
- $lightTrace = array();
+ $lightTrace = [];
$errorAsException = null;
}
if (100 < ++self::$silencedErrorCount) {
- self::$silencedErrorCache = $lightTrace = array();
+ self::$silencedErrorCache = $lightTrace = [];
self::$silencedErrorCount = 1;
}
if ($errorAsException) {
@@ -446,8 +448,8 @@ class ErrorHandler
$lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw);
$this->traceReflector->setValue($errorAsException, $lightTrace);
} else {
- $this->traceReflector->setValue($errorAsException, array());
- $backtrace = array();
+ $this->traceReflector->setValue($errorAsException, []);
+ $backtrace = [];
}
}
@@ -490,12 +492,21 @@ class ErrorHandler
if ($this->isRecursive) {
$log = 0;
} else {
+ if (!\defined('HHVM_VERSION')) {
+ $currentErrorHandler = set_error_handler('var_dump');
+ restore_error_handler();
+ }
+
try {
$this->isRecursive = true;
$level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG;
- $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? array('exception' => $errorAsException) : array());
+ $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? ['exception' => $errorAsException] : []);
} finally {
$this->isRecursive = false;
+
+ if (!\defined('HHVM_VERSION')) {
+ set_error_handler($currentErrorHandler);
+ }
}
}
@@ -527,12 +538,12 @@ class ErrorHandler
}
if ($exception instanceof FatalErrorException) {
if ($exception instanceof FatalThrowableError) {
- $error = array(
+ $error = [
'type' => $type,
'message' => $message,
'file' => $exception->getFile(),
'line' => $exception->getLine(),
- );
+ ];
} else {
$message = 'Fatal '.$message;
}
@@ -544,7 +555,7 @@ class ErrorHandler
}
if ($this->loggedErrors & $type) {
try {
- $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception));
+ $this->loggers[$type][0]->log($this->loggers[$type][1], $message, ['exception' => $exception]);
} catch (\Throwable $handlerException) {
}
}
@@ -586,7 +597,7 @@ class ErrorHandler
}
$handler = self::$reservedMemory = null;
- $handlers = array();
+ $handlers = [];
$previousHandler = null;
$sameHandlerLimit = 10;
@@ -617,7 +628,7 @@ class ErrorHandler
$handler[0]->setExceptionHandler($h);
}
$handler = $handler[0];
- $handlers = array();
+ $handlers = [];
if ($exit = null === $error) {
$error = error_get_last();
@@ -661,11 +672,11 @@ class ErrorHandler
*/
protected function getFatalErrorHandlers()
{
- return array(
+ return [
new UndefinedFunctionFatalErrorHandler(),
new UndefinedMethodFatalErrorHandler(),
new ClassNotFoundFatalErrorHandler(),
- );
+ ];
}
/**
diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php
index 8305d392..93880fbc 100644
--- a/vendor/symfony/debug/Exception/FatalErrorException.php
+++ b/vendor/symfony/debug/Exception/FatalErrorException.php
@@ -61,7 +61,7 @@ class FatalErrorException extends \ErrorException
unset($frame);
$trace = array_reverse($trace);
} else {
- $trace = array();
+ $trace = [];
}
$this->setTrace($trace);
diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php
index f85522ce..304df040 100644
--- a/vendor/symfony/debug/Exception/FlattenException.php
+++ b/vendor/symfony/debug/Exception/FlattenException.php
@@ -27,18 +27,19 @@ class FlattenException
private $code;
private $previous;
private $trace;
+ private $traceAsString;
private $class;
private $statusCode;
private $headers;
private $file;
private $line;
- public static function create(\Exception $exception, $statusCode = null, array $headers = array())
+ public static function create(\Exception $exception, $statusCode = null, array $headers = [])
{
return static::createFromThrowable($exception, $statusCode, $headers);
}
- public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = array()): self
+ public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = []): self
{
$e = new static();
$e->setMessage($exception->getMessage());
@@ -73,13 +74,13 @@ class FlattenException
public function toArray()
{
- $exceptions = array();
- foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
- $exceptions[] = array(
+ $exceptions = [];
+ foreach (array_merge([$this], $this->getAllPrevious()) as $exception) {
+ $exceptions[] = [
'message' => $exception->getMessage(),
'class' => $exception->getClass(),
'trace' => $exception->getTrace(),
- );
+ ];
}
return $exceptions;
@@ -213,7 +214,7 @@ class FlattenException
public function getAllPrevious()
{
- $exceptions = array();
+ $exceptions = [];
$e = $this;
while ($e = $e->getPrevious()) {
$exceptions[] = $e;
@@ -239,6 +240,8 @@ class FlattenException
public function setTraceFromThrowable(\Throwable $throwable)
{
+ $this->traceAsString = $throwable->getTraceAsString();
+
return $this->setTrace($throwable->getTrace(), $throwable->getFile(), $throwable->getLine());
}
@@ -247,8 +250,8 @@ class FlattenException
*/
public function setTrace($trace, $file, $line)
{
- $this->trace = array();
- $this->trace[] = array(
+ $this->trace = [];
+ $this->trace[] = [
'namespace' => '',
'short_class' => '',
'class' => '',
@@ -256,8 +259,8 @@ class FlattenException
'function' => '',
'file' => $file,
'line' => $line,
- 'args' => array(),
- );
+ 'args' => [],
+ ];
foreach ($trace as $entry) {
$class = '';
$namespace = '';
@@ -267,7 +270,7 @@ class FlattenException
$namespace = implode('\\', $parts);
}
- $this->trace[] = array(
+ $this->trace[] = [
'namespace' => $namespace,
'short_class' => $class,
'class' => isset($entry['class']) ? $entry['class'] : '',
@@ -275,8 +278,8 @@ class FlattenException
'function' => isset($entry['function']) ? $entry['function'] : null,
'file' => isset($entry['file']) ? $entry['file'] : null,
'line' => isset($entry['line']) ? $entry['line'] : null,
- 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
- );
+ 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
+ ];
}
return $this;
@@ -284,34 +287,34 @@ class FlattenException
private function flattenArgs($args, $level = 0, &$count = 0)
{
- $result = array();
+ $result = [];
foreach ($args as $key => $value) {
if (++$count > 1e4) {
- return array('array', '*SKIPPED over 10000 entries*');
+ return ['array', '*SKIPPED over 10000 entries*'];
}
if ($value instanceof \__PHP_Incomplete_Class) {
// is_object() returns false on PHP<=7.1
- $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
+ $result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)];
} elseif (\is_object($value)) {
- $result[$key] = array('object', \get_class($value));
+ $result[$key] = ['object', \get_class($value)];
} elseif (\is_array($value)) {
if ($level > 10) {
- $result[$key] = array('array', '*DEEP NESTED ARRAY*');
+ $result[$key] = ['array', '*DEEP NESTED ARRAY*'];
} else {
- $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
+ $result[$key] = ['array', $this->flattenArgs($value, $level + 1, $count)];
}
} elseif (null === $value) {
- $result[$key] = array('null', null);
+ $result[$key] = ['null', null];
} elseif (\is_bool($value)) {
- $result[$key] = array('boolean', $value);
+ $result[$key] = ['boolean', $value];
} elseif (\is_int($value)) {
- $result[$key] = array('integer', $value);
+ $result[$key] = ['integer', $value];
} elseif (\is_float($value)) {
- $result[$key] = array('float', $value);
+ $result[$key] = ['float', $value];
} elseif (\is_resource($value)) {
- $result[$key] = array('resource', get_resource_type($value));
+ $result[$key] = ['resource', get_resource_type($value)];
} else {
- $result[$key] = array('string', (string) $value);
+ $result[$key] = ['string', (string) $value];
}
}
@@ -324,4 +327,33 @@ class FlattenException
return $array['__PHP_Incomplete_Class_Name'];
}
+
+ public function getTraceAsString()
+ {
+ return $this->traceAsString;
+ }
+
+ public function getAsString()
+ {
+ $message = '';
+ $next = false;
+
+ foreach (array_reverse(array_merge([$this], $this->getAllPrevious())) as $exception) {
+ if ($next) {
+ $message .= 'Next ';
+ } else {
+ $next = true;
+ }
+ $message .= $exception->getClass();
+
+ if ('' != $exception->getMessage()) {
+ $message .= ': '.$exception->getMessage();
+ }
+
+ $message .= ' in '.$exception->getFile().':'.$exception->getLine().
+ "\nStack trace:\n".$exception->getTraceAsString()."\n\n";
+ }
+
+ return rtrim($message);
+ }
}
diff --git a/vendor/symfony/debug/Exception/SilencedErrorContext.php b/vendor/symfony/debug/Exception/SilencedErrorContext.php
index 6f84617c..236c56ed 100644
--- a/vendor/symfony/debug/Exception/SilencedErrorContext.php
+++ b/vendor/symfony/debug/Exception/SilencedErrorContext.php
@@ -25,7 +25,7 @@ class SilencedErrorContext implements \JsonSerializable
private $line;
private $trace;
- public function __construct(int $severity, string $file, int $line, array $trace = array(), int $count = 1)
+ public function __construct(int $severity, string $file, int $line, array $trace = [], int $count = 1)
{
$this->severity = $severity;
$this->file = $file;
@@ -56,12 +56,12 @@ class SilencedErrorContext implements \JsonSerializable
public function JsonSerialize()
{
- return array(
+ return [
'severity' => $this->severity,
'file' => $this->file,
'line' => $this->line,
'trace' => $this->trace,
'count' => $this->count,
- );
+ ];
}
}
diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php
index 2483a57a..7ae85eeb 100644
--- a/vendor/symfony/debug/ExceptionHandler.php
+++ b/vendor/symfony/debug/ExceptionHandler.php
@@ -26,9 +26,21 @@ use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
*
* @author Fabien Potencier
* @author Nicolas Grekas
+ *
+ * @final since Symfony 4.3
*/
class ExceptionHandler
{
+ private const GHOST_ADDONS = [
+ '02-14' => self::GHOST_HEART,
+ '02-29' => self::GHOST_PLUS,
+ '10-18' => self::GHOST_GIFT,
+ ];
+
+ private const GHOST_GIFT = 'M124.005 5.36c.396-.715 1.119-1.648-.124-1.873-.346-.177-.692-.492-1.038-.141-.769.303-1.435.728-.627 1.523.36.514.685 1.634 1.092 1.758.242-.417.47-.842.697-1.266zm-1.699 1.977c-.706-1.26-1.274-2.612-2.138-3.774-1.051-1.123-3.122-.622-3.593.825-.625 1.431.724 3.14 2.251 2.96 1.159.02 2.324.072 3.48-.011zm5.867.043c1.502-.202 2.365-2.092 1.51-3.347-.757-1.34-2.937-1.387-3.698-.025-.659 1.1-1.23 2.25-1.835 3.38 1.336.077 2.686.06 4.023-.008zm2.487 1.611c.512-.45 2.494-.981.993-1.409-.372-.105-.805-.59-1.14-.457-.726.902-1.842 1.432-3.007 1.376-.228.075-1.391-.114-1.077.1.822.47 1.623.979 2.474 1.395.595-.317 1.173-.667 1.757-1.005zm-11.696.255l1.314-.765c-1.338-.066-2.87.127-3.881-.95-.285-.319-.559-.684-.954-.282-.473.326-1.929.66-.808 1.058.976.576 1.945 1.167 2.946 1.701.476-.223.926-.503 1.383-.762zm6.416 2.846c.567-.456 1.942-.89 1.987-1.38-1.282-.737-2.527-1.56-3.87-2.183-.461-.175-.835.094-1.207.328-1.1.654-2.225 1.267-3.288 1.978 1.39.86 2.798 1.695 4.219 2.504.725-.407 1.44-.83 2.16-1.247zm5.692 1.423l1.765-1.114c-.005-1.244.015-2.488-.019-3.732a77.306 77.306 0 0 0-3.51 2.084c-.126 1.282-.062 2.586-.034 3.876.607-.358 1.2-.741 1.798-1.114zm-13.804-.784c.06-1.06.19-2.269-1.09-2.583-.807-.376-1.926-1.341-2.548-1.332-.02 1.195-.01 2.39-.011 3.585 1.192.744 2.364 1.524 3.582 2.226.119-.616.041-1.269.067-1.896zm8.541 4.105l2.117-1.336c-.003-1.284.05-2.57-.008-3.853-.776.223-1.662.91-2.48 1.337l-1.834 1.075c.012 1.37-.033 2.744.044 4.113.732-.427 1.443-.887 2.161-1.336zm-2.957-.72v-2.057c-1.416-.828-2.828-1.664-4.25-2.482-.078 1.311-.033 2.627-.045 3.94 1.416.887 2.817 1.798 4.25 2.655.057-.683.036-1.372.045-2.057zm8.255 2.755l1.731-1.153c-.024-1.218.06-2.453-.062-3.658-1.2.685-2.358 1.464-3.537 2.195.028 1.261-.058 2.536.072 3.786.609-.373 1.2-.777 1.796-1.17zm-13.851-.683l-.014-1.916c-1.193-.746-2.37-1.517-3.58-2.234-.076 1.224-.033 2.453-.044 3.679 1.203.796 2.392 1.614 3.61 2.385.048-.636.024-1.276.028-1.914zm8.584 4.199l2.102-1.396c-.002-1.298.024-2.596-.01-3.893-1.427.88-2.843 1.775-4.25 2.686-.158 1.253-.055 2.545-.056 3.811.437.266 1.553-.912 2.214-1.208zm-2.988-.556c-.085-.894.365-2.154-.773-2.5-1.146-.727-2.288-1.46-3.45-2.163-.17 1.228.008 2.508-.122 3.751a79.399 79.399 0 0 0 4.278 2.885c.117-.641.044-1.32.067-1.973zm-4.872-.236l-5.087-3.396c.002-3.493-.047-6.988.015-10.48.85-.524 1.753-.954 2.627-1.434-.564-1.616.25-3.58 1.887-4.184 1.372-.563 3.025-.055 3.9 1.13l1.906-.978 1.916.987c.915-1.086 2.483-1.706 3.842-1.097 1.631.573 2.52 2.532 1.936 4.145.88.497 1.837.886 2.644 1.492.036 3.473 0 6.946-.003 10.419-3.374 2.233-6.693 4.55-10.122 6.699-.997 0-1.858-1.083-2.783-1.522a735.316 735.316 0 0 1-2.678-1.781z';
+ private const GHOST_HEART = 'M125.914 8.305c3.036-8.71 14.933 0 0 11.2-14.932-11.2-3.036-19.91 0-11.2z';
+ private const GHOST_PLUS = 'M111.368 8.97h7.324V1.645h7.512v7.323h7.324v7.513h-7.324v7.323h-7.512v-7.323h-7.324z';
+
private $debug;
private $charset;
private $handler;
@@ -56,10 +68,10 @@ class ExceptionHandler
{
$handler = new static($debug, $charset, $fileLinkFormat);
- $prev = set_exception_handler(array($handler, 'handle'));
+ $prev = set_exception_handler([$handler, 'handle']);
if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
restore_exception_handler();
- $prev[0]->setExceptionHandler(array($handler, 'handle'));
+ $prev[0]->setExceptionHandler([$handler, 'handle']);
}
return $handler;
@@ -205,7 +217,7 @@ class ExceptionHandler
$title = 'Sorry, the page you are looking for could not be found.';
break;
default:
- $title = 'Whoops, looks like something went wrong.';
+ $title = $this->debug ? $this->escapeHtml($exception->getMessage()) : 'Whoops, looks like something went wrong.';
}
if (!$this->debug) {
@@ -373,12 +385,12 @@ EOF;
$fmt = $this->fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
if (!$fmt) {
- return sprintf('in %s%s', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
+ return sprintf('in %s%s', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
}
if (\is_string($fmt)) {
$i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f);
- $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
+ $fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 1; isset($fmt[$i]); ++$i) {
if (0 === strpos($path, $k = $fmt[$i++])) {
@@ -387,9 +399,13 @@ EOF;
}
}
- $link = strtr($fmt[0], array('%f' => $path, '%l' => $line));
+ $link = strtr($fmt[0], ['%f' => $path, '%l' => $line]);
} else {
- $link = $fmt->format($path, $line);
+ try {
+ $link = $fmt->format($path, $line);
+ } catch (\Exception $e) {
+ return sprintf('in %s%s', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
+ }
}
return sprintf('in %s%s', $this->escapeHtml($link), $file, 0 < $line ? ' line '.$line : '');
@@ -404,7 +420,7 @@ EOF;
*/
private function formatArgs(array $args)
{
- $result = array();
+ $result = [];
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
$formattedValue = sprintf('object(%s)', $this->formatClass($item[1]));
@@ -436,6 +452,15 @@ EOF;
private function getSymfonyGhostAsSvg()
{
- return '';
+ return '';
+ }
+
+ private function addElementToGhost()
+ {
+ if (!isset(self::GHOST_ADDONS[\date('m-d')])) {
+ return '';
+ }
+
+ return '';
}
}
diff --git a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
index 4ccd16fe..a0e2f770 100644
--- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
+++ b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
@@ -40,7 +40,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
return;
}
- foreach (array('class', 'interface', 'trait') as $typeName) {
+ foreach (['class', 'interface', 'trait'] as $typeName) {
$prefix = ucfirst($typeName).' \'';
$prefixLen = \strlen($prefix);
if (0 !== strpos($error['message'], $prefix)) {
@@ -86,11 +86,11 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
private function getClassCandidates(string $class): array
{
if (!\is_array($functions = spl_autoload_functions())) {
- return array();
+ return [];
}
// find Symfony and Composer autoloaders
- $classes = array();
+ $classes = [];
foreach ($functions as $function) {
if (!\is_array($function)) {
@@ -127,10 +127,10 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
private function findClassInPath(string $path, string $class, string $prefix): array
{
if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
- return array();
+ return [];
}
- $classes = array();
+ $classes = [];
$filename = $class.'.php';
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
@@ -143,9 +143,9 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
private function convertFileToClass(string $path, string $file, string $prefix): ?string
{
- $candidates = array(
+ $candidates = [
// namespaced class
- $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
+ $namespacedClass = str_replace([$path.\DIRECTORY_SEPARATOR, '.php', '/'], ['', '', '\\'], $file),
// namespaced class (with target dir)
$prefix.$namespacedClass,
// namespaced class (with target dir and separator)
@@ -156,7 +156,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
str_replace('\\', '_', $prefix.$namespacedClass),
// PEAR class (with target dir and separator)
str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
- );
+ ];
if ($prefix) {
$candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
@@ -171,7 +171,11 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
}
}
- require_once $file;
+ try {
+ require_once $file;
+ } catch (\Throwable $e) {
+ return null;
+ }
foreach ($candidates as $candidate) {
if ($this->classExists($candidate)) {
diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php
index db241803..9eddeba5 100644
--- a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php
+++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php
@@ -53,7 +53,7 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
$message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
}
- $candidates = array();
+ $candidates = [];
foreach (get_defined_functions() as $type => $definedFunctionNames) {
foreach ($definedFunctionNames as $definedFunctionName) {
if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php
index 618a2c20..1318cb13 100644
--- a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php
+++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php
@@ -41,7 +41,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
return new UndefinedMethodException($message, $exception);
}
- $candidates = array();
+ $candidates = [];
foreach ($methods as $definedMethodName) {
$lev = levenshtein($methodName, $definedMethodName);
if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
index c7e03fbe..6ee20ae8 100644
--- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
+++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php
@@ -27,14 +27,14 @@ class DebugClassLoaderTest extends TestCase
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
- spl_autoload_register(array($this->loader, 'loadClass'), true, true);
+ spl_autoload_register([$this->loader, 'loadClass'], true, true);
DebugClassLoader::enable();
}
protected function tearDown()
{
DebugClassLoader::disable();
- spl_autoload_unregister(array($this->loader, 'loadClass'));
+ spl_autoload_unregister([$this->loader, 'loadClass']);
error_reporting($this->errorReporting);
}
@@ -44,7 +44,7 @@ class DebugClassLoaderTest extends TestCase
$functions = spl_autoload_functions();
foreach ($functions as $function) {
- if (is_array($function) && $function[0] instanceof DebugClassLoader) {
+ if (\is_array($function) && $function[0] instanceof DebugClassLoader) {
$reflClass = new \ReflectionClass($function[0]);
$reflProp = $reflClass->getProperty('classLoader');
$reflProp->setAccessible(true);
@@ -136,20 +136,20 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_DEPRECATED,
'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice.',
- );
+ ];
$this->assertSame($xError, $lastError);
}
public function provideDeprecatedSuper()
{
- return array(
- array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'),
- array('DeprecatedParentClass', 'DeprecatedClass', 'extends'),
- );
+ return [
+ ['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'],
+ ['DeprecatedParentClass', 'DeprecatedClass', 'extends'],
+ ];
}
public function testInterfaceExtendsDeprecatedInterface()
@@ -166,10 +166,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_NOTICE,
'message' => '',
- );
+ ];
$this->assertSame($xError, $lastError);
}
@@ -188,39 +188,46 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_NOTICE,
'message' => '',
- );
+ ];
$this->assertSame($xError, $lastError);
}
public function testExtendedFinalClass()
{
- set_error_handler(function () { return false; });
- $e = error_reporting(0);
- trigger_error('', E_USER_NOTICE);
+ $deprecations = [];
+ set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
+ $e = error_reporting(E_USER_DEPRECATED);
- class_exists('Test\\'.__NAMESPACE__.'\\ExtendsFinalClass', true);
+ require __DIR__.'/Fixtures/FinalClasses.php';
+
+ $i = 1;
+ while (class_exists($finalClass = __NAMESPACE__.'\\Fixtures\\FinalClass'.$i++, false)) {
+ spl_autoload_call($finalClass);
+ class_exists('Test\\'.__NAMESPACE__.'\\Extends'.substr($finalClass, strrpos($finalClass, '\\') + 1), true);
+ }
error_reporting($e);
restore_error_handler();
- $lastError = error_get_last();
- unset($lastError['file'], $lastError['line']);
-
- $xError = array(
- 'type' => E_USER_DEPRECATED,
- 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".',
- );
-
- $this->assertSame($xError, $lastError);
+ $this->assertSame([
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass1" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass1".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass2" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass2".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass3" class is considered final comment with @@@ and ***. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass3".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass4" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass4".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass5" class is considered final multiline comment. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass5".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass6" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass6".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass7" class is considered final another multiline comment... It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass7".',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass8" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass8".',
+ ], $deprecations);
}
public function testExtendedFinalMethod()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -229,10 +236,10 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $xError = array(
+ $xError = [
'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
- );
+ ];
$this->assertSame($xError, $deprecations);
}
@@ -251,12 +258,12 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $this->assertSame(array('type' => E_USER_NOTICE, 'message' => ''), $lastError);
+ $this->assertSame(['type' => E_USER_NOTICE, 'message' => ''], $lastError);
}
public function testInternalsUse()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -265,17 +272,17 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $this->assertSame($deprecations, array(
+ $this->assertSame($deprecations, [
'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
- ));
+ ]);
}
public function testExtendedMethodDefinesNewParameters()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -284,16 +291,21 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $this->assertSame(array(
+ $this->assertSame([
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::quzMethod()" method will require a new "Quz $quz" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "$noType" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable(\Throwable|null $reason, mixed $value) $callback" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "string $param" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "callable ($a, $b) $anotherOne" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
+ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::iAmHere()" method will require a new "Type$WithDollarIsStillAType $ccc" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.',
'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::isSymfony()" method will require a new "true $yes" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.',
- ), $deprecations);
+ ], $deprecations);
}
public function testUseTraitWithInternalMethod()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -302,7 +314,52 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $this->assertSame(array(), $deprecations);
+ $this->assertSame([], $deprecations);
+ }
+
+ public function testVirtualUse()
+ {
+ $deprecations = [];
+ set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
+ $e = error_reporting(E_USER_DEPRECATED);
+
+ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsVirtual', true);
+
+ error_reporting($e);
+ restore_error_handler();
+
+ $this->assertSame([
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::sameLineInterfaceMethodNoBraces()".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::newLineInterfaceMethod()": Some description!',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::newLineInterfaceMethodNoBraces()": Description.',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::invalidInterfaceMethod()".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::invalidInterfaceMethodNoBraces()".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::complexInterfaceMethod($arg, ...$args)".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::complexInterfaceMethodTyped($arg, int ...$args)": Description ...',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "static Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::staticMethodNoBraces()".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "static Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::staticMethodTyped(int $arg)": Description.',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtualParent" should implement method "static Symfony\Component\Debug\Tests\Fixtures\VirtualInterface::staticMethodTypedNoBraces()".',
+ 'Class "Test\Symfony\Component\Debug\Tests\ExtendsVirtual" should implement method "Symfony\Component\Debug\Tests\Fixtures\VirtualSubInterface::subInterfaceMethod()".',
+ ], $deprecations);
+ }
+
+ public function testVirtualUseWithMagicCall()
+ {
+ $deprecations = [];
+ set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
+ $e = error_reporting(E_USER_DEPRECATED);
+
+ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsVirtualMagicCall', true);
+
+ error_reporting($e);
+ restore_error_handler();
+
+ $this->assertSame([], $deprecations);
+ }
+
+ public function testEvaluatedCode()
+ {
+ $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\DefinitionInEvaluatedCode', true));
}
}
@@ -314,12 +371,12 @@ class ClassLoader
public function getClassMap()
{
- return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php');
+ return [__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'];
}
public function findFile($class)
{
- $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
+ $fixtureDir = __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
if (__NAMESPACE__.'\TestingUnsilencing' === $class) {
eval('-- parse error --');
@@ -328,7 +385,7 @@ class ClassLoader
} elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) {
eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}');
} elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) {
- return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php';
+ return $fixtureDir.'psr4'.\DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) {
return $fixtureDir.'reallyNotPsr0.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) {
@@ -343,8 +400,9 @@ class ClassLoader
eval('namespace Test\\'.__NAMESPACE__.'; class NonDeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\NonDeprecatedInterface {}');
} elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class Float {}');
- } elseif ('Test\\'.__NAMESPACE__.'\ExtendsFinalClass' === $class) {
- eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsFinalClass extends \\'.__NAMESPACE__.'\Fixtures\FinalClass {}');
+ } elseif (0 === strpos($class, 'Test\\'.__NAMESPACE__.'\ExtendsFinalClass')) {
+ $classShortName = substr($class, strrpos($class, '\\') + 1);
+ eval('namespace Test\\'.__NAMESPACE__.'; class '.$classShortName.' extends \\'.__NAMESPACE__.'\Fixtures\\'.substr($classShortName, 7).' {}');
} elseif ('Test\\'.__NAMESPACE__.'\ExtendsAnnotatedClass' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsAnnotatedClass extends \\'.__NAMESPACE__.'\Fixtures\AnnotatedClass {
public function deprecatedMethod() { }
@@ -359,6 +417,32 @@ class ClassLoader
eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsInternalsParent extends \\'.__NAMESPACE__.'\Fixtures\InternalClass implements \\'.__NAMESPACE__.'\Fixtures\InternalInterface { }');
} elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }');
+ } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtual' === $class) {
+ eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtual extends ExtendsVirtualParent implements \\'.__NAMESPACE__.'\Fixtures\VirtualSubInterface {
+ public function ownClassMethod() { }
+ public function classMethod() { }
+ public function sameLineInterfaceMethodNoBraces() { }
+ }');
+ } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtualParent' === $class) {
+ eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtualParent extends ExtendsVirtualAbstract {
+ public function ownParentMethod() { }
+ public function traitMethod() { }
+ public function sameLineInterfaceMethod() { }
+ public function staticMethodNoBraces() { } // should be static
+ }');
+ } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtualAbstract' === $class) {
+ eval('namespace Test\\'.__NAMESPACE__.'; abstract class ExtendsVirtualAbstract extends ExtendsVirtualAbstractBase {
+ public static function staticMethod() { }
+ public function ownAbstractMethod() { }
+ public function interfaceMethod() { }
+ }');
+ } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtualAbstractBase' === $class) {
+ eval('namespace Test\\'.__NAMESPACE__.'; abstract class ExtendsVirtualAbstractBase extends \\'.__NAMESPACE__.'\Fixtures\VirtualClass implements \\'.__NAMESPACE__.'\Fixtures\VirtualInterface {
+ public function ownAbstractBaseMethod() { }
+ }');
+ } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtualMagicCall' === $class) {
+ eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtualMagicCall extends \\'.__NAMESPACE__.'\Fixtures\VirtualClassMagicCall implements \\'.__NAMESPACE__.'\Fixtures\VirtualInterface {
+ }');
}
}
}
diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
index 15e47638..f758d21e 100644
--- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
@@ -13,9 +13,12 @@ namespace Symfony\Component\Debug\Tests;
use PHPUnit\Framework\TestCase;
use Psr\Log\LogLevel;
+use Psr\Log\NullLogger;
use Symfony\Component\Debug\BufferingLogger;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\Exception\SilencedErrorContext;
+use Symfony\Component\Debug\Tests\Fixtures\ErrorHandlerThatUsesThePreviousOne;
+use Symfony\Component\Debug\Tests\Fixtures\LoggerThatSetAnErrorHandler;
/**
* ErrorHandlerTest.
@@ -38,13 +41,13 @@ class ErrorHandlerTest extends TestCase
$this->assertSame($handler, ErrorHandler::register($newHandler, false));
$h = set_error_handler('var_dump');
restore_error_handler();
- $this->assertSame(array($handler, 'handleError'), $h);
+ $this->assertSame([$handler, 'handleError'], $h);
try {
$this->assertSame($newHandler, ErrorHandler::register($newHandler, true));
$h = set_error_handler('var_dump');
restore_error_handler();
- $this->assertSame(array($newHandler, 'handleError'), $h);
+ $this->assertSame([$newHandler, 'handleError'], $h);
} catch (\Exception $e) {
}
@@ -74,12 +77,12 @@ class ErrorHandlerTest extends TestCase
try {
@trigger_error('Hello', E_USER_WARNING);
- $expected = array(
+ $expected = [
'type' => E_USER_WARNING,
'message' => 'Hello',
'file' => __FILE__,
'line' => __LINE__ - 5,
- );
+ ];
$this->assertSame($expected, error_get_last());
} catch (\Exception $e) {
restore_error_handler();
@@ -145,26 +148,26 @@ class ErrorHandlerTest extends TestCase
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$handler->setDefaultLogger($logger, E_NOTICE);
- $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL));
+ $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]);
- $loggers = array(
- E_DEPRECATED => array(null, LogLevel::INFO),
- E_USER_DEPRECATED => array(null, LogLevel::INFO),
- E_NOTICE => array($logger, LogLevel::WARNING),
- E_USER_NOTICE => array($logger, LogLevel::CRITICAL),
- E_STRICT => array(null, LogLevel::WARNING),
- E_WARNING => array(null, LogLevel::WARNING),
- E_USER_WARNING => array(null, LogLevel::WARNING),
- E_COMPILE_WARNING => array(null, LogLevel::WARNING),
- E_CORE_WARNING => array(null, LogLevel::WARNING),
- E_USER_ERROR => array(null, LogLevel::CRITICAL),
- E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
- E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
- E_PARSE => array(null, LogLevel::CRITICAL),
- E_ERROR => array(null, LogLevel::CRITICAL),
- E_CORE_ERROR => array(null, LogLevel::CRITICAL),
- );
- $this->assertSame($loggers, $handler->setLoggers(array()));
+ $loggers = [
+ E_DEPRECATED => [null, LogLevel::INFO],
+ E_USER_DEPRECATED => [null, LogLevel::INFO],
+ E_NOTICE => [$logger, LogLevel::WARNING],
+ E_USER_NOTICE => [$logger, LogLevel::CRITICAL],
+ E_STRICT => [null, LogLevel::WARNING],
+ E_WARNING => [null, LogLevel::WARNING],
+ E_USER_WARNING => [null, LogLevel::WARNING],
+ E_COMPILE_WARNING => [null, LogLevel::WARNING],
+ E_CORE_WARNING => [null, LogLevel::WARNING],
+ E_USER_ERROR => [null, LogLevel::CRITICAL],
+ E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL],
+ E_COMPILE_ERROR => [null, LogLevel::CRITICAL],
+ E_PARSE => [null, LogLevel::CRITICAL],
+ E_ERROR => [null, LogLevel::CRITICAL],
+ E_CORE_ERROR => [null, LogLevel::CRITICAL],
+ ];
+ $this->assertSame($loggers, $handler->setLoggers([]));
} finally {
restore_error_handler();
restore_exception_handler();
@@ -176,14 +179,14 @@ class ErrorHandlerTest extends TestCase
try {
$handler = ErrorHandler::register();
$handler->throwAt(0, true);
- $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array()));
+ $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, []));
restore_error_handler();
restore_exception_handler();
$handler = ErrorHandler::register();
$handler->throwAt(3, true);
- $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array()));
+ $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, []));
restore_error_handler();
restore_exception_handler();
@@ -191,7 +194,7 @@ class ErrorHandlerTest extends TestCase
$handler = ErrorHandler::register();
$handler->throwAt(3, true);
try {
- $handler->handleError(4, 'foo', 'foo.php', 12, array());
+ $handler->handleError(4, 'foo', 'foo.php', 12, []);
} catch (\ErrorException $e) {
$this->assertSame('Parse Error: foo', $e->getMessage());
$this->assertSame(4, $e->getSeverity());
@@ -204,14 +207,14 @@ class ErrorHandlerTest extends TestCase
$handler = ErrorHandler::register();
$handler->throwAt(E_USER_DEPRECATED, true);
- $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array()));
+ $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, []));
restore_error_handler();
restore_exception_handler();
$handler = ErrorHandler::register();
$handler->throwAt(E_DEPRECATED, true);
- $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array()));
+ $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, []));
restore_error_handler();
restore_exception_handler();
@@ -231,12 +234,12 @@ class ErrorHandlerTest extends TestCase
$logger
->expects($this->once())
->method('log')
- ->will($this->returnCallback($warnArgCheck))
+ ->willReturnCallback($warnArgCheck)
;
$handler = ErrorHandler::register();
$handler->setDefaultLogger($logger, E_USER_DEPRECATED);
- $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array()));
+ $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, []));
restore_error_handler();
restore_exception_handler();
@@ -259,7 +262,7 @@ class ErrorHandlerTest extends TestCase
$logger
->expects($this->once())
->method('log')
- ->will($this->returnCallback($logArgCheck))
+ ->willReturnCallback($logArgCheck)
;
$handler = ErrorHandler::register();
@@ -315,12 +318,14 @@ class ErrorHandlerTest extends TestCase
$logger
->expects($this->once())
->method('log')
- ->will($this->returnCallback($logArgCheck))
+ ->willReturnCallback($logArgCheck)
;
$handler = new ErrorHandler();
$handler->setDefaultLogger($logger);
- @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array());
+ @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, []);
+
+ restore_error_handler();
}
public function testHandleException()
@@ -341,7 +346,7 @@ class ErrorHandlerTest extends TestCase
$logger
->expects($this->exactly(2))
->method('log')
- ->will($this->returnCallback($logArgCheck))
+ ->willReturnCallback($logArgCheck)
;
$handler->setDefaultLogger($logger, E_ERROR);
@@ -369,27 +374,27 @@ class ErrorHandlerTest extends TestCase
$bootLogger = new BufferingLogger();
$handler = new ErrorHandler($bootLogger);
- $loggers = array(
- E_DEPRECATED => array($bootLogger, LogLevel::INFO),
- E_USER_DEPRECATED => array($bootLogger, LogLevel::INFO),
- E_NOTICE => array($bootLogger, LogLevel::WARNING),
- E_USER_NOTICE => array($bootLogger, LogLevel::WARNING),
- E_STRICT => array($bootLogger, LogLevel::WARNING),
- E_WARNING => array($bootLogger, LogLevel::WARNING),
- E_USER_WARNING => array($bootLogger, LogLevel::WARNING),
- E_COMPILE_WARNING => array($bootLogger, LogLevel::WARNING),
- E_CORE_WARNING => array($bootLogger, LogLevel::WARNING),
- E_USER_ERROR => array($bootLogger, LogLevel::CRITICAL),
- E_RECOVERABLE_ERROR => array($bootLogger, LogLevel::CRITICAL),
- E_COMPILE_ERROR => array($bootLogger, LogLevel::CRITICAL),
- E_PARSE => array($bootLogger, LogLevel::CRITICAL),
- E_ERROR => array($bootLogger, LogLevel::CRITICAL),
- E_CORE_ERROR => array($bootLogger, LogLevel::CRITICAL),
- );
+ $loggers = [
+ E_DEPRECATED => [$bootLogger, LogLevel::INFO],
+ E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO],
+ E_NOTICE => [$bootLogger, LogLevel::WARNING],
+ E_USER_NOTICE => [$bootLogger, LogLevel::WARNING],
+ E_STRICT => [$bootLogger, LogLevel::WARNING],
+ E_WARNING => [$bootLogger, LogLevel::WARNING],
+ E_USER_WARNING => [$bootLogger, LogLevel::WARNING],
+ E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING],
+ E_CORE_WARNING => [$bootLogger, LogLevel::WARNING],
+ E_USER_ERROR => [$bootLogger, LogLevel::CRITICAL],
+ E_RECOVERABLE_ERROR => [$bootLogger, LogLevel::CRITICAL],
+ E_COMPILE_ERROR => [$bootLogger, LogLevel::CRITICAL],
+ E_PARSE => [$bootLogger, LogLevel::CRITICAL],
+ E_ERROR => [$bootLogger, LogLevel::CRITICAL],
+ E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL],
+ ];
- $this->assertSame($loggers, $handler->setLoggers(array()));
+ $this->assertSame($loggers, $handler->setLoggers([]));
- $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, array());
+ $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, []);
$logs = $bootLogger->cleanLogs();
@@ -405,14 +410,14 @@ class ErrorHandlerTest extends TestCase
$this->assertSame(123, $exception->getLine());
$this->assertSame(E_DEPRECATED, $exception->getSeverity());
- $bootLogger->log(LogLevel::WARNING, 'Foo message', array('exception' => $exception));
+ $bootLogger->log(LogLevel::WARNING, 'Foo message', ['exception' => $exception]);
$mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$mockLogger->expects($this->once())
->method('log')
- ->with(LogLevel::WARNING, 'Foo message', array('exception' => $exception));
+ ->with(LogLevel::WARNING, 'Foo message', ['exception' => $exception]);
- $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING)));
+ $handler->setLoggers([E_DEPRECATED => [$mockLogger, LogLevel::WARNING]]);
}
public function testSettingLoggerWhenExceptionIsBuffered()
@@ -425,7 +430,7 @@ class ErrorHandlerTest extends TestCase
$mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$mockLogger->expects($this->once())
->method('log')
- ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', array('exception' => $exception));
+ ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', ['exception' => $exception]);
$handler->setExceptionHandler(function () use ($handler, $mockLogger) {
$handler->setDefaultLogger($mockLogger);
@@ -439,12 +444,12 @@ class ErrorHandlerTest extends TestCase
try {
$handler = ErrorHandler::register();
- $error = array(
+ $error = [
'type' => E_PARSE,
'message' => 'foo',
'file' => 'bar',
'line' => 123,
- );
+ ];
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
@@ -457,7 +462,7 @@ class ErrorHandlerTest extends TestCase
$logger
->expects($this->once())
->method('log')
- ->will($this->returnCallback($logArgCheck))
+ ->willReturnCallback($logArgCheck)
;
$handler->setDefaultLogger($logger, E_PARSE);
@@ -476,7 +481,7 @@ class ErrorHandlerTest extends TestCase
public function testHandleErrorException()
{
- $exception = new \Error("Class 'Foo' not found");
+ $exception = new \Error("Class 'IReallyReallyDoNotExistAnywhereInTheRepositoryISwear' not found");
$handler = new ErrorHandler();
$handler->setExceptionHandler(function () use (&$args) {
@@ -486,7 +491,7 @@ class ErrorHandlerTest extends TestCase
$handler->handleException($exception);
$this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $args[0]);
- $this->assertStringStartsWith("Attempted to load class \"Foo\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage());
+ $this->assertStringStartsWith("Attempted to load class \"IReallyReallyDoNotExistAnywhereInTheRepositoryISwear\" from the global namespace.\nDid you forget a \"use\" statement", $args[0]->getMessage());
}
/**
@@ -501,4 +506,58 @@ class ErrorHandlerTest extends TestCase
$handler->handleException(new \Exception());
}
+
+ /**
+ * @dataProvider errorHandlerWhenLoggingProvider
+ */
+ public function testErrorHandlerWhenLogging($previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined)
+ {
+ try {
+ if ($previousHandlerWasDefined) {
+ set_error_handler('count');
+ }
+
+ $logger = $loggerSetsAnotherHandler ? new LoggerThatSetAnErrorHandler() : new NullLogger();
+
+ $handler = ErrorHandler::register();
+ $handler->setDefaultLogger($logger);
+
+ if ($nextHandlerIsDefined) {
+ $handler = ErrorHandlerThatUsesThePreviousOne::register();
+ }
+
+ @trigger_error('foo', E_USER_DEPRECATED);
+ @trigger_error('bar', E_USER_DEPRECATED);
+
+ $this->assertSame([$handler, 'handleError'], set_error_handler('var_dump'));
+
+ if ($logger instanceof LoggerThatSetAnErrorHandler) {
+ $this->assertCount(2, $logger->cleanLogs());
+ }
+
+ restore_error_handler();
+
+ if ($previousHandlerWasDefined) {
+ restore_error_handler();
+ }
+
+ if ($nextHandlerIsDefined) {
+ restore_error_handler();
+ }
+ } finally {
+ restore_error_handler();
+ restore_exception_handler();
+ }
+ }
+
+ public function errorHandlerWhenLoggingProvider()
+ {
+ foreach ([false, true] as $previousHandlerWasDefined) {
+ foreach ([false, true] as $loggerSetsAnotherHandler) {
+ foreach ([false, true] as $nextHandlerIsDefined) {
+ yield [$previousHandlerWasDefined, $loggerSetsAnotherHandler, $nextHandlerIsDefined];
+ }
+ }
+ }
+ }
}
diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
index 5b77b999..e86210b9 100644
--- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
+++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
@@ -61,7 +61,7 @@ class FlattenExceptionTest extends TestCase
$flattened = FlattenException::create(new ConflictHttpException());
$this->assertEquals('409', $flattened->getStatusCode());
- $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST')));
+ $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST']));
$this->assertEquals('405', $flattened->getStatusCode());
$flattened = FlattenException::create(new AccessDeniedHttpException());
@@ -96,23 +96,23 @@ class FlattenExceptionTest extends TestCase
public function testHeadersForHttpException()
{
- $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST')));
- $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders());
+ $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST']));
+ $this->assertEquals(['Allow' => 'POST'], $flattened->getHeaders());
$flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"'));
- $this->assertEquals(array('WWW-Authenticate' => 'Basic realm="My Realm"'), $flattened->getHeaders());
+ $this->assertEquals(['WWW-Authenticate' => 'Basic realm="My Realm"'], $flattened->getHeaders());
$flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
- $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders());
+ $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders());
$flattened = FlattenException::create(new ServiceUnavailableHttpException(120));
- $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders());
+ $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders());
$flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT'));
- $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders());
+ $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders());
$flattened = FlattenException::create(new TooManyRequestsHttpException(120));
- $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders());
+ $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders());
}
/**
@@ -162,7 +162,7 @@ class FlattenExceptionTest extends TestCase
$this->assertSame($flattened2, $flattened->getPrevious());
- $this->assertSame(array($flattened2), $flattened->getAllPrevious());
+ $this->assertSame([$flattened2], $flattened->getAllPrevious());
}
public function testPreviousError()
@@ -200,18 +200,18 @@ class FlattenExceptionTest extends TestCase
public function testToArray(\Throwable $exception, string $expectedClass)
{
$flattened = FlattenException::createFromThrowable($exception);
- $flattened->setTrace(array(), 'foo.php', 123);
+ $flattened->setTrace([], 'foo.php', 123);
- $this->assertEquals(array(
- array(
+ $this->assertEquals([
+ [
'message' => 'test',
'class' => $expectedClass,
- 'trace' => array(array(
+ 'trace' => [[
'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123,
- 'args' => array(),
- )),
- ),
- ), $flattened->toArray());
+ 'args' => [],
+ ]],
+ ],
+ ], $flattened->toArray());
}
public function testCreate()
@@ -229,10 +229,10 @@ class FlattenExceptionTest extends TestCase
public function flattenDataProvider()
{
- return array(
- array(new \Exception('test', 123), 'Exception'),
- array(new \Error('test', 123), 'Error'),
- );
+ return [
+ [new \Exception('test', 123), 'Exception'],
+ [new \Error('test', 123), 'Error'],
+ ];
}
public function testArguments()
@@ -242,15 +242,15 @@ class FlattenExceptionTest extends TestCase
$incomplete = unserialize('O:14:"BogusTestClass":0:{}');
- $exception = $this->createException(array(
- (object) array('foo' => 1),
+ $exception = $this->createException([
+ (object) ['foo' => 1],
new NotFoundHttpException(),
$incomplete,
$dh,
$fh,
function () {},
- array(1, 2),
- array('foo' => 123),
+ [1, 2],
+ ['foo' => 123],
null,
true,
false,
@@ -260,7 +260,7 @@ class FlattenExceptionTest extends TestCase
'',
INF,
NAN,
- ));
+ ]);
$flattened = FlattenException::create($exception);
$trace = $flattened->getTrace();
@@ -271,26 +271,26 @@ class FlattenExceptionTest extends TestCase
fclose($fh);
$i = 0;
- $this->assertSame(array('object', 'stdClass'), $array[$i++]);
- $this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]);
- $this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]);
- $this->assertSame(array('resource', 'stream'), $array[$i++]);
- $this->assertSame(array('resource', 'stream'), $array[$i++]);
+ $this->assertSame(['object', 'stdClass'], $array[$i++]);
+ $this->assertSame(['object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'], $array[$i++]);
+ $this->assertSame(['incomplete-object', 'BogusTestClass'], $array[$i++]);
+ $this->assertSame(['resource', 'stream'], $array[$i++]);
+ $this->assertSame(['resource', 'stream'], $array[$i++]);
$args = $array[$i++];
$this->assertSame($args[0], 'object');
$this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.');
- $this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]);
- $this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]);
- $this->assertSame(array('null', null), $array[$i++]);
- $this->assertSame(array('boolean', true), $array[$i++]);
- $this->assertSame(array('boolean', false), $array[$i++]);
- $this->assertSame(array('integer', 0), $array[$i++]);
- $this->assertSame(array('float', 0.0), $array[$i++]);
- $this->assertSame(array('string', '0'), $array[$i++]);
- $this->assertSame(array('string', ''), $array[$i++]);
- $this->assertSame(array('float', INF), $array[$i++]);
+ $this->assertSame(['array', [['integer', 1], ['integer', 2]]], $array[$i++]);
+ $this->assertSame(['array', ['foo' => ['integer', 123]]], $array[$i++]);
+ $this->assertSame(['null', null], $array[$i++]);
+ $this->assertSame(['boolean', true], $array[$i++]);
+ $this->assertSame(['boolean', false], $array[$i++]);
+ $this->assertSame(['integer', 0], $array[$i++]);
+ $this->assertSame(['float', 0.0], $array[$i++]);
+ $this->assertSame(['string', '0'], $array[$i++]);
+ $this->assertSame(['string', ''], $array[$i++]);
+ $this->assertSame(['float', INF], $array[$i++]);
// assertEquals() does not like NAN values.
$this->assertEquals($array[$i][0], 'float');
@@ -300,7 +300,7 @@ class FlattenExceptionTest extends TestCase
public function testRecursionInArguments()
{
$a = null;
- $a = array('foo', array(2, &$a));
+ $a = ['foo', [2, &$a]];
$exception = $this->createException($a);
$flattened = FlattenException::create($exception);
@@ -310,7 +310,7 @@ class FlattenExceptionTest extends TestCase
public function testTooBigArray()
{
- $a = array();
+ $a = [];
for ($i = 0; $i < 20; ++$i) {
for ($j = 0; $j < 50; ++$j) {
for ($k = 0; $k < 10; ++$k) {
@@ -325,7 +325,7 @@ class FlattenExceptionTest extends TestCase
$flattened = FlattenException::create($exception);
$trace = $flattened->getTrace();
- $this->assertSame($trace[1]['args'][0], array('array', array('array', '*SKIPPED over 10000 entries*')));
+ $this->assertSame($trace[1]['args'][0], ['array', ['array', '*SKIPPED over 10000 entries*']]);
$serializeTrace = serialize($trace);
@@ -346,6 +346,41 @@ class FlattenExceptionTest extends TestCase
$this->assertSame('Class "RuntimeException@anonymous" blah.', $flattened->getMessage());
}
+ public function testToStringEmptyMessage()
+ {
+ $exception = new \RuntimeException();
+
+ $flattened = FlattenException::create($exception);
+
+ $this->assertSame($exception->getTraceAsString(), $flattened->getTraceAsString());
+ $this->assertSame($exception->__toString(), $flattened->getAsString());
+ }
+
+ public function testToString()
+ {
+ $test = function ($a, $b, $c, $d) {
+ return new \RuntimeException('This is a test message');
+ };
+
+ $exception = $test('foo123', 1, null, 1.5);
+
+ $flattened = FlattenException::create($exception);
+
+ $this->assertSame($exception->getTraceAsString(), $flattened->getTraceAsString());
+ $this->assertSame($exception->__toString(), $flattened->getAsString());
+ }
+
+ public function testToStringParent()
+ {
+ $exception = new \LogicException('This is message 1');
+ $exception = new \RuntimeException('This is messsage 2', 500, $exception);
+
+ $flattened = FlattenException::create($exception);
+
+ $this->assertSame($exception->getTraceAsString(), $flattened->getTraceAsString());
+ $this->assertSame($exception->__toString(), $flattened->getAsString());
+ }
+
private function createException($foo)
{
return new \Exception();
diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
index 6ff6a74f..4910fe5e 100644
--- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
+++ b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php
@@ -48,8 +48,17 @@ class ExceptionHandlerTest extends TestCase
$handler->sendPhpResponse(new \RuntimeException('Foo'));
$response = ob_get_clean();
- $this->assertContains('Whoops, looks like something went wrong.', $response);
+ $this->assertContains('
Foo
', $response);
$this->assertContains('', $response);
+
+ // taken from https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
+ $htmlWithXss = '
click me! ';
+ ob_start();
+ $handler->sendPhpResponse(new \RuntimeException($htmlWithXss));
+ $response = ob_get_clean();
+
+ $this->assertContains(sprintf('
%s
', htmlspecialchars($htmlWithXss, ENT_COMPAT | ENT_SUBSTITUTE, 'UTF-8')), $response);
}
public function testStatusCode()
@@ -62,10 +71,10 @@ class ExceptionHandlerTest extends TestCase
$this->assertContains('Sorry, the page you are looking for could not be found.', $response);
- $expectedHeaders = array(
- array('HTTP/1.0 404', true, null),
- array('Content-Type: text/html; charset=iso8859-1', true, null),
- );
+ $expectedHeaders = [
+ ['HTTP/1.0 404', true, null],
+ ['Content-Type: text/html; charset=iso8859-1', true, null],
+ ];
$this->assertSame($expectedHeaders, testHeader());
}
@@ -75,14 +84,14 @@ class ExceptionHandlerTest extends TestCase
$handler = new ExceptionHandler(false, 'iso8859-1');
ob_start();
- $handler->sendPhpResponse(new MethodNotAllowedHttpException(array('POST')));
+ $handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST']));
$response = ob_get_clean();
- $expectedHeaders = array(
- array('HTTP/1.0 405', true, null),
- array('Allow: POST', false, null),
- array('Content-Type: text/html; charset=iso8859-1', true, null),
- );
+ $expectedHeaders = [
+ ['HTTP/1.0 405', true, null],
+ ['Allow: POST', false, null],
+ ['Content-Type: text/html; charset=iso8859-1', true, null],
+ ];
$this->assertSame($expectedHeaders, testHeader());
}
@@ -101,7 +110,7 @@ class ExceptionHandlerTest extends TestCase
{
$exception = new \Exception('foo');
- $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock();
+ $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock();
$handler
->expects($this->exactly(2))
->method('sendPhpResponse');
@@ -119,7 +128,7 @@ class ExceptionHandlerTest extends TestCase
{
$exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__);
- $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock();
+ $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock();
$handler
->expects($this->once())
->method('sendPhpResponse');
diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
index 5cdac2f1..8e615ac6 100644
--- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
@@ -72,85 +72,85 @@ class ClassNotFoundFatalErrorHandlerTest extends TestCase
$autoloader = new ComposerClassLoader();
$autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception'));
- $debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass'));
+ $debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']);
- return array(
- array(
- array(
+ return [
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'WhizBangFactory\' not found',
- ),
+ ],
"Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found',
- ),
+ ],
"Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'UndefinedFunctionException\' not found',
- ),
+ ],
"Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'PEARClass\' not found',
- ),
+ ],
"Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
- ),
+ ],
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
- ),
+ ],
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
- array($autoloader, 'loadClass'),
- ),
- array(
- array(
+ [$autoloader, 'loadClass'],
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
- ),
+ ],
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?",
- array($debugClassLoader, 'loadClass'),
- ),
- array(
- array(
+ [$debugClassLoader, 'loadClass'],
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found',
- ),
+ ],
"Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?",
function ($className) { /* do nothing here */ },
- ),
- );
+ ],
+ ];
}
public function testCannotRedeclareClass()
@@ -161,12 +161,12 @@ class ClassNotFoundFatalErrorHandlerTest extends TestCase
require_once __DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP';
- $error = array(
+ $error = [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Class \'Foo\\Bar\\RequiredTwice\' not found',
- );
+ ];
$handler = new ClassNotFoundFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
index 60153fc5..de9994e4 100644
--- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
@@ -35,44 +35,44 @@ class UndefinedFunctionFatalErrorHandlerTest extends TestCase
public function provideUndefinedFunctionData()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined function test_namespaced_function()',
- ),
+ ],
"Attempted to call function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined function Foo\\Bar\\Baz\\test_namespaced_function()',
- ),
+ ],
"Attempted to call function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined function foo()',
- ),
+ ],
'Attempted to call function "foo" from the global namespace.',
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined function Foo\\Bar\\Baz\\foo()',
- ),
+ ],
'Attempted to call function "foo" from namespace "Foo\Bar\Baz".',
- ),
- );
+ ],
+ ];
}
}
diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
index a2647f57..268a8413 100644
--- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
@@ -34,43 +34,43 @@ class UndefinedMethodFatalErrorHandlerTest extends TestCase
public function provideUndefinedMethodData()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined method SplObjectStorage::what()',
- ),
+ ],
'Attempted to call an undefined method named "what" of class "SplObjectStorage".',
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined method SplObjectStorage::walid()',
- ),
+ ],
"Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'line' => 12,
'file' => 'foo.php',
'message' => 'Call to undefined method SplObjectStorage::offsetFet()',
- ),
+ ],
"Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?",
- ),
- array(
- array(
+ ],
+ [
+ [
'type' => 1,
'message' => 'Call to undefined method class@anonymous::test()',
'file' => '/home/possum/work/symfony/test.php',
'line' => 11,
- ),
+ ],
'Attempted to call an undefined method named "test" of class "class@anonymous".',
- ),
- );
+ ],
+ ];
}
}
diff --git a/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php b/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php
new file mode 100644
index 00000000..ff6976e0
--- /dev/null
+++ b/vendor/symfony/debug/Tests/Fixtures/DefinitionInEvaluatedCode.php
@@ -0,0 +1,11 @@
+setExceptionHandler('print_r');
if (true) {
- class Broken implements \Serializable
+ class Broken implements \JsonSerializable
{
}
}
@@ -37,6 +37,6 @@ array(1) {
}
object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
["message":protected]=>
- string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)"
+ string(179) "Error: Class Symfony\Component\Debug\Broken contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (JsonSerializable::jsonSerialize)"
%a
}
diff --git a/vendor/symfony/debug/composer.json b/vendor/symfony/debug/composer.json
index 45799e2e..7fd5ff9c 100644
--- a/vendor/symfony/debug/composer.json
+++ b/vendor/symfony/debug/composer.json
@@ -34,7 +34,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/event-dispatcher-contracts/Event.php b/vendor/symfony/event-dispatcher-contracts/Event.php
new file mode 100644
index 00000000..84f60f3e
--- /dev/null
+++ b/vendor/symfony/event-dispatcher-contracts/Event.php
@@ -0,0 +1,96 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Contracts\EventDispatcher;
+
+use Psr\EventDispatcher\StoppableEventInterface;
+
+if (interface_exists(StoppableEventInterface::class)) {
+ /**
+ * Event is the base class for classes containing event data.
+ *
+ * This class contains no event data. It is used by events that do not pass
+ * state information to an event handler when an event is raised.
+ *
+ * You can call the method stopPropagation() to abort the execution of
+ * further listeners in your event listener.
+ *
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Bernhard Schussek
+ * @author Nicolas Grekas
+ */
+ class Event implements StoppableEventInterface
+ {
+ private $propagationStopped = false;
+
+ /**
+ * Returns whether further event listeners should be triggered.
+ */
+ public function isPropagationStopped(): bool
+ {
+ return $this->propagationStopped;
+ }
+
+ /**
+ * Stops the propagation of the event to further event listeners.
+ *
+ * If multiple event listeners are connected to the same event, no
+ * further event listener will be triggered once any trigger calls
+ * stopPropagation().
+ */
+ public function stopPropagation(): void
+ {
+ $this->propagationStopped = true;
+ }
+ }
+} else {
+ /**
+ * Event is the base class for classes containing event data.
+ *
+ * This class contains no event data. It is used by events that do not pass
+ * state information to an event handler when an event is raised.
+ *
+ * You can call the method stopPropagation() to abort the execution of
+ * further listeners in your event listener.
+ *
+ * @author Guilherme Blanco
+ * @author Jonathan Wage
+ * @author Roman Borschel
+ * @author Bernhard Schussek
+ * @author Nicolas Grekas
+ */
+ class Event
+ {
+ private $propagationStopped = false;
+
+ /**
+ * Returns whether further event listeners should be triggered.
+ */
+ public function isPropagationStopped(): bool
+ {
+ return $this->propagationStopped;
+ }
+
+ /**
+ * Stops the propagation of the event to further event listeners.
+ *
+ * If multiple event listeners are connected to the same event, no
+ * further event listener will be triggered once any trigger calls
+ * stopPropagation().
+ */
+ public function stopPropagation(): void
+ {
+ $this->propagationStopped = true;
+ }
+ }
+}
diff --git a/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php
new file mode 100644
index 00000000..9b1a69ad
--- /dev/null
+++ b/vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Contracts\EventDispatcher;
+
+use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
+
+if (interface_exists(PsrEventDispatcherInterface::class)) {
+ /**
+ * Allows providing hooks on domain-specific lifecycles by dispatching events.
+ */
+ interface EventDispatcherInterface extends PsrEventDispatcherInterface
+ {
+ /**
+ * Dispatches an event to all registered listeners.
+ *
+ * For BC with Symfony 4, the $eventName argument is not declared explicitly on the
+ * signature of the method. Implementations that are not bound by this BC contraint
+ * MUST declare it explicitly, as allowed by PHP.
+ *
+ * @param object $event The event to pass to the event handlers/listeners
+ * @param string|null $eventName The name of the event to dispatch. If not supplied,
+ * the class of $event should be used instead.
+ *
+ * @return object The passed $event MUST be returned
+ */
+ public function dispatch($event/*, string $eventName = null*/);
+ }
+} else {
+ /**
+ * Allows providing hooks on domain-specific lifecycles by dispatching events.
+ */
+ interface EventDispatcherInterface
+ {
+ /**
+ * Dispatches an event to all registered listeners.
+ *
+ * For BC with Symfony 4, the $eventName argument is not declared explicitly on the
+ * signature of the method. Implementations that are not bound by this BC contraint
+ * MUST declare it explicitly, as allowed by PHP.
+ *
+ * @param object $event The event to pass to the event handlers/listeners
+ * @param string|null $eventName The name of the event to dispatch. If not supplied,
+ * the class of $event should be used instead.
+ *
+ * @return object The passed $event MUST be returned
+ */
+ public function dispatch($event/*, string $eventName = null*/);
+ }
+}
diff --git a/vendor/symfony/contracts/LICENSE b/vendor/symfony/event-dispatcher-contracts/LICENSE
similarity index 96%
rename from vendor/symfony/contracts/LICENSE
rename to vendor/symfony/event-dispatcher-contracts/LICENSE
index ad399a79..3f853aaf 100644
--- a/vendor/symfony/contracts/LICENSE
+++ b/vendor/symfony/event-dispatcher-contracts/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2018 Fabien Potencier
+Copyright (c) 2018-2019 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/symfony/event-dispatcher-contracts/README.md b/vendor/symfony/event-dispatcher-contracts/README.md
new file mode 100644
index 00000000..fb051c73
--- /dev/null
+++ b/vendor/symfony/event-dispatcher-contracts/README.md
@@ -0,0 +1,9 @@
+Symfony EventDispatcher Contracts
+=================================
+
+A set of abstractions extracted out of the Symfony components.
+
+Can be used to build on semantics that the Symfony components proved useful - and
+that already have battle tested implementations.
+
+See https://github.com/symfony/contracts/blob/master/README.md for more information.
diff --git a/vendor/symfony/event-dispatcher-contracts/composer.json b/vendor/symfony/event-dispatcher-contracts/composer.json
new file mode 100644
index 00000000..55802a49
--- /dev/null
+++ b/vendor/symfony/event-dispatcher-contracts/composer.json
@@ -0,0 +1,34 @@
+{
+ "name": "symfony/event-dispatcher-contracts",
+ "type": "library",
+ "description": "Generic abstractions related to dispatching event",
+ "keywords": ["abstractions", "contracts", "decoupling", "interfaces", "interoperability", "standards"],
+ "homepage": "https://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": "^7.1.3"
+ },
+ "suggest": {
+ "psr/event-dispatcher": "",
+ "symfony/event-dispatcher-implementation": ""
+ },
+ "autoload": {
+ "psr-4": { "Symfony\\Contracts\\EventDispatcher\\": "" }
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ }
+}
diff --git a/vendor/symfony/event-dispatcher/CHANGELOG.md b/vendor/symfony/event-dispatcher/CHANGELOG.md
index b581d314..7653cad1 100644
--- a/vendor/symfony/event-dispatcher/CHANGELOG.md
+++ b/vendor/symfony/event-dispatcher/CHANGELOG.md
@@ -1,6 +1,12 @@
CHANGELOG
=========
+4.3.0
+-----
+
+ * The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated
+ * deprecated the `Event` class, use `Symfony\Contracts\EventDispatcher\Event` instead
+
4.1.0
-----
diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
index d421941f..7716d866 100644
--- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
+++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
@@ -11,11 +11,17 @@
namespace Symfony\Component\EventDispatcher\Debug;
+use Psr\EventDispatcher\StoppableEventInterface;
use Psr\Log\LoggerInterface;
+use Symfony\Component\BrowserKit\Request;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Component\EventDispatcher\LegacyEventProxy;
+use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Stopwatch\Stopwatch;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
/**
* Collects some data about event listeners.
@@ -33,14 +39,17 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
private $dispatcher;
private $wrappedListeners;
private $orphanedEvents;
+ private $requestStack;
+ private $currentRequestHash = '';
- public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null)
+ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null)
{
- $this->dispatcher = $dispatcher;
+ $this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
$this->stopwatch = $stopwatch;
$this->logger = $logger;
- $this->wrappedListeners = array();
- $this->orphanedEvents = array();
+ $this->wrappedListeners = [];
+ $this->orphanedEvents = [];
+ $this->requestStack = $requestStack;
}
/**
@@ -121,37 +130,52 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
/**
* {@inheritdoc}
+ *
+ * @param string|null $eventName
*/
- public function dispatch($eventName, Event $event = null)
+ public function dispatch($event/*, string $eventName = null*/)
{
if (null === $this->callStack) {
$this->callStack = new \SplObjectStorage();
}
- if (null === $event) {
- $event = new Event();
+ $currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
+ $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
+
+ if (\is_object($event)) {
+ $eventName = $eventName ?? \get_class($event);
+ } else {
+ @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED);
+ $swap = $event;
+ $event = $eventName ?? new Event();
+ $eventName = $swap;
+
+ if (!$event instanceof Event) {
+ throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
+ }
}
- if (null !== $this->logger && $event->isPropagationStopped()) {
+ if (null !== $this->logger && ($event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface) && $event->isPropagationStopped()) {
$this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
}
$this->preProcess($eventName);
try {
- $this->preDispatch($eventName, $event);
+ $this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
- $this->dispatcher->dispatch($eventName, $event);
+ $this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
} finally {
- $this->postDispatch($eventName, $event);
+ $this->afterDispatch($eventName, $event);
}
} finally {
+ $this->currentRequestHash = $currentRequestHash;
$this->postProcess($eventName);
}
@@ -160,18 +184,22 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
/**
* {@inheritdoc}
+ *
+ * @param Request|null $request The request to get listeners for
*/
- public function getCalledListeners()
+ public function getCalledListeners(/* Request $request = null */)
{
if (null === $this->callStack) {
- return array();
+ return [];
}
- $called = array();
+ $hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
+ $called = [];
foreach ($this->callStack as $listener) {
- list($eventName) = $this->callStack->getInfo();
-
- $called[] = $listener->getInfo($eventName);
+ list($eventName, $requestHash) = $this->callStack->getInfo();
+ if (null === $hash || $hash === $requestHash) {
+ $called[] = $listener->getInfo($eventName);
+ }
}
return $called;
@@ -179,27 +207,31 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
/**
* {@inheritdoc}
+ *
+ * @param Request|null $request The request to get listeners for
*/
- public function getNotCalledListeners()
+ public function getNotCalledListeners(/* Request $request = null */)
{
try {
$allListeners = $this->getListeners();
} catch (\Exception $e) {
if (null !== $this->logger) {
- $this->logger->info('An exception was thrown while getting the uncalled listeners.', array('exception' => $e));
+ $this->logger->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]);
}
// unable to retrieve the uncalled listeners
- return array();
+ return [];
}
- $notCalled = array();
+ $hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
+ $notCalled = [];
foreach ($allListeners as $eventName => $listeners) {
foreach ($listeners as $listener) {
$called = false;
if (null !== $this->callStack) {
foreach ($this->callStack as $calledListener) {
- if ($calledListener->getWrappedListener() === $listener) {
+ list(, $requestHash) = $this->callStack->getInfo();
+ if ((null === $hash || $hash === $requestHash) && $calledListener->getWrappedListener() === $listener) {
$called = true;
break;
@@ -216,20 +248,32 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
}
}
- uasort($notCalled, array($this, 'sortNotCalledListeners'));
+ uasort($notCalled, [$this, 'sortNotCalledListeners']);
return $notCalled;
}
- public function getOrphanedEvents(): array
+ /**
+ * @param Request|null $request The request to get orphaned events for
+ */
+ public function getOrphanedEvents(/* Request $request = null */): array
{
- return $this->orphanedEvents;
+ if (1 <= \func_num_args() && null !== $request = \func_get_arg(0)) {
+ return $this->orphanedEvents[spl_object_hash($request)] ?? [];
+ }
+
+ if (!$this->orphanedEvents) {
+ return [];
+ }
+
+ return array_merge(...array_values($this->orphanedEvents));
}
public function reset()
{
$this->callStack = null;
- $this->orphanedEvents = array();
+ $this->orphanedEvents = [];
+ $this->currentRequestHash = '';
}
/**
@@ -248,18 +292,32 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
/**
* Called before dispatching the event.
*
- * @param string $eventName The event name
- * @param Event $event The event
+ * @param object $event
+ */
+ protected function beforeDispatch(string $eventName, $event)
+ {
+ $this->preDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
+ }
+
+ /**
+ * Called after dispatching the event.
+ *
+ * @param object $event
+ */
+ protected function afterDispatch(string $eventName, $event)
+ {
+ $this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event));
+ }
+
+ /**
+ * @deprecated since Symfony 4.3, will be removed in 5.0, use beforeDispatch instead
*/
protected function preDispatch($eventName, Event $event)
{
}
/**
- * Called after dispatching the event.
- *
- * @param string $eventName The event name
- * @param Event $event The event
+ * @deprecated since Symfony 4.3, will be removed in 5.0, use afterDispatch instead
*/
protected function postDispatch($eventName, Event $event)
{
@@ -268,7 +326,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
private function preProcess($eventName)
{
if (!$this->dispatcher->hasListeners($eventName)) {
- $this->orphanedEvents[] = $eventName;
+ $this->orphanedEvents[$this->currentRequestHash][] = $eventName;
return;
}
@@ -279,7 +337,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
$this->wrappedListeners[$eventName][] = $wrappedListener;
$this->dispatcher->removeListener($eventName, $listener);
$this->dispatcher->addListener($eventName, $wrappedListener, $priority);
- $this->callStack->attach($wrappedListener, array($eventName));
+ $this->callStack->attach($wrappedListener, [$eventName, $this->currentRequestHash]);
}
}
@@ -297,17 +355,13 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
$this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority);
if (null !== $this->logger) {
- $context = array('event' => $eventName, 'listener' => $listener->getPretty());
+ $context = ['event' => $eventName, 'listener' => $listener->getPretty()];
}
if ($listener->wasCalled()) {
if (null !== $this->logger) {
$this->logger->debug('Notified event "{event}" to listener "{listener}".', $context);
}
-
- if (!isset($this->called[$eventName])) {
- $this->called[$eventName] = new \SplObjectStorage();
- }
} else {
$this->callStack->detach($listener);
}
diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
index cd4d7470..4fedb9a4 100644
--- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
+++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\EventDispatcher\Debug;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Service\ResetInterface;
/**
@@ -24,14 +25,18 @@ interface TraceableEventDispatcherInterface extends EventDispatcherInterface, Re
/**
* Gets the called listeners.
*
+ * @param Request|null $request The request to get listeners for
+ *
* @return array An array of called listeners
*/
- public function getCalledListeners();
+ public function getCalledListeners(/* Request $request = null */);
/**
* Gets the not called listeners.
*
+ * @param Request|null $request The request to get listeners for
+ *
* @return array An array of not called listeners
*/
- public function getNotCalledListeners();
+ public function getNotCalledListeners(/* Request $request = null */);
}
diff --git a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php
index 6acaa38e..e0476390 100644
--- a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php
+++ b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php
@@ -11,17 +11,23 @@
namespace Symfony\Component\EventDispatcher\Debug;
+use Psr\EventDispatcher\StoppableEventInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\LegacyEventProxy;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\VarDumper\Caster\ClassStub;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
/**
* @author Fabien Potencier
+ *
+ * @final since Symfony 4.3: the "Event" type-hint on __invoke() will be replaced by "object" in 5.0
*/
class WrappedListener
{
private $listener;
+ private $optimizedListener;
private $name;
private $called;
private $stoppedPropagation;
@@ -29,11 +35,13 @@ class WrappedListener
private $dispatcher;
private $pretty;
private $stub;
+ private $priority;
private static $hasClassStub;
- public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
+ public function __construct($listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
{
$this->listener = $listener;
+ $this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? \Closure::fromCallable($listener) : null);
$this->stopwatch = $stopwatch;
$this->dispatcher = $dispatcher;
$this->called = false;
@@ -94,27 +102,34 @@ class WrappedListener
$this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()';
}
- return array(
+ return [
'event' => $eventName,
- 'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null,
+ 'priority' => null !== $this->priority ? $this->priority : (null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null),
'pretty' => $this->pretty,
'stub' => $this->stub,
- );
+ ];
}
public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher)
{
+ if ($event instanceof LegacyEventProxy) {
+ $event = $event->getEvent();
+ }
+
+ $dispatcher = $this->dispatcher ?: $dispatcher;
+
$this->called = true;
+ $this->priority = $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
- ($this->listener)($event, $eventName, $this->dispatcher ?: $dispatcher);
+ ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
if ($e->isStarted()) {
$e->stop();
}
- if ($event->isPropagationStopped()) {
+ if (($event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface) && $event->isPropagationStopped()) {
$this->stoppedPropagation = true;
}
}
diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
index 4c8db4c6..3e6493eb 100644
--- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
+++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
@@ -27,15 +27,17 @@ class RegisterListenersPass implements CompilerPassInterface
protected $dispatcherService;
protected $listenerTag;
protected $subscriberTag;
+ protected $eventAliasesParameter;
- private $hotPathEvents = array();
+ private $hotPathEvents = [];
private $hotPathTagName;
- public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber')
+ public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber', string $eventAliasesParameter = 'event_dispatcher.event_aliases')
{
$this->dispatcherService = $dispatcherService;
$this->listenerTag = $listenerTag;
$this->subscriberTag = $subscriberTag;
+ $this->eventAliasesParameter = $eventAliasesParameter;
}
public function setHotPathEvents(array $hotPathEvents, $tagName = 'container.hot_path')
@@ -52,6 +54,12 @@ class RegisterListenersPass implements CompilerPassInterface
return;
}
+ if ($container->hasParameter($this->eventAliasesParameter)) {
+ $aliases = $container->getParameter($this->eventAliasesParameter);
+ $container->getParameterBag()->remove($this->eventAliasesParameter);
+ } else {
+ $aliases = [];
+ }
$definition = $container->findDefinition($this->dispatcherService);
foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) {
@@ -61,12 +69,13 @@ class RegisterListenersPass implements CompilerPassInterface
if (!isset($event['event'])) {
throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag));
}
+ $event['event'] = $aliases[$event['event']] ?? $event['event'];
if (!isset($event['method'])) {
- $event['method'] = 'on'.preg_replace_callback(array(
+ $event['method'] = 'on'.preg_replace_callback([
'/(?<=\b)[a-z]/i',
'/[^a-z0-9]/i',
- ), function ($matches) { return strtoupper($matches[0]); }, $event['event']);
+ ], function ($matches) { return strtoupper($matches[0]); }, $event['event']);
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method']) && $r->hasMethod('__invoke')) {
@@ -74,7 +83,7 @@ class RegisterListenersPass implements CompilerPassInterface
}
}
- $definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority));
+ $definition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]);
if (isset($this->hotPathEvents[$event['event']])) {
$container->getDefinition($id)->addTag($this->hotPathTagName);
@@ -98,17 +107,19 @@ class RegisterListenersPass implements CompilerPassInterface
}
$class = $r->name;
+ ExtractingEventDispatcher::$aliases = $aliases;
ExtractingEventDispatcher::$subscriber = $class;
$extractingDispatcher->addSubscriber($extractingDispatcher);
foreach ($extractingDispatcher->listeners as $args) {
- $args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]);
+ $args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]];
$definition->addMethodCall('addListener', $args);
if (isset($this->hotPathEvents[$args[0]])) {
- $container->getDefinition($id)->addTag('container.hot_path');
+ $container->getDefinition($id)->addTag($this->hotPathTagName);
}
}
- $extractingDispatcher->listeners = array();
+ $extractingDispatcher->listeners = [];
+ ExtractingEventDispatcher::$aliases = [];
}
}
}
@@ -118,19 +129,24 @@ class RegisterListenersPass implements CompilerPassInterface
*/
class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface
{
- public $listeners = array();
+ public $listeners = [];
+ public static $aliases = [];
public static $subscriber;
public function addListener($eventName, $listener, $priority = 0)
{
- $this->listeners[] = array($eventName, $listener[1], $priority);
+ $this->listeners[] = [$eventName, $listener[1], $priority];
}
public static function getSubscribedEvents()
{
- $callback = array(self::$subscriber, 'getSubscribedEvents');
+ $events = [];
- return $callback();
+ foreach ([self::$subscriber, 'getSubscribedEvents']() as $eventName => $params) {
+ $events[self::$aliases[$eventName] ?? $eventName] = $params;
+ }
+
+ return $events;
}
}
diff --git a/vendor/symfony/event-dispatcher/Event.php b/vendor/symfony/event-dispatcher/Event.php
index 9c56b2f5..307c4be5 100644
--- a/vendor/symfony/event-dispatcher/Event.php
+++ b/vendor/symfony/event-dispatcher/Event.php
@@ -12,32 +12,16 @@
namespace Symfony\Component\EventDispatcher;
/**
- * Event is the base class for classes containing event data.
- *
- * This class contains no event data. It is used by events that do not pass
- * state information to an event handler when an event is raised.
- *
- * You can call the method stopPropagation() to abort the execution of
- * further listeners in your event listener.
- *
- * @author Guilherme Blanco
- * @author Jonathan Wage
- * @author Roman Borschel
- * @author Bernhard Schussek
+ * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
*/
class Event
{
- /**
- * @var bool Whether no further event listeners should be triggered
- */
private $propagationStopped = false;
/**
- * Returns whether further event listeners should be triggered.
- *
- * @see Event::stopPropagation()
- *
* @return bool Whether propagation was already stopped for this event
+ *
+ * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
*/
public function isPropagationStopped()
{
@@ -45,11 +29,7 @@ class Event
}
/**
- * Stops the propagation of the event to further event listeners.
- *
- * If multiple event listeners are connected to the same event, no
- * further event listener will be triggered once any trigger calls
- * stopPropagation().
+ * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead
*/
public function stopPropagation()
{
diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php
index 4c90ce5b..e68918c3 100644
--- a/vendor/symfony/event-dispatcher/EventDispatcher.php
+++ b/vendor/symfony/event-dispatcher/EventDispatcher.php
@@ -11,6 +11,10 @@
namespace Symfony\Component\EventDispatcher;
+use Psr\EventDispatcher\StoppableEventInterface;
+use Symfony\Component\EventDispatcher\Debug\WrappedListener;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
+
/**
* The EventDispatcherInterface is the central point of Symfony's event listener system.
*
@@ -28,20 +32,47 @@ namespace Symfony\Component\EventDispatcher;
*/
class EventDispatcher implements EventDispatcherInterface
{
- private $listeners = array();
- private $sorted = array();
+ private $listeners = [];
+ private $sorted = [];
+ private $optimized;
+
+ public function __construct()
+ {
+ if (__CLASS__ === \get_class($this)) {
+ $this->optimized = [];
+ }
+ }
/**
* {@inheritdoc}
+ *
+ * @param string|null $eventName
*/
- public function dispatch($eventName, Event $event = null)
+ public function dispatch($event/*, string $eventName = null*/)
{
- if (null === $event) {
- $event = new Event();
+ $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
+
+ if (\is_object($event)) {
+ $eventName = $eventName ?? \get_class($event);
+ } else {
+ @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED);
+ $swap = $event;
+ $event = $eventName ?? new Event();
+ $eventName = $swap;
+
+ if (!$event instanceof Event) {
+ throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
+ }
}
- if ($listeners = $this->getListeners($eventName)) {
- $this->doDispatch($listeners, $eventName, $event);
+ if (null !== $this->optimized && null !== $eventName) {
+ $listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
+ } else {
+ $listeners = $this->getListeners($eventName);
+ }
+
+ if ($listeners) {
+ $this->callListeners($listeners, $eventName, $event);
}
return $event;
@@ -54,7 +85,7 @@ class EventDispatcher implements EventDispatcherInterface
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
- return array();
+ return [];
}
if (!isset($this->sorted[$eventName])) {
@@ -86,11 +117,10 @@ class EventDispatcher implements EventDispatcherInterface
$listener[0] = $listener[0]();
}
- foreach ($this->listeners[$eventName] as $priority => $listeners) {
- foreach ($listeners as $k => $v) {
+ foreach ($this->listeners[$eventName] as $priority => &$listeners) {
+ foreach ($listeners as &$v) {
if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
$v[0] = $v[0]();
- $this->listeners[$eventName][$priority][$k] = $v;
}
if ($v === $listener) {
return $priority;
@@ -123,7 +153,7 @@ class EventDispatcher implements EventDispatcherInterface
public function addListener($eventName, $listener, $priority = 0)
{
$this->listeners[$eventName][$priority][] = $listener;
- unset($this->sorted[$eventName]);
+ unset($this->sorted[$eventName], $this->optimized[$eventName]);
}
/**
@@ -139,21 +169,17 @@ class EventDispatcher implements EventDispatcherInterface
$listener[0] = $listener[0]();
}
- foreach ($this->listeners[$eventName] as $priority => $listeners) {
- foreach ($listeners as $k => $v) {
+ foreach ($this->listeners[$eventName] as $priority => &$listeners) {
+ foreach ($listeners as $k => &$v) {
if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) {
$v[0] = $v[0]();
}
if ($v === $listener) {
- unset($listeners[$k], $this->sorted[$eventName]);
- } else {
- $listeners[$k] = $v;
+ unset($listeners[$k], $this->sorted[$eventName], $this->optimized[$eventName]);
}
}
- if ($listeners) {
- $this->listeners[$eventName][$priority] = $listeners;
- } else {
+ if (!$listeners) {
unset($this->listeners[$eventName][$priority]);
}
}
@@ -166,12 +192,12 @@ class EventDispatcher implements EventDispatcherInterface
{
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_string($params)) {
- $this->addListener($eventName, array($subscriber, $params));
+ $this->addListener($eventName, [$subscriber, $params]);
} elseif (\is_string($params[0])) {
- $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
+ $this->addListener($eventName, [$subscriber, $params[0]], isset($params[1]) ? $params[1] : 0);
} else {
foreach ($params as $listener) {
- $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
+ $this->addListener($eventName, [$subscriber, $listener[0]], isset($listener[1]) ? $listener[1] : 0);
}
}
}
@@ -185,10 +211,10 @@ class EventDispatcher implements EventDispatcherInterface
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
if (\is_array($params) && \is_array($params[0])) {
foreach ($params as $listener) {
- $this->removeListener($eventName, array($subscriber, $listener[0]));
+ $this->removeListener($eventName, [$subscriber, $listener[0]]);
}
} else {
- $this->removeListener($eventName, array($subscriber, \is_string($params) ? $params : $params[0]));
+ $this->removeListener($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]);
}
}
}
@@ -201,7 +227,29 @@ class EventDispatcher implements EventDispatcherInterface
*
* @param callable[] $listeners The event listeners
* @param string $eventName The name of the event to dispatch
- * @param Event $event The event object to pass to the event handlers/listeners
+ * @param object $event The event object to pass to the event handlers/listeners
+ */
+ protected function callListeners(iterable $listeners, string $eventName, $event)
+ {
+ if ($event instanceof Event) {
+ $this->doDispatch($listeners, $eventName, $event);
+
+ return;
+ }
+
+ $stoppable = $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
+
+ foreach ($listeners as $listener) {
+ if ($stoppable && $event->isPropagationStopped()) {
+ break;
+ }
+ // @deprecated: the ternary operator is part of a BC layer and should be removed in 5.0
+ $listener($listener instanceof WrappedListener ? new LegacyEventProxy($event) : $event, $eventName, $this);
+ }
+ }
+
+ /**
+ * @deprecated since Symfony 4.3, use callListeners() instead
*/
protected function doDispatch($listeners, $eventName, Event $event)
{
@@ -215,22 +263,46 @@ class EventDispatcher implements EventDispatcherInterface
/**
* Sorts the internal list of listeners for the given event by priority.
- *
- * @param string $eventName The name of the event
*/
- private function sortListeners($eventName)
+ private function sortListeners(string $eventName)
{
krsort($this->listeners[$eventName]);
- $this->sorted[$eventName] = array();
+ $this->sorted[$eventName] = [];
- foreach ($this->listeners[$eventName] as $priority => $listeners) {
+ foreach ($this->listeners[$eventName] as &$listeners) {
foreach ($listeners as $k => $listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
- $this->listeners[$eventName][$priority][$k] = $listener;
}
$this->sorted[$eventName][] = $listener;
}
}
}
+
+ /**
+ * Optimizes the internal list of listeners for the given event by priority.
+ */
+ private function optimizeListeners(string $eventName): array
+ {
+ krsort($this->listeners[$eventName]);
+ $this->optimized[$eventName] = [];
+
+ foreach ($this->listeners[$eventName] as &$listeners) {
+ foreach ($listeners as &$listener) {
+ $closure = &$this->optimized[$eventName][];
+ if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
+ $closure = static function (...$args) use (&$listener, &$closure) {
+ if ($listener[0] instanceof \Closure) {
+ $listener[0] = $listener[0]();
+ }
+ ($closure = \Closure::fromCallable($listener))(...$args);
+ };
+ } else {
+ $closure = $listener instanceof \Closure || $listener instanceof WrappedListener ? $listener : \Closure::fromCallable($listener);
+ }
+ }
+ }
+
+ return $this->optimized[$eventName];
+ }
}
diff --git a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php
index bde753a1..ceaa62ae 100644
--- a/vendor/symfony/event-dispatcher/EventDispatcherInterface.php
+++ b/vendor/symfony/event-dispatcher/EventDispatcherInterface.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\EventDispatcher;
+use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface;
+
/**
* The EventDispatcherInterface is the central point of Symfony's event listener system.
* Listeners are registered on the manager and events are dispatched through the
@@ -18,21 +20,8 @@ namespace Symfony\Component\EventDispatcher;
*
* @author Bernhard Schussek
*/
-interface EventDispatcherInterface
+interface EventDispatcherInterface extends ContractsEventDispatcherInterface
{
- /**
- * Dispatches an event to all registered listeners.
- *
- * @param string $eventName The name of the event to dispatch. The name of
- * the event is the name of the method that is
- * invoked on listeners.
- * @param Event|null $event The event to pass to the event handlers/listeners
- * If not supplied, an empty Event instance is created
- *
- * @return Event
- */
- public function dispatch($eventName, Event $event = null);
-
/**
* Adds an event listener that listens on the specified events.
*
diff --git a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php
index 6e1976b8..824f2159 100644
--- a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php
+++ b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php
@@ -36,9 +36,9 @@ interface EventSubscriberInterface
*
* For instance:
*
- * * array('eventName' => 'methodName')
- * * array('eventName' => array('methodName', $priority))
- * * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
+ * * ['eventName' => 'methodName']
+ * * ['eventName' => ['methodName', $priority]]
+ * * ['eventName' => [['methodName1', $priority], ['methodName2']]]
*
* @return array The event names to listen to
*/
diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php
index f0be7e18..f005e3a3 100644
--- a/vendor/symfony/event-dispatcher/GenericEvent.php
+++ b/vendor/symfony/event-dispatcher/GenericEvent.php
@@ -29,7 +29,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
* @param mixed $subject The subject of the event, usually an object or a callable
* @param array $arguments Arguments to store in the event
*/
- public function __construct($subject = null, array $arguments = array())
+ public function __construct($subject = null, array $arguments = [])
{
$this->subject = $subject;
$this->arguments = $arguments;
@@ -95,7 +95,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
*
* @return $this
*/
- public function setArguments(array $args = array())
+ public function setArguments(array $args = [])
{
$this->arguments = $args;
@@ -111,7 +111,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
*/
public function hasArgument($key)
{
- return array_key_exists($key, $this->arguments);
+ return \array_key_exists($key, $this->arguments);
}
/**
diff --git a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php b/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php
index b3cf56c5..082e2a05 100644
--- a/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php
+++ b/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php
@@ -22,15 +22,26 @@ class ImmutableEventDispatcher implements EventDispatcherInterface
public function __construct(EventDispatcherInterface $dispatcher)
{
- $this->dispatcher = $dispatcher;
+ $this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
}
/**
* {@inheritdoc}
+ *
+ * @param string|null $eventName
*/
- public function dispatch($eventName, Event $event = null)
+ public function dispatch($event/*, string $eventName = null*/)
{
- return $this->dispatcher->dispatch($eventName, $event);
+ $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
+
+ if (\is_scalar($event)) {
+ // deprecated
+ $swap = $event;
+ $event = $eventName ?? new Event();
+ $eventName = $swap;
+ }
+
+ return $this->dispatcher->dispatch($event, $eventName);
}
/**
diff --git a/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php b/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php
new file mode 100644
index 00000000..3ae3735e
--- /dev/null
+++ b/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php
@@ -0,0 +1,147 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\EventDispatcher;
+
+use Psr\EventDispatcher\StoppableEventInterface;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
+use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface;
+
+/**
+ * An helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch().
+ *
+ * This class should be deprecated in Symfony 5.1
+ *
+ * @author Nicolas Grekas
+ */
+final class LegacyEventDispatcherProxy implements EventDispatcherInterface
+{
+ private $dispatcher;
+
+ public static function decorate(?ContractsEventDispatcherInterface $dispatcher): ?ContractsEventDispatcherInterface
+ {
+ if (null === $dispatcher) {
+ return null;
+ }
+ $r = new \ReflectionMethod($dispatcher, 'dispatch');
+ $param2 = $r->getParameters()[1] ?? null;
+
+ if (!$param2 || !$param2->hasType() || $param2->getType()->isBuiltin()) {
+ return $dispatcher;
+ }
+
+ @trigger_error(sprintf('The signature of the "%s::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3.', $r->class), E_USER_DEPRECATED);
+
+ $self = new self();
+ $self->dispatcher = $dispatcher;
+
+ return $self;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param string|null $eventName
+ */
+ public function dispatch($event/*, string $eventName = null*/)
+ {
+ $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;
+
+ if (\is_object($event)) {
+ $eventName = $eventName ?? \get_class($event);
+ } else {
+ @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', ContractsEventDispatcherInterface::class), E_USER_DEPRECATED);
+ $swap = $event;
+ $event = $eventName ?? new Event();
+ $eventName = $swap;
+
+ if (!$event instanceof Event) {
+ throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', ContractsEventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
+ }
+ }
+
+ $listeners = $this->getListeners($eventName);
+ $stoppable = $event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
+
+ foreach ($listeners as $listener) {
+ if ($stoppable && $event->isPropagationStopped()) {
+ break;
+ }
+ $listener($event, $eventName, $this);
+ }
+
+ return $event;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function addListener($eventName, $listener, $priority = 0)
+ {
+ return $this->dispatcher->addListener($eventName, $listener, $priority);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function addSubscriber(EventSubscriberInterface $subscriber)
+ {
+ return $this->dispatcher->addSubscriber($subscriber);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function removeListener($eventName, $listener)
+ {
+ return $this->dispatcher->removeListener($eventName, $listener);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function removeSubscriber(EventSubscriberInterface $subscriber)
+ {
+ return $this->dispatcher->removeSubscriber($subscriber);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListeners($eventName = null)
+ {
+ return $this->dispatcher->getListeners($eventName);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListenerPriority($eventName, $listener)
+ {
+ return $this->dispatcher->getListenerPriority($eventName, $listener);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function hasListeners($eventName = null)
+ {
+ return $this->dispatcher->hasListeners($eventName);
+ }
+
+ /**
+ * Proxies all method calls to the original event dispatcher.
+ */
+ public function __call($method, $arguments)
+ {
+ return $this->dispatcher->{$method}(...$arguments);
+ }
+}
diff --git a/vendor/symfony/event-dispatcher/LegacyEventProxy.php b/vendor/symfony/event-dispatcher/LegacyEventProxy.php
new file mode 100644
index 00000000..cad8cfae
--- /dev/null
+++ b/vendor/symfony/event-dispatcher/LegacyEventProxy.php
@@ -0,0 +1,62 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\EventDispatcher;
+
+use Psr\EventDispatcher\StoppableEventInterface;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
+
+/**
+ * @internal to be removed in 5.0.
+ */
+final class LegacyEventProxy extends Event
+{
+ private $event;
+
+ /**
+ * @param object $event
+ */
+ public function __construct($event)
+ {
+ $this->event = $event;
+ }
+
+ /**
+ * @return object $event
+ */
+ public function getEvent()
+ {
+ return $this->event;
+ }
+
+ public function isPropagationStopped()
+ {
+ if (!$this->event instanceof ContractsEvent && !$this->event instanceof StoppableEventInterface) {
+ return false;
+ }
+
+ return $this->event->isPropagationStopped();
+ }
+
+ public function stopPropagation()
+ {
+ if (!$this->event instanceof ContractsEvent) {
+ return;
+ }
+
+ $this->event->stopPropagation();
+ }
+
+ public function __call($name, $args)
+ {
+ return $this->event->{$name}(...$args);
+ }
+}
diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
deleted file mode 100644
index 6d377d11..00000000
--- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
+++ /dev/null
@@ -1,442 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\EventDispatcher\Tests;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventDispatcher;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-abstract class AbstractEventDispatcherTest extends TestCase
-{
- /* Some pseudo events */
- const preFoo = 'pre.foo';
- const postFoo = 'post.foo';
- const preBar = 'pre.bar';
- const postBar = 'post.bar';
-
- /**
- * @var EventDispatcher
- */
- private $dispatcher;
-
- private $listener;
-
- protected function setUp()
- {
- $this->dispatcher = $this->createEventDispatcher();
- $this->listener = new TestEventListener();
- }
-
- protected function tearDown()
- {
- $this->dispatcher = null;
- $this->listener = null;
- }
-
- abstract protected function createEventDispatcher();
-
- public function testInitialState()
- {
- $this->assertEquals(array(), $this->dispatcher->getListeners());
- $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
- $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
- }
-
- public function testAddListener()
- {
- $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
- $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
- $this->assertTrue($this->dispatcher->hasListeners());
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
- $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo));
- $this->assertCount(1, $this->dispatcher->getListeners(self::postFoo));
- $this->assertCount(2, $this->dispatcher->getListeners());
- }
-
- public function testGetListenersSortsByPriority()
- {
- $listener1 = new TestEventListener();
- $listener2 = new TestEventListener();
- $listener3 = new TestEventListener();
- $listener1->name = '1';
- $listener2->name = '2';
- $listener3->name = '3';
-
- $this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10);
- $this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10);
- $this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo'));
-
- $expected = array(
- array($listener2, 'preFoo'),
- array($listener3, 'preFoo'),
- array($listener1, 'preFoo'),
- );
-
- $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo'));
- }
-
- public function testGetAllListenersSortsByPriority()
- {
- $listener1 = new TestEventListener();
- $listener2 = new TestEventListener();
- $listener3 = new TestEventListener();
- $listener4 = new TestEventListener();
- $listener5 = new TestEventListener();
- $listener6 = new TestEventListener();
-
- $this->dispatcher->addListener('pre.foo', $listener1, -10);
- $this->dispatcher->addListener('pre.foo', $listener2);
- $this->dispatcher->addListener('pre.foo', $listener3, 10);
- $this->dispatcher->addListener('post.foo', $listener4, -10);
- $this->dispatcher->addListener('post.foo', $listener5);
- $this->dispatcher->addListener('post.foo', $listener6, 10);
-
- $expected = array(
- 'pre.foo' => array($listener3, $listener2, $listener1),
- 'post.foo' => array($listener6, $listener5, $listener4),
- );
-
- $this->assertSame($expected, $this->dispatcher->getListeners());
- }
-
- public function testGetListenerPriority()
- {
- $listener1 = new TestEventListener();
- $listener2 = new TestEventListener();
-
- $this->dispatcher->addListener('pre.foo', $listener1, -10);
- $this->dispatcher->addListener('pre.foo', $listener2);
-
- $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1));
- $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2));
- $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2));
- $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {}));
- }
-
- public function testDispatch()
- {
- $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
- $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
- $this->dispatcher->dispatch(self::preFoo);
- $this->assertTrue($this->listener->preFooInvoked);
- $this->assertFalse($this->listener->postFooInvoked);
- $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch('noevent'));
- $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(self::preFoo));
- $event = new Event();
- $return = $this->dispatcher->dispatch(self::preFoo, $event);
- $this->assertSame($event, $return);
- }
-
- public function testDispatchForClosure()
- {
- $invoked = 0;
- $listener = function () use (&$invoked) {
- ++$invoked;
- };
- $this->dispatcher->addListener('pre.foo', $listener);
- $this->dispatcher->addListener('post.foo', $listener);
- $this->dispatcher->dispatch(self::preFoo);
- $this->assertEquals(1, $invoked);
- }
-
- public function testStopEventPropagation()
- {
- $otherListener = new TestEventListener();
-
- // postFoo() stops the propagation, so only one listener should
- // be executed
- // Manually set priority to enforce $this->listener to be called first
- $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10);
- $this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo'));
- $this->dispatcher->dispatch(self::postFoo);
- $this->assertTrue($this->listener->postFooInvoked);
- $this->assertFalse($otherListener->postFooInvoked);
- }
-
- public function testDispatchByPriority()
- {
- $invoked = array();
- $listener1 = function () use (&$invoked) {
- $invoked[] = '1';
- };
- $listener2 = function () use (&$invoked) {
- $invoked[] = '2';
- };
- $listener3 = function () use (&$invoked) {
- $invoked[] = '3';
- };
- $this->dispatcher->addListener('pre.foo', $listener1, -10);
- $this->dispatcher->addListener('pre.foo', $listener2);
- $this->dispatcher->addListener('pre.foo', $listener3, 10);
- $this->dispatcher->dispatch(self::preFoo);
- $this->assertEquals(array('3', '2', '1'), $invoked);
- }
-
- public function testRemoveListener()
- {
- $this->dispatcher->addListener('pre.bar', $this->listener);
- $this->assertTrue($this->dispatcher->hasListeners(self::preBar));
- $this->dispatcher->removeListener('pre.bar', $this->listener);
- $this->assertFalse($this->dispatcher->hasListeners(self::preBar));
- $this->dispatcher->removeListener('notExists', $this->listener);
- }
-
- public function testAddSubscriber()
- {
- $eventSubscriber = new TestEventSubscriber();
- $this->dispatcher->addSubscriber($eventSubscriber);
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
- }
-
- public function testAddSubscriberWithPriorities()
- {
- $eventSubscriber = new TestEventSubscriber();
- $this->dispatcher->addSubscriber($eventSubscriber);
-
- $eventSubscriber = new TestEventSubscriberWithPriorities();
- $this->dispatcher->addSubscriber($eventSubscriber);
-
- $listeners = $this->dispatcher->getListeners('pre.foo');
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertCount(2, $listeners);
- $this->assertInstanceOf('Symfony\Component\EventDispatcher\Tests\TestEventSubscriberWithPriorities', $listeners[0][0]);
- }
-
- public function testAddSubscriberWithMultipleListeners()
- {
- $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
- $this->dispatcher->addSubscriber($eventSubscriber);
-
- $listeners = $this->dispatcher->getListeners('pre.foo');
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertCount(2, $listeners);
- $this->assertEquals('preFoo2', $listeners[0][1]);
- }
-
- public function testRemoveSubscriber()
- {
- $eventSubscriber = new TestEventSubscriber();
- $this->dispatcher->addSubscriber($eventSubscriber);
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
- $this->dispatcher->removeSubscriber($eventSubscriber);
- $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
- $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
- }
-
- public function testRemoveSubscriberWithPriorities()
- {
- $eventSubscriber = new TestEventSubscriberWithPriorities();
- $this->dispatcher->addSubscriber($eventSubscriber);
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->dispatcher->removeSubscriber($eventSubscriber);
- $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
- }
-
- public function testRemoveSubscriberWithMultipleListeners()
- {
- $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
- $this->dispatcher->addSubscriber($eventSubscriber);
- $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
- $this->assertCount(2, $this->dispatcher->getListeners(self::preFoo));
- $this->dispatcher->removeSubscriber($eventSubscriber);
- $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
- }
-
- public function testEventReceivesTheDispatcherInstanceAsArgument()
- {
- $listener = new TestWithDispatcher();
- $this->dispatcher->addListener('test', array($listener, 'foo'));
- $this->assertNull($listener->name);
- $this->assertNull($listener->dispatcher);
- $this->dispatcher->dispatch('test');
- $this->assertEquals('test', $listener->name);
- $this->assertSame($this->dispatcher, $listener->dispatcher);
- }
-
- /**
- * @see https://bugs.php.net/bug.php?id=62976
- *
- * This bug affects:
- * - The PHP 5.3 branch for versions < 5.3.18
- * - The PHP 5.4 branch for versions < 5.4.8
- * - The PHP 5.5 branch is not affected
- */
- public function testWorkaroundForPhpBug62976()
- {
- $dispatcher = $this->createEventDispatcher();
- $dispatcher->addListener('bug.62976', new CallableClass());
- $dispatcher->removeListener('bug.62976', function () {});
- $this->assertTrue($dispatcher->hasListeners('bug.62976'));
- }
-
- public function testHasListenersWhenAddedCallbackListenerIsRemoved()
- {
- $listener = function () {};
- $this->dispatcher->addListener('foo', $listener);
- $this->dispatcher->removeListener('foo', $listener);
- $this->assertFalse($this->dispatcher->hasListeners());
- }
-
- public function testGetListenersWhenAddedCallbackListenerIsRemoved()
- {
- $listener = function () {};
- $this->dispatcher->addListener('foo', $listener);
- $this->dispatcher->removeListener('foo', $listener);
- $this->assertSame(array(), $this->dispatcher->getListeners());
- }
-
- public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled()
- {
- $this->assertFalse($this->dispatcher->hasListeners('foo'));
- $this->assertFalse($this->dispatcher->hasListeners());
- }
-
- public function testHasListenersIsLazy()
- {
- $called = 0;
- $listener = array(function () use (&$called) { ++$called; }, 'onFoo');
- $this->dispatcher->addListener('foo', $listener);
- $this->assertTrue($this->dispatcher->hasListeners());
- $this->assertTrue($this->dispatcher->hasListeners('foo'));
- $this->assertSame(0, $called);
- }
-
- public function testDispatchLazyListener()
- {
- $called = 0;
- $factory = function () use (&$called) {
- ++$called;
-
- return new TestWithDispatcher();
- };
- $this->dispatcher->addListener('foo', array($factory, 'foo'));
- $this->assertSame(0, $called);
- $this->dispatcher->dispatch('foo', new Event());
- $this->dispatcher->dispatch('foo', new Event());
- $this->assertSame(1, $called);
- }
-
- public function testRemoveFindsLazyListeners()
- {
- $test = new TestWithDispatcher();
- $factory = function () use ($test) { return $test; };
-
- $this->dispatcher->addListener('foo', array($factory, 'foo'));
- $this->assertTrue($this->dispatcher->hasListeners('foo'));
- $this->dispatcher->removeListener('foo', array($test, 'foo'));
- $this->assertFalse($this->dispatcher->hasListeners('foo'));
-
- $this->dispatcher->addListener('foo', array($test, 'foo'));
- $this->assertTrue($this->dispatcher->hasListeners('foo'));
- $this->dispatcher->removeListener('foo', array($factory, 'foo'));
- $this->assertFalse($this->dispatcher->hasListeners('foo'));
- }
-
- public function testPriorityFindsLazyListeners()
- {
- $test = new TestWithDispatcher();
- $factory = function () use ($test) { return $test; };
-
- $this->dispatcher->addListener('foo', array($factory, 'foo'), 3);
- $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', array($test, 'foo')));
- $this->dispatcher->removeListener('foo', array($factory, 'foo'));
-
- $this->dispatcher->addListener('foo', array($test, 'foo'), 5);
- $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', array($factory, 'foo')));
- }
-
- public function testGetLazyListeners()
- {
- $test = new TestWithDispatcher();
- $factory = function () use ($test) { return $test; };
-
- $this->dispatcher->addListener('foo', array($factory, 'foo'), 3);
- $this->assertSame(array(array($test, 'foo')), $this->dispatcher->getListeners('foo'));
-
- $this->dispatcher->removeListener('foo', array($test, 'foo'));
- $this->dispatcher->addListener('bar', array($factory, 'foo'), 3);
- $this->assertSame(array('bar' => array(array($test, 'foo'))), $this->dispatcher->getListeners());
- }
-}
-
-class CallableClass
-{
- public function __invoke()
- {
- }
-}
-
-class TestEventListener
-{
- public $preFooInvoked = false;
- public $postFooInvoked = false;
-
- /* Listener methods */
-
- public function preFoo(Event $e)
- {
- $this->preFooInvoked = true;
- }
-
- public function postFoo(Event $e)
- {
- $this->postFooInvoked = true;
-
- $e->stopPropagation();
- }
-}
-
-class TestWithDispatcher
-{
- public $name;
- public $dispatcher;
-
- public function foo(Event $e, $name, $dispatcher)
- {
- $this->name = $name;
- $this->dispatcher = $dispatcher;
- }
-}
-
-class TestEventSubscriber implements EventSubscriberInterface
-{
- public static function getSubscribedEvents()
- {
- return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo');
- }
-}
-
-class TestEventSubscriberWithPriorities implements EventSubscriberInterface
-{
- public static function getSubscribedEvents()
- {
- return array(
- 'pre.foo' => array('preFoo', 10),
- 'post.foo' => array('postFoo'),
- );
- }
-}
-
-class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterface
-{
- public static function getSubscribedEvents()
- {
- return array('pre.foo' => array(
- array('preFoo1'),
- array('preFoo2', 10),
- ));
- }
-}
diff --git a/vendor/symfony/event-dispatcher/Tests/ChildEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ChildEventDispatcherTest.php
new file mode 100644
index 00000000..442b88fb
--- /dev/null
+++ b/vendor/symfony/event-dispatcher/Tests/ChildEventDispatcherTest.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\EventDispatcher\Tests;
+
+use Symfony\Component\EventDispatcher\EventDispatcher;
+
+class ChildEventDispatcherTest extends EventDispatcherTest
+{
+ protected function createEventDispatcher()
+ {
+ return new ChildEventDispatcher();
+ }
+}
+
+class ChildEventDispatcher extends EventDispatcher
+{
+}
diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
index 0a2b3279..ea476eee 100644
--- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
@@ -18,6 +18,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Stopwatch\Stopwatch;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
class TraceableEventDispatcherTest extends TestCase
{
@@ -69,7 +70,7 @@ class TraceableEventDispatcherTest extends TestCase
// Verify that priority is preserved when listener is removed and re-added
// in preProcess() and postProcess().
- $tdispatcher->dispatch('foo', new Event());
+ $tdispatcher->dispatch(new Event(), 'foo');
$listeners = $dispatcher->getListeners('foo');
$this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0]));
}
@@ -84,7 +85,7 @@ class TraceableEventDispatcherTest extends TestCase
};
$tdispatcher->addListener('bar', $listener, 5);
- $tdispatcher->dispatch('bar');
+ $tdispatcher->dispatch(new Event(), 'bar');
$this->assertSame(5, $priorityWhileDispatching);
}
@@ -98,7 +99,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addSubscriber($subscriber);
$listeners = $dispatcher->getListeners('foo');
$this->assertCount(1, $listeners);
- $this->assertSame(array($subscriber, 'call'), $listeners[0]);
+ $this->assertSame([$subscriber, 'call'], $listeners[0]);
$tdispatcher->removeSubscriber($subscriber);
$this->assertCount(0, $dispatcher->getListeners('foo'));
@@ -112,16 +113,16 @@ class TraceableEventDispatcherTest extends TestCase
$listeners = $tdispatcher->getNotCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
- $this->assertEquals(array(), $tdispatcher->getCalledListeners());
- $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
+ $this->assertEquals([], $tdispatcher->getCalledListeners());
+ $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
- $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
- $this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
+ $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
+ $this->assertEquals([], $tdispatcher->getNotCalledListeners());
}
public function testClearCalledListeners()
@@ -129,14 +130,27 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {}, 5);
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$tdispatcher->reset();
$listeners = $tdispatcher->getNotCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
unset($listeners[0]['stub']);
- $this->assertEquals(array(), $tdispatcher->getCalledListeners());
- $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
+ $this->assertEquals([], $tdispatcher->getCalledListeners());
+ $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners);
+ }
+
+ public function testDispatchContractsEvent()
+ {
+ $expectedEvent = new ContractsEvent();
+ $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
+ $tdispatcher->addListener('foo', function ($event) use ($expectedEvent) {
+ $this->assertSame($event, $expectedEvent);
+ }, 5);
+ $tdispatcher->dispatch($expectedEvent, 'foo');
+
+ $listeners = $tdispatcher->getCalledListeners();
+ $this->assertArrayHasKey('stub', $listeners[0]);
}
public function testDispatchAfterReset()
@@ -145,7 +159,7 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', function () {}, 5);
$tdispatcher->reset();
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$listeners = $tdispatcher->getCalledListeners();
$this->assertArrayHasKey('stub', $listeners[0]);
@@ -157,10 +171,10 @@ class TraceableEventDispatcherTest extends TestCase
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) {
$tdispatcher = $dispatcher;
- $dispatcher->dispatch('bar');
+ $dispatcher->dispatch(new Event(), 'bar');
});
$dispatcher->addListener('bar', function (Event $event) {});
- $dispatcher->dispatch('foo');
+ $dispatcher->dispatch(new Event(), 'foo');
$this->assertSame($dispatcher, $tdispatcher);
$this->assertCount(2, $dispatcher->getCalledListeners());
}
@@ -175,17 +189,17 @@ class TraceableEventDispatcherTest extends TestCase
public function testItReturnsOrphanedEventsAfterDispatch()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertCount(1, $events);
- $this->assertEquals(array('foo'), $events);
+ $this->assertEquals(['foo'], $events);
}
public function testItDoesNotReturnHandledEvents()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$tdispatcher->addListener('foo', function () {});
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertEmpty($events);
}
@@ -199,10 +213,10 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', $listener1 = function () {});
$tdispatcher->addListener('foo', $listener2 = function () {});
- $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
- $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
+ $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
+ $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
}
public function testLoggerWithStoppedEvent()
@@ -214,25 +228,25 @@ class TraceableEventDispatcherTest extends TestCase
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
$tdispatcher->addListener('foo', $listener2 = function () {});
- $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure'));
- $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', array('event' => 'foo', 'listener' => 'closure'));
- $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', array('event' => 'foo', 'listener' => 'closure'));
+ $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']);
+ $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
+ $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', ['event' => 'foo', 'listener' => 'closure']);
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
}
public function testDispatchCallListeners()
{
- $called = array();
+ $called = [];
$dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo1'; }, 10);
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo2'; }, 20);
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
- $this->assertSame(array('foo2', 'foo1'), $called);
+ $this->assertSame(['foo2', 'foo1'], $called);
}
public function testDispatchNested()
@@ -243,14 +257,14 @@ class TraceableEventDispatcherTest extends TestCase
$dispatcher->addListener('foo', $listener1 = function () use ($dispatcher, &$loop) {
++$loop;
if (2 == $loop) {
- $dispatcher->dispatch('foo');
+ $dispatcher->dispatch(new Event(), 'foo');
}
});
$dispatcher->addListener('foo', function () use (&$dispatchedEvents) {
++$dispatchedEvents;
});
- $dispatcher->dispatch('foo');
+ $dispatcher->dispatch(new Event(), 'foo');
$this->assertSame(2, $dispatchedEvents);
}
@@ -260,14 +274,14 @@ class TraceableEventDispatcherTest extends TestCase
$nestedCall = false;
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher->addListener('foo', function (Event $e) use ($dispatcher) {
- $dispatcher->dispatch('bar', $e);
+ $dispatcher->dispatch(new Event(), 'bar', $e);
});
$dispatcher->addListener('bar', function (Event $e) use (&$nestedCall) {
$nestedCall = true;
});
$this->assertFalse($nestedCall);
- $dispatcher->dispatch('foo');
+ $dispatcher->dispatch(new Event(), 'foo');
$this->assertTrue($nestedCall);
}
@@ -279,7 +293,7 @@ class TraceableEventDispatcherTest extends TestCase
};
$eventDispatcher->addListener('foo', $listener1);
$eventDispatcher->addListener('foo', function () {});
- $eventDispatcher->dispatch('foo');
+ $eventDispatcher->dispatch(new Event(), 'foo');
$this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed');
}
@@ -287,7 +301,7 @@ class TraceableEventDispatcherTest extends TestCase
public function testClearOrphanedEvents()
{
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
- $tdispatcher->dispatch('foo');
+ $tdispatcher->dispatch(new Event(), 'foo');
$events = $tdispatcher->getOrphanedEvents();
$this->assertCount(1, $events);
$tdispatcher->reset();
@@ -300,6 +314,6 @@ class EventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
- return array('foo' => 'call');
+ return ['foo' => 'call'];
}
}
diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php
index 3847a155..75e90120 100644
--- a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php
@@ -21,7 +21,7 @@ class WrappedListenerTest extends TestCase
/**
* @dataProvider provideListenersToDescribe
*/
- public function testListenerDescription(callable $listener, $expected)
+ public function testListenerDescription($listener, $expected)
{
$wrappedListener = new WrappedListener($listener, null, $this->getMockBuilder(Stopwatch::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock());
@@ -30,16 +30,17 @@ class WrappedListenerTest extends TestCase
public function provideListenersToDescribe()
{
- return array(
- array(new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'),
- array(array(new FooListener(), 'listen'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
- array(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
- array('var_dump', 'var_dump'),
- array(function () {}, 'closure'),
- array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'),
- array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'),
- array(\Closure::fromCallable(function () {}), 'closure'),
- );
+ return [
+ [new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'],
+ [[new FooListener(), 'listen'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'],
+ [['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'],
+ [['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'invalidMethod'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::invalidMethod'],
+ ['var_dump', 'var_dump'],
+ [function () {}, 'closure'],
+ [\Closure::fromCallable([new FooListener(), 'listen']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'],
+ [\Closure::fromCallable(['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'],
+ [\Closure::fromCallable(function () {}), 'closure'],
+ ];
}
}
diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
index a359bd7e..d665f426 100644
--- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
@@ -38,9 +38,9 @@ class RegisterListenersPassTest extends TestCase
public function testValidEventSubscriber()
{
- $services = array(
- 'my_event_subscriber' => array(0 => array()),
- );
+ $services = [
+ 'my_event_subscriber' => [0 => []],
+ ];
$builder = new ContainerBuilder();
$eventDispatcherDefinition = $builder->register('event_dispatcher');
@@ -50,16 +50,16 @@ class RegisterListenersPassTest extends TestCase
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($builder);
- $expectedCalls = array(
- array(
+ $expectedCalls = [
+ [
'addListener',
- array(
+ [
'event',
- array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'),
+ [new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'],
0,
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
}
@@ -70,7 +70,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventListener()
{
$container = new ContainerBuilder();
- $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', array());
+ $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -84,7 +84,7 @@ class RegisterListenersPassTest extends TestCase
public function testAbstractEventSubscriber()
{
$container = new ContainerBuilder();
- $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array());
+ $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -96,23 +96,23 @@ class RegisterListenersPassTest extends TestCase
$container = new ContainerBuilder();
$container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService');
- $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
+ $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($container);
$definition = $container->getDefinition('event_dispatcher');
- $expectedCalls = array(
- array(
+ $expectedCalls = [
+ [
'addListener',
- array(
+ [
'event',
- array(new ServiceClosureArgument(new Reference('foo')), 'onEvent'),
+ [new ServiceClosureArgument(new Reference('foo')), 'onEvent'],
0,
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
}
@@ -120,10 +120,10 @@ class RegisterListenersPassTest extends TestCase
{
$container = new ContainerBuilder();
- $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array());
+ $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
- (new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container);
+ (new RegisterListenersPass())->setHotPathEvents(['event'])->process($container);
$this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path'));
}
@@ -135,7 +135,7 @@ class RegisterListenersPassTest extends TestCase
public function testEventSubscriberUnresolvableClassName()
{
$container = new ContainerBuilder();
- $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
+ $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []);
$container->register('event_dispatcher', 'stdClass');
$registerListenersPass = new RegisterListenersPass();
@@ -145,41 +145,41 @@ class RegisterListenersPassTest extends TestCase
public function testInvokableEventListener()
{
$container = new ContainerBuilder();
- $container->register('foo', \stdClass::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
- $container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
- $container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'event'));
+ $container->register('foo', \stdClass::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']);
+ $container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']);
+ $container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'event']);
$container->register('event_dispatcher', \stdClass::class);
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($container);
$definition = $container->getDefinition('event_dispatcher');
- $expectedCalls = array(
- array(
+ $expectedCalls = [
+ [
'addListener',
- array(
+ [
'foo.bar',
- array(new ServiceClosureArgument(new Reference('foo')), 'onFooBar'),
+ [new ServiceClosureArgument(new Reference('foo')), 'onFooBar'],
0,
- ),
- ),
- array(
+ ],
+ ],
+ [
'addListener',
- array(
+ [
'foo.bar',
- array(new ServiceClosureArgument(new Reference('bar')), '__invoke'),
+ [new ServiceClosureArgument(new Reference('bar')), '__invoke'],
0,
- ),
- ),
- array(
+ ],
+ ],
+ [
'addListener',
- array(
+ [
'event',
- array(new ServiceClosureArgument(new Reference('baz')), 'onEvent'),
+ [new ServiceClosureArgument(new Reference('baz')), 'onEvent'],
0,
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->assertEquals($expectedCalls, $definition->getMethodCalls());
}
}
@@ -188,9 +188,9 @@ class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubsc
{
public static function getSubscribedEvents()
{
- return array(
+ return [
'event' => 'onEvent',
- );
+ ];
}
}
diff --git a/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
index 5faa5c8b..e89f78cd 100644
--- a/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/EventDispatcherTest.php
@@ -11,12 +11,476 @@
namespace Symfony\Component\EventDispatcher\Tests;
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Contracts\EventDispatcher\Event as ContractsEvent;
-class EventDispatcherTest extends AbstractEventDispatcherTest
+class EventDispatcherTest extends TestCase
{
+ /* Some pseudo events */
+ const preFoo = 'pre.foo';
+ const postFoo = 'post.foo';
+ const preBar = 'pre.bar';
+ const postBar = 'post.bar';
+
+ /**
+ * @var EventDispatcher
+ */
+ private $dispatcher;
+
+ private $listener;
+
+ protected function setUp()
+ {
+ $this->dispatcher = $this->createEventDispatcher();
+ $this->listener = new TestEventListener();
+ }
+
+ protected function tearDown()
+ {
+ $this->dispatcher = null;
+ $this->listener = null;
+ }
+
protected function createEventDispatcher()
{
return new EventDispatcher();
}
+
+ public function testInitialState()
+ {
+ $this->assertEquals([], $this->dispatcher->getListeners());
+ $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
+ }
+
+ public function testAddListener()
+ {
+ $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
+ $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
+ $this->assertTrue($this->dispatcher->hasListeners());
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
+ $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo));
+ $this->assertCount(1, $this->dispatcher->getListeners(self::postFoo));
+ $this->assertCount(2, $this->dispatcher->getListeners());
+ }
+
+ public function testGetListenersSortsByPriority()
+ {
+ $listener1 = new TestEventListener();
+ $listener2 = new TestEventListener();
+ $listener3 = new TestEventListener();
+ $listener1->name = '1';
+ $listener2->name = '2';
+ $listener3->name = '3';
+
+ $this->dispatcher->addListener('pre.foo', [$listener1, 'preFoo'], -10);
+ $this->dispatcher->addListener('pre.foo', [$listener2, 'preFoo'], 10);
+ $this->dispatcher->addListener('pre.foo', [$listener3, 'preFoo']);
+
+ $expected = [
+ [$listener2, 'preFoo'],
+ [$listener3, 'preFoo'],
+ [$listener1, 'preFoo'],
+ ];
+
+ $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo'));
+ }
+
+ public function testGetAllListenersSortsByPriority()
+ {
+ $listener1 = new TestEventListener();
+ $listener2 = new TestEventListener();
+ $listener3 = new TestEventListener();
+ $listener4 = new TestEventListener();
+ $listener5 = new TestEventListener();
+ $listener6 = new TestEventListener();
+
+ $this->dispatcher->addListener('pre.foo', $listener1, -10);
+ $this->dispatcher->addListener('pre.foo', $listener2);
+ $this->dispatcher->addListener('pre.foo', $listener3, 10);
+ $this->dispatcher->addListener('post.foo', $listener4, -10);
+ $this->dispatcher->addListener('post.foo', $listener5);
+ $this->dispatcher->addListener('post.foo', $listener6, 10);
+
+ $expected = [
+ 'pre.foo' => [$listener3, $listener2, $listener1],
+ 'post.foo' => [$listener6, $listener5, $listener4],
+ ];
+
+ $this->assertSame($expected, $this->dispatcher->getListeners());
+ }
+
+ public function testGetListenerPriority()
+ {
+ $listener1 = new TestEventListener();
+ $listener2 = new TestEventListener();
+
+ $this->dispatcher->addListener('pre.foo', $listener1, -10);
+ $this->dispatcher->addListener('pre.foo', $listener2);
+
+ $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1));
+ $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2));
+ $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2));
+ $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {}));
+ }
+
+ public function testDispatch()
+ {
+ $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
+ $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
+ $this->dispatcher->dispatch(new Event(), self::preFoo);
+ $this->assertTrue($this->listener->preFooInvoked);
+ $this->assertFalse($this->listener->postFooInvoked);
+ $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(new Event(), 'noevent'));
+ $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(new Event(), self::preFoo));
+ $event = new Event();
+ $return = $this->dispatcher->dispatch($event, self::preFoo);
+ $this->assertSame($event, $return);
+ }
+
+ public function testDispatchContractsEvent()
+ {
+ $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']);
+ $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']);
+ $this->dispatcher->dispatch(new ContractsEvent(), self::preFoo);
+ $this->assertTrue($this->listener->preFooInvoked);
+ $this->assertFalse($this->listener->postFooInvoked);
+ $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(new Event(), 'noevent'));
+ $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(new Event(), self::preFoo));
+ $event = new Event();
+ $return = $this->dispatcher->dispatch($event, self::preFoo);
+ $this->assertSame($event, $return);
+ }
+
+ public function testDispatchForClosure()
+ {
+ $invoked = 0;
+ $listener = function () use (&$invoked) {
+ ++$invoked;
+ };
+ $this->dispatcher->addListener('pre.foo', $listener);
+ $this->dispatcher->addListener('post.foo', $listener);
+ $this->dispatcher->dispatch(new Event(), self::preFoo);
+ $this->assertEquals(1, $invoked);
+ }
+
+ public function testStopEventPropagation()
+ {
+ $otherListener = new TestEventListener();
+
+ // postFoo() stops the propagation, so only one listener should
+ // be executed
+ // Manually set priority to enforce $this->listener to be called first
+ $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo'], 10);
+ $this->dispatcher->addListener('post.foo', [$otherListener, 'postFoo']);
+ $this->dispatcher->dispatch(new Event(), self::postFoo);
+ $this->assertTrue($this->listener->postFooInvoked);
+ $this->assertFalse($otherListener->postFooInvoked);
+ }
+
+ public function testDispatchByPriority()
+ {
+ $invoked = [];
+ $listener1 = function () use (&$invoked) {
+ $invoked[] = '1';
+ };
+ $listener2 = function () use (&$invoked) {
+ $invoked[] = '2';
+ };
+ $listener3 = function () use (&$invoked) {
+ $invoked[] = '3';
+ };
+ $this->dispatcher->addListener('pre.foo', $listener1, -10);
+ $this->dispatcher->addListener('pre.foo', $listener2);
+ $this->dispatcher->addListener('pre.foo', $listener3, 10);
+ $this->dispatcher->dispatch(new Event(), self::preFoo);
+ $this->assertEquals(['3', '2', '1'], $invoked);
+ }
+
+ public function testRemoveListener()
+ {
+ $this->dispatcher->addListener('pre.bar', $this->listener);
+ $this->assertTrue($this->dispatcher->hasListeners(self::preBar));
+ $this->dispatcher->removeListener('pre.bar', $this->listener);
+ $this->assertFalse($this->dispatcher->hasListeners(self::preBar));
+ $this->dispatcher->removeListener('notExists', $this->listener);
+ }
+
+ public function testAddSubscriber()
+ {
+ $eventSubscriber = new TestEventSubscriber();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
+ }
+
+ public function testAddSubscriberWithPriorities()
+ {
+ $eventSubscriber = new TestEventSubscriber();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+
+ $eventSubscriber = new TestEventSubscriberWithPriorities();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+
+ $listeners = $this->dispatcher->getListeners('pre.foo');
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertCount(2, $listeners);
+ $this->assertInstanceOf('Symfony\Component\EventDispatcher\Tests\TestEventSubscriberWithPriorities', $listeners[0][0]);
+ }
+
+ public function testAddSubscriberWithMultipleListeners()
+ {
+ $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+
+ $listeners = $this->dispatcher->getListeners('pre.foo');
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertCount(2, $listeners);
+ $this->assertEquals('preFoo2', $listeners[0][1]);
+ }
+
+ public function testRemoveSubscriber()
+ {
+ $eventSubscriber = new TestEventSubscriber();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
+ $this->dispatcher->removeSubscriber($eventSubscriber);
+ $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
+ }
+
+ public function testRemoveSubscriberWithPriorities()
+ {
+ $eventSubscriber = new TestEventSubscriberWithPriorities();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->dispatcher->removeSubscriber($eventSubscriber);
+ $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
+ }
+
+ public function testRemoveSubscriberWithMultipleListeners()
+ {
+ $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
+ $this->dispatcher->addSubscriber($eventSubscriber);
+ $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
+ $this->assertCount(2, $this->dispatcher->getListeners(self::preFoo));
+ $this->dispatcher->removeSubscriber($eventSubscriber);
+ $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
+ }
+
+ public function testEventReceivesTheDispatcherInstanceAsArgument()
+ {
+ $listener = new TestWithDispatcher();
+ $this->dispatcher->addListener('test', [$listener, 'foo']);
+ $this->assertNull($listener->name);
+ $this->assertNull($listener->dispatcher);
+ $this->dispatcher->dispatch(new Event(), 'test');
+ $this->assertEquals('test', $listener->name);
+ $this->assertSame($this->dispatcher, $listener->dispatcher);
+ }
+
+ /**
+ * @see https://bugs.php.net/bug.php?id=62976
+ *
+ * This bug affects:
+ * - The PHP 5.3 branch for versions < 5.3.18
+ * - The PHP 5.4 branch for versions < 5.4.8
+ * - The PHP 5.5 branch is not affected
+ */
+ public function testWorkaroundForPhpBug62976()
+ {
+ $dispatcher = $this->createEventDispatcher();
+ $dispatcher->addListener('bug.62976', new CallableClass());
+ $dispatcher->removeListener('bug.62976', function () {});
+ $this->assertTrue($dispatcher->hasListeners('bug.62976'));
+ }
+
+ public function testHasListenersWhenAddedCallbackListenerIsRemoved()
+ {
+ $listener = function () {};
+ $this->dispatcher->addListener('foo', $listener);
+ $this->dispatcher->removeListener('foo', $listener);
+ $this->assertFalse($this->dispatcher->hasListeners());
+ }
+
+ public function testGetListenersWhenAddedCallbackListenerIsRemoved()
+ {
+ $listener = function () {};
+ $this->dispatcher->addListener('foo', $listener);
+ $this->dispatcher->removeListener('foo', $listener);
+ $this->assertSame([], $this->dispatcher->getListeners());
+ }
+
+ public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled()
+ {
+ $this->assertFalse($this->dispatcher->hasListeners('foo'));
+ $this->assertFalse($this->dispatcher->hasListeners());
+ }
+
+ public function testHasListenersIsLazy()
+ {
+ $called = 0;
+ $listener = [function () use (&$called) { ++$called; }, 'onFoo'];
+ $this->dispatcher->addListener('foo', $listener);
+ $this->assertTrue($this->dispatcher->hasListeners());
+ $this->assertTrue($this->dispatcher->hasListeners('foo'));
+ $this->assertSame(0, $called);
+ }
+
+ public function testDispatchLazyListener()
+ {
+ $called = 0;
+ $factory = function () use (&$called) {
+ ++$called;
+
+ return new TestWithDispatcher();
+ };
+ $this->dispatcher->addListener('foo', [$factory, 'foo']);
+ $this->assertSame(0, $called);
+ $this->dispatcher->dispatch(new Event(), 'foo');
+ $this->dispatcher->dispatch(new Event(), 'foo');
+ $this->assertSame(1, $called);
+ }
+
+ public function testRemoveFindsLazyListeners()
+ {
+ $test = new TestWithDispatcher();
+ $factory = function () use ($test) { return $test; };
+
+ $this->dispatcher->addListener('foo', [$factory, 'foo']);
+ $this->assertTrue($this->dispatcher->hasListeners('foo'));
+ $this->dispatcher->removeListener('foo', [$test, 'foo']);
+ $this->assertFalse($this->dispatcher->hasListeners('foo'));
+
+ $this->dispatcher->addListener('foo', [$test, 'foo']);
+ $this->assertTrue($this->dispatcher->hasListeners('foo'));
+ $this->dispatcher->removeListener('foo', [$factory, 'foo']);
+ $this->assertFalse($this->dispatcher->hasListeners('foo'));
+ }
+
+ public function testPriorityFindsLazyListeners()
+ {
+ $test = new TestWithDispatcher();
+ $factory = function () use ($test) { return $test; };
+
+ $this->dispatcher->addListener('foo', [$factory, 'foo'], 3);
+ $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', [$test, 'foo']));
+ $this->dispatcher->removeListener('foo', [$factory, 'foo']);
+
+ $this->dispatcher->addListener('foo', [$test, 'foo'], 5);
+ $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', [$factory, 'foo']));
+ }
+
+ public function testGetLazyListeners()
+ {
+ $test = new TestWithDispatcher();
+ $factory = function () use ($test) { return $test; };
+
+ $this->dispatcher->addListener('foo', [$factory, 'foo'], 3);
+ $this->assertSame([[$test, 'foo']], $this->dispatcher->getListeners('foo'));
+
+ $this->dispatcher->removeListener('foo', [$test, 'foo']);
+ $this->dispatcher->addListener('bar', [$factory, 'foo'], 3);
+ $this->assertSame(['bar' => [[$test, 'foo']]], $this->dispatcher->getListeners());
+ }
+
+ public function testMutatingWhilePropagationIsStopped()
+ {
+ $testLoaded = false;
+ $test = new TestEventListener();
+ $this->dispatcher->addListener('foo', [$test, 'postFoo']);
+ $this->dispatcher->addListener('foo', [function () use ($test, &$testLoaded) {
+ $testLoaded = true;
+
+ return $test;
+ }, 'preFoo']);
+
+ $this->dispatcher->dispatch(new Event(), 'foo');
+
+ $this->assertTrue($test->postFooInvoked);
+ $this->assertFalse($test->preFooInvoked);
+
+ $this->assertsame(0, $this->dispatcher->getListenerPriority('foo', [$test, 'preFoo']));
+
+ $test->preFoo(new Event());
+ $this->dispatcher->dispatch(new Event(), 'foo');
+
+ $this->assertTrue($testLoaded);
+ }
+}
+
+class CallableClass
+{
+ public function __invoke()
+ {
+ }
+}
+
+class TestEventListener
+{
+ public $preFooInvoked = false;
+ public $postFooInvoked = false;
+
+ /* Listener methods */
+
+ public function preFoo($e)
+ {
+ $this->preFooInvoked = true;
+ }
+
+ public function postFoo($e)
+ {
+ $this->postFooInvoked = true;
+
+ if (!$this->preFooInvoked) {
+ $e->stopPropagation();
+ }
+ }
+}
+
+class TestWithDispatcher
+{
+ public $name;
+ public $dispatcher;
+
+ public function foo($e, $name, $dispatcher)
+ {
+ $this->name = $name;
+ $this->dispatcher = $dispatcher;
+ }
+}
+
+class TestEventSubscriber implements EventSubscriberInterface
+{
+ public static function getSubscribedEvents()
+ {
+ return ['pre.foo' => 'preFoo', 'post.foo' => 'postFoo'];
+ }
+}
+
+class TestEventSubscriberWithPriorities implements EventSubscriberInterface
+{
+ public static function getSubscribedEvents()
+ {
+ return [
+ 'pre.foo' => ['preFoo', 10],
+ 'post.foo' => ['postFoo'],
+ ];
+ }
+}
+
+class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterface
+{
+ public static function getSubscribedEvents()
+ {
+ return ['pre.foo' => [
+ ['preFoo1'],
+ ['preFoo2', 10],
+ ]];
+ }
}
diff --git a/vendor/symfony/event-dispatcher/Tests/EventTest.php b/vendor/symfony/event-dispatcher/Tests/EventTest.php
index 5be2ea09..ca8e945c 100644
--- a/vendor/symfony/event-dispatcher/Tests/EventTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/EventTest.php
@@ -15,7 +15,7 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\Event;
/**
- * Test class for Event.
+ * @group legacy
*/
class EventTest extends TestCase
{
diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
index b63f69df..e9e011a2 100644
--- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php
@@ -32,7 +32,7 @@ class GenericEventTest extends TestCase
protected function setUp()
{
$this->subject = new \stdClass();
- $this->event = new GenericEvent($this->subject, array('name' => 'Event'));
+ $this->event = new GenericEvent($this->subject, ['name' => 'Event']);
}
/**
@@ -46,7 +46,7 @@ class GenericEventTest extends TestCase
public function testConstruct()
{
- $this->assertEquals($this->event, new GenericEvent($this->subject, array('name' => 'Event')));
+ $this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event']));
}
/**
@@ -55,20 +55,20 @@ class GenericEventTest extends TestCase
public function testGetArguments()
{
// test getting all
- $this->assertSame(array('name' => 'Event'), $this->event->getArguments());
+ $this->assertSame(['name' => 'Event'], $this->event->getArguments());
}
public function testSetArguments()
{
- $result = $this->event->setArguments(array('foo' => 'bar'));
- $this->assertAttributeSame(array('foo' => 'bar'), 'arguments', $this->event);
+ $result = $this->event->setArguments(['foo' => 'bar']);
+ $this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event);
$this->assertSame($this->event, $result);
}
public function testSetArgument()
{
$result = $this->event->setArgument('foo2', 'bar2');
- $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event);
+ $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
$this->assertEquals($this->event, $result);
}
@@ -92,20 +92,20 @@ class GenericEventTest extends TestCase
$this->assertEquals('Event', $this->event['name']);
// test getting invalid arg
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
+ $this->expectException('InvalidArgumentException');
$this->assertFalse($this->event['nameNotExist']);
}
public function testOffsetSet()
{
$this->event['foo2'] = 'bar2';
- $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event);
+ $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event);
}
public function testOffsetUnset()
{
unset($this->event['name']);
- $this->assertAttributeSame(array(), 'arguments', $this->event);
+ $this->assertAttributeSame([], 'arguments', $this->event);
}
public function testOffsetIsset()
@@ -127,10 +127,10 @@ class GenericEventTest extends TestCase
public function testHasIterator()
{
- $data = array();
+ $data = [];
foreach ($this->event as $key => $value) {
$data[$key] = $value;
}
- $this->assertEquals(array('name' => 'Event'), $data);
+ $this->assertEquals(['name' => 'Event'], $data);
}
}
diff --git a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
index 04f2861e..f6556f0b 100644
--- a/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php
@@ -42,10 +42,10 @@ class ImmutableEventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once())
->method('dispatch')
- ->with('event', $event)
- ->will($this->returnValue('result'));
+ ->with($event, 'event')
+ ->willReturn('result');
- $this->assertSame('result', $this->dispatcher->dispatch('event', $event));
+ $this->assertSame('result', $this->dispatcher->dispatch($event, 'event'));
}
public function testGetListenersDelegates()
@@ -53,7 +53,7 @@ class ImmutableEventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once())
->method('getListeners')
->with('event')
- ->will($this->returnValue('result'));
+ ->willReturn('result');
$this->assertSame('result', $this->dispatcher->getListeners('event'));
}
@@ -63,7 +63,7 @@ class ImmutableEventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once())
->method('hasListeners')
->with('event')
- ->will($this->returnValue('result'));
+ ->willReturn('result');
$this->assertSame('result', $this->dispatcher->hasListeners('event'));
}
diff --git a/vendor/symfony/event-dispatcher/Tests/LegacyEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/LegacyEventDispatcherTest.php
new file mode 100644
index 00000000..49aa2f9f
--- /dev/null
+++ b/vendor/symfony/event-dispatcher/Tests/LegacyEventDispatcherTest.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\EventDispatcher\Tests;
+
+use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+
+/**
+ * @group legacy
+ */
+class LegacyEventDispatcherTest extends EventDispatcherTest
+{
+ protected function createEventDispatcher()
+ {
+ return LegacyEventDispatcherProxy::decorate(new TestLegacyEventDispatcher());
+ }
+}
+
+class TestLegacyEventDispatcher extends EventDispatcher
+{
+ public function dispatch($eventName, Event $event = null)
+ {
+ return parent::dispatch($event, $eventName);
+ }
+}
diff --git a/vendor/symfony/event-dispatcher/composer.json b/vendor/symfony/event-dispatcher/composer.json
index 6c75dfbb..8449c478 100644
--- a/vendor/symfony/event-dispatcher/composer.json
+++ b/vendor/symfony/event-dispatcher/composer.json
@@ -17,18 +17,24 @@
],
"require": {
"php": "^7.1.3",
- "symfony/contracts": "^1.0"
+ "symfony/event-dispatcher-contracts": "^1.1"
},
"require-dev": {
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
"symfony/config": "~3.4|~4.0",
+ "symfony/http-foundation": "^3.4|^4.0",
+ "symfony/service-contracts": "^1.1",
"symfony/stopwatch": "~3.4|~4.0",
"psr/log": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.4"
},
+ "provide": {
+ "psr/event-dispatcher-implementation": "1.0",
+ "symfony/event-dispatcher-implementation": "1.1"
+ },
"suggest": {
"symfony/dependency-injection": "",
"symfony/http-kernel": ""
@@ -42,7 +48,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/finder/CHANGELOG.md b/vendor/symfony/finder/CHANGELOG.md
index 9abccfc2..2045184e 100644
--- a/vendor/symfony/finder/CHANGELOG.md
+++ b/vendor/symfony/finder/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========
+4.3.0
+-----
+
+ * added Finder::ignoreVCSIgnored() to ignore files based on rules listed in .gitignore
+
4.2.0
-----
diff --git a/vendor/symfony/finder/Comparator/Comparator.php b/vendor/symfony/finder/Comparator/Comparator.php
index ea37566d..6aee21cf 100644
--- a/vendor/symfony/finder/Comparator/Comparator.php
+++ b/vendor/symfony/finder/Comparator/Comparator.php
@@ -64,7 +64,7 @@ class Comparator
$operator = '==';
}
- if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
+ if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
}
diff --git a/vendor/symfony/finder/Exception/DirectoryNotFoundException.php b/vendor/symfony/finder/Exception/DirectoryNotFoundException.php
new file mode 100644
index 00000000..c6cc0f27
--- /dev/null
+++ b/vendor/symfony/finder/Exception/DirectoryNotFoundException.php
@@ -0,0 +1,19 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Finder\Exception;
+
+/**
+ * @author Andreas Erhard
+ */
+class DirectoryNotFoundException extends \InvalidArgumentException
+{
+}
diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php
index 993f9e34..33b18059 100644
--- a/vendor/symfony/finder/Finder.php
+++ b/vendor/symfony/finder/Finder.php
@@ -13,6 +13,7 @@ namespace Symfony\Component\Finder;
use Symfony\Component\Finder\Comparator\DateComparator;
use Symfony\Component\Finder\Comparator\NumberComparator;
+use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
use Symfony\Component\Finder\Iterator\CustomFilterIterator;
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
@@ -29,7 +30,7 @@ use Symfony\Component\Finder\Iterator\SortableIterator;
*
* All rules may be invoked several times.
*
- * All methods return the current Finder object to allow easy chaining:
+ * All methods return the current Finder object to allow chaining:
*
* $finder = Finder::create()->files()->name('*.php')->in(__DIR__);
*
@@ -39,28 +40,29 @@ class Finder implements \IteratorAggregate, \Countable
{
const IGNORE_VCS_FILES = 1;
const IGNORE_DOT_FILES = 2;
+ const IGNORE_VCS_IGNORED_FILES = 4;
private $mode = 0;
- private $names = array();
- private $notNames = array();
- private $exclude = array();
- private $filters = array();
- private $depths = array();
- private $sizes = array();
+ private $names = [];
+ private $notNames = [];
+ private $exclude = [];
+ private $filters = [];
+ private $depths = [];
+ private $sizes = [];
private $followLinks = false;
private $reverseSorting = false;
private $sort = false;
private $ignore = 0;
- private $dirs = array();
- private $dates = array();
- private $iterators = array();
- private $contains = array();
- private $notContains = array();
- private $paths = array();
- private $notPaths = array();
+ private $dirs = [];
+ private $dates = [];
+ private $iterators = [];
+ private $contains = [];
+ private $notContains = [];
+ private $paths = [];
+ private $notPaths = [];
private $ignoreUnreadableDirs = false;
- private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
+ private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
public function __construct()
{
@@ -373,6 +375,24 @@ class Finder implements \IteratorAggregate, \Countable
return $this;
}
+ /**
+ * Forces Finder to obey .gitignore and ignore files based on rules listed there.
+ *
+ * This option is disabled by default.
+ *
+ * @return $this
+ */
+ public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
+ {
+ if ($ignoreVCSIgnored) {
+ $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
+ } else {
+ $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES;
+ }
+
+ return $this;
+ }
+
/**
* Adds VCS patterns.
*
@@ -566,19 +586,19 @@ class Finder implements \IteratorAggregate, \Countable
*
* @return $this
*
- * @throws \InvalidArgumentException if one of the directories does not exist
+ * @throws DirectoryNotFoundException if one of the directories does not exist
*/
public function in($dirs)
{
- $resolvedDirs = array();
+ $resolvedDirs = [];
foreach ((array) $dirs as $dir) {
if (is_dir($dir)) {
$resolvedDirs[] = $this->normalizeDir($dir);
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
- $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
+ $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
} else {
- throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
+ throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
}
}
@@ -674,12 +694,23 @@ class Finder implements \IteratorAggregate, \Countable
private function searchInDirectory(string $dir): \Iterator
{
+ $exclude = $this->exclude;
+ $notPaths = $this->notPaths;
+
if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
- $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
+ $exclude = array_merge($exclude, self::$vcsPatterns);
}
if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
- $this->notPaths[] = '#(^|/)\..+(/|$)#';
+ $notPaths[] = '#(^|/)\..+(/|$)#';
+ }
+
+ if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
+ $gitignoreFilePath = sprintf('%s/.gitignore', $dir);
+ if (!is_readable($gitignoreFilePath)) {
+ throw new \RuntimeException(sprintf('The "ignoreVCSIgnored" option cannot be used by the Finder as the "%s" file is not readable.', $gitignoreFilePath));
+ }
+ $notPaths = array_merge($notPaths, [Gitignore::toRegex(file_get_contents($gitignoreFilePath))]);
}
$minDepth = 0;
@@ -712,8 +743,8 @@ class Finder implements \IteratorAggregate, \Countable
$iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
- if ($this->exclude) {
- $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
+ if ($exclude) {
+ $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude);
}
$iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
@@ -746,8 +777,8 @@ class Finder implements \IteratorAggregate, \Countable
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
}
- if ($this->paths || $this->notPaths) {
- $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
+ if ($this->paths || $notPaths) {
+ $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
}
if ($this->sort || $this->reverseSorting) {
diff --git a/vendor/symfony/finder/Gitignore.php b/vendor/symfony/finder/Gitignore.php
new file mode 100644
index 00000000..fbeabdbd
--- /dev/null
+++ b/vendor/symfony/finder/Gitignore.php
@@ -0,0 +1,107 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Finder;
+
+/**
+ * Gitignore matches against text.
+ *
+ * @author Ahmed Abdou
+ */
+class Gitignore
+{
+ /**
+ * Returns a regexp which is the equivalent of the gitignore pattern.
+ *
+ * @param string $gitignoreFileContent
+ *
+ * @return string The regexp
+ */
+ public static function toRegex(string $gitignoreFileContent): string
+ {
+ $gitignoreFileContent = preg_replace('/^[^\\\\]*#.*/', '', $gitignoreFileContent);
+ $gitignoreLines = preg_split('/\r\n|\r|\n/', $gitignoreFileContent);
+ $gitignoreLines = array_map('trim', $gitignoreLines);
+ $gitignoreLines = array_filter($gitignoreLines);
+
+ $ignoreLinesPositive = array_filter($gitignoreLines, function (string $line) {
+ return !preg_match('/^!/', $line);
+ });
+
+ $ignoreLinesNegative = array_filter($gitignoreLines, function (string $line) {
+ return preg_match('/^!/', $line);
+ });
+
+ $ignoreLinesNegative = array_map(function (string $line) {
+ return preg_replace('/^!(.*)/', '${1}', $line);
+ }, $ignoreLinesNegative);
+ $ignoreLinesNegative = array_map([__CLASS__, 'getRegexFromGitignore'], $ignoreLinesNegative);
+
+ $ignoreLinesPositive = array_map([__CLASS__, 'getRegexFromGitignore'], $ignoreLinesPositive);
+ if (empty($ignoreLinesPositive)) {
+ return '/^$/';
+ }
+
+ if (empty($ignoreLinesNegative)) {
+ return sprintf('/%s/', implode('|', $ignoreLinesPositive));
+ }
+
+ return sprintf('/(?=^(?:(?!(%s)).)*$)(%s)/', implode('|', $ignoreLinesNegative), implode('|', $ignoreLinesPositive));
+ }
+
+ private static function getRegexFromGitignore(string $gitignorePattern): string
+ {
+ $regex = '(';
+ if (0 === strpos($gitignorePattern, '/')) {
+ $gitignorePattern = substr($gitignorePattern, 1);
+ $regex .= '^';
+ } else {
+ $regex .= '(^|\/)';
+ }
+
+ if ('/' === $gitignorePattern[\strlen($gitignorePattern) - 1]) {
+ $gitignorePattern = substr($gitignorePattern, 0, -1);
+ }
+
+ $iMax = \strlen($gitignorePattern);
+ for ($i = 0; $i < $iMax; ++$i) {
+ $doubleChars = substr($gitignorePattern, $i, 2);
+ if ('**' === $doubleChars) {
+ $regex .= '.+';
+ ++$i;
+ continue;
+ }
+
+ $c = $gitignorePattern[$i];
+ switch ($c) {
+ case '*':
+ $regex .= '[^\/]+';
+ break;
+ case '/':
+ case '.':
+ case ':':
+ case '(':
+ case ')':
+ case '{':
+ case '}':
+ $regex .= '\\'.$c;
+ break;
+ default:
+ $regex .= $c;
+ }
+ }
+
+ $regex .= '($|\/)';
+ $regex .= ')';
+
+ return $regex;
+ }
+}
diff --git a/vendor/symfony/finder/Glob.php b/vendor/symfony/finder/Glob.php
index 27d9ce3d..ea76d51a 100644
--- a/vendor/symfony/finder/Glob.php
+++ b/vendor/symfony/finder/Glob.php
@@ -18,7 +18,7 @@ namespace Symfony\Component\Finder;
*
* // prints foo.bar and foo.baz
* $regex = glob_to_regex("foo.*");
- * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
+ * for (['foo.bar', 'foo.baz', 'foo', 'bar'] as $t)
* {
* if (/$regex/) echo "matched: $car\n";
* }
diff --git a/vendor/symfony/finder/Iterator/CustomFilterIterator.php b/vendor/symfony/finder/Iterator/CustomFilterIterator.php
index 6359727d..a30bbd0b 100644
--- a/vendor/symfony/finder/Iterator/CustomFilterIterator.php
+++ b/vendor/symfony/finder/Iterator/CustomFilterIterator.php
@@ -21,7 +21,7 @@ namespace Symfony\Component\Finder\Iterator;
*/
class CustomFilterIterator extends \FilterIterator
{
- private $filters = array();
+ private $filters = [];
/**
* @param \Iterator $iterator The Iterator to filter
diff --git a/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php
index c08e0a16..2e97e00d 100644
--- a/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php
+++ b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php
@@ -20,7 +20,7 @@ use Symfony\Component\Finder\Comparator\DateComparator;
*/
class DateRangeFilterIterator extends \FilterIterator
{
- private $comparators = array();
+ private $comparators = [];
/**
* @param \Iterator $iterator The Iterator to filter
diff --git a/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php
index d2d41f4a..3c5a3f0e 100644
--- a/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php
+++ b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php
@@ -20,7 +20,7 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
{
private $iterator;
private $isRecursive;
- private $excludedDirs = array();
+ private $excludedDirs = [];
private $excludedPattern;
/**
@@ -31,7 +31,7 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
{
$this->iterator = $iterator;
$this->isRecursive = $iterator instanceof \RecursiveIterator;
- $patterns = array();
+ $patterns = [];
foreach ($directories as $directory) {
$directory = rtrim($directory, '/');
if (!$this->isRecursive || false !== strpos($directory, '/')) {
@@ -75,7 +75,7 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
public function getChildren()
{
- $children = new self($this->iterator->getChildren(), array());
+ $children = new self($this->iterator->getChildren(), []);
$children->excludedDirs = $this->excludedDirs;
$children->excludedPattern = $this->excludedPattern;
diff --git a/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php b/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php
index b94e1d43..18b082ec 100644
--- a/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php
+++ b/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php
@@ -18,8 +18,8 @@ namespace Symfony\Component\Finder\Iterator;
*/
abstract class MultiplePcreFilterIterator extends \FilterIterator
{
- protected $matchRegexps = array();
- protected $noMatchRegexps = array();
+ protected $matchRegexps = [];
+ protected $noMatchRegexps = [];
/**
* @param \Iterator $iterator The Iterator to filter
@@ -91,7 +91,7 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}
- foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
+ foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
if ($start === $delimiters[0] && $end === $delimiters[1]) {
return true;
}
diff --git a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php
index 844ba469..3facef58 100644
--- a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php
+++ b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php
@@ -96,7 +96,7 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
} catch (\UnexpectedValueException $e) {
if ($this->ignoreUnreadableDirs) {
// If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
- return new \RecursiveArrayIterator(array());
+ return new \RecursiveArrayIterator([]);
} else {
throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
}
diff --git a/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php
index a68666b4..2aeef67b 100644
--- a/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php
+++ b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php
@@ -20,7 +20,7 @@ use Symfony\Component\Finder\Comparator\NumberComparator;
*/
class SizeRangeFilterIterator extends \FilterIterator
{
- private $comparators = array();
+ private $comparators = [];
/**
* @param \Iterator $iterator The Iterator to filter
diff --git a/vendor/symfony/finder/Iterator/SortableIterator.php b/vendor/symfony/finder/Iterator/SortableIterator.php
index 56bdcfb1..eda093fa 100644
--- a/vendor/symfony/finder/Iterator/SortableIterator.php
+++ b/vendor/symfony/finder/Iterator/SortableIterator.php
@@ -42,7 +42,7 @@ class SortableIterator implements \IteratorAggregate
if (self::SORT_BY_NAME === $sort) {
$this->sort = function ($a, $b) use ($order) {
- return $order * strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
+ return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
};
} elseif (self::SORT_BY_NAME_NATURAL === $sort) {
$this->sort = function ($a, $b) use ($order) {
@@ -56,7 +56,7 @@ class SortableIterator implements \IteratorAggregate
return $order;
}
- return $order * strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
+ return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
};
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
$this->sort = function ($a, $b) use ($order) {
@@ -73,7 +73,8 @@ class SortableIterator implements \IteratorAggregate
} elseif (self::SORT_BY_NONE === $sort) {
$this->sort = $order;
} elseif (\is_callable($sort)) {
- $this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -$sort($a, $b); } : $sort;
+ $this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -$sort($a, $b); }
+ : $sort;
} else {
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
}
diff --git a/vendor/symfony/finder/SplFileInfo.php b/vendor/symfony/finder/SplFileInfo.php
index b8143ed7..ee798dc7 100644
--- a/vendor/symfony/finder/SplFileInfo.php
+++ b/vendor/symfony/finder/SplFileInfo.php
@@ -57,6 +57,13 @@ class SplFileInfo extends \SplFileInfo
return $this->relativePathname;
}
+ public function getFilenameWithoutExtension(): string
+ {
+ $filename = $this->getFilename();
+
+ return \pathinfo($filename, PATHINFO_FILENAME);
+ }
+
/**
* Returns the contents of the file.
*
diff --git a/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php
index 656fc57a..2f56092e 100644
--- a/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php
+++ b/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php
@@ -58,8 +58,8 @@ class ComparatorTest extends TestCase
public function getTestData()
{
- return array(
- array('<', '1000', array('500', '999'), array('1000', '1500')),
- );
+ return [
+ ['<', '1000', ['500', '999'], ['1000', '1500']],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php
index 8a6c1ddf..3aebf524 100644
--- a/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php
+++ b/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php
@@ -51,14 +51,14 @@ class DateComparatorTest extends TestCase
public function getTestData()
{
- return array(
- array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
- array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
- array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
- array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
- array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
- array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
- array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))),
- );
+ return [
+ ['< 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
+ ['until 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
+ ['before 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
+ ['> 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
+ ['after 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
+ ['since 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
+ ['!= 2005-10-10', [strtotime('2005-10-11')], [strtotime('2005-10-10')]],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php
index 30a75c73..5b49b660 100644
--- a/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php
+++ b/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php
@@ -53,39 +53,39 @@ class NumberComparatorTest extends TestCase
public function getTestData()
{
- return array(
- array('< 1000', array('500', '999'), array('1000', '1500')),
+ return [
+ ['< 1000', ['500', '999'], ['1000', '1500']],
- array('< 1K', array('500', '999'), array('1000', '1500')),
- array('<1k', array('500', '999'), array('1000', '1500')),
- array(' < 1 K ', array('500', '999'), array('1000', '1500')),
- array('<= 1K', array('1000'), array('1001')),
- array('> 1K', array('1001'), array('1000')),
- array('>= 1K', array('1000'), array('999')),
+ ['< 1K', ['500', '999'], ['1000', '1500']],
+ ['<1k', ['500', '999'], ['1000', '1500']],
+ [' < 1 K ', ['500', '999'], ['1000', '1500']],
+ ['<= 1K', ['1000'], ['1001']],
+ ['> 1K', ['1001'], ['1000']],
+ ['>= 1K', ['1000'], ['999']],
- array('< 1KI', array('500', '1023'), array('1024', '1500')),
- array('<= 1KI', array('1024'), array('1025')),
- array('> 1KI', array('1025'), array('1024')),
- array('>= 1KI', array('1024'), array('1023')),
+ ['< 1KI', ['500', '1023'], ['1024', '1500']],
+ ['<= 1KI', ['1024'], ['1025']],
+ ['> 1KI', ['1025'], ['1024']],
+ ['>= 1KI', ['1024'], ['1023']],
- array('1KI', array('1024'), array('1023', '1025')),
- array('==1KI', array('1024'), array('1023', '1025')),
+ ['1KI', ['1024'], ['1023', '1025']],
+ ['==1KI', ['1024'], ['1023', '1025']],
- array('==1m', array('1000000'), array('999999', '1000001')),
- array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
+ ['==1m', ['1000000'], ['999999', '1000001']],
+ ['==1mi', [1024 * 1024], [1024 * 1024 - 1, 1024 * 1024 + 1]],
- array('==1g', array('1000000000'), array('999999999', '1000000001')),
- array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
+ ['==1g', ['1000000000'], ['999999999', '1000000001']],
+ ['==1gi', [1024 * 1024 * 1024], [1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1]],
- array('!= 1000', array('500', '999'), array('1000')),
- );
+ ['!= 1000', ['500', '999'], ['1000']],
+ ];
}
public function getConstructorTestData()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'1', '0',
'3.5', '33.55', '123.456', '123456.78',
'.1', '.123',
@@ -94,15 +94,15 @@ class NumberComparatorTest extends TestCase
'==1', '!=1', '<1', '>1', '<=1', '>=1',
'==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi',
'1k', '1ki', '1m', '1mi', '1g', '1gi',
- ),
- array(
+ ],
+ [
false, null, '',
' ', 'foobar',
'=1', '===1',
'0 . 1', '123 .45', '234. 567',
'..', '.0.', '0.1.2',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/FinderTest.php b/vendor/symfony/finder/Tests/FinderTest.php
index cdd176d7..8d663790 100644
--- a/vendor/symfony/finder/Tests/FinderTest.php
+++ b/vendor/symfony/finder/Tests/FinderTest.php
@@ -24,20 +24,20 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->directories());
- $this->assertIterator($this->toAbsolute(array('foo', 'qux', 'toto')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo', 'qux', 'toto']), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->directories();
$finder->files();
$finder->directories();
- $this->assertIterator($this->toAbsolute(array('foo', 'qux', 'toto')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo', 'qux', 'toto']), $finder->in(self::$tmpDir)->getIterator());
}
public function testFiles()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->files());
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp',
+ $this->assertIterator($this->toAbsolute(['foo/bar.tmp',
'test.php',
'test.py',
'foo bar',
@@ -49,13 +49,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->files();
$finder->directories();
$finder->files();
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp',
+ $this->assertIterator($this->toAbsolute(['foo/bar.tmp',
'test.php',
'test.py',
'foo bar',
@@ -67,14 +67,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testRemoveTrailingSlash()
{
$finder = $this->buildFinder();
- $expected = $this->toAbsolute(array(
+ $expected = $this->toAbsolute([
'foo/bar.tmp',
'test.php',
'test.py',
@@ -87,7 +87,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- ));
+ ]);
$in = self::$tmpDir.'//';
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
@@ -102,7 +102,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $this->buildFinder();
symlink($this->toAbsolute('foo'), $this->toAbsolute('baz'));
- $expected = $this->toAbsolute(array('baz/bar.tmp'));
+ $expected = $this->toAbsolute(['baz/bar.tmp']);
$in = self::$tmpDir.'/baz/';
try {
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
@@ -117,7 +117,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder();
- $expected = $this->toAbsolute(array('foo/../foo/bar.tmp'));
+ $expected = $this->toAbsolute(['foo/../foo/bar.tmp']);
$in = self::$tmpDir.'/foo/../foo/';
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
}
@@ -126,7 +126,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->depth('< 1'));
- $this->assertIterator($this->toAbsolute(array('foo',
+ $this->assertIterator($this->toAbsolute(['foo',
'test.php',
'test.py',
'toto',
@@ -138,11 +138,11 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->depth('<= 0'));
- $this->assertIterator($this->toAbsolute(array('foo',
+ $this->assertIterator($this->toAbsolute(['foo',
'test.php',
'test.py',
'toto',
@@ -154,37 +154,37 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->depth('>= 1'));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo/bar.tmp',
'qux/baz_100_1.py',
'qux/baz_1_2.py',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->depth('< 1')->depth('>= 1');
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator([], $finder->in(self::$tmpDir)->getIterator());
}
public function testDepthWithArrayParam()
{
$finder = $this->buildFinder();
- $finder->depth(array('>= 1', '< 2'));
- $this->assertIterator($this->toAbsolute(array(
+ $finder->depth(['>= 1', '< 2']);
+ $this->assertIterator($this->toAbsolute([
'foo/bar.tmp',
'qux/baz_100_1.py',
'qux/baz_1_2.py',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testName()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->name('*.php'));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'test.php',
'qux_0_1.php',
'qux_1000_1.php',
@@ -192,20 +192,20 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('test.ph*');
$finder->name('test.py');
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['test.php', 'test.py']), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('~^test~i');
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['test.php', 'test.py']), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('~\\.php$~i');
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'test.php',
'qux_0_1.php',
'qux_1000_1.php',
@@ -213,25 +213,25 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('test.p{hp,y}');
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['test.php', 'test.py']), $finder->in(self::$tmpDir)->getIterator());
}
public function testNameWithArrayParam()
{
$finder = $this->buildFinder();
- $finder->name(array('test.php', 'test.py'));
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
+ $finder->name(['test.php', 'test.py']);
+ $this->assertIterator($this->toAbsolute(['test.php', 'test.py']), $finder->in(self::$tmpDir)->getIterator());
}
public function testNotName()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->notName('*.php'));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo/bar.tmp',
'test.py',
@@ -240,44 +240,44 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux',
'qux/baz_100_1.py',
'qux/baz_1_2.py',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->notName('*.php');
$finder->notName('*.py');
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo/bar.tmp',
'toto',
'foo bar',
'qux',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('test.ph*');
$finder->name('test.py');
$finder->notName('*.php');
$finder->notName('*.py');
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator([], $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->name('test.ph*');
$finder->name('test.py');
$finder->notName('*.p{hp,y}');
- $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator([], $finder->in(self::$tmpDir)->getIterator());
}
public function testNotNameWithArrayParam()
{
$finder = $this->buildFinder();
- $finder->notName(array('*.php', '*.py'));
- $this->assertIterator($this->toAbsolute(array(
+ $finder->notName(['*.php', '*.py']);
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo/bar.tmp',
'toto',
'foo bar',
'qux',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
/**
@@ -287,45 +287,45 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder();
$finder->name($regex);
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'test.py',
'test.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSize()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->files()->size('< 1K')->size('> 500'));
- $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['test.php']), $finder->in(self::$tmpDir)->getIterator());
}
public function testSizeWithArrayParam()
{
$finder = $this->buildFinder();
- $this->assertSame($finder, $finder->files()->size(array('< 1K', '> 500')));
- $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertSame($finder, $finder->files()->size(['< 1K', '> 500']));
+ $this->assertIterator($this->toAbsolute(['test.php']), $finder->in(self::$tmpDir)->getIterator());
}
public function testDate()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->files()->date('until last month'));
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo/bar.tmp', 'test.php']), $finder->in(self::$tmpDir)->getIterator());
}
public function testDateWithArrayParam()
{
$finder = $this->buildFinder();
- $this->assertSame($finder, $finder->files()->date(array('>= 2005-10-15', 'until last month')));
- $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertSame($finder, $finder->files()->date(['>= 2005-10-15', 'until last month']));
+ $this->assertIterator($this->toAbsolute(['foo/bar.tmp', 'test.php']), $finder->in(self::$tmpDir)->getIterator());
}
public function testExclude()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->exclude('foo'));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'test.php',
'test.py',
'toto',
@@ -339,14 +339,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testIgnoreVCS()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
'.git',
'foo',
'foo/bar.tmp',
@@ -368,11 +369,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
'.git',
'foo',
'foo/bar.tmp',
@@ -394,11 +396,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
'foo',
'foo/bar.tmp',
'test.php',
@@ -418,14 +421,93 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
+ }
+
+ public function testIgnoreVCSIgnored()
+ {
+ $finder = $this->buildFinder();
+ $this->assertSame(
+ $finder,
+ $finder
+ ->ignoreVCS(true)
+ ->ignoreDotFiles(true)
+ ->ignoreVCSIgnored(true)
+ );
+ $this->assertIterator($this->toAbsolute([
+ 'foo',
+ 'foo/bar.tmp',
+ 'test.py',
+ 'toto',
+ 'foo bar',
+ 'qux',
+ 'qux/baz_100_1.py',
+ 'qux/baz_1_2.py',
+ ]), $finder->in(self::$tmpDir)->getIterator());
+ }
+
+ public function testIgnoreVCSCanBeDisabledAfterFirstIteration()
+ {
+ $finder = $this->buildFinder();
+ $finder->in(self::$tmpDir);
+ $finder->ignoreDotFiles(false);
+
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
+ 'foo',
+ 'foo/bar.tmp',
+ 'qux',
+ 'qux/baz_100_1.py',
+ 'qux/baz_1_2.py',
+ 'qux_0_1.php',
+ 'qux_1000_1.php',
+ 'qux_1002_0.php',
+ 'qux_10_2.php',
+ 'qux_12_0.php',
+ 'qux_2_0.php',
+ 'test.php',
+ 'test.py',
+ 'toto',
+ '.bar',
+ '.foo',
+ '.foo/.bar',
+ '.foo/bar',
+ 'foo bar',
+ ]), $finder->getIterator());
+
+ $finder->ignoreVCS(false);
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
+ '.git',
+ 'foo',
+ 'foo/bar.tmp',
+ 'qux',
+ 'qux/baz_100_1.py',
+ 'qux/baz_1_2.py',
+ 'qux_0_1.php',
+ 'qux_1000_1.php',
+ 'qux_1002_0.php',
+ 'qux_10_2.php',
+ 'qux_12_0.php',
+ 'qux_2_0.php',
+ 'test.php',
+ 'test.py',
+ 'toto',
+ 'toto/.git',
+ '.bar',
+ '.foo',
+ '.foo/.bar',
+ '.foo/bar',
+ 'foo bar',
+ ]), $finder->getIterator());
}
public function testIgnoreDotFiles()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
'.git',
'.bar',
'.foo',
@@ -447,11 +529,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false);
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
'.git',
'.bar',
'.foo',
@@ -473,11 +556,11 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo/bar.tmp',
'test.php',
@@ -493,14 +576,62 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
+ }
+
+ public function testIgnoreDotFilesCanBeDisabledAfterFirstIteration()
+ {
+ $finder = $this->buildFinder();
+ $finder->in(self::$tmpDir);
+
+ $this->assertIterator($this->toAbsolute([
+ 'foo',
+ 'foo/bar.tmp',
+ 'qux',
+ 'qux/baz_100_1.py',
+ 'qux/baz_1_2.py',
+ 'qux_0_1.php',
+ 'qux_1000_1.php',
+ 'qux_1002_0.php',
+ 'qux_10_2.php',
+ 'qux_12_0.php',
+ 'qux_2_0.php',
+ 'test.php',
+ 'test.py',
+ 'toto',
+ 'foo bar',
+ ]), $finder->getIterator());
+
+ $finder->ignoreDotFiles(false);
+ $this->assertIterator($this->toAbsolute([
+ '.gitignore',
+ 'foo',
+ 'foo/bar.tmp',
+ 'qux',
+ 'qux/baz_100_1.py',
+ 'qux/baz_1_2.py',
+ 'qux_0_1.php',
+ 'qux_1000_1.php',
+ 'qux_1002_0.php',
+ 'qux_10_2.php',
+ 'qux_12_0.php',
+ 'qux_2_0.php',
+ 'test.php',
+ 'test.py',
+ 'toto',
+ '.bar',
+ '.foo',
+ '.foo/.bar',
+ '.foo/bar',
+ 'foo bar',
+ ]), $finder->getIterator());
}
public function testSortByName()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByName());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo bar',
'foo/bar.tmp',
@@ -516,14 +647,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'test.php',
'test.py',
'toto',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSortByType()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByType());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo bar',
'toto',
@@ -539,14 +670,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSortByAccessedTime()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByAccessedTime());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo/bar.tmp',
'test.php',
'toto',
@@ -562,14 +693,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSortByChangedTime()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByChangedTime());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'toto',
'test.py',
'test.php',
@@ -585,14 +716,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSortByModifiedTime()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByModifiedTime());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo/bar.tmp',
'test.php',
'toto',
@@ -608,7 +739,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testReverseSorting()
@@ -616,7 +747,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByName());
$this->assertSame($finder, $finder->reverseSorting());
- $this->assertOrderedIteratorInForeach($this->toAbsolute(array(
+ $this->assertOrderedIteratorInForeach($this->toAbsolute([
'toto',
'test.py',
'test.php',
@@ -632,14 +763,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'foo/bar.tmp',
'foo bar',
'foo',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSortByNameNatural()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByName(true));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo bar',
'foo/bar.tmp',
@@ -655,11 +786,11 @@ class FinderTest extends Iterator\RealIteratorTestCase
'test.php',
'test.py',
'toto',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sortByName(false));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo bar',
'foo/bar.tmp',
@@ -675,14 +806,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'test.php',
'test.py',
'toto',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testSort()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo bar',
'foo/bar.tmp',
@@ -698,14 +829,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testFilter()
{
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return false !== strpos($f, 'test'); }));
- $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
+ $this->assertIterator($this->toAbsolute(['test.php', 'test.py']), $finder->in(self::$tmpDir)->getIterator());
}
public function testFollowLinks()
@@ -716,7 +847,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $this->buildFinder();
$this->assertSame($finder, $finder->followLinks());
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo',
'foo/bar.tmp',
'test.php',
@@ -732,16 +863,17 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )), $finder->in(self::$tmpDir)->getIterator());
+ ]), $finder->in(self::$tmpDir)->getIterator());
}
public function testIn()
{
$finder = $this->buildFinder();
- $iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator();
+ $iterator = $finder->files()->name('*.php')->depth('< 1')->in([self::$tmpDir, __DIR__])->getIterator();
- $expected = array(
+ $expected = [
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
+ __DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php',
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_0_1.php',
@@ -750,13 +882,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_10_2.php',
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_12_0.php',
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_2_0.php',
- );
+ ];
$this->assertIterator($expected, $iterator);
}
/**
- * @expectedException \InvalidArgumentException
+ * @expectedException \Symfony\Component\Finder\Exception\DirectoryNotFoundException
*/
public function testInWithNonExistentDirectory()
{
@@ -764,12 +896,21 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder->in('foobar');
}
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testInWithNonExistentDirectoryLegacyException()
+ {
+ $finder = new Finder();
+ $finder->in('foobar');
+ }
+
public function testInWithGlob()
{
$finder = $this->buildFinder();
- $finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator();
+ $finder->in([__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'])->getIterator();
- $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
+ $this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder);
}
/**
@@ -783,10 +924,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testInWithGlobBrace()
{
- $finder = $this->buildFinder();
- $finder->in(array(__DIR__.'/Fixtures/{A,copy/A}/B/C'))->getIterator();
+ if (!\defined('GLOB_BRACE')) {
+ $this->markTestSkipped('Glob brace is not supported on this system.');
+ }
- $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
+ $finder = $this->buildFinder();
+ $finder->in([__DIR__.'/Fixtures/{A,copy/A}/B/C'])->getIterator();
+
+ $this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder);
}
/**
@@ -801,12 +946,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testGetIterator()
{
$finder = $this->buildFinder();
- $dirs = array();
+ $dirs = [];
foreach ($finder->directories()->in(self::$tmpDir) as $dir) {
$dirs[] = (string) $dir;
}
- $expected = $this->toAbsolute(array('foo', 'qux', 'toto'));
+ $expected = $this->toAbsolute(['foo', 'qux', 'toto']);
sort($dirs);
sort($expected);
@@ -827,13 +972,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder()->in(self::$tmpDir);
- $paths = array();
+ $paths = [];
foreach ($finder as $file) {
$paths[] = $file->getRelativePath();
}
- $ref = array('', '', '', '', '', '', '', '', '', '', '', 'foo', 'qux', 'qux', '');
+ $ref = ['', '', '', '', '', '', '', '', '', '', '', 'foo', 'qux', 'qux', ''];
sort($ref);
sort($paths);
@@ -845,13 +990,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
$finder = $this->buildFinder()->in(self::$tmpDir)->sortByName();
- $paths = array();
+ $paths = [];
foreach ($finder as $file) {
$paths[] = $file->getRelativePathname();
}
- $ref = array(
+ $ref = [
'test.php',
'toto',
'test.py',
@@ -867,7 +1012,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
sort($paths);
sort($ref);
@@ -875,6 +1020,40 @@ class FinderTest extends Iterator\RealIteratorTestCase
$this->assertEquals($ref, $paths);
}
+ public function testGetFilenameWithoutExtension()
+ {
+ $finder = $this->buildFinder()->in(self::$tmpDir)->sortByName();
+
+ $fileNames = [];
+
+ foreach ($finder as $file) {
+ $fileNames[] = $file->getFilenameWithoutExtension();
+ }
+
+ $ref = [
+ 'test',
+ 'toto',
+ 'test',
+ 'foo',
+ 'bar',
+ 'foo bar',
+ 'qux',
+ 'baz_100_1',
+ 'baz_1_2',
+ 'qux_0_1',
+ 'qux_1000_1',
+ 'qux_1002_0',
+ 'qux_10_2',
+ 'qux_12_0',
+ 'qux_2_0',
+ ];
+
+ sort($fileNames);
+ sort($ref);
+
+ $this->assertEquals($ref, $fileNames);
+ }
+
public function testAppendWithAFinder()
{
$finder = $this->buildFinder();
@@ -885,7 +1064,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $finder->append($finder1);
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'qux', 'toto')), $finder->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'qux', 'toto']), $finder->getIterator());
}
public function testAppendWithAnArray()
@@ -893,14 +1072,14 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder = $this->buildFinder();
$finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
- $finder->append($this->toAbsolute(array('foo', 'toto')));
+ $finder->append($this->toAbsolute(['foo', 'toto']));
- $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'toto']), $finder->getIterator());
}
public function testAppendReturnsAFinder()
{
- $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append(array()));
+ $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append([]));
}
public function testAppendDoesNotRequireIn()
@@ -981,7 +1160,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
->directories()
->name('Fixtures')
->contains('abc');
- $this->assertIterator(array(), $finder);
+ $this->assertIterator([], $finder);
}
public function testNotContainsOnDirectory()
@@ -991,7 +1170,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
->directories()
->name('Fixtures')
->notContains('abc');
- $this->assertIterator(array(), $finder);
+ $this->assertIterator([], $finder);
}
/**
@@ -1002,10 +1181,10 @@ class FinderTest extends Iterator\RealIteratorTestCase
*/
public function testMultipleLocations()
{
- $locations = array(
+ $locations = [
self::$tmpDir.'/',
self::$tmpDir.'/toto/',
- );
+ ];
// it is expected that there are test.py test.php in the tmpDir
$finder = new Finder();
@@ -1027,18 +1206,18 @@ class FinderTest extends Iterator\RealIteratorTestCase
*/
public function testMultipleLocationsWithSubDirectories()
{
- $locations = array(
+ $locations = [
__DIR__.'/Fixtures/one',
self::$tmpDir.\DIRECTORY_SEPARATOR.'toto',
- );
+ ];
$finder = $this->buildFinder();
$finder->in($locations)->depth('< 10')->name('*.neon');
- $expected = array(
+ $expected = [
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon',
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon',
- );
+ ];
$this->assertIterator($expected, $finder);
$this->assertIteratorInForeach($expected, $finder);
@@ -1061,34 +1240,34 @@ class FinderTest extends Iterator\RealIteratorTestCase
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
->path('/^dir/');
- $expected = array('r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'bar.dat');
+ $expected = ['r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'bar.dat'];
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
}
public function getContainsTestData()
{
- return array(
- array('', '', array()),
- array('foo', 'bar', array()),
- array('', 'foobar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
- array('lorem ipsum dolor sit amet', 'foobar', array('lorem.txt')),
- array('sit', 'bar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
- array('dolor sit amet', '@^L@m', array('dolor.txt', 'ipsum.txt')),
- array('/^lorem ipsum dolor sit amet$/m', 'foobar', array('lorem.txt')),
- array('lorem', 'foobar', array('lorem.txt')),
- array('', 'lorem', array('dolor.txt', 'ipsum.txt')),
- array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')),
- array(array('lorem', 'dolor'), array(), array('lorem.txt', 'ipsum.txt', 'dolor.txt')),
- array('', array('lorem', 'ipsum'), array('dolor.txt')),
- );
+ return [
+ ['', '', []],
+ ['foo', 'bar', []],
+ ['', 'foobar', ['dolor.txt', 'ipsum.txt', 'lorem.txt']],
+ ['lorem ipsum dolor sit amet', 'foobar', ['lorem.txt']],
+ ['sit', 'bar', ['dolor.txt', 'ipsum.txt', 'lorem.txt']],
+ ['dolor sit amet', '@^L@m', ['dolor.txt', 'ipsum.txt']],
+ ['/^lorem ipsum dolor sit amet$/m', 'foobar', ['lorem.txt']],
+ ['lorem', 'foobar', ['lorem.txt']],
+ ['', 'lorem', ['dolor.txt', 'ipsum.txt']],
+ ['ipsum dolor sit amet', '/^IPSUM/m', ['lorem.txt']],
+ [['lorem', 'dolor'], [], ['lorem.txt', 'ipsum.txt', 'dolor.txt']],
+ ['', ['lorem', 'ipsum'], ['dolor.txt']],
+ ];
}
public function getRegexNameTestData()
{
- return array(
- array('~.*t\\.p.+~i'),
- array('~t.*s~i'),
- );
+ return [
+ ['~.*t\\.p.+~i'],
+ ['~t.*s~i'],
+ ];
}
/**
@@ -1106,29 +1285,29 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function getTestPathData()
{
- return array(
- array('', '', array()),
- array('/^A\/B\/C/', '/C$/',
- array('A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'),
- ),
- array('/^A\/B/', 'foobar',
- array(
+ return [
+ ['', '', []],
+ ['/^A\/B\/C/', '/C$/',
+ ['A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'],
+ ],
+ ['/^A\/B/', 'foobar',
+ [
'A'.\DIRECTORY_SEPARATOR.'B',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
- ),
- ),
- array('A/B/C', 'foobar',
- array(
+ ],
+ ],
+ ['A/B/C', 'foobar',
+ [
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
- ),
- ),
- array('A/B', 'foobar',
- array(
+ ],
+ ],
+ ['A/B', 'foobar',
+ [
//dirs
'A'.\DIRECTORY_SEPARATOR.'B',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
@@ -1139,27 +1318,27 @@ class FinderTest extends Iterator\RealIteratorTestCase
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat.copy',
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
- ),
- ),
- array('/^with space\//', 'foobar',
- array(
+ ],
+ ],
+ ['/^with space\//', 'foobar',
+ [
'with space'.\DIRECTORY_SEPARATOR.'foo.txt',
- ),
- ),
- array(
+ ],
+ ],
+ [
'/^A/',
- array('a.dat', 'abc.dat'),
- array(
+ ['a.dat', 'abc.dat'],
+ [
'A',
'A'.\DIRECTORY_SEPARATOR.'B',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
- ),
- ),
- array(
- array('/^A/', 'one'),
+ ],
+ ],
+ [
+ ['/^A/', 'one'],
'foobar',
- array(
+ [
'A',
'A'.\DIRECTORY_SEPARATOR.'B',
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
@@ -1171,9 +1350,9 @@ class FinderTest extends Iterator\RealIteratorTestCase
'one'.\DIRECTORY_SEPARATOR.'b',
'one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon',
'one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon',
- ),
- ),
- );
+ ],
+ ],
+ ];
}
public function testAccessDeniedException()
@@ -1191,7 +1370,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
if (false === $couldRead = is_readable($testDir)) {
try {
- $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
+ $this->assertIterator($this->toAbsolute(['foo bar', 'test.php', 'test.py']), $finder->getIterator());
$this->fail('Finder should throw an exception when opening a non-readable directory.');
} catch (\Exception $e) {
$expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
@@ -1230,7 +1409,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
chmod($testDir, 0333);
if (false === ($couldRead = is_readable($testDir))) {
- $this->assertIterator($this->toAbsolute(array(
+ $this->assertIterator($this->toAbsolute([
'foo bar',
'test.php',
'test.py',
@@ -1242,7 +1421,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- )
+ ]
), $finder->getIterator());
}
diff --git a/vendor/symfony/finder/Tests/GitignoreTest.php b/vendor/symfony/finder/Tests/GitignoreTest.php
new file mode 100644
index 00000000..fca846d8
--- /dev/null
+++ b/vendor/symfony/finder/Tests/GitignoreTest.php
@@ -0,0 +1,118 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Finder\Tests;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Finder\Gitignore;
+
+class GitignoreTest extends TestCase
+{
+ /**
+ * @dataProvider provider
+ *
+ * @param string $patterns
+ * @param array $matchingCases
+ * @param array $nonMatchingCases
+ */
+ public function testCases(string $patterns, array $matchingCases, array $nonMatchingCases)
+ {
+ $regex = Gitignore::toRegex($patterns);
+
+ foreach ($matchingCases as $matchingCase) {
+ $this->assertRegExp($regex, $matchingCase, sprintf('Failed asserting path [%s] matches gitignore patterns [%s] using regex [%s]', $matchingCase, $patterns, $regex));
+ }
+
+ foreach ($nonMatchingCases as $nonMatchingCase) {
+ $this->assertNotRegExp($regex, $nonMatchingCase, sprintf('Failed asserting path [%s] not matching gitignore patterns [%s] using regex [%s]', $nonMatchingCase, $patterns, $regex));
+ }
+ }
+
+ /**
+ * @return array return is array of
+ * [
+ * [
+ * '', // Git-ignore Pattern
+ * [], // array of file paths matching
+ * [], // array of file paths not matching
+ * ],
+ * ]
+ */
+ public function provider()
+ {
+ return [
+ [
+ '
+ *
+ !/bin/bash
+ ',
+ ['bin/cat', 'abc/bin/cat'],
+ ['bin/bash'],
+ ],
+ [
+ 'fi#le.txt',
+ [],
+ ['#file.txt'],
+ ],
+ [
+ '
+ /bin/
+ /usr/local/
+ !/bin/bash
+ !/usr/local/bin/bash
+ ',
+ ['bin/cat'],
+ ['bin/bash'],
+ ],
+ [
+ '*.py[co]',
+ ['file.pyc', 'file.pyc'],
+ ['filexpyc', 'file.pycx', 'file.py'],
+ ],
+ [
+ 'dir1/**/dir2/',
+ ['dir1/dirA/dir2/', 'dir1/dirA/dirB/dir2/'],
+ [],
+ ],
+ [
+ 'dir1/*/dir2/',
+ ['dir1/dirA/dir2/'],
+ ['dir1/dirA/dirB/dir2/'],
+ ],
+ [
+ '/*.php',
+ ['file.php'],
+ ['app/file.php'],
+ ],
+ [
+ '\#file.txt',
+ ['#file.txt'],
+ [],
+ ],
+ [
+ '*.php',
+ ['app/file.php', 'file.php'],
+ ['file.phps', 'file.phps', 'filephps'],
+ ],
+ [
+ 'app/cache/',
+ ['app/cache/file.txt', 'app/cache/dir1/dir2/file.txt', 'a/app/cache/file.txt'],
+ [],
+ ],
+ [
+ '
+ #IamComment
+ /app/cache/',
+ ['app/cache/file.txt', 'app/cache/subdir/ile.txt'],
+ ['a/app/cache/file.txt'],
+ ],
+ ];
+ }
+}
diff --git a/vendor/symfony/finder/Tests/GlobTest.php b/vendor/symfony/finder/Tests/GlobTest.php
index 3a5aab31..2d48799c 100644
--- a/vendor/symfony/finder/Tests/GlobTest.php
+++ b/vendor/symfony/finder/Tests/GlobTest.php
@@ -39,7 +39,7 @@ class GlobTest extends TestCase
}
sort($match);
- $this->assertSame(array('one/b/c.neon', 'one/b/d.neon'), $match);
+ $this->assertSame(['one/b/c.neon', 'one/b/d.neon'], $match);
}
public function testGlobToRegexDoubleStarNonStrictDots()
@@ -56,7 +56,7 @@ class GlobTest extends TestCase
}
sort($match);
- $this->assertSame(array('.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'), $match);
+ $this->assertSame(['.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'], $match);
}
public function testGlobToRegexDoubleStarWithoutLeadingSlash()
@@ -73,7 +73,7 @@ class GlobTest extends TestCase
}
sort($match);
- $this->assertSame(array('one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
+ $this->assertSame(['one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
}
public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
@@ -90,6 +90,6 @@ class GlobTest extends TestCase
}
sort($match);
- $this->assertSame(array('one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
+ $this->assertSame(['one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php
index b036ad13..ad0187e0 100644
--- a/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php
@@ -20,7 +20,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
*/
public function testWithInvalidFilter()
{
- new CustomFilterIterator(new Iterator(), array('foo'));
+ new CustomFilterIterator(new Iterator(), ['foo']);
}
/**
@@ -28,7 +28,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
*/
public function testAccept($filters, $expected)
{
- $inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
+ $inner = new Iterator(['test.php', 'test.py', 'foo.php']);
$iterator = new CustomFilterIterator($inner, $filters);
@@ -37,10 +37,10 @@ class CustomFilterIteratorTest extends IteratorTestCase
public function getAcceptData()
{
- return array(
- array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
- array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')),
- array(array('is_dir'), array()),
- );
+ return [
+ [[function (\SplFileInfo $fileinfo) { return false; }], []],
+ [[function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }], ['test.php', 'test.py']],
+ [['is_dir'], []],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php
index ade1a41a..2d8cfb30 100644
--- a/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php
@@ -32,7 +32,7 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $since20YearsAgo = array(
+ $since20YearsAgo = [
'.git',
'test.py',
'foo',
@@ -54,9 +54,9 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $since2MonthsAgo = array(
+ $since2MonthsAgo = [
'.git',
'test.py',
'foo',
@@ -76,17 +76,17 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $untilLastMonth = array(
+ $untilLastMonth = [
'foo/bar.tmp',
'test.php',
- );
+ ];
- return array(
- array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
- array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
- array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),
- );
+ return [
+ [[new DateComparator('since 20 years ago')], $this->toAbsolute($since20YearsAgo)],
+ [[new DateComparator('since 2 months ago')], $this->toAbsolute($since2MonthsAgo)],
+ [[new DateComparator('until last month')], $this->toAbsolute($untilLastMonth)],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
index 3a403cb9..7c2572d2 100644
--- a/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
@@ -32,7 +32,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $lessThan1 = array(
+ $lessThan1 = [
+ '.gitignore',
'.git',
'test.py',
'foo',
@@ -48,9 +49,10 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $lessThanOrEqualTo1 = array(
+ $lessThanOrEqualTo1 = [
+ '.gitignore',
'.git',
'test.py',
'foo',
@@ -72,32 +74,32 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $graterThanOrEqualTo1 = array(
+ $graterThanOrEqualTo1 = [
'toto/.git',
'foo/bar.tmp',
'.foo/.bar',
'.foo/bar',
'qux/baz_100_1.py',
'qux/baz_1_2.py',
- );
+ ];
- $equalTo1 = array(
+ $equalTo1 = [
'toto/.git',
'foo/bar.tmp',
'.foo/.bar',
'.foo/bar',
'qux/baz_100_1.py',
'qux/baz_1_2.py',
- );
+ ];
- return array(
- array(0, 0, $this->toAbsolute($lessThan1)),
- array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
- array(2, PHP_INT_MAX, array()),
- array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
- array(1, 1, $this->toAbsolute($equalTo1)),
- );
+ return [
+ [0, 0, $this->toAbsolute($lessThan1)],
+ [0, 1, $this->toAbsolute($lessThanOrEqualTo1)],
+ [2, PHP_INT_MAX, []],
+ [1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)],
+ [1, 1, $this->toAbsolute($equalTo1)],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
index c977b0cf..dbf461f6 100644
--- a/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
@@ -30,7 +30,8 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $foo = array(
+ $foo = [
+ '.gitignore',
'.bar',
'.foo',
'.foo/.bar',
@@ -50,9 +51,10 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $fo = array(
+ $fo = [
+ '.gitignore',
'.bar',
'.foo',
'.foo/.bar',
@@ -74,9 +76,10 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $toto = array(
+ $toto = [
+ '.gitignore',
'.bar',
'.foo',
'.foo/.bar',
@@ -96,12 +99,12 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- return array(
- array(array('foo'), $this->toAbsolute($foo)),
- array(array('fo'), $this->toAbsolute($fo)),
- array(array('toto/'), $this->toAbsolute($toto)),
- );
+ return [
+ [['foo'], $this->toAbsolute($foo)],
+ [['fo'], $this->toAbsolute($fo)],
+ [['toto/'], $this->toAbsolute($toto)],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php
index 0ecd8dfe..49616ce0 100644
--- a/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php
@@ -29,7 +29,7 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $onlyFiles = array(
+ $onlyFiles = [
'test.py',
'foo/bar.tmp',
'test.php',
@@ -45,21 +45,21 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- );
+ ];
- $onlyDirectories = array(
+ $onlyDirectories = [
'.git',
'foo',
'qux',
'toto',
'toto/.git',
'.foo',
- );
+ ];
- return array(
- array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)),
- array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)),
- );
+ return [
+ [FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)],
+ [FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php
index 744bdae1..f4f70c8e 100644
--- a/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php
@@ -17,23 +17,23 @@ class FilecontentFilterIteratorTest extends IteratorTestCase
{
public function testAccept()
{
- $inner = new MockFileListIterator(array('test.txt'));
- $iterator = new FilecontentFilterIterator($inner, array(), array());
- $this->assertIterator(array('test.txt'), $iterator);
+ $inner = new MockFileListIterator(['test.txt']);
+ $iterator = new FilecontentFilterIterator($inner, [], []);
+ $this->assertIterator(['test.txt'], $iterator);
}
public function testDirectory()
{
- $inner = new MockFileListIterator(array('directory'));
- $iterator = new FilecontentFilterIterator($inner, array('directory'), array());
- $this->assertIterator(array(), $iterator);
+ $inner = new MockFileListIterator(['directory']);
+ $iterator = new FilecontentFilterIterator($inner, ['directory'], []);
+ $this->assertIterator([], $iterator);
}
public function testUnreadableFile()
{
- $inner = new MockFileListIterator(array('file r-'));
- $iterator = new FilecontentFilterIterator($inner, array('file r-'), array());
- $this->assertIterator(array(), $iterator);
+ $inner = new MockFileListIterator(['file r-']);
+ $iterator = new FilecontentFilterIterator($inner, ['file r-'], []);
+ $this->assertIterator([], $iterator);
}
/**
@@ -49,38 +49,38 @@ class FilecontentFilterIteratorTest extends IteratorTestCase
{
$inner = new MockFileListIterator();
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'a.txt',
'contents' => 'Lorem ipsum...',
'type' => 'file',
- 'mode' => 'r+', )
+ 'mode' => 'r+', ]
);
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'b.yml',
'contents' => 'dolor sit...',
'type' => 'file',
- 'mode' => 'r+', )
+ 'mode' => 'r+', ]
);
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'some/other/dir/third.php',
'contents' => 'amet...',
'type' => 'file',
- 'mode' => 'r+', )
+ 'mode' => 'r+', ]
);
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'unreadable-file.txt',
'contents' => false,
'type' => 'file',
- 'mode' => 'r+', )
+ 'mode' => 'r+', ]
);
- return array(
- array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')),
- array($inner, array('ipsum'), array(), array('a.txt')),
- array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')),
- );
+ return [
+ [$inner, ['.'], [], ['a.txt', 'b.yml', 'some/other/dir/third.php']],
+ [$inner, ['ipsum'], [], ['a.txt']],
+ [$inner, ['i', 'amet'], ['Lorem', 'amet'], ['b.yml']],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
index c4b97959..9270dd1c 100644
--- a/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
@@ -20,7 +20,7 @@ class FilenameFilterIteratorTest extends IteratorTestCase
*/
public function testAccept($matchPatterns, $noMatchPatterns, $expected)
{
- $inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php'));
+ $inner = new InnerNameIterator(['test.php', 'test.py', 'foo.php']);
$iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
@@ -29,14 +29,14 @@ class FilenameFilterIteratorTest extends IteratorTestCase
public function getAcceptData()
{
- return array(
- array(array('test.*'), array(), array('test.php', 'test.py')),
- array(array(), array('test.*'), array('foo.php')),
- array(array('*.php'), array('test.*'), array('foo.php')),
- array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')),
- array(array('/\.php$/'), array(), array('test.php', 'foo.php')),
- array(array(), array('/\.php$/'), array('test.py')),
- );
+ return [
+ [['test.*'], [], ['test.php', 'test.py']],
+ [[], ['test.*'], ['foo.php']],
+ [['*.php'], ['test.*'], ['foo.php']],
+ [['*.php', '*.py'], ['foo.*'], ['test.php', 'test.py']],
+ [['/\.php$/'], [], ['test.php', 'foo.php']],
+ [[], ['/\.php$/'], ['test.py']],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/Iterator.php b/vendor/symfony/finder/Tests/Iterator/Iterator.php
index 849bf081..3e21a070 100644
--- a/vendor/symfony/finder/Tests/Iterator/Iterator.php
+++ b/vendor/symfony/finder/Tests/Iterator/Iterator.php
@@ -13,9 +13,9 @@ namespace Symfony\Component\Finder\Tests\Iterator;
class Iterator implements \Iterator
{
- protected $values = array();
+ protected $values = [];
- public function __construct(array $values = array())
+ public function __construct(array $values = [])
{
foreach ($values as $value) {
$this->attach(new \SplFileInfo($value));
diff --git a/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php
index 89f042ae..796dc6ac 100644
--- a/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php
+++ b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php
@@ -51,7 +51,7 @@ abstract class IteratorTestCase extends TestCase
$values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)));
foreach ($expected as $subarray) {
- $temp = array();
+ $temp = [];
while (\count($values) && \count($temp) < \count($subarray)) {
$temp[] = array_shift($values);
}
@@ -69,7 +69,7 @@ abstract class IteratorTestCase extends TestCase
*/
protected function assertIteratorInForeach($expected, \Traversable $iterator)
{
- $values = array();
+ $values = [];
foreach ($iterator as $file) {
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
$values[] = $file->getPathname();
@@ -89,7 +89,7 @@ abstract class IteratorTestCase extends TestCase
*/
protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator)
{
- $values = array();
+ $values = [];
foreach ($iterator as $file) {
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
$values[] = $file->getPathname();
diff --git a/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php b/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php
index eb0adfad..670478d7 100644
--- a/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php
+++ b/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php
@@ -13,7 +13,7 @@ namespace Symfony\Component\Finder\Tests\Iterator;
class MockFileListIterator extends \ArrayIterator
{
- public function __construct(array $filesArray = array())
+ public function __construct(array $filesArray = [])
{
$files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray);
parent::__construct($files);
diff --git a/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php
index a5ac93a4..58bb5979 100644
--- a/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php
+++ b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php
@@ -28,14 +28,14 @@ class MockSplFileInfo extends \SplFileInfo
if (\is_string($param)) {
parent::__construct($param);
} elseif (\is_array($param)) {
- $defaults = array(
+ $defaults = [
'name' => 'file.txt',
'contents' => null,
'mode' => null,
'type' => null,
'relativePath' => null,
'relativePathname' => null,
- );
+ ];
$defaults = array_merge($defaults, $param);
parent::__construct($defaults['name']);
$this->setContents($defaults['contents']);
diff --git a/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
index f2c1cd24..95567769 100644
--- a/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
@@ -27,24 +27,24 @@ class MultiplePcreFilterIteratorTest extends TestCase
public function getIsRegexFixtures()
{
- return array(
- array('foo', false, 'string'),
- array(' foo ', false, '" " is not a valid delimiter'),
- array('\\foo\\', false, '"\\" is not a valid delimiter'),
- array('afooa', false, '"a" is not a valid delimiter'),
- array('//', false, 'the pattern should contain at least 1 character'),
- array('/a/', true, 'valid regex'),
- array('/foo/', true, 'valid regex'),
- array('/foo/i', true, 'valid regex with a single modifier'),
- array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
- array('#foo#', true, '"#" is a valid delimiter'),
- array('{foo}', true, '"{,}" is a valid delimiter pair'),
- array('[foo]', true, '"[,]" is a valid delimiter pair'),
- array('(foo)', true, '"(,)" is a valid delimiter pair'),
- array('', true, '"<,>" is a valid delimiter pair'),
- array('*foo.*', false, '"*" is not considered as a valid delimiter'),
- array('?foo.?', false, '"?" is not considered as a valid delimiter'),
- );
+ return [
+ ['foo', false, 'string'],
+ [' foo ', false, '" " is not a valid delimiter'],
+ ['\\foo\\', false, '"\\" is not a valid delimiter'],
+ ['afooa', false, '"a" is not a valid delimiter'],
+ ['//', false, 'the pattern should contain at least 1 character'],
+ ['/a/', true, 'valid regex'],
+ ['/foo/', true, 'valid regex'],
+ ['/foo/i', true, 'valid regex with a single modifier'],
+ ['/foo/imsxu', true, 'valid regex with multiple modifiers'],
+ ['#foo#', true, '"#" is a valid delimiter'],
+ ['{foo}', true, '"{,}" is a valid delimiter pair'],
+ ['[foo]', true, '"[,]" is a valid delimiter pair'],
+ ['(foo)', true, '"(,)" is a valid delimiter pair'],
+ ['', true, '"<,>" is a valid delimiter pair'],
+ ['*foo.*', false, '"*" is not considered as a valid delimiter'],
+ ['?foo.?', false, '"?" is not considered as a valid delimiter'],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php
index 38ed966a..9040ee04 100644
--- a/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php
@@ -29,54 +29,54 @@ class PathFilterIteratorTest extends IteratorTestCase
$inner = new MockFileListIterator();
//PATH: A/B/C/abc.dat
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'abc.dat',
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
- ));
+ ]);
//PATH: A/B/ab.dat
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'ab.dat',
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
- ));
+ ]);
//PATH: A/a.dat
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'a.dat',
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'a.dat',
- ));
+ ]);
//PATH: copy/A/B/C/abc.dat.copy
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'abc.dat.copy',
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
- ));
+ ]);
//PATH: copy/A/B/ab.dat.copy
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'ab.dat.copy',
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
- ));
+ ]);
//PATH: copy/A/a.dat.copy
- $inner[] = new MockSplFileInfo(array(
+ $inner[] = new MockSplFileInfo([
'name' => 'a.dat.copy',
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'a.dat',
- ));
+ ]);
- return array(
- array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')),
- array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')),
- array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')),
- array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')),
+ return [
+ [$inner, ['/^A/'], [], ['abc.dat', 'ab.dat', 'a.dat']],
+ [$inner, ['/^A\/B/'], [], ['abc.dat', 'ab.dat']],
+ [$inner, ['/^A\/B\/C/'], [], ['abc.dat']],
+ [$inner, ['/A\/B\/C/'], [], ['abc.dat', 'abc.dat.copy']],
- array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
- array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')),
- array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')),
+ [$inner, ['A'], [], ['abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy']],
+ [$inner, ['A/B'], [], ['abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy']],
+ [$inner, ['A/B/C'], [], ['abc.dat', 'abc.dat.copy']],
- array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
- array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
- array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
- );
+ [$inner, ['copy/A'], [], ['abc.dat.copy', 'ab.dat.copy', 'a.dat.copy']],
+ [$inner, ['copy/A/B'], [], ['abc.dat.copy', 'ab.dat.copy']],
+ [$inner, ['copy/A/B/C'], [], ['abc.dat.copy']],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php
index 9aa68ea2..4f4ba016 100644
--- a/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php
+++ b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php
@@ -20,7 +20,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
{
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
- self::$files = array(
+ self::$files = [
'.git/',
'.foo/',
'.foo/.bar',
@@ -42,7 +42,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
'qux/',
'qux/baz_1_2.py',
'qux/baz_100_1.py',
- );
+ ];
self::$files = self::toAbsolute(self::$files);
@@ -63,6 +63,8 @@ abstract class RealIteratorTestCase extends IteratorTestCase
file_put_contents(self::toAbsolute('test.php'), str_repeat(' ', 800));
file_put_contents(self::toAbsolute('test.py'), str_repeat(' ', 2000));
+ file_put_contents(self::toAbsolute('.gitignore'), '*.php');
+
touch(self::toAbsolute('foo/bar.tmp'), strtotime('2005-10-15'));
touch(self::toAbsolute('test.php'), strtotime('2005-10-15'));
}
@@ -97,7 +99,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
}
if (\is_array($files)) {
- $f = array();
+ $f = [];
foreach ($files as $file) {
if (\is_array($file)) {
$f[] = self::toAbsolute($file);
@@ -118,7 +120,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
protected static function toAbsoluteFixtures($files)
{
- $f = array();
+ $f = [];
foreach ($files as $file) {
$f[] = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.$file);
}
diff --git a/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
index 0c9aca24..037810ae 100644
--- a/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
@@ -42,11 +42,11 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
$this->markTestSkipped('Unsupported stream "ftp".');
}
- $contains = array(
+ $contains = [
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
- );
- $actual = array();
+ ];
+ $actual = [];
$i->seek(0);
$actual[] = $i->getPathname();
diff --git a/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
index 0ee463c6..1c0381fe 100644
--- a/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
@@ -30,7 +30,7 @@ class SizeRangeFilterIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $lessThan1KGreaterThan05K = array(
+ $lessThan1KGreaterThan05K = [
'.foo',
'.git',
'foo',
@@ -38,11 +38,11 @@ class SizeRangeFilterIteratorTest extends RealIteratorTestCase
'test.php',
'toto',
'toto/.git',
- );
+ ];
- return array(
- array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
- );
+ return [
+ [[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], $this->toAbsolute($lessThan1KGreaterThan05K)],
+ ];
}
}
diff --git a/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
index 33687c52..e9dad1e0 100644
--- a/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
+++ b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
@@ -18,7 +18,7 @@ class SortableIteratorTest extends RealIteratorTestCase
public function testConstructor()
{
try {
- new SortableIterator(new Iterator(array()), 'foobar');
+ new SortableIterator(new Iterator([]), 'foobar');
$this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
@@ -73,7 +73,7 @@ class SortableIteratorTest extends RealIteratorTestCase
public function getAcceptData()
{
- $sortByName = array(
+ $sortByName = [
'.bar',
'.foo',
'.foo/.bar',
@@ -95,9 +95,9 @@ class SortableIteratorTest extends RealIteratorTestCase
'test.py',
'toto',
'toto/.git',
- );
+ ];
- $sortByType = array(
+ $sortByType = [
'.foo',
'.git',
'foo',
@@ -119,13 +119,13 @@ class SortableIteratorTest extends RealIteratorTestCase
'qux_2_0.php',
'test.php',
'test.py',
- );
+ ];
- $sortByAccessedTime = array(
+ $sortByAccessedTime = [
// For these two files the access time was set to 2005-10-15
- array('foo/bar.tmp', 'test.php'),
+ ['foo/bar.tmp', 'test.php'],
// These files were created more or less at the same time
- array(
+ [
'.git',
'.foo',
'.foo/.bar',
@@ -144,13 +144,13 @@ class SortableIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- ),
+ ],
// This file was accessed after sleeping for 1 sec
- array('.bar'),
- );
+ ['.bar'],
+ ];
- $sortByChangedTime = array(
- array(
+ $sortByChangedTime = [
+ [
'.git',
'.foo',
'.foo/.bar',
@@ -170,13 +170,13 @@ class SortableIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- ),
- array('test.php'),
- array('test.py'),
- );
+ ],
+ ['test.php'],
+ ['test.py'],
+ ];
- $sortByModifiedTime = array(
- array(
+ $sortByModifiedTime = [
+ [
'.git',
'.foo',
'.foo/.bar',
@@ -196,12 +196,12 @@ class SortableIteratorTest extends RealIteratorTestCase
'qux_10_2.php',
'qux_12_0.php',
'qux_2_0.php',
- ),
- array('test.php'),
- array('test.py'),
- );
+ ],
+ ['test.php'],
+ ['test.py'],
+ ];
- $sortByNameNatural = array(
+ $sortByNameNatural = [
'.bar',
'.foo',
'.foo/.bar',
@@ -223,9 +223,9 @@ class SortableIteratorTest extends RealIteratorTestCase
'test.py',
'toto',
'toto/.git',
- );
+ ];
- $customComparison = array(
+ $customComparison = [
'.bar',
'.foo',
'.foo/.bar',
@@ -247,16 +247,16 @@ class SortableIteratorTest extends RealIteratorTestCase
'test.py',
'toto',
'toto/.git',
- );
+ ];
- return array(
- array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)),
- array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)),
- array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
- array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
- array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
- array(SortableIterator::SORT_BY_NAME_NATURAL, $this->toAbsolute($sortByNameNatural)),
- array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)),
- );
+ return [
+ [SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)],
+ [SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)],
+ [SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)],
+ [SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)],
+ [SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)],
+ [SortableIterator::SORT_BY_NAME_NATURAL, $this->toAbsolute($sortByNameNatural)],
+ [function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)],
+ ];
}
}
diff --git a/vendor/symfony/finder/composer.json b/vendor/symfony/finder/composer.json
index 37d34a5e..05d5d1bb 100644
--- a/vendor/symfony/finder/composer.json
+++ b/vendor/symfony/finder/composer.json
@@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php
index c702371f..3f5fbb8f 100644
--- a/vendor/symfony/http-foundation/AcceptHeader.php
+++ b/vendor/symfony/http-foundation/AcceptHeader.php
@@ -24,7 +24,7 @@ class AcceptHeader
/**
* @var AcceptHeaderItem[]
*/
- private $items = array();
+ private $items = [];
/**
* @var bool
diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php
index 2aaf5957..954aac60 100644
--- a/vendor/symfony/http-foundation/AcceptHeaderItem.php
+++ b/vendor/symfony/http-foundation/AcceptHeaderItem.php
@@ -21,9 +21,9 @@ class AcceptHeaderItem
private $value;
private $quality = 1.0;
private $index = 0;
- private $attributes = array();
+ private $attributes = [];
- public function __construct(string $value, array $attributes = array())
+ public function __construct(string $value, array $attributes = [])
{
$this->value = $value;
foreach ($attributes as $name => $value) {
diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php
index 07ef8005..e2178209 100644
--- a/vendor/symfony/http-foundation/BinaryFileResponse.php
+++ b/vendor/symfony/http-foundation/BinaryFileResponse.php
@@ -44,7 +44,7 @@ class BinaryFileResponse extends Response
* @param bool $autoEtag Whether the ETag header should be automatically set
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
*/
- public function __construct($file, int $status = 200, array $headers = array(), bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
+ public function __construct($file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
{
parent::__construct(null, $status, $headers);
@@ -66,7 +66,7 @@ class BinaryFileResponse extends Response
*
* @return static
*/
- public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
+ public static function create($file = null, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
{
return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified);
}
@@ -223,18 +223,23 @@ class BinaryFileResponse extends Response
list($pathPrefix, $location) = $part;
if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) {
$path = $location.substr($path, \strlen($pathPrefix));
+ // Only set X-Accel-Redirect header if a valid URI can be produced
+ // as nginx does not serve arbitrary file paths.
+ $this->headers->set($type, $path);
+ $this->maxlen = 0;
break;
}
}
+ } else {
+ $this->headers->set($type, $path);
+ $this->maxlen = 0;
}
- $this->headers->set($type, $path);
- $this->maxlen = 0;
} elseif ($request->headers->has('Range')) {
// Process the range headers.
if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) {
$range = $request->headers->get('Range');
- list($start, $end) = explode('-', substr($range, 6), 2) + array(0);
+ list($start, $end) = explode('-', substr($range, 6), 2) + [0];
$end = ('' === $end) ? $fileSize - 1 : (int) $end;
@@ -300,7 +305,7 @@ class BinaryFileResponse extends Response
fclose($out);
fclose($file);
- if ($this->deleteFileAfterSend) {
+ if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) {
unlink($this->file->getPathname());
}
diff --git a/vendor/symfony/http-foundation/CHANGELOG.md b/vendor/symfony/http-foundation/CHANGELOG.md
index 55eed3f7..54acd6ae 100644
--- a/vendor/symfony/http-foundation/CHANGELOG.md
+++ b/vendor/symfony/http-foundation/CHANGELOG.md
@@ -1,6 +1,17 @@
CHANGELOG
=========
+4.3.0
+-----
+
+ * added PHPUnit constraints: `RequestAttributeValueSame`, `ResponseCookieValueSame`, `ResponseHasCookie`,
+ `ResponseHasHeader`, `ResponseHeaderSame`, `ResponseIsRedirected`, `ResponseIsSuccessful`, and `ResponseStatusCodeSame`
+ * deprecated `MimeTypeGuesserInterface` and `ExtensionGuesserInterface` in favor of `Symfony\Component\Mime\MimeTypesInterface`.
+ * deprecated `MimeType` and `MimeTypeExtensionGuesser` in favor of `Symfony\Component\Mime\MimeTypes`.
+ * deprecated `FileBinaryMimeTypeGuesser` in favor of `Symfony\Component\Mime\FileBinaryMimeTypeGuesser`.
+ * deprecated `FileinfoMimeTypeGuesser` in favor of `Symfony\Component\Mime\FileinfoMimeTypeGuesser`.
+ * added `UrlHelper` that allows to get an absolute URL and a relative path for a given path
+
4.2.0
-----
@@ -190,10 +201,10 @@ CHANGELOG
* Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This
implementation is ESI compatible.
* Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire
- behaviour of messages auto expiring after one page page load. Messages must
+ behavior of messages auto expiring after one page page load. Messages must
be retrieved by `get()` or `all()`.
* Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate
- attributes storage behaviour from 2.0.x (default).
+ attributes storage behavior from 2.0.x (default).
* Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for
namespace session attributes.
* Flash API can stores messages in an array so there may be multiple messages
diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php
index 7aab318c..e6b8b798 100644
--- a/vendor/symfony/http-foundation/Cookie.php
+++ b/vendor/symfony/http-foundation/Cookie.php
@@ -29,6 +29,7 @@ class Cookie
private $sameSite;
private $secureDefault = false;
+ const SAMESITE_NONE = 'none';
const SAMESITE_LAX = 'lax';
const SAMESITE_STRICT = 'strict';
@@ -42,7 +43,7 @@ class Cookie
*/
public static function fromString($cookie, $decode = false)
{
- $data = array(
+ $data = [
'expires' => 0,
'path' => '/',
'domain' => null,
@@ -50,7 +51,7 @@ class Cookie
'httponly' => false,
'raw' => !$decode,
'samesite' => null,
- );
+ ];
$parts = HeaderUtils::split($cookie, ';=');
$part = array_shift($parts);
@@ -126,7 +127,7 @@ class Cookie
$sameSite = strtolower($sameSite);
}
- if (!\in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) {
+ if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, self::SAMESITE_NONE, null], true)) {
throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.');
}
diff --git a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php
index e9c8441c..26bed7d3 100644
--- a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php
+++ b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php
@@ -35,13 +35,13 @@ class ExpressionRequestMatcher extends RequestMatcher
throw new \LogicException('Unable to match the request as the expression language is not available.');
}
- return $this->language->evaluate($this->expression, array(
+ return $this->language->evaluate($this->expression, [
'request' => $request,
'method' => $request->getMethod(),
'path' => rawurldecode($request->getPathInfo()),
'host' => $request->getHost(),
'ip' => $request->getClientIp(),
'attributes' => $request->attributes->all(),
- )) && parent::matches($request);
+ ]) && parent::matches($request);
}
}
diff --git a/vendor/symfony/http-foundation/File/File.php b/vendor/symfony/http-foundation/File/File.php
index de7b0809..396ff345 100644
--- a/vendor/symfony/http-foundation/File/File.php
+++ b/vendor/symfony/http-foundation/File/File.php
@@ -13,8 +13,7 @@ namespace Symfony\Component\HttpFoundation\File;
use Symfony\Component\HttpFoundation\File\Exception\FileException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
-use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
+use Symfony\Component\Mime\MimeTypes;
/**
* A file in the file system.
@@ -50,33 +49,28 @@ class File extends \SplFileInfo
*
* @return string|null The guessed extension or null if it cannot be guessed
*
- * @see ExtensionGuesser
+ * @see MimeTypes
* @see getMimeType()
*/
public function guessExtension()
{
- $type = $this->getMimeType();
- $guesser = ExtensionGuesser::getInstance();
-
- return $guesser->guess($type);
+ return MimeTypes::getDefault()->getExtensions($this->getMimeType())[0] ?? null;
}
/**
* Returns the mime type of the file.
*
- * The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(),
- * mime_content_type() and the system binary "file" (in this order), depending on
- * which of those are available.
+ * The mime type is guessed using a MimeTypeGuesserInterface instance,
+ * which uses finfo_file() then the "file" system binary,
+ * depending on which of those are available.
*
* @return string|null The guessed mime type (e.g. "application/pdf")
*
- * @see MimeTypeGuesser
+ * @see MimeTypes
*/
public function getMimeType()
{
- $guesser = MimeTypeGuesser::getInstance();
-
- return $guesser->guess($this->getPathname());
+ return MimeTypes::getDefault()->guessMimeType($this->getPathname());
}
/**
diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php
index 263fb321..06e5b462 100644
--- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php
@@ -11,6 +11,10 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
+use Symfony\Component\Mime\MimeTypes;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', ExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
+
/**
* A singleton mime type to file extension guesser.
*
@@ -22,6 +26,8 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
* $guesser->register(new MyCustomExtensionGuesser());
*
* The last registered guesser is preferred over previously registered ones.
+ *
+ * @deprecated since Symfony 4.3, use {@link MimeTypes} instead
*/
class ExtensionGuesser implements ExtensionGuesserInterface
{
@@ -37,7 +43,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface
*
* @var array
*/
- protected $guessers = array();
+ protected $guessers = [];
/**
* Returns the singleton instance.
diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php
index d19a0e53..69fe6efb 100644
--- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php
+++ b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesserInterface.php
@@ -11,8 +11,12 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
+use Symfony\Component\Mime\MimeTypesInterface;
+
/**
* Guesses the file extension corresponding to a given mime type.
+ *
+ * @deprecated since Symfony 4.3, use {@link MimeTypesInterface} instead
*/
interface ExtensionGuesserInterface
{
diff --git a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
index 31300019..b4d51023 100644
--- a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
@@ -13,11 +13,16 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
+use Symfony\Component\Mime\FileBinaryMimeTypeGuesser as NewFileBinaryMimeTypeGuesser;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileBinaryMimeTypeGuesser::class, NewFileBinaryMimeTypeGuesser::class), E_USER_DEPRECATED);
/**
* Guesses the mime type with the binary "file" (only available on *nix).
*
* @author Bernhard Schussek
+ *
+ * @deprecated since Symfony 4.3, use {@link NewFileBinaryMimeTypeGuesser} instead
*/
class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
{
diff --git a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php
index cee9ef3f..bb323701 100644
--- a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php
@@ -13,11 +13,16 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
+use Symfony\Component\Mime\FileinfoMimeTypeGuesser as NewFileinfoMimeTypeGuesser;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', FileinfoMimeTypeGuesser::class, NewFileinfoMimeTypeGuesser::class), E_USER_DEPRECATED);
/**
* Guesses the mime type using the PECL extension FileInfo.
*
* @author Bernhard Schussek
+ *
+ * @deprecated since Symfony 4.3, use {@link NewFileinfoMimeTypeGuesser} instead
*/
class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
{
diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
index 77bf51b1..651be070 100644
--- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
@@ -11,8 +11,14 @@
namespace Symfony\Component\HttpFoundation\File\MimeType;
+use Symfony\Component\Mime\MimeTypes;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeExtensionGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
+
/**
* Provides a best-guess mapping of mime type to file extension.
+ *
+ * @deprecated since Symfony 4.3, use {@link MimeTypes} instead
*/
class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
{
@@ -20,11 +26,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
* A map of mime types and their default extensions.
*
* This list has been placed under the public domain by the Apache HTTPD project.
- * This list has been updated from upstream on 2013-04-23.
+ * This list has been updated from upstream on 2019-01-14.
*
- * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+ * @see https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
*/
- protected $defaultExtensions = array(
+ protected $defaultExtensions = [
'application/andrew-inset' => 'ez',
'application/applixware' => 'aw',
'application/atom+xml' => 'atom',
@@ -618,7 +624,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'audio/adpcm' => 'adp',
'audio/basic' => 'au',
'audio/midi' => 'mid',
- 'audio/mp4' => 'mp4a',
+ 'audio/mp4' => 'm4a',
'audio/mpeg' => 'mpga',
'audio/ogg' => 'oga',
'audio/s3m' => 's3m',
@@ -639,6 +645,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'audio/x-aiff' => 'aif',
'audio/x-caf' => 'caf',
'audio/x-flac' => 'flac',
+ 'audio/x-hx-aac-adts' => 'aac',
'audio/x-matroska' => 'mka',
'audio/x-mpegurl' => 'm3u',
'audio/x-ms-wax' => 'wax',
@@ -653,6 +660,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'chemical/x-cml' => 'cml',
'chemical/x-csml' => 'csml',
'chemical/x-xyz' => 'xyz',
+ 'font/collection' => 'ttc',
+ 'font/otf' => 'otf',
+ 'font/ttf' => 'ttf',
+ 'font/woff' => 'woff',
+ 'font/woff2' => 'woff2',
'image/bmp' => 'bmp',
'image/x-ms-bmp' => 'bmp',
'image/cgm' => 'cgm',
@@ -669,8 +681,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'image/tiff' => 'tiff',
'image/vnd.adobe.photoshop' => 'psd',
'image/vnd.dece.graphic' => 'uvi',
- 'image/vnd.dvb.subtitle' => 'sub',
'image/vnd.djvu' => 'djvu',
+ 'image/vnd.dvb.subtitle' => 'sub',
'image/vnd.dwg' => 'dwg',
'image/vnd.dxf' => 'dxf',
'image/vnd.fastbidsheet' => 'fbs',
@@ -732,8 +744,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'text/vcard' => 'vcard',
'text/vnd.curl' => 'curl',
'text/vnd.curl.dcurl' => 'dcurl',
- 'text/vnd.curl.scurl' => 'scurl',
'text/vnd.curl.mcurl' => 'mcurl',
+ 'text/vnd.curl.scurl' => 'scurl',
'text/vnd.dvb.subtitle' => 'sub',
'text/vnd.fly' => 'fly',
'text/vnd.fmi.flexstor' => 'flx',
@@ -747,10 +759,10 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'text/x-asm' => 's',
'text/x-c' => 'c',
'text/x-fortran' => 'f',
- 'text/x-pascal' => 'p',
'text/x-java-source' => 'java',
- 'text/x-opml' => 'opml',
'text/x-nfo' => 'nfo',
+ 'text/x-opml' => 'opml',
+ 'text/x-pascal' => 'p',
'text/x-setext' => 'etx',
'text/x-sfv' => 'sfv',
'text/x-uuencode' => 'uu',
@@ -796,13 +808,19 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'video/x-sgi-movie' => 'movie',
'video/x-smv' => 'smv',
'x-conference/x-cooltalk' => 'ice',
- );
+ ];
/**
* {@inheritdoc}
*/
public function guess($mimeType)
{
- return isset($this->defaultExtensions[$mimeType]) ? $this->defaultExtensions[$mimeType] : null;
+ if (isset($this->defaultExtensions[$mimeType])) {
+ return $this->defaultExtensions[$mimeType];
+ }
+
+ $lcMimeType = strtolower($mimeType);
+
+ return isset($this->defaultExtensions[$lcMimeType]) ? $this->defaultExtensions[$lcMimeType] : null;
}
}
diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
index dae47a7c..2b30a62a 100644
--- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
@@ -13,6 +13,9 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
+use Symfony\Component\Mime\MimeTypes;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', MimeTypeGuesser::class, MimeTypes::class), E_USER_DEPRECATED);
/**
* A singleton mime type guesser.
@@ -51,7 +54,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
*
* @var array
*/
- protected $guessers = array();
+ protected $guessers = [];
/**
* Returns the singleton instance.
diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php
index 5ac1acb8..0f048b53 100644
--- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php
+++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php
@@ -13,11 +13,14 @@ namespace Symfony\Component\HttpFoundation\File\MimeType;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
+use Symfony\Component\Mime\MimeTypesInterface;
/**
* Guesses the mime type of a file.
*
* @author Bernhard Schussek
+ *
+ * @deprecated since Symfony 4.3, use {@link MimeTypesInterface} instead
*/
interface MimeTypeGuesserInterface
{
diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php
index 63fa6c73..568d192f 100644
--- a/vendor/symfony/http-foundation/File/UploadedFile.php
+++ b/vendor/symfony/http-foundation/File/UploadedFile.php
@@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\File\Exception\IniSizeFileException;
use Symfony\Component\HttpFoundation\File\Exception\NoFileException;
use Symfony\Component\HttpFoundation\File\Exception\NoTmpDirFileException;
use Symfony\Component\HttpFoundation\File\Exception\PartialFileException;
-use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser;
+use Symfony\Component\Mime\MimeTypes;
/**
* A file uploaded through a form.
@@ -140,10 +140,7 @@ class UploadedFile extends File
*/
public function guessClientExtension()
{
- $type = $this->getClientMimeType();
- $guesser = ExtensionGuesser::getInstance();
-
- return $guesser->guess($type);
+ return MimeTypes::getDefault()->getExtensions($this->getClientMimeType())[0] ?? null;
}
/**
@@ -281,7 +278,7 @@ class UploadedFile extends File
*/
public function getErrorMessage()
{
- static $errors = array(
+ static $errors = [
UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).',
UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
@@ -289,7 +286,7 @@ class UploadedFile extends File
UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
- );
+ ];
$errorCode = $this->error;
$maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php
index f37e10f2..efd83ffe 100644
--- a/vendor/symfony/http-foundation/FileBag.php
+++ b/vendor/symfony/http-foundation/FileBag.php
@@ -21,12 +21,12 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
*/
class FileBag extends ParameterBag
{
- private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type');
+ private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type'];
/**
* @param array $parameters An array of HTTP files
*/
- public function __construct(array $parameters = array())
+ public function __construct(array $parameters = [])
{
$this->replace($parameters);
}
@@ -34,9 +34,9 @@ class FileBag extends ParameterBag
/**
* {@inheritdoc}
*/
- public function replace(array $files = array())
+ public function replace(array $files = [])
{
- $this->parameters = array();
+ $this->parameters = [];
$this->add($files);
}
@@ -55,7 +55,7 @@ class FileBag extends ParameterBag
/**
* {@inheritdoc}
*/
- public function add(array $files = array())
+ public function add(array $files = [])
{
foreach ($files as $key => $file) {
$this->set($key, $file);
@@ -84,10 +84,10 @@ class FileBag extends ParameterBag
if (UPLOAD_ERR_NO_FILE == $file['error']) {
$file = null;
} else {
- $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error']);
+ $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], false);
}
} else {
- $file = array_map(array($this, 'convertFileInformation'), $file);
+ $file = array_map([$this, 'convertFileInformation'], $file);
if (array_keys($keys) === $keys) {
$file = array_filter($file);
}
@@ -130,13 +130,13 @@ class FileBag extends ParameterBag
}
foreach ($data['name'] as $key => $name) {
- $files[$key] = $this->fixPhpFilesArray(array(
+ $files[$key] = $this->fixPhpFilesArray([
'error' => $data['error'][$key],
'name' => $name,
'type' => $data['type'][$key],
'tmp_name' => $data['tmp_name'][$key],
'size' => $data['size'][$key],
- ));
+ ]);
}
return $files;
diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php
index 8f51ef9d..fa9d1731 100644
--- a/vendor/symfony/http-foundation/HeaderBag.php
+++ b/vendor/symfony/http-foundation/HeaderBag.php
@@ -18,13 +18,13 @@ namespace Symfony\Component\HttpFoundation;
*/
class HeaderBag implements \IteratorAggregate, \Countable
{
- protected $headers = array();
- protected $cacheControl = array();
+ protected $headers = [];
+ protected $cacheControl = [];
/**
* @param array $headers An array of HTTP headers
*/
- public function __construct(array $headers = array())
+ public function __construct(array $headers = [])
{
foreach ($headers as $key => $values) {
$this->set($key, $values);
@@ -80,9 +80,9 @@ class HeaderBag implements \IteratorAggregate, \Countable
*
* @param array $headers An array of HTTP headers
*/
- public function replace(array $headers = array())
+ public function replace(array $headers = [])
{
- $this->headers = array();
+ $this->headers = [];
$this->add($headers);
}
@@ -112,12 +112,12 @@ class HeaderBag implements \IteratorAggregate, \Countable
$key = str_replace('_', '-', strtolower($key));
$headers = $this->all();
- if (!array_key_exists($key, $headers)) {
+ if (!\array_key_exists($key, $headers)) {
if (null === $default) {
- return $first ? null : array();
+ return $first ? null : [];
}
- return $first ? $default : array($default);
+ return $first ? $default : [$default];
}
if ($first) {
@@ -148,7 +148,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
}
} else {
if (true === $replace || !isset($this->headers[$key])) {
- $this->headers[$key] = array($values);
+ $this->headers[$key] = [$values];
} else {
$this->headers[$key][] = $values;
}
@@ -168,7 +168,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
*/
public function has($key)
{
- return array_key_exists(str_replace('_', '-', strtolower($key)), $this->all());
+ return \array_key_exists(str_replace('_', '-', strtolower($key)), $this->all());
}
/**
@@ -196,7 +196,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
unset($this->headers[$key]);
if ('cache-control' === $key) {
- $this->cacheControl = array();
+ $this->cacheControl = [];
}
}
@@ -245,7 +245,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
*/
public function hasCacheControlDirective($key)
{
- return array_key_exists($key, $this->cacheControl);
+ return \array_key_exists($key, $this->cacheControl);
}
/**
@@ -257,7 +257,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
*/
public function getCacheControlDirective($key)
{
- return array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
+ return \array_key_exists($key, $this->cacheControl) ? $this->cacheControl[$key] : null;
}
/**
diff --git a/vendor/symfony/http-foundation/HeaderUtils.php b/vendor/symfony/http-foundation/HeaderUtils.php
index 637bc5be..31db1bd0 100644
--- a/vendor/symfony/http-foundation/HeaderUtils.php
+++ b/vendor/symfony/http-foundation/HeaderUtils.php
@@ -34,7 +34,7 @@ class HeaderUtils
* Example:
*
* HeaderUtils::split("da, en-gb;q=0.8", ",;")
- * // => array(array('da'), array('en-gb', 'q=0.8'))
+ * // => ['da'], ['en-gb', 'q=0.8']]
*
* @param string $header HTTP header value
* @param string $separators List of characters to split on, ordered by
@@ -78,12 +78,12 @@ class HeaderUtils
*
* Example:
*
- * HeaderUtils::combine(array(array("foo", "abc"), array("bar")))
- * // => array("foo" => "abc", "bar" => true)
+ * HeaderUtils::combine([["foo", "abc"], ["bar"]])
+ * // => ["foo" => "abc", "bar" => true]
*/
public static function combine(array $parts): array
{
- $assoc = array();
+ $assoc = [];
foreach ($parts as $part) {
$name = strtolower($part[0]);
$value = $part[1] ?? true;
@@ -102,12 +102,12 @@ class HeaderUtils
*
* Example:
*
- * HeaderUtils::toString(array("foo" => "abc", "bar" => true, "baz" => "a b c"), ",")
+ * HeaderUtils::toString(["foo" => "abc", "bar" => true, "baz" => "a b c"], ",")
* // => 'foo=abc, bar, baz="a b c"'
*/
public static function toString(array $assoc, string $separator): string
{
- $parts = array();
+ $parts = [];
foreach ($assoc as $name => $value) {
if (true === $value) {
$parts[] = $name;
@@ -163,7 +163,7 @@ class HeaderUtils
*/
public static function makeDisposition(string $disposition, string $filename, string $filenameFallback = ''): string
{
- if (!\in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) {
+ if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) {
throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE));
}
@@ -186,7 +186,7 @@ class HeaderUtils
throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.');
}
- $params = array('filename' => $filenameFallback);
+ $params = ['filename' => $filenameFallback];
if ($filename !== $filenameFallback) {
$params['filename*'] = "utf-8''".rawurlencode($filename);
}
@@ -200,7 +200,7 @@ class HeaderUtils
$partSeparators = substr($separators, 1);
$i = 0;
- $partMatches = array();
+ $partMatches = [];
foreach ($matches as $match) {
if (isset($match['separator']) && $match['separator'] === $separator) {
++$i;
@@ -209,7 +209,7 @@ class HeaderUtils
}
}
- $parts = array();
+ $parts = [];
if ($partSeparators) {
foreach ($partMatches as $matches) {
$parts[] = self::groupParts($matches, $partSeparators);
diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php
index a1bfa908..67d13e57 100644
--- a/vendor/symfony/http-foundation/IpUtils.php
+++ b/vendor/symfony/http-foundation/IpUtils.php
@@ -18,7 +18,7 @@ namespace Symfony\Component\HttpFoundation;
*/
class IpUtils
{
- private static $checkedIps = array();
+ private static $checkedIps = [];
/**
* This class should not be instantiated.
@@ -38,7 +38,7 @@ class IpUtils
public static function checkIp($requestIp, $ips)
{
if (!\is_array($ips)) {
- $ips = array($ips);
+ $ips = [$ips];
}
$method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4';
diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php
index f10262e8..4dae091f 100644
--- a/vendor/symfony/http-foundation/JsonResponse.php
+++ b/vendor/symfony/http-foundation/JsonResponse.php
@@ -39,7 +39,7 @@ class JsonResponse extends Response
* @param array $headers An array of response headers
* @param bool $json If the data is already a JSON string
*/
- public function __construct($data = null, int $status = 200, array $headers = array(), bool $json = false)
+ public function __construct($data = null, int $status = 200, array $headers = [], bool $json = false)
{
parent::__construct('', $status, $headers);
@@ -64,7 +64,7 @@ class JsonResponse extends Response
*
* @return static
*/
- public static function create($data = null, $status = 200, $headers = array())
+ public static function create($data = null, $status = 200, $headers = [])
{
return new static($data, $status, $headers);
}
@@ -72,7 +72,7 @@ class JsonResponse extends Response
/**
* Make easier the creation of JsonResponse from raw json.
*/
- public static function fromJsonString($data = null, $status = 200, $headers = array())
+ public static function fromJsonString($data = null, $status = 200, $headers = [])
{
return new static($data, $status, $headers, true);
}
@@ -94,11 +94,11 @@ class JsonResponse extends Response
// JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details.
// (c) William Durand
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u';
- $reserved = array(
+ $reserved = [
'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while',
'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export',
'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false',
- );
+ ];
$parts = explode('.', $callback);
foreach ($parts as $part) {
if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) {
@@ -137,7 +137,7 @@ class JsonResponse extends Response
*
* @throws \InvalidArgumentException
*/
- public function setData($data = array())
+ public function setData($data = [])
{
try {
$data = json_encode($data, $this->encodingOptions);
@@ -148,6 +148,10 @@ class JsonResponse extends Response
throw $e;
}
+ if (\PHP_VERSION_ID >= 70300 && (JSON_THROW_ON_ERROR & $this->encodingOptions)) {
+ return $this->setJson($data);
+ }
+
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException(json_last_error_msg());
}
diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php
index 19d7ee91..f05e4a21 100644
--- a/vendor/symfony/http-foundation/ParameterBag.php
+++ b/vendor/symfony/http-foundation/ParameterBag.php
@@ -26,7 +26,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
/**
* @param array $parameters An array of parameters
*/
- public function __construct(array $parameters = array())
+ public function __construct(array $parameters = [])
{
$this->parameters = $parameters;
}
@@ -56,7 +56,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
*
* @param array $parameters An array of parameters
*/
- public function replace(array $parameters = array())
+ public function replace(array $parameters = [])
{
$this->parameters = $parameters;
}
@@ -66,7 +66,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
*
* @param array $parameters An array of parameters
*/
- public function add(array $parameters = array())
+ public function add(array $parameters = [])
{
$this->parameters = array_replace($this->parameters, $parameters);
}
@@ -81,7 +81,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
*/
public function get($key, $default = null)
{
- return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
+ return \array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default;
}
/**
@@ -104,7 +104,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
*/
public function has($key)
{
- return array_key_exists($key, $this->parameters);
+ return \array_key_exists($key, $this->parameters);
}
/**
@@ -154,7 +154,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
public function getDigits($key, $default = '')
{
// we need to remove - and + because they're allowed in the filter
- return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
+ return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT));
}
/**
@@ -195,13 +195,13 @@ class ParameterBag implements \IteratorAggregate, \Countable
*
* @return mixed
*/
- public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array())
+ public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = [])
{
$value = $this->get($key, $default);
// Always turn $options into an array - this allows filter_var option shortcuts.
if (!\is_array($options) && $options) {
- $options = array('flags' => $options);
+ $options = ['flags' => $options];
}
// Add a convenience check for arrays.
diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php
index 11f71a03..8d04aa42 100644
--- a/vendor/symfony/http-foundation/RedirectResponse.php
+++ b/vendor/symfony/http-foundation/RedirectResponse.php
@@ -32,7 +32,7 @@ class RedirectResponse extends Response
*
* @see http://tools.ietf.org/html/rfc2616#section-10.3
*/
- public function __construct(?string $url, int $status = 302, array $headers = array())
+ public function __construct(?string $url, int $status = 302, array $headers = [])
{
parent::__construct('', $status, $headers);
@@ -42,7 +42,7 @@ class RedirectResponse extends Response
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
}
- if (301 == $status && !array_key_exists('cache-control', $headers)) {
+ if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
$this->headers->remove('cache-control');
}
}
@@ -56,7 +56,7 @@ class RedirectResponse extends Response
*
* @return static
*/
- public static function create($url = '', $status = 302, $headers = array())
+ public static function create($url = '', $status = 302, $headers = [])
{
return new static($url, $status, $headers);
}
diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php
index c13016e5..fffe2ab8 100644
--- a/vendor/symfony/http-foundation/Request.php
+++ b/vendor/symfony/http-foundation/Request.php
@@ -52,17 +52,17 @@ class Request
/**
* @var string[]
*/
- protected static $trustedProxies = array();
+ protected static $trustedProxies = [];
/**
* @var string[]
*/
- protected static $trustedHostPatterns = array();
+ protected static $trustedHostPatterns = [];
/**
* @var string[]
*/
- protected static $trustedHosts = array();
+ protected static $trustedHosts = [];
protected static $httpMethodParameterOverride = false;
@@ -197,12 +197,12 @@ class Request
private static $trustedHeaderSet = -1;
- private static $forwardedParams = array(
+ private static $forwardedParams = [
self::HEADER_X_FORWARDED_FOR => 'for',
self::HEADER_X_FORWARDED_HOST => 'host',
self::HEADER_X_FORWARDED_PROTO => 'proto',
self::HEADER_X_FORWARDED_PORT => 'host',
- );
+ ];
/**
* Names for headers that can be trusted when
@@ -213,13 +213,13 @@ class Request
* The other headers are non-standard, but widely used
* by popular reverse proxies (like Apache mod_proxy or Amazon EC2).
*/
- private static $trustedHeaders = array(
+ private static $trustedHeaders = [
self::HEADER_FORWARDED => 'FORWARDED',
self::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
self::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
self::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
self::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
- );
+ ];
/**
* @param array $query The GET parameters
@@ -230,7 +230,7 @@ class Request
* @param array $server The SERVER parameters
* @param string|resource|null $content The raw body data
*/
- public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
+ public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
{
$this->initialize($query, $request, $attributes, $cookies, $files, $server, $content);
}
@@ -248,7 +248,7 @@ class Request
* @param array $server The SERVER parameters
* @param string|resource|null $content The raw body data
*/
- public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
+ public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
{
$this->request = new ParameterBag($request);
$this->query = new ParameterBag($query);
@@ -278,10 +278,10 @@ class Request
*/
public static function createFromGlobals()
{
- $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
+ $request = self::createRequestFromFactory($_GET, $_POST, [], $_COOKIE, $_FILES, $_SERVER);
if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
- && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
+ && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), ['PUT', 'DELETE', 'PATCH'])
) {
parse_str($request->getContent(), $data);
$request->request = new ParameterBag($data);
@@ -306,9 +306,9 @@ class Request
*
* @return static
*/
- public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
+ public static function create($uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
{
- $server = array_replace(array(
+ $server = array_replace([
'SERVER_NAME' => 'localhost',
'SERVER_PORT' => 80,
'HTTP_HOST' => 'localhost',
@@ -321,7 +321,7 @@ class Request
'SCRIPT_FILENAME' => '',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_TIME' => time(),
- ), $server);
+ ], $server);
$server['PATH_INFO'] = '';
$server['REQUEST_METHOD'] = strtoupper($method);
@@ -369,10 +369,10 @@ class Request
// no break
case 'PATCH':
$request = $parameters;
- $query = array();
+ $query = [];
break;
default:
- $request = array();
+ $request = [];
$query = $parameters;
break;
}
@@ -395,7 +395,7 @@ class Request
$server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : '');
$server['QUERY_STRING'] = $queryString;
- return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content);
+ return self::createRequestFromFactory($query, $request, [], $cookies, $files, $server, $content);
}
/**
@@ -499,7 +499,7 @@ class Request
}
$cookieHeader = '';
- $cookies = array();
+ $cookies = [];
foreach ($this->cookies as $k => $v) {
$cookies[] = $k.'='.$v;
@@ -533,19 +533,19 @@ class Request
foreach ($this->headers->all() as $key => $value) {
$key = strtoupper(str_replace('-', '_', $key));
- if (\in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) {
+ if (\in_array($key, ['CONTENT_TYPE', 'CONTENT_LENGTH'])) {
$_SERVER[$key] = implode(', ', $value);
} else {
$_SERVER['HTTP_'.$key] = implode(', ', $value);
}
}
- $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE);
+ $request = ['g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE];
$requestOrder = ini_get('request_order') ?: ini_get('variables_order');
$requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';
- $_REQUEST = array(array());
+ $_REQUEST = [[]];
foreach (str_split($requestOrder) as $order) {
$_REQUEST[] = $request[$order];
@@ -603,7 +603,7 @@ class Request
return sprintf('{%s}i', $hostPattern);
}, $hostPatterns);
// we need to reset trusted hosts on trusted host patterns change
- self::$trustedHosts = array();
+ self::$trustedHosts = [];
}
/**
@@ -777,10 +777,10 @@ class Request
$ip = $this->server->get('REMOTE_ADDR');
if (!$this->isFromTrustedProxy()) {
- return array($ip);
+ return [$ip];
}
- return $this->getTrustedValues(self::HEADER_X_FORWARDED_FOR, $ip) ?: array($ip);
+ return $this->getTrustedValues(self::HEADER_X_FORWARDED_FOR, $ip) ?: [$ip];
}
/**
@@ -1114,7 +1114,7 @@ class Request
public function isSecure()
{
if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_X_FORWARDED_PROTO)) {
- return \in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true);
+ return \in_array(strtolower($proto[0]), ['https', 'on', 'ssl', '1'], true);
}
$https = $this->server->get('HTTPS');
@@ -1214,22 +1214,37 @@ class Request
*/
public function getMethod()
{
- if (null === $this->method) {
- $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
-
- if ('POST' === $this->method) {
- if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) {
- $this->method = strtoupper($method);
- } elseif (self::$httpMethodParameterOverride) {
- $method = $this->request->get('_method', $this->query->get('_method', 'POST'));
- if (\is_string($method)) {
- $this->method = strtoupper($method);
- }
- }
- }
+ if (null !== $this->method) {
+ return $this->method;
}
- return $this->method;
+ $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
+
+ if ('POST' !== $this->method) {
+ return $this->method;
+ }
+
+ $method = $this->headers->get('X-HTTP-METHOD-OVERRIDE');
+
+ if (!$method && self::$httpMethodParameterOverride) {
+ $method = $this->request->get('_method', $this->query->get('_method', 'POST'));
+ }
+
+ if (!\is_string($method)) {
+ return $this->method;
+ }
+
+ $method = strtoupper($method);
+
+ if (\in_array($method, ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'PATCH', 'PURGE', 'TRACE'], true)) {
+ return $this->method = $method;
+ }
+
+ if (!preg_match('/^[A-Z]++$/D', $method)) {
+ throw new SuspiciousOperationException(sprintf('Invalid method override "%s".', $method));
+ }
+
+ return $this->method = $method;
}
/**
@@ -1273,7 +1288,7 @@ class Request
static::initializeFormats();
}
- return isset(static::$formats[$format]) ? static::$formats[$format] : array();
+ return isset(static::$formats[$format]) ? static::$formats[$format] : [];
}
/**
@@ -1316,7 +1331,7 @@ class Request
static::initializeFormats();
}
- static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : array($mimeTypes);
+ static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [$mimeTypes];
}
/**
@@ -1330,7 +1345,7 @@ class Request
*
* @param string|null $default The default format
*
- * @return string The request format
+ * @return string|null The request format
*/
public function getRequestFormat($default = 'html')
{
@@ -1433,7 +1448,7 @@ class Request
throw new \BadMethodCallException('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is not supported.');
}
- return \in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
+ return \in_array($this->getMethod(), ['GET', 'HEAD', 'OPTIONS', 'TRACE']);
}
/**
@@ -1443,7 +1458,7 @@ class Request
*/
public function isMethodIdempotent()
{
- return \in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE'));
+ return \in_array($this->getMethod(), ['HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE']);
}
/**
@@ -1455,7 +1470,7 @@ class Request
*/
public function isMethodCacheable()
{
- return \in_array($this->getMethod(), array('GET', 'HEAD'));
+ return \in_array($this->getMethod(), ['GET', 'HEAD']);
}
/**
@@ -1566,7 +1581,7 @@ class Request
return $locales[0];
}
- $extendedPreferredLanguages = array();
+ $extendedPreferredLanguages = [];
foreach ($preferredLanguages as $language) {
$extendedPreferredLanguages[] = $language;
if (false !== $position = strpos($language, '_')) {
@@ -1594,7 +1609,7 @@ class Request
}
$languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all();
- $this->languages = array();
+ $this->languages = [];
foreach ($languages as $lang => $acceptHeaderItem) {
if (false !== strpos($lang, '-')) {
$codes = explode('-', $lang);
@@ -1864,19 +1879,19 @@ class Request
*/
protected static function initializeFormats()
{
- static::$formats = array(
- 'html' => array('text/html', 'application/xhtml+xml'),
- 'txt' => array('text/plain'),
- 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'),
- 'css' => array('text/css'),
- 'json' => array('application/json', 'application/x-json'),
- 'jsonld' => array('application/ld+json'),
- 'xml' => array('text/xml', 'application/xml', 'application/x-xml'),
- 'rdf' => array('application/rdf+xml'),
- 'atom' => array('application/atom+xml'),
- 'rss' => array('application/rss+xml'),
- 'form' => array('application/x-www-form-urlencoded'),
- );
+ static::$formats = [
+ 'html' => ['text/html', 'application/xhtml+xml'],
+ 'txt' => ['text/plain'],
+ 'js' => ['application/javascript', 'application/x-javascript', 'text/javascript'],
+ 'css' => ['text/css'],
+ 'json' => ['application/json', 'application/x-json'],
+ 'jsonld' => ['application/ld+json'],
+ 'xml' => ['text/xml', 'application/xml', 'application/x-xml'],
+ 'rdf' => ['application/rdf+xml'],
+ 'atom' => ['application/atom+xml'],
+ 'rss' => ['application/rss+xml'],
+ 'form' => ['application/x-www-form-urlencoded'],
+ ];
}
private function setPhpDefaultLocale(string $locale)
@@ -1892,7 +1907,7 @@ class Request
}
}
- /*
+ /**
* Returns the prefix as encoded in the string when the string starts with
* the given prefix, false otherwise.
*
@@ -1913,7 +1928,7 @@ class Request
return false;
}
- private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
+ private static function createRequestFromFactory(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
{
if (self::$requestFactory) {
$request = (self::$requestFactory)($query, $request, $attributes, $cookies, $files, $server, $content);
@@ -1943,8 +1958,8 @@ class Request
private function getTrustedValues($type, $ip = null)
{
- $clientValues = array();
- $forwardedValues = array();
+ $clientValues = [];
+ $forwardedValues = [];
if ((self::$trustedHeaderSet & $type) && $this->headers->has(self::$trustedHeaders[$type])) {
foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) {
@@ -1955,7 +1970,7 @@ class Request
if ((self::$trustedHeaderSet & self::HEADER_FORWARDED) && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
$forwarded = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
$parts = HeaderUtils::split($forwarded, ',;=');
- $forwardedValues = array();
+ $forwardedValues = [];
$param = self::$forwardedParams[$type];
foreach ($parts as $subParts) {
if (null === $v = HeaderUtils::combine($subParts)[$param] ?? null) {
@@ -1985,7 +2000,7 @@ class Request
}
if (!$this->isForwardedValid) {
- return null !== $ip ? array('0.0.0.0', $ip) : array();
+ return null !== $ip ? ['0.0.0.0', $ip] : [];
}
$this->isForwardedValid = false;
@@ -1995,7 +2010,7 @@ class Request
private function normalizeAndFilterClientIps(array $clientIps, $ip)
{
if (!$clientIps) {
- return array();
+ return [];
}
$clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from
$firstTrustedIp = null;
@@ -2031,6 +2046,6 @@ class Request
}
// Now the IP chain contains only untrusted proxies and the client IP
- return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp);
+ return $clientIps ? array_reverse($clientIps) : [$firstTrustedIp];
}
}
diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php
index ab9434f4..d79c7f2e 100644
--- a/vendor/symfony/http-foundation/RequestMatcher.php
+++ b/vendor/symfony/http-foundation/RequestMatcher.php
@@ -36,22 +36,22 @@ class RequestMatcher implements RequestMatcherInterface
/**
* @var string[]
*/
- private $methods = array();
+ private $methods = [];
/**
* @var string[]
*/
- private $ips = array();
+ private $ips = [];
/**
* @var array
*/
- private $attributes = array();
+ private $attributes = [];
/**
* @var string[]
*/
- private $schemes = array();
+ private $schemes = [];
/**
* @param string|null $path
@@ -61,7 +61,7 @@ class RequestMatcher implements RequestMatcherInterface
* @param array $attributes
* @param string|string[]|null $schemes
*/
- public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, int $port = null)
+ public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, int $port = null)
{
$this->matchPath($path);
$this->matchHost($host);
@@ -82,7 +82,7 @@ class RequestMatcher implements RequestMatcherInterface
*/
public function matchScheme($scheme)
{
- $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array();
+ $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : [];
}
/**
@@ -132,7 +132,7 @@ class RequestMatcher implements RequestMatcherInterface
*/
public function matchIps($ips)
{
- $this->ips = null !== $ips ? (array) $ips : array();
+ $this->ips = null !== $ips ? (array) $ips : [];
}
/**
@@ -142,7 +142,7 @@ class RequestMatcher implements RequestMatcherInterface
*/
public function matchMethod($method)
{
- $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array();
+ $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : [];
}
/**
diff --git a/vendor/symfony/http-foundation/RequestStack.php b/vendor/symfony/http-foundation/RequestStack.php
index 40123f66..885d78a5 100644
--- a/vendor/symfony/http-foundation/RequestStack.php
+++ b/vendor/symfony/http-foundation/RequestStack.php
@@ -21,7 +21,7 @@ class RequestStack
/**
* @var Request[]
*/
- private $requests = array();
+ private $requests = [];
/**
* Pushes a Request on the stack.
diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php
index 7c962126..c3ac19d4 100644
--- a/vendor/symfony/http-foundation/Response.php
+++ b/vendor/symfony/http-foundation/Response.php
@@ -128,7 +128,7 @@ class Response
*
* @var array
*/
- public static $statusTexts = array(
+ public static $statusTexts = [
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing', // RFC2518
@@ -191,12 +191,12 @@ class Response
508 => 'Loop Detected', // RFC5842
510 => 'Not Extended', // RFC2774
511 => 'Network Authentication Required', // RFC6585
- );
+ ];
/**
* @throws \InvalidArgumentException When the HTTP status code is not valid
*/
- public function __construct($content = '', int $status = 200, array $headers = array())
+ public function __construct($content = '', int $status = 200, array $headers = [])
{
$this->headers = new ResponseHeaderBag($headers);
$this->setContent($content);
@@ -218,7 +218,7 @@ class Response
*
* @return static
*/
- public static function create($content = '', $status = 200, $headers = array())
+ public static function create($content = '', $status = 200, $headers = [])
{
return new static($content, $status, $headers);
}
@@ -306,9 +306,9 @@ class Response
}
// Check if we need to send extra expire info headers
- if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
- $this->headers->set('pragma', 'no-cache');
- $this->headers->set('expires', -1);
+ if ('1.0' == $this->getProtocolVersion() && false !== strpos($headers->get('Cache-Control'), 'no-cache')) {
+ $headers->set('pragma', 'no-cache');
+ $headers->set('expires', -1);
}
$this->ensureIEOverSSLCompatibility($request);
@@ -377,7 +377,7 @@ class Response
if (\function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
- } elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
+ } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
static::closeOutputBuffers(0, true);
}
@@ -397,7 +397,7 @@ class Response
*/
public function setContent($content)
{
- if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable(array($content, '__toString'))) {
+ if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable([$content, '__toString'])) {
throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content)));
}
@@ -529,7 +529,7 @@ class Response
*/
public function isCacheable(): bool
{
- if (!\in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) {
+ if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) {
return false;
}
@@ -939,7 +939,7 @@ class Response
*/
public function setCache(array $options)
{
- if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) {
+ if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
}
@@ -1000,7 +1000,7 @@ class Response
$this->setContent(null);
// remove headers that MUST NOT be included with 304 Not Modified responses
- foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) {
+ foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] as $header) {
$this->headers->remove($header);
}
@@ -1025,10 +1025,10 @@ class Response
public function getVary(): array
{
if (!$vary = $this->headers->get('Vary', null, false)) {
- return array();
+ return [];
}
- $ret = array();
+ $ret = [];
foreach ($vary as $item) {
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
}
@@ -1188,7 +1188,7 @@ class Response
*/
public function isRedirect(string $location = null): bool
{
- return \in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location'));
+ return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location'));
}
/**
@@ -1198,7 +1198,7 @@ class Response
*/
public function isEmpty(): bool
{
- return \in_array($this->statusCode, array(204, 304));
+ return \in_array($this->statusCode, [204, 304]);
}
/**
diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php
index 1141e8d9..cf44d0ec 100644
--- a/vendor/symfony/http-foundation/ResponseHeaderBag.php
+++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php
@@ -24,11 +24,11 @@ class ResponseHeaderBag extends HeaderBag
const DISPOSITION_ATTACHMENT = 'attachment';
const DISPOSITION_INLINE = 'inline';
- protected $computedCacheControl = array();
- protected $cookies = array();
- protected $headerNames = array();
+ protected $computedCacheControl = [];
+ protected $cookies = [];
+ protected $headerNames = [];
- public function __construct(array $headers = array())
+ public function __construct(array $headers = [])
{
parent::__construct($headers);
@@ -49,7 +49,7 @@ class ResponseHeaderBag extends HeaderBag
*/
public function allPreserveCase()
{
- $headers = array();
+ $headers = [];
foreach ($this->all() as $name => $value) {
$headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value;
}
@@ -70,9 +70,9 @@ class ResponseHeaderBag extends HeaderBag
/**
* {@inheritdoc}
*/
- public function replace(array $headers = array())
+ public function replace(array $headers = [])
{
- $this->headerNames = array();
+ $this->headerNames = [];
parent::replace($headers);
@@ -107,7 +107,7 @@ class ResponseHeaderBag extends HeaderBag
if ('set-cookie' === $uniqueKey) {
if ($replace) {
- $this->cookies = array();
+ $this->cookies = [];
}
foreach ((array) $values as $cookie) {
$this->setCookie(Cookie::fromString($cookie));
@@ -122,9 +122,8 @@ class ResponseHeaderBag extends HeaderBag
parent::set($key, $values, $replace);
// ensure the cache-control header has sensible defaults
- if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) {
- $computed = $this->computeCacheControlValue();
- $this->headers['cache-control'] = array($computed);
+ if (\in_array($uniqueKey, ['cache-control', 'etag', 'last-modified', 'expires'], true) && '' !== $computed = $this->computeCacheControlValue()) {
+ $this->headers['cache-control'] = [$computed];
$this->headerNames['cache-control'] = 'Cache-Control';
$this->computedCacheControl = $this->parseCacheControl($computed);
}
@@ -139,7 +138,7 @@ class ResponseHeaderBag extends HeaderBag
unset($this->headerNames[$uniqueKey]);
if ('set-cookie' === $uniqueKey) {
- $this->cookies = array();
+ $this->cookies = [];
return;
}
@@ -147,7 +146,7 @@ class ResponseHeaderBag extends HeaderBag
parent::remove($key);
if ('cache-control' === $uniqueKey) {
- $this->computedCacheControl = array();
+ $this->computedCacheControl = [];
}
if ('date' === $uniqueKey) {
@@ -160,7 +159,7 @@ class ResponseHeaderBag extends HeaderBag
*/
public function hasCacheControlDirective($key)
{
- return array_key_exists($key, $this->computedCacheControl);
+ return \array_key_exists($key, $this->computedCacheControl);
}
/**
@@ -168,7 +167,7 @@ class ResponseHeaderBag extends HeaderBag
*/
public function getCacheControlDirective($key)
{
- return array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null;
+ return \array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null;
}
public function setCookie(Cookie $cookie)
@@ -216,15 +215,15 @@ class ResponseHeaderBag extends HeaderBag
*/
public function getCookies($format = self::COOKIES_FLAT)
{
- if (!\in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) {
- throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY))));
+ if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
+ throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
}
if (self::COOKIES_ARRAY === $format) {
return $this->cookies;
}
- $flattenedCookies = array();
+ $flattenedCookies = [];
foreach ($this->cookies as $path) {
foreach ($path as $cookies) {
foreach ($cookies as $cookie) {
diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php
index d8ab561a..90da49fa 100644
--- a/vendor/symfony/http-foundation/ServerBag.php
+++ b/vendor/symfony/http-foundation/ServerBag.php
@@ -27,8 +27,8 @@ class ServerBag extends ParameterBag
*/
public function getHeaders()
{
- $headers = array();
- $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
+ $headers = [];
+ $contentHeaders = ['CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true];
foreach ($this->parameters as $key => $value) {
if (0 === strpos($key, 'HTTP_')) {
$headers[substr($key, 5)] = $value;
diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
index 82577b80..ee33698c 100644
--- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
+++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php
@@ -19,7 +19,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
private $name = 'attributes';
private $storageKey;
- protected $attributes = array();
+ protected $attributes = [];
/**
* @param string $storageKey The key used to store attributes in the session
@@ -63,7 +63,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function has($name)
{
- return array_key_exists($name, $this->attributes);
+ return \array_key_exists($name, $this->attributes);
}
/**
@@ -71,7 +71,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function get($name, $default = null)
{
- return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
+ return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
}
/**
@@ -95,7 +95,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function replace(array $attributes)
{
- $this->attributes = array();
+ $this->attributes = [];
foreach ($attributes as $key => $value) {
$this->set($key, $value);
}
@@ -107,7 +107,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
public function remove($name)
{
$retval = null;
- if (array_key_exists($name, $this->attributes)) {
+ if (\array_key_exists($name, $this->attributes)) {
$retval = $this->attributes[$name];
unset($this->attributes[$name]);
}
@@ -121,7 +121,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
public function clear()
{
$return = $this->attributes;
- $this->attributes = array();
+ $this->attributes = [];
return $return;
}
diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
index 50cd740d..162c4b52 100644
--- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
+++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php
@@ -44,7 +44,7 @@ class NamespacedAttributeBag extends AttributeBag
return false;
}
- return array_key_exists($name, $attributes);
+ return \array_key_exists($name, $attributes);
}
/**
@@ -60,7 +60,7 @@ class NamespacedAttributeBag extends AttributeBag
return $default;
}
- return array_key_exists($name, $attributes) ? $attributes[$name] : $default;
+ return \array_key_exists($name, $attributes) ? $attributes[$name] : $default;
}
/**
@@ -81,7 +81,7 @@ class NamespacedAttributeBag extends AttributeBag
$retval = null;
$attributes = &$this->resolveAttributePath($name);
$name = $this->resolveKey($name);
- if (null !== $attributes && array_key_exists($name, $attributes)) {
+ if (null !== $attributes && \array_key_exists($name, $attributes)) {
$retval = $attributes[$name];
unset($attributes[$name]);
}
@@ -115,7 +115,7 @@ class NamespacedAttributeBag extends AttributeBag
return $array;
}
- $array[$parts[0]] = array();
+ $array[$parts[0]] = [];
return $array;
}
@@ -123,14 +123,14 @@ class NamespacedAttributeBag extends AttributeBag
unset($parts[\count($parts) - 1]);
foreach ($parts as $part) {
- if (null !== $array && !array_key_exists($part, $array)) {
+ if (null !== $array && !\array_key_exists($part, $array)) {
if (!$writeContext) {
$null = null;
return $null;
}
- $array[$part] = array();
+ $array[$part] = [];
}
$array = &$array[$part];
diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
index ef23457b..6502f3d5 100644
--- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
+++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php
@@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class AutoExpireFlashBag implements FlashBagInterface
{
private $name = 'flashes';
- private $flashes = array('display' => array(), 'new' => array());
+ private $flashes = ['display' => [], 'new' => []];
private $storageKey;
/**
@@ -53,8 +53,8 @@ class AutoExpireFlashBag implements FlashBagInterface
// The logic: messages from the last request will be stored in new, so we move them to previous
// This request we will show what is in 'display'. What is placed into 'new' this time round will
// be moved to display next time round.
- $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
- $this->flashes['new'] = array();
+ $this->flashes['display'] = \array_key_exists('new', $this->flashes) ? $this->flashes['new'] : [];
+ $this->flashes['new'] = [];
}
/**
@@ -68,7 +68,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
- public function peek($type, array $default = array())
+ public function peek($type, array $default = [])
{
return $this->has($type) ? $this->flashes['display'][$type] : $default;
}
@@ -78,13 +78,13 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public function peekAll()
{
- return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
+ return \array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : [];
}
/**
* {@inheritdoc}
*/
- public function get($type, array $default = array())
+ public function get($type, array $default = [])
{
$return = $default;
@@ -106,7 +106,7 @@ class AutoExpireFlashBag implements FlashBagInterface
public function all()
{
$return = $this->flashes['display'];
- $this->flashes['display'] = array();
+ $this->flashes['display'] = [];
return $return;
}
@@ -132,7 +132,7 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public function has($type)
{
- return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
+ return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
index 44ddb963..c6b7ce35 100644
--- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
+++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php
@@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class FlashBag implements FlashBagInterface
{
private $name = 'flashes';
- private $flashes = array();
+ private $flashes = [];
private $storageKey;
/**
@@ -62,7 +62,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
- public function peek($type, array $default = array())
+ public function peek($type, array $default = [])
{
return $this->has($type) ? $this->flashes[$type] : $default;
}
@@ -78,7 +78,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
- public function get($type, array $default = array())
+ public function get($type, array $default = [])
{
if (!$this->has($type)) {
return $default;
@@ -97,7 +97,7 @@ class FlashBag implements FlashBagInterface
public function all()
{
$return = $this->peekAll();
- $this->flashes = array();
+ $this->flashes = [];
return $return;
}
@@ -123,7 +123,7 @@ class FlashBag implements FlashBagInterface
*/
public function has($type)
{
- return array_key_exists($type, $this->flashes) && $this->flashes[$type];
+ return \array_key_exists($type, $this->flashes) && $this->flashes[$type];
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
index f53c9dae..99e80742 100644
--- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
+++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php
@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
interface FlashBagInterface extends SessionBagInterface
{
/**
- * Adds a flash message for type.
+ * Adds a flash message for the given type.
*
* @param string $type
* @param mixed $message
@@ -29,12 +29,12 @@ interface FlashBagInterface extends SessionBagInterface
public function add($type, $message);
/**
- * Registers a message for a given type.
+ * Registers one or more messages for a given type.
*
* @param string $type
- * @param string|array $message
+ * @param string|array $messages
*/
- public function set($type, $message);
+ public function set($type, $messages);
/**
* Gets flash messages for a given type.
@@ -44,7 +44,7 @@ interface FlashBagInterface extends SessionBagInterface
*
* @return array
*/
- public function peek($type, array $default = array());
+ public function peek($type, array $default = []);
/**
* Gets all flash messages.
@@ -61,7 +61,7 @@ interface FlashBagInterface extends SessionBagInterface
*
* @return array
*/
- public function get($type, array $default = array());
+ public function get($type, array $default = []);
/**
* Gets and clears flashes from the stack.
diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php
index 33499068..867ceba9 100644
--- a/vendor/symfony/http-foundation/Session/Session.php
+++ b/vendor/symfony/http-foundation/Session/Session.php
@@ -28,7 +28,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
private $flashName;
private $attributeName;
- private $data = array();
+ private $data = [];
private $usageIndex = 0;
/**
diff --git a/vendor/symfony/http-foundation/Session/SessionUtils.php b/vendor/symfony/http-foundation/Session/SessionUtils.php
index 91737c39..b5bce4a8 100644
--- a/vendor/symfony/http-foundation/Session/SessionUtils.php
+++ b/vendor/symfony/http-foundation/Session/SessionUtils.php
@@ -30,7 +30,7 @@ final class SessionUtils
$sessionCookie = null;
$sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName));
$sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
- $otherCookies = array();
+ $otherCookies = [];
foreach (headers_list() as $h) {
if (0 !== stripos($h, 'Set-Cookie:')) {
continue;
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
index 95f11033..defca606 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
@@ -104,7 +104,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
{
if (null === $this->igbinaryEmptyData) {
// see https://github.com/igbinary/igbinary/issues/146
- $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : '';
+ $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
}
if ('' === $data || $this->igbinaryEmptyData === $data) {
return $this->destroy($sessionId);
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
index 61a7afd9..1db590b3 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
@@ -45,11 +45,11 @@ class MemcachedSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When unsupported options are passed
*/
- public function __construct(\Memcached $memcached, array $options = array())
+ public function __construct(\Memcached $memcached, array $options = [])
{
$this->memcached = $memcached;
- if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
+ if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
}
@@ -62,7 +62,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
*/
public function close()
{
- return true;
+ return $this->memcached->quit();
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
index 853b0bc7..904dc1b5 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php
@@ -74,12 +74,12 @@ class MongoDbSessionHandler extends AbstractSessionHandler
$this->mongo = $mongo;
- $this->options = array_merge(array(
+ $this->options = array_merge([
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
'expiry_field' => 'expires_at',
- ), $options);
+ ], $options);
}
/**
@@ -95,9 +95,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
protected function doDestroy($sessionId)
{
- $this->getCollection()->deleteOne(array(
+ $this->getCollection()->deleteOne([
$this->options['id_field'] => $sessionId,
- ));
+ ]);
return true;
}
@@ -107,9 +107,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
public function gc($maxlifetime)
{
- $this->getCollection()->deleteMany(array(
- $this->options['expiry_field'] => array('$lt' => new \MongoDB\BSON\UTCDateTime()),
- ));
+ $this->getCollection()->deleteMany([
+ $this->options['expiry_field'] => ['$lt' => new \MongoDB\BSON\UTCDateTime()],
+ ]);
return true;
}
@@ -121,16 +121,16 @@ class MongoDbSessionHandler extends AbstractSessionHandler
{
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
- $fields = array(
+ $fields = [
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
$this->options['expiry_field'] => $expiry,
$this->options['data_field'] => new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
- );
+ ];
$this->getCollection()->updateOne(
- array($this->options['id_field'] => $sessionId),
- array('$set' => $fields),
- array('upsert' => true)
+ [$this->options['id_field'] => $sessionId],
+ ['$set' => $fields],
+ ['upsert' => true]
);
return true;
@@ -144,11 +144,11 @@ class MongoDbSessionHandler extends AbstractSessionHandler
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
$this->getCollection()->updateOne(
- array($this->options['id_field'] => $sessionId),
- array('$set' => array(
+ [$this->options['id_field'] => $sessionId],
+ ['$set' => [
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
$this->options['expiry_field'] => $expiry,
- ))
+ ]]
);
return true;
@@ -159,10 +159,10 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
protected function doRead($sessionId)
{
- $dbData = $this->getCollection()->findOne(array(
+ $dbData = $this->getCollection()->findOne([
$this->options['id_field'] => $sessionId,
- $this->options['expiry_field'] => array('$gte' => new \MongoDB\BSON\UTCDateTime()),
- ));
+ $this->options['expiry_field'] => ['$gte' => new \MongoDB\BSON\UTCDateTime()],
+ ]);
if (null === $dbData) {
return '';
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
index 1bb647ef..0623318d 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -118,7 +118,7 @@ class PdoSessionHandler extends AbstractSessionHandler
/**
* @var array Connection options when lazy-connect
*/
- private $connectionOptions = array();
+ private $connectionOptions = [];
/**
* @var int The strategy for locking, see constants
@@ -130,7 +130,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @var \PDOStatement[] An array of statements to release advisory locks
*/
- private $unlockStatements = array();
+ private $unlockStatements = [];
/**
* @var bool True when the current session exists but expired according to session.gc_maxlifetime
@@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler
* * db_time_col: The column where to store the timestamp [default: sess_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
+ * * db_connection_options: An array of driver-specific connection options [default: []]
* * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
*
* @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
@@ -169,7 +169,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
*/
- public function __construct($pdoOrDsn = null, array $options = array())
+ public function __construct($pdoOrDsn = null, array $options = [])
{
if ($pdoOrDsn instanceof \PDO) {
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
@@ -468,13 +468,13 @@ class PdoSessionHandler extends AbstractSessionHandler
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
}
- $driverAliasMap = array(
+ $driverAliasMap = [
'mssql' => 'sqlsrv',
'mysql2' => 'mysql', // Amazon RDS, for some weird reason
'postgres' => 'pgsql',
'postgresql' => 'pgsql',
'sqlite3' => 'sqlite',
- );
+ ];
$driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php
index 9c08ddcc..a6498b88 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php
@@ -39,7 +39,7 @@ class RedisSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When unsupported client or options are passed
*/
- public function __construct($redis, array $options = array())
+ public function __construct($redis, array $options = [])
{
if (
!$redis instanceof \Redis &&
@@ -52,7 +52,7 @@ class RedisSessionHandler extends AbstractSessionHandler
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
}
- if ($diff = array_diff(array_keys($options), array('prefix'))) {
+ if ($diff = array_diff(array_keys($options), ['prefix'])) {
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
index ea0d5ecb..2eff4109 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php
@@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface
/**
* @var array
*/
- protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
+ protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0];
/**
* Unix timestamp.
diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
index 47cac398..37b6f145 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php
@@ -50,7 +50,7 @@ class MockArraySessionStorage implements SessionStorageInterface
/**
* @var array
*/
- protected $data = array();
+ protected $data = [];
/**
* @var MetadataBag
@@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
/**
* @var array|SessionBagInterface[]
*/
- protected $bags = array();
+ protected $bags = [];
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
{
@@ -166,7 +166,7 @@ class MockArraySessionStorage implements SessionStorageInterface
}
// clear out the session
- $this->data = array();
+ $this->data = [];
// reconnect the bags to the session
$this->loadSession();
@@ -238,11 +238,11 @@ class MockArraySessionStorage implements SessionStorageInterface
protected function loadSession()
{
- $bags = array_merge($this->bags, array($this->metadataBag));
+ $bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
- $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array();
+ $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : [];
$bag->initialize($this->data[$key]);
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
index 732f92ab..c0316c2c 100644
--- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php
@@ -98,7 +98,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
unset($data[$key]);
}
}
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) {
+ if ([$key = $this->metadataBag->getStorageKey()] === array_keys($data)) {
unset($data[$key]);
}
@@ -145,7 +145,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
private function read()
{
$filePath = $this->getFilePath();
- $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array();
+ $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
$this->loadSession();
}
diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
index 232eb64c..ce702795 100644
--- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
@@ -27,7 +27,7 @@ class NativeSessionStorage implements SessionStorageInterface
/**
* @var SessionBagInterface[]
*/
- protected $bags = array();
+ protected $bags = [];
/**
* @var bool
@@ -101,15 +101,15 @@ class NativeSessionStorage implements SessionStorageInterface
* @param \SessionHandlerInterface|null $handler
* @param MetadataBag $metaBag MetadataBag
*/
- public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
+ public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
{
- $options += array(
+ $options += [
'cache_limiter' => '',
'cache_expire' => 0,
'use_cookies' => 1,
'lazy_write' => 1,
'use_strict_mode' => 1,
- );
+ ];
session_register_shutdown();
@@ -244,7 +244,7 @@ class NativeSessionStorage implements SessionStorageInterface
unset($_SESSION[$key]);
}
}
- if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) {
+ if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
unset($_SESSION[$key]);
}
@@ -280,7 +280,7 @@ class NativeSessionStorage implements SessionStorageInterface
}
// clear out the session
- $_SESSION = array();
+ $_SESSION = [];
// reconnect the bags to the session
$this->loadSession();
@@ -349,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface
* For convenience we omit 'session.' from the beginning of the keys.
* Explicitly ignores other ini keys.
*
- * @param array $options Session ini directives array(key => value)
+ * @param array $options Session ini directives [key => value]
*
* @see http://php.net/session.configuration
*/
@@ -359,7 +359,7 @@ class NativeSessionStorage implements SessionStorageInterface
return;
}
- $validOptions = array_flip(array(
+ $validOptions = array_flip([
'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure', 'cookie_samesite',
'gc_divisor', 'gc_maxlifetime', 'gc_probability',
@@ -369,7 +369,7 @@ class NativeSessionStorage implements SessionStorageInterface
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags',
'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
- ));
+ ]);
foreach ($options as $key => $value) {
if (isset($validOptions[$key])) {
@@ -445,11 +445,11 @@ class NativeSessionStorage implements SessionStorageInterface
$session = &$_SESSION;
}
- $bags = array_merge($this->bags, array($this->metadataBag));
+ $bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
- $session[$key] = isset($session[$key]) ? $session[$key] : array();
+ $session[$key] = isset($session[$key]) ? $session[$key] : [];
$bag->initialize($session[$key]);
}
diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php
index d3bcbb79..8310ea72 100644
--- a/vendor/symfony/http-foundation/StreamedResponse.php
+++ b/vendor/symfony/http-foundation/StreamedResponse.php
@@ -35,7 +35,7 @@ class StreamedResponse extends Response
* @param int $status The response status code
* @param array $headers An array of response headers
*/
- public function __construct(callable $callback = null, int $status = 200, array $headers = array())
+ public function __construct(callable $callback = null, int $status = 200, array $headers = [])
{
parent::__construct(null, $status, $headers);
@@ -55,7 +55,7 @@ class StreamedResponse extends Response
*
* @return static
*/
- public static function create($callback = null, $status = 200, $headers = array())
+ public static function create($callback = null, $status = 200, $headers = [])
{
return new static($callback, $status, $headers);
}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/RequestAttributeValueSame.php b/vendor/symfony/http-foundation/Test/Constraint/RequestAttributeValueSame.php
new file mode 100644
index 00000000..2d105627
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/RequestAttributeValueSame.php
@@ -0,0 +1,54 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+
+final class RequestAttributeValueSame extends Constraint
+{
+ private $name;
+ private $value;
+
+ public function __construct(string $name, string $value)
+ {
+ $this->name = $name;
+ $this->value = $value;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return sprintf('has attribute "%s" with value "%s"', $this->name, $this->value);
+ }
+
+ /**
+ * @param Request $request
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($request): bool
+ {
+ return $this->value === $request->attributes->get($this->name);
+ }
+
+ /**
+ * @param Request $request
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($request): string
+ {
+ return 'the Request '.$this->toString();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseCookieValueSame.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseCookieValueSame.php
new file mode 100644
index 00000000..554e1a16
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseCookieValueSame.php
@@ -0,0 +1,85 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Cookie;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseCookieValueSame extends Constraint
+{
+ private $name;
+ private $value;
+ private $path;
+ private $domain;
+
+ public function __construct(string $name, string $value, string $path = '/', string $domain = null)
+ {
+ $this->name = $name;
+ $this->value = $value;
+ $this->path = $path;
+ $this->domain = $domain;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ $str = sprintf('has cookie "%s"', $this->name);
+ if ('/' !== $this->path) {
+ $str .= sprintf(' with path "%s"', $this->path);
+ }
+ if ($this->domain) {
+ $str .= sprintf(' for domain "%s"', $this->domain);
+ }
+ $str .= sprintf(' with value "%s"', $this->value);
+
+ return $str;
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ $cookie = $this->getCookie($response);
+ if (!$cookie) {
+ return false;
+ }
+
+ return $this->value === $cookie->getValue();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+
+ protected function getCookie(Response $response): ?Cookie
+ {
+ $cookies = $response->headers->getCookies();
+
+ $filteredCookies = array_filter($cookies, function (Cookie $cookie) {
+ return $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain;
+ });
+
+ return reset($filteredCookies) ?: null;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseHasCookie.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseHasCookie.php
new file mode 100644
index 00000000..bd792b0d
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseHasCookie.php
@@ -0,0 +1,77 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Cookie;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseHasCookie extends Constraint
+{
+ private $name;
+ private $path;
+ private $domain;
+
+ public function __construct(string $name, string $path = '/', string $domain = null)
+ {
+ $this->name = $name;
+ $this->path = $path;
+ $this->domain = $domain;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ $str = sprintf('has cookie "%s"', $this->name);
+ if ('/' !== $this->path) {
+ $str .= sprintf(' with path "%s"', $this->path);
+ }
+ if ($this->domain) {
+ $str .= sprintf(' for domain "%s"', $this->domain);
+ }
+
+ return $str;
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return null !== $this->getCookie($response);
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+
+ protected function getCookie(Response $response): ?Cookie
+ {
+ $cookies = $response->headers->getCookies();
+
+ $filteredCookies = array_filter($cookies, function (Cookie $cookie) {
+ return $cookie->getName() === $this->name && $cookie->getPath() === $this->path && $cookie->getDomain() === $this->domain;
+ });
+
+ return reset($filteredCookies) ?: null;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseHasHeader.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseHasHeader.php
new file mode 100644
index 00000000..68ad8273
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseHasHeader.php
@@ -0,0 +1,53 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseHasHeader extends Constraint
+{
+ private $headerName;
+
+ public function __construct(string $headerName)
+ {
+ $this->headerName = $headerName;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return sprintf('has header "%s"', $this->headerName);
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return $response->headers->has($this->headerName);
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseHeaderSame.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseHeaderSame.php
new file mode 100644
index 00000000..acdea71d
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseHeaderSame.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseHeaderSame extends Constraint
+{
+ private $headerName;
+ private $expectedValue;
+
+ public function __construct(string $headerName, string $expectedValue)
+ {
+ $this->headerName = $headerName;
+ $this->expectedValue = $expectedValue;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return $this->expectedValue === $response->headers->get($this->headerName, null, true);
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseIsRedirected.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseIsRedirected.php
new file mode 100644
index 00000000..8c4b883f
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseIsRedirected.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseIsRedirected extends Constraint
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return 'is redirected';
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return $response->isRedirect();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function additionalFailureDescription($response): string
+ {
+ return (string) $response;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseIsSuccessful.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseIsSuccessful.php
new file mode 100644
index 00000000..9c665589
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseIsSuccessful.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseIsSuccessful extends Constraint
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return 'is successful';
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return $response->isSuccessful();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function additionalFailureDescription($response): string
+ {
+ return (string) $response;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Test/Constraint/ResponseStatusCodeSame.php b/vendor/symfony/http-foundation/Test/Constraint/ResponseStatusCodeSame.php
new file mode 100644
index 00000000..72bb000b
--- /dev/null
+++ b/vendor/symfony/http-foundation/Test/Constraint/ResponseStatusCodeSame.php
@@ -0,0 +1,63 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Test\Constraint;
+
+use PHPUnit\Framework\Constraint\Constraint;
+use Symfony\Component\HttpFoundation\Response;
+
+final class ResponseStatusCodeSame extends Constraint
+{
+ private $statusCode;
+
+ public function __construct(int $statusCode)
+ {
+ $this->statusCode = $statusCode;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function toString(): string
+ {
+ return 'status code is '.$this->statusCode;
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function matches($response): bool
+ {
+ return $this->statusCode === $response->getStatusCode();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function failureDescription($response): string
+ {
+ return 'the Response '.$this->toString();
+ }
+
+ /**
+ * @param Response $response
+ *
+ * {@inheritdoc}
+ */
+ protected function additionalFailureDescription($response): string
+ {
+ return (string) $response;
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
index 1a660247..516bd555 100644
--- a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
+++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php
@@ -28,24 +28,24 @@ class AcceptHeaderItemTest extends TestCase
public function provideFromStringData()
{
- return array(
- array(
+ return [
+ [
'text/html',
- 'text/html', array(),
- ),
- array(
+ 'text/html', [],
+ ],
+ [
'"this;should,not=matter"',
- 'this;should,not=matter', array(),
- ),
- array(
+ 'this;should,not=matter', [],
+ ],
+ [
"text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true",
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
- ),
- array(
+ 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'],
+ ],
+ [
'"this;should,not=matter";charset=utf-8',
- 'this;should,not=matter', array('charset' => 'utf-8'),
- ),
- );
+ 'this;should,not=matter', ['charset' => 'utf-8'],
+ ],
+ ];
}
/**
@@ -59,21 +59,21 @@ class AcceptHeaderItemTest extends TestCase
public function provideToStringData()
{
- return array(
- array(
- 'text/html', array(),
+ return [
+ [
+ 'text/html', [],
'text/html',
- ),
- array(
- 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'),
+ ],
+ [
+ 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'],
'text/plain; charset=utf-8; param="this;should,not=matter"; footnotes=true',
- ),
- );
+ ],
+ ];
}
public function testValue()
{
- $item = new AcceptHeaderItem('value', array());
+ $item = new AcceptHeaderItem('value', []);
$this->assertEquals('value', $item->getValue());
$item->setValue('new value');
@@ -85,7 +85,7 @@ class AcceptHeaderItemTest extends TestCase
public function testQuality()
{
- $item = new AcceptHeaderItem('value', array());
+ $item = new AcceptHeaderItem('value', []);
$this->assertEquals(1.0, $item->getQuality());
$item->setQuality(0.5);
@@ -98,14 +98,14 @@ class AcceptHeaderItemTest extends TestCase
public function testAttribute()
{
- $item = new AcceptHeaderItem('value', array());
- $this->assertEquals(array(), $item->getAttributes());
+ $item = new AcceptHeaderItem('value', []);
+ $this->assertEquals([], $item->getAttributes());
$this->assertFalse($item->hasAttribute('test'));
$this->assertNull($item->getAttribute('test'));
$this->assertEquals('default', $item->getAttribute('test', 'default'));
$item->setAttribute('test', 'value');
- $this->assertEquals(array('test' => 'value'), $item->getAttributes());
+ $this->assertEquals(['test' => 'value'], $item->getAttributes());
$this->assertTrue($item->hasAttribute('test'));
$this->assertEquals('value', $item->getAttribute('test'));
$this->assertEquals('value', $item->getAttribute('test', 'default'));
diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
index 1ac6103e..1987e97f 100644
--- a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
+++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php
@@ -39,13 +39,13 @@ class AcceptHeaderTest extends TestCase
public function provideFromStringData()
{
- return array(
- array('', array()),
- array('gzip', array(new AcceptHeaderItem('gzip'))),
- array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))),
- array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))),
- );
+ return [
+ ['', []],
+ ['gzip', [new AcceptHeaderItem('gzip')]],
+ ['gzip,deflate,sdch', [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]],
+ ["gzip, deflate\t,sdch", [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]],
+ ['"this;should,not=matter"', [new AcceptHeaderItem('this;should,not=matter')]],
+ ];
}
/**
@@ -59,12 +59,12 @@ class AcceptHeaderTest extends TestCase
public function provideToStringData()
{
- return array(
- array(array(), ''),
- array(array(new AcceptHeaderItem('gzip')), 'gzip'),
- array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'),
- array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'),
- );
+ return [
+ [[], ''],
+ [[new AcceptHeaderItem('gzip')], 'gzip'],
+ [[new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')], 'gzip,deflate,sdch'],
+ [[new AcceptHeaderItem('this;should,not=matter')], 'this;should,not=matter'],
+ ];
}
/**
@@ -78,9 +78,9 @@ class AcceptHeaderTest extends TestCase
public function provideFilterData()
{
- return array(
- array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')),
- );
+ return [
+ ['fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', ['fr-FR', 'fr']],
+ ];
}
/**
@@ -94,11 +94,11 @@ class AcceptHeaderTest extends TestCase
public function provideSortingData()
{
- return array(
- 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')),
- 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')),
- );
+ return [
+ 'quality has priority' => ['*;q=0.3,ISO-8859-1,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']],
+ 'order matters when q is equal' => ['*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']],
+ 'order matters when q is equal2' => ['*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', ['utf-8', 'ISO-8859-1', '*']],
+ ];
}
/**
@@ -112,19 +112,19 @@ class AcceptHeaderTest extends TestCase
public function provideDefaultValueData()
{
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, *;q=0.3', 'text/xml', 0.3);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/xml', 0.3);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/html', 1.0);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/plain', 0.5);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', '*', 0.3);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', '*', 1.0);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/xml', 1.0);
- yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/*', 1.0);
- yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/*', 0.8);
- yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/html', 1.0);
- yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/x-dvi', 0.8);
- yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', '*', 0.3);
- yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'utf-8', 0.7);
- yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'SHIFT_JIS', 0.3);
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, *;q=0.3', 'text/xml', 0.3];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/xml', 0.3];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/html', 1.0];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/plain', 0.5];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', '*', 0.3];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', '*', 1.0];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/xml', 1.0];
+ yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/*', 1.0];
+ yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/*', 0.8];
+ yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/html', 1.0];
+ yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/x-dvi', 0.8];
+ yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', '*', 0.3];
+ yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'utf-8', 0.7];
+ yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'SHIFT_JIS', 0.3];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
index 157ab90e..6fa3b889 100644
--- a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
+++ b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php
@@ -31,63 +31,63 @@ class ApacheRequestTest extends TestCase
public function provideServerVars()
{
- return array(
- array(
- array(
+ return [
+ [
+ [
'REQUEST_URI' => '/foo/app_dev.php/bar',
'SCRIPT_NAME' => '/foo/app_dev.php',
'PATH_INFO' => '/bar',
- ),
+ ],
'/foo/app_dev.php/bar',
'/foo/app_dev.php',
'/bar',
- ),
- array(
- array(
+ ],
+ [
+ [
'REQUEST_URI' => '/foo/bar',
'SCRIPT_NAME' => '/foo/app_dev.php',
- ),
+ ],
'/foo/bar',
'/foo',
'/bar',
- ),
- array(
- array(
+ ],
+ [
+ [
'REQUEST_URI' => '/app_dev.php/foo/bar',
'SCRIPT_NAME' => '/app_dev.php',
'PATH_INFO' => '/foo/bar',
- ),
+ ],
'/app_dev.php/foo/bar',
'/app_dev.php',
'/foo/bar',
- ),
- array(
- array(
+ ],
+ [
+ [
'REQUEST_URI' => '/foo/bar',
'SCRIPT_NAME' => '/app_dev.php',
- ),
+ ],
'/foo/bar',
'',
'/foo/bar',
- ),
- array(
- array(
+ ],
+ [
+ [
'REQUEST_URI' => '/app_dev.php',
'SCRIPT_NAME' => '/app_dev.php',
- ),
+ ],
'/app_dev.php',
'/app_dev.php',
'/',
- ),
- array(
- array(
+ ],
+ [
+ [
'REQUEST_URI' => '/',
'SCRIPT_NAME' => '/app_dev.php',
- ),
+ ],
'/',
'',
'/',
- ),
- );
+ ],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
index 6bf04e16..effffe92 100644
--- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php
@@ -22,14 +22,14 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testConstruction()
{
$file = __DIR__.'/../README.md';
- $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true);
+ $response = new BinaryFileResponse($file, 404, ['X-Header' => 'Foo'], true, null, true, true);
$this->assertEquals(404, $response->getStatusCode());
$this->assertEquals('Foo', $response->headers->get('X-Header'));
$this->assertTrue($response->headers->has('ETag'));
$this->assertTrue($response->headers->has('Last-Modified'));
$this->assertFalse($response->headers->has('Content-Disposition'));
- $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE);
+ $response = BinaryFileResponse::create($file, 404, [], true, ResponseHeaderBag::DISPOSITION_INLINE);
$this->assertEquals(404, $response->getStatusCode());
$this->assertFalse($response->headers->has('ETag'));
$this->assertEquals('inline; filename=README.md', $response->headers->get('Content-Disposition'));
@@ -39,7 +39,7 @@ class BinaryFileResponseTest extends ResponseTestCase
{
touch(sys_get_temp_dir().'/fööö.html');
- $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment');
+ $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, [], true, 'attachment');
@unlink(sys_get_temp_dir().'/fööö.html');
@@ -85,7 +85,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testRequests($requestRange, $offset, $length, $responseRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// do a request to get the ETag
$request = Request::create('/');
@@ -117,7 +117,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
// do a request to get the LastModified
$request = Request::create('/');
@@ -145,19 +145,19 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideRanges()
{
- return array(
- array('bytes=1-4', 1, 4, 'bytes 1-4/35'),
- array('bytes=-5', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-', 30, 5, 'bytes 30-34/35'),
- array('bytes=30-30', 30, 1, 'bytes 30-30/35'),
- array('bytes=30-34', 30, 5, 'bytes 30-34/35'),
- );
+ return [
+ ['bytes=1-4', 1, 4, 'bytes 1-4/35'],
+ ['bytes=-5', 30, 5, 'bytes 30-34/35'],
+ ['bytes=30-', 30, 5, 'bytes 30-34/35'],
+ ['bytes=30-30', 30, 1, 'bytes 30-30/35'],
+ ['bytes=30-34', 30, 5, 'bytes 30-34/35'],
+ ];
}
public function testRangeRequestsWithoutLastModifiedDate()
{
// prevent auto last modified
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false);
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'], true, null, false, false);
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -178,7 +178,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testFullFileRequests($requestRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -198,14 +198,14 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideFullFileRanges()
{
- return array(
- array('bytes=0-'),
- array('bytes=0-34'),
- array('bytes=-35'),
+ return [
+ ['bytes=0-'],
+ ['bytes=0-34'],
+ ['bytes=-35'],
// Syntactical invalid range-request should also return the full resource
- array('bytes=20-10'),
- array('bytes=50-40'),
- );
+ ['bytes=20-10'],
+ ['bytes=50-40'],
+ ];
}
public function testUnpreparedResponseSendsFullFile()
@@ -226,7 +226,7 @@ class BinaryFileResponseTest extends ResponseTestCase
*/
public function testInvalidRequests($requestRange)
{
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag();
// prepare a request for a range of the testing file
$request = Request::create('/');
@@ -242,10 +242,10 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideInvalidRanges()
{
- return array(
- array('bytes=-40'),
- array('bytes=30-40'),
- );
+ return [
+ ['bytes=-40'],
+ ['bytes=30-40'],
+ ];
}
/**
@@ -257,7 +257,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$request->headers->set('X-Sendfile-Type', 'X-Sendfile');
BinaryFileResponse::trustXSendfileTypeHeader();
- $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create($file, 200, ['Content-Type' => 'application/octet-stream']);
$response->prepare($request);
$this->expectOutputString('');
@@ -268,10 +268,10 @@ class BinaryFileResponseTest extends ResponseTestCase
public function provideXSendfileFiles()
{
- return array(
- array(__DIR__.'/../README.md'),
- array('file://'.__DIR__.'/../README.md'),
- );
+ return [
+ [__DIR__.'/../README.md'],
+ ['file://'.__DIR__.'/../README.md'],
+ ];
}
/**
@@ -286,7 +286,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
BinaryFileResponse::trustXSendfileTypeHeader();
- $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']);
$reflection = new \ReflectionObject($response);
$property = $reflection->getProperty('file');
$property->setAccessible(true);
@@ -305,7 +305,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$realPath = realpath($path);
$this->assertFileExists($realPath);
- $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream'));
+ $response = new BinaryFileResponse($realPath, 200, ['Content-Type' => 'application/octet-stream']);
$response->deleteFileAfterSend(true);
$response->prepare($request);
@@ -317,7 +317,7 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testAcceptRangeOnUnsafeMethods()
{
$request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
$response->prepare($request);
$this->assertEquals('none', $response->headers->get('Accept-Ranges'));
@@ -326,7 +326,7 @@ class BinaryFileResponseTest extends ResponseTestCase
public function testAcceptRangeNotOverriden()
{
$request = Request::create('/', 'POST');
- $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'));
+ $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
$response->headers->set('Accept-Ranges', 'foo');
$response->prepare($request);
@@ -335,17 +335,18 @@ class BinaryFileResponseTest extends ResponseTestCase
public function getSampleXAccelMappings()
{
- return array(
- array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'),
- array('/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'),
- array('/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'),
- );
+ return [
+ ['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'],
+ ['/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'],
+ ['/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'],
+ ['/tmp/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', null],
+ ];
}
public function testStream()
{
$request = Request::create('/');
- $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain'));
+ $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, ['Content-Type' => 'text/plain']);
$response->prepare($request);
$this->assertNull($response->headers->get('Content-Length'));
@@ -353,7 +354,7 @@ class BinaryFileResponseTest extends ResponseTestCase
protected function provideResponse()
{
- return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream'));
+ return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']);
}
public static function tearDownAfterClass()
diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php
index 44981dff..4aa32eea 100644
--- a/vendor/symfony/http-foundation/Tests/CookieTest.php
+++ b/vendor/symfony/http-foundation/Tests/CookieTest.php
@@ -26,17 +26,17 @@ class CookieTest extends TestCase
{
public function invalidNames()
{
- return array(
- array(''),
- array(',MyName'),
- array(';MyName'),
- array(' MyName'),
- array("\tMyName"),
- array("\rMyName"),
- array("\nMyName"),
- array("\013MyName"),
- array("\014MyName"),
- );
+ return [
+ [''],
+ [',MyName'],
+ [';MyName'],
+ [' MyName'],
+ ["\tMyName"],
+ ["\rMyName"],
+ ["\nMyName"],
+ ["\013MyName"],
+ ["\014MyName"],
+ ];
}
/**
diff --git a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
index 1152e46c..2afdade6 100644
--- a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
+++ b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php
@@ -55,15 +55,15 @@ class ExpressionRequestMatcherTest extends TestCase
public function provideExpressions()
{
- return array(
- array('request.getMethod() == method', true),
- array('request.getPathInfo() == path', true),
- array('request.getHost() == host', true),
- array('request.getClientIp() == ip', true),
- array('request.attributes.all() == attributes', true),
- array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true),
- array('request.getMethod() != method', false),
- array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false),
- );
+ return [
+ ['request.getMethod() == method', true],
+ ['request.getPathInfo() == path', true],
+ ['request.getHost() == host', true],
+ ['request.getClientIp() == ip', true],
+ ['request.attributes.all() == attributes', true],
+ ['request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true],
+ ['request.getMethod() != method', false],
+ ['request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/File/FileTest.php b/vendor/symfony/http-foundation/Tests/File/FileTest.php
index dbd9c44b..9c1854d9 100644
--- a/vendor/symfony/http-foundation/Tests/File/FileTest.php
+++ b/vendor/symfony/http-foundation/Tests/File/FileTest.php
@@ -13,8 +13,10 @@ namespace Symfony\Component\HttpFoundation\Tests\File;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\File\File;
-use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
+/**
+ * @requires extension fileinfo
+ */
class FileTest extends TestCase
{
protected $file;
@@ -22,50 +24,24 @@ class FileTest extends TestCase
public function testGetMimeTypeUsesMimeTypeGuessers()
{
$file = new File(__DIR__.'/Fixtures/test.gif');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
$this->assertEquals('image/gif', $file->getMimeType());
}
public function testGuessExtensionWithoutGuesser()
{
$file = new File(__DIR__.'/Fixtures/directory/.empty');
-
$this->assertNull($file->guessExtension());
}
public function testGuessExtensionIsBasedOnMimeType()
{
$file = new File(__DIR__.'/Fixtures/test');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
-
- MimeTypeGuesser::getInstance()->register($guesser);
-
$this->assertEquals('gif', $file->guessExtension());
}
- /**
- * @requires extension fileinfo
- */
- public function testGuessExtensionWithReset()
- {
- $file = new File(__DIR__.'/Fixtures/other-file.example');
- $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
- MimeTypeGuesser::getInstance()->register($guesser);
-
- $this->assertEquals('gif', $file->guessExtension());
-
- MimeTypeGuesser::reset();
-
- $this->assertNull($file->guessExtension());
- }
-
public function testConstructWhenFileNotExists()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
-
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
new File(__DIR__.'/Fixtures/not_here');
}
@@ -110,14 +86,14 @@ class FileTest extends TestCase
public function getFilenameFixtures()
{
- return array(
- array('original.gif', 'original.gif'),
- array('..\\..\\original.gif', 'original.gif'),
- array('../../original.gif', 'original.gif'),
- array('файлfile.gif', 'файлfile.gif'),
- array('..\\..\\файлfile.gif', 'файлfile.gif'),
- array('../../файлfile.gif', 'файлfile.gif'),
- );
+ return [
+ ['original.gif', 'original.gif'],
+ ['..\\..\\original.gif', 'original.gif'],
+ ['../../original.gif', 'original.gif'],
+ ['файлfile.gif', 'файлfile.gif'],
+ ['..\\..\\файлfile.gif', 'файлfile.gif'],
+ ['../../файлfile.gif', 'файлfile.gif'],
+ ];
}
/**
@@ -164,17 +140,4 @@ class FileTest extends TestCase
@unlink($targetPath);
@rmdir($targetDir);
}
-
- protected function createMockGuesser($path, $mimeType)
- {
- $guesser = $this->getMockBuilder('Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface')->getMock();
- $guesser
- ->expects($this->once())
- ->method('guess')
- ->with($this->equalTo($path))
- ->will($this->returnValue($mimeType))
- ;
-
- return $guesser;
- }
}
diff --git a/vendor/symfony/http-foundation/Tests/File/Fixtures/case-sensitive-mime-type.xlsm b/vendor/symfony/http-foundation/Tests/File/Fixtures/case-sensitive-mime-type.xlsm
new file mode 100644
index 0000000000000000000000000000000000000000..94d85e6132c553225a1628f056151bee22f5b352
GIT binary patch
literal 4791
zcmaJ_by$;q7bYA%x^yBTjifNTk=Ou7hct}dMu}1)H4rK35NQxZL_|6iLAsH0l%O;y
zAfX`N_Qof#*ZX=ue{9#To%1};ea^YhIX@Vb@EkoJ2?+__b=!Ddyfe6f{eIhB*xC#3
z?k#)^<>h9FLb(auMz{;%etDYEOV%breeK{RS|lKAJR(Z`=4F*yeMPpyQQ{h{u6B*n
z*{FQR29E{Tx?QOQv8jFV-bQGgOaY+KlYru-m{AD`ztgML^bI(^ig14+X1YeKyEMF4N~R&w0F@TI(O9KU^{Q%+*e{J|iPM;uBli)XwJwO0^Qg
zpu{Bc1O#}^*jG%)$HRmDCkf1dl7M@CZ)Z5%$6NT14^bQsu}1Ip--}QOZJXTQo1M(V
z^t9Wi4a!IoX2AS-vfD4dFW)8S5>`7kyDrYUkKt^sNq-Zm@Qb`r0E0;A&D^i#W<*PG1%abL(59t#%7#hGF!MY7$c5
zyJlS;sC)~4;!m<<{IbhE1V{WW5fXKs{D(7yvvfoCi$_GhN$1&B+@^(=-*jCt=?plX+`^<*m;
zt6gl=fy3Sl4*Sn8Blp*3C2wfmGa5pQNxQwnOp9;W=%GM9?b^5a+aQOd-9G-09_|HS
z>7kkVUQsu<+Q1=UWHY{#a{HThOl)!%)INJ++0qiJ!a2SXESu^Qu))yA!RiZFxkhmC
zEf23bf563DU4L<*Tgxos?Rg=sMo`C#WdXrQWUJqJxMTErX0XDpt{=5?v=???!HrOwGfj~uTb1MB*4QnA^KhQQ2nf)zr`cgpc{!Tn&tz6
zbF&CRt2O3SLXDaPycz0}?uRRhHML
zc}9J0wy)%1^+Ms(9UJQgGU=j&943G?bLBoEo2kv6nGc2i3Zwqp!$EL+V|K9jT&*8K
zqE>b0ZoX!zPX7b#7rO}iyG%6%ugt&cQEQ)Ml6T02*B`M`Sf+ABz8s*E;N4K7(2Q%J
zHO_zTUe6m5zFff`FWJvyMYkE=`|zmOWZF6=?Mq;=vwlyUS$7e@wR)sva7wc4fy@Ve
zv1jun3pyfO20!i&X=WIrA3j|)d)56TuC`dUX+k}4f~+3%NgaCrs(7TE1V=Q-sfojT
z%C&n=HMbsFhx708IacTQX6<&fSgVCF2ztn5#s?SzHZ|2&8NmtDI
zVy>CA=XtCxkr+OE`I!AwM+50}GGTzsy_Lvh+na1b1z_+MQ;xnE!H~h(<|xE#b1AwD
zf1h^@p}WXLg5IGEg0-``^PT5aTnlA04)=|1-TLJEOqqix?hPAB8za-e;p_bGRwS^yj@bbl_9?u=Vrvb9AcZBbK6vidaWwG4hW31$&2!EG2z&{hm
z+sDrx?v2yh&2(i{mI!_4_ILW!ZGnVh7g>Cx_xD`VO3e*iMykUIiOMg4rgTByRu5uG
zLk!=gZd4jVglkUaPG{$+ZioV(88c{HH+12?79K{&dYNB8LsU=g(DqSa(<@C7hge%t
zE)DYWTaz!5uq^cG_eA}$yKFw;Q2Vv(k4i=pjn#6xGRbZyLXBt$RgG>p7$-YS>z36?
zemTi7q2czp7!6M`R4*_TiogdohgU4n
zQ(VaXo~G~0ocl(6wHe`l!n_=G!aYgqX-a4Rn3j|RHjyJK(R2>KvCVe6PEn01TKx5r
zyGR~_ZCj;`!gs-gSc()LL$6Q$1EwLxV_|@S=6rl%df&6l1&LQ~sy98}HT{Cx-T{#P
z^A(^NDV-$G-6X%#Kxac$Xm>ee
zwPU_e2S#7RJ4x=h;DZeTQdvG!q^I7t{-vDvSjVtFRwS5YFN^RLCbwNwh
zZ!tY(9BvQ~aNEPJC}qVHYk60&O24m?U`jp*!hhr_N_-|;eCMWUe)g&SW?UKl>}{%s
ziy;HEM2I+wCJWT=+`~gjT&g#a*k@E?HIkP0cd1T}P4z!#tUu?f#MioSL@3bP0nz*i
z5;IC9dBu&|nvLw@mtJuqK`-wWw1@5NtI^R?#8$nD^Sl%M!>(vn8+m0`gd1vg&&cc^
zK{K~~P)U354^KZ~aDV=tw=_~3`Y2U?ulVbby}kwIp27g11PIy6t`2k!6s88W$8!@z=PR99@!RMO7br5b6NG;Zj{t8z=m~bSq`*uOJ3j#}|nrMM=
zG@0KlJgB~RZabOsJcWp+4ow>Sr>!o=(b_onljPpj^mMw0`cGaSc6&tqO|;=6PCfxT
zmxDC5w{jR*u3AIxn?E}4{X~bODI!xma|=tt0G6u%9>nOd|8PLr!@N))-oo}by?sy!
zoG!c^)j@@dFcW|Nt^inNxdAhzu%Q>1-KcC&3owZm536x`0y5j5F+r~kJB+>`O*;jq@oXJeix@R
zFGEx$>P3{t&Gq#8rAau_ge=e1eFMgl%S)#2%-!|87^B3RC(5aTP}}T*UR>F6&W->h7uv5GgdZ2>RJ`d}14&iQ
zY!F5+PR|Cie{5M#ij~VS<5H~FyC-=mmtBRXN%vYM)2RzpzQRuRe|y4|CYFgetNY)R4rZlnfP#Hx-{MmK%(LP-goS+{JR0xk=l;Ms@gU3sUQa8#G+1R+KLeNrAG{!
zl$%6L5-p9^{aTEGg;>^@6A|+WJ+ZhXwma8Xa}KiS*(+}D!=Pvock?n4P2uV!_S~=?z3Th0q2~Ibf;wJ2`MrdcgB$`AO%_Z7(}N
z>J^^hN`@JPqw?HXQ8xK#U?4$f*tN7tWZvhaXaXIncj`2g6
zOA02NL$f9(gsOfEi2}gj`YKreVT3&Fg*A1K%x7MM6$0)vDX^Vg?
zpuLj?O+!+s=2sj(7BJkiTFfM7m$U;OdwY7->8wl)`s)vic6EX=lH;fBEFF&@7o?t$(*L^oJIhY~TL8b3^#
zB;Z^+u}_>SaXE1<;^GyqP32%flc;spqbx2FZXz*!y!tk8*b8#gn
zl}1+W^nIew@otnu_MaBer;Ele9e#WG^%%RI{f%P6Vv6?g^t~^ctX`}OK40_Pb#q)f
z_ogiK3JM9nzLPKWJ7rC8A;6Jed~8E4hb10-4kzmP1oU`64;jvG-nc`Cf8xK79Den4
zb_c=j=|2I$-WluXU$^#Oy__9Lar??osA8Y}FE4*@FTWa}ZSlC7^(O+cixJlN=LGw!
z>Dji2n*n~piS!>6!LNpA)f$(*KM_avuRZct2WJ%oC+a^zO>x%2UlRYT`PsU{$;?kQ
qV=4H5kN!(^eziWE82^0wPn7>!i7+StOC=s2DfUvpYM%Wc_xvA{ir)|b
literal 0
HcmV?d00001
diff --git a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
index bb88807a..f990a4f3 100644
--- a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
+++ b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php
@@ -17,11 +17,10 @@ use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
/**
* @requires extension fileinfo
+ * @group legacy
*/
class MimeTypeTest extends TestCase
{
- protected $path;
-
public function testGuessImageWithoutExtension()
{
$this->assertEquals('image/gif', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test'));
@@ -29,7 +28,7 @@ class MimeTypeTest extends TestCase
public function testGuessImageWithDirectory()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory');
}
@@ -53,7 +52,7 @@ class MimeTypeTest extends TestCase
public function testGuessWithIncorrectPath()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here');
}
@@ -72,7 +71,7 @@ class MimeTypeTest extends TestCase
@chmod($path, 0333);
if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) {
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
MimeTypeGuesser::getInstance()->guess($path);
} else {
$this->markTestSkipped('Can not verify chmod operations, change of file permissions failed');
diff --git a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
index 6a0b550d..8518df26 100644
--- a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
+++ b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php
@@ -33,7 +33,7 @@ class UploadedFileTest extends TestCase
public function testConstructWhenFileNotExists()
{
- $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
+ $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
new UploadedFile(
__DIR__.'/Fixtures/not_here',
@@ -94,6 +94,18 @@ class UploadedFileTest extends TestCase
$this->assertEquals('jpeg', $file->guessClientExtension());
}
+ public function testCaseSensitiveMimeType()
+ {
+ $file = new UploadedFile(
+ __DIR__.'/Fixtures/case-sensitive-mime-type.xlsm',
+ 'test.xlsm',
+ 'application/vnd.ms-excel.sheet.macroEnabled.12',
+ null
+ );
+
+ $this->assertEquals('xlsm', $file->guessClientExtension());
+ }
+
public function testErrorIsOkByDefault()
{
$file = new UploadedFile(
@@ -147,13 +159,13 @@ class UploadedFileTest extends TestCase
public function failedUploadedFile()
{
- foreach (array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_EXTENSION, -1) as $error) {
- yield array(new UploadedFile(
+ foreach ([UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_EXTENSION, -1] as $error) {
+ yield [new UploadedFile(
__DIR__.'/Fixtures/test.gif',
'original.gif',
'image/gif',
$error
- ));
+ )];
}
}
@@ -323,13 +335,13 @@ class UploadedFileTest extends TestCase
public function uploadedFileErrorProvider()
{
- return array(
- array(UPLOAD_ERR_INI_SIZE),
- array(UPLOAD_ERR_FORM_SIZE),
- array(UPLOAD_ERR_PARTIAL),
- array(UPLOAD_ERR_NO_TMP_DIR),
- array(UPLOAD_ERR_EXTENSION),
- );
+ return [
+ [UPLOAD_ERR_INI_SIZE],
+ [UPLOAD_ERR_FORM_SIZE],
+ [UPLOAD_ERR_PARTIAL],
+ [UPLOAD_ERR_NO_TMP_DIR],
+ [UPLOAD_ERR_EXTENSION],
+ ];
}
public function testIsInvalidIfNotHttpUpload()
diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php
index 06136e20..5eaf64f8 100644
--- a/vendor/symfony/http-foundation/Tests/FileBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php
@@ -28,7 +28,7 @@ class FileBagTest extends TestCase
*/
public function testFileMustBeAnArrayOrUploadedFile()
{
- new FileBag(array('file' => 'foo'));
+ new FileBag(['file' => 'foo']);
}
public function testShouldConvertsUploadedFiles()
@@ -36,54 +36,54 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array('file' => array(
+ $bag = new FileBag(['file' => [
'name' => basename($tmpFile),
'type' => 'text/plain',
'tmp_name' => $tmpFile,
'error' => 0,
'size' => null,
- )));
+ ]]);
$this->assertEquals($file, $bag->get('file'));
}
public function testShouldSetEmptyUploadedFilesToNull()
{
- $bag = new FileBag(array('file' => array(
+ $bag = new FileBag(['file' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => UPLOAD_ERR_NO_FILE,
'size' => 0,
- )));
+ ]]);
$this->assertNull($bag->get('file'));
}
public function testShouldRemoveEmptyUploadedFilesForMultiUpload()
{
- $bag = new FileBag(array('files' => array(
- 'name' => array(''),
- 'type' => array(''),
- 'tmp_name' => array(''),
- 'error' => array(UPLOAD_ERR_NO_FILE),
- 'size' => array(0),
- )));
+ $bag = new FileBag(['files' => [
+ 'name' => [''],
+ 'type' => [''],
+ 'tmp_name' => [''],
+ 'error' => [UPLOAD_ERR_NO_FILE],
+ 'size' => [0],
+ ]]);
- $this->assertSame(array(), $bag->get('files'));
+ $this->assertSame([], $bag->get('files'));
}
public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray()
{
- $bag = new FileBag(array('files' => array(
- 'name' => array('file1' => ''),
- 'type' => array('file1' => ''),
- 'tmp_name' => array('file1' => ''),
- 'error' => array('file1' => UPLOAD_ERR_NO_FILE),
- 'size' => array('file1' => 0),
- )));
+ $bag = new FileBag(['files' => [
+ 'name' => ['file1' => ''],
+ 'type' => ['file1' => ''],
+ 'tmp_name' => ['file1' => ''],
+ 'error' => ['file1' => UPLOAD_ERR_NO_FILE],
+ 'size' => ['file1' => 0],
+ ]]);
- $this->assertSame(array('file1' => null), $bag->get('files'));
+ $this->assertSame(['file1' => null], $bag->get('files'));
}
public function testShouldConvertUploadedFilesWithPhpBug()
@@ -91,25 +91,25 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
+ $bag = new FileBag([
+ 'child' => [
+ 'name' => [
'file' => basename($tmpFile),
- ),
- 'type' => array(
+ ],
+ 'type' => [
'file' => 'text/plain',
- ),
- 'tmp_name' => array(
+ ],
+ 'tmp_name' => [
'file' => $tmpFile,
- ),
- 'error' => array(
+ ],
+ 'error' => [
'file' => 0,
- ),
- 'size' => array(
+ ],
+ 'size' => [
'file' => null,
- ),
- ),
- ));
+ ],
+ ],
+ ]);
$files = $bag->all();
$this->assertEquals($file, $files['child']['file']);
@@ -120,25 +120,25 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'sub' => array('file' => basename($tmpFile)),
- ),
- 'type' => array(
- 'sub' => array('file' => 'text/plain'),
- ),
- 'tmp_name' => array(
- 'sub' => array('file' => $tmpFile),
- ),
- 'error' => array(
- 'sub' => array('file' => 0),
- ),
- 'size' => array(
- 'sub' => array('file' => null),
- ),
- ),
- ));
+ $bag = new FileBag([
+ 'child' => [
+ 'name' => [
+ 'sub' => ['file' => basename($tmpFile)],
+ ],
+ 'type' => [
+ 'sub' => ['file' => 'text/plain'],
+ ],
+ 'tmp_name' => [
+ 'sub' => ['file' => $tmpFile],
+ ],
+ 'error' => [
+ 'sub' => ['file' => 0],
+ ],
+ 'size' => [
+ 'sub' => ['file' => null],
+ ],
+ ],
+ ]);
$files = $bag->all();
$this->assertEquals($file, $files['child']['sub']['file']);
@@ -148,7 +148,7 @@ class FileBagTest extends TestCase
{
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array('image' => array('file' => $file)));
+ $bag = new FileBag(['image' => ['file' => $file]]);
$files = $bag->all();
$this->assertEquals($file, $files['image']['file']);
diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
index c5a437f9..6c4915f2 100644
--- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php
@@ -18,7 +18,7 @@ class HeaderBagTest extends TestCase
{
public function testConstructor()
{
- $bag = new HeaderBag(array('foo' => 'bar'));
+ $bag = new HeaderBag(['foo' => 'bar']);
$this->assertTrue($bag->has('foo'));
}
@@ -30,20 +30,20 @@ class HeaderBagTest extends TestCase
public function testToStringNotNull()
{
- $bag = new HeaderBag(array('foo' => 'bar'));
+ $bag = new HeaderBag(['foo' => 'bar']);
$this->assertEquals("Foo: bar\r\n", $bag->__toString());
}
public function testKeys()
{
- $bag = new HeaderBag(array('foo' => 'bar'));
+ $bag = new HeaderBag(['foo' => 'bar']);
$keys = $bag->keys();
$this->assertEquals('foo', $keys[0]);
}
public function testGetDate()
{
- $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200'));
+ $bag = new HeaderBag(['foo' => 'Tue, 4 Sep 2012 20:00:00 +0200']);
$headerDate = $bag->getDate('foo');
$this->assertInstanceOf('DateTime', $headerDate);
}
@@ -53,7 +53,7 @@ class HeaderBagTest extends TestCase
*/
public function testGetDateException()
{
- $bag = new HeaderBag(array('foo' => 'Tue'));
+ $bag = new HeaderBag(['foo' => 'Tue']);
$headerDate = $bag->getDate('foo');
}
@@ -67,50 +67,50 @@ class HeaderBagTest extends TestCase
public function testAll()
{
- $bag = new HeaderBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input');
+ $bag = new HeaderBag(['foo' => 'bar']);
+ $this->assertEquals(['foo' => ['bar']], $bag->all(), '->all() gets all the input');
- $bag = new HeaderBag(array('FOO' => 'BAR'));
- $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case');
+ $bag = new HeaderBag(['FOO' => 'BAR']);
+ $this->assertEquals(['foo' => ['BAR']], $bag->all(), '->all() gets all the input key are lower case');
}
public function testReplace()
{
- $bag = new HeaderBag(array('foo' => 'bar'));
+ $bag = new HeaderBag(['foo' => 'bar']);
- $bag->replace(array('NOPE' => 'BAR'));
- $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument');
+ $bag->replace(['NOPE' => 'BAR']);
+ $this->assertEquals(['nope' => ['BAR']], $bag->all(), '->replace() replaces the input with the argument');
$this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
}
public function testGet()
{
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
+ $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']);
$this->assertEquals('bar', $bag->get('foo'), '->get return current value');
$this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive');
- $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array');
+ $this->assertEquals(['bar'], $bag->get('foo', 'nope', false), '->get return the value as array');
// defaults
$this->assertNull($bag->get('none'), '->get unknown values returns null');
$this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default');
- $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array');
+ $this->assertEquals(['default'], $bag->get('none', 'default', false), '->get unknown values returns default as array');
$bag->set('foo', 'bor', false);
$this->assertEquals('bar', $bag->get('foo'), '->get return first value');
- $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array');
+ $this->assertEquals(['bar', 'bor'], $bag->get('foo', 'nope', false), '->get return all values as array');
}
public function testSetAssociativeArray()
{
$bag = new HeaderBag();
- $bag->set('foo', array('bad-assoc-index' => 'value'));
+ $bag->set('foo', ['bad-assoc-index' => 'value']);
$this->assertSame('value', $bag->get('foo'));
- $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored');
+ $this->assertEquals(['value'], $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored');
}
public function testContains()
{
- $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz'));
+ $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']);
$this->assertTrue($bag->contains('foo', 'bar'), '->contains first value');
$this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value');
$this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value');
@@ -143,7 +143,7 @@ class HeaderBagTest extends TestCase
public function testCacheControlDirectiveParsing()
{
- $bag = new HeaderBag(array('cache-control' => 'public, max-age=10'));
+ $bag = new HeaderBag(['cache-control' => 'public, max-age=10']);
$this->assertTrue($bag->hasCacheControlDirective('public'));
$this->assertTrue($bag->getCacheControlDirective('public'));
@@ -156,15 +156,15 @@ class HeaderBagTest extends TestCase
public function testCacheControlDirectiveParsingQuotedZero()
{
- $bag = new HeaderBag(array('cache-control' => 'max-age="0"'));
+ $bag = new HeaderBag(['cache-control' => 'max-age="0"']);
$this->assertTrue($bag->hasCacheControlDirective('max-age'));
$this->assertEquals(0, $bag->getCacheControlDirective('max-age'));
}
public function testCacheControlDirectiveOverrideWithReplace()
{
- $bag = new HeaderBag(array('cache-control' => 'private, max-age=100'));
- $bag->replace(array('cache-control' => 'public, max-age=10'));
+ $bag = new HeaderBag(['cache-control' => 'private, max-age=100']);
+ $bag->replace(['cache-control' => 'public, max-age=10']);
$this->assertTrue($bag->hasCacheControlDirective('public'));
$this->assertTrue($bag->getCacheControlDirective('public'));
@@ -174,7 +174,7 @@ class HeaderBagTest extends TestCase
public function testCacheControlClone()
{
- $headers = array('foo' => 'bar');
+ $headers = ['foo' => 'bar'];
$bag1 = new HeaderBag($headers);
$bag2 = new HeaderBag($bag1->all());
@@ -183,13 +183,13 @@ class HeaderBagTest extends TestCase
public function testGetIterator()
{
- $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm');
+ $headers = ['foo' => 'bar', 'hello' => 'world', 'third' => 'charm'];
$headerBag = new HeaderBag($headers);
$i = 0;
foreach ($headerBag as $key => $val) {
++$i;
- $this->assertEquals(array($headers[$key]), $val);
+ $this->assertEquals([$headers[$key]], $val);
}
$this->assertEquals(\count($headers), $i);
@@ -197,7 +197,7 @@ class HeaderBagTest extends TestCase
public function testCount()
{
- $headers = array('foo' => 'bar', 'HELLO' => 'WORLD');
+ $headers = ['foo' => 'bar', 'HELLO' => 'WORLD'];
$headerBag = new HeaderBag($headers);
$this->assertCount(\count($headers), $headerBag);
diff --git a/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php b/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php
index 15efdf92..2f82dc4e 100644
--- a/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php
+++ b/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php
@@ -18,48 +18,48 @@ class HeaderUtilsTest extends TestCase
{
public function testSplit()
{
- $this->assertSame(array('foo=123', 'bar'), HeaderUtils::split('foo=123,bar', ','));
- $this->assertSame(array('foo=123', 'bar'), HeaderUtils::split('foo=123, bar', ','));
- $this->assertSame(array(array('foo=123', 'bar')), HeaderUtils::split('foo=123; bar', ',;'));
- $this->assertSame(array(array('foo=123'), array('bar')), HeaderUtils::split('foo=123, bar', ',;'));
- $this->assertSame(array('foo', '123, bar'), HeaderUtils::split('foo=123, bar', '='));
- $this->assertSame(array('foo', '123, bar'), HeaderUtils::split(' foo = 123, bar ', '='));
- $this->assertSame(array(array('foo', '123'), array('bar')), HeaderUtils::split('foo=123, bar', ',='));
- $this->assertSame(array(array(array('foo', '123')), array(array('bar'), array('foo', '456'))), HeaderUtils::split('foo=123, bar; foo=456', ',;='));
- $this->assertSame(array(array(array('foo', 'a,b;c=d'))), HeaderUtils::split('foo="a,b;c=d"', ',;='));
+ $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123,bar', ','));
+ $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123, bar', ','));
+ $this->assertSame([['foo=123', 'bar']], HeaderUtils::split('foo=123; bar', ',;'));
+ $this->assertSame([['foo=123'], ['bar']], HeaderUtils::split('foo=123, bar', ',;'));
+ $this->assertSame(['foo', '123, bar'], HeaderUtils::split('foo=123, bar', '='));
+ $this->assertSame(['foo', '123, bar'], HeaderUtils::split(' foo = 123, bar ', '='));
+ $this->assertSame([['foo', '123'], ['bar']], HeaderUtils::split('foo=123, bar', ',='));
+ $this->assertSame([[['foo', '123']], [['bar'], ['foo', '456']]], HeaderUtils::split('foo=123, bar; foo=456', ',;='));
+ $this->assertSame([[['foo', 'a,b;c=d']]], HeaderUtils::split('foo="a,b;c=d"', ',;='));
- $this->assertSame(array('foo', 'bar'), HeaderUtils::split('foo,,,, bar', ','));
- $this->assertSame(array('foo', 'bar'), HeaderUtils::split(',foo, bar,', ','));
- $this->assertSame(array('foo', 'bar'), HeaderUtils::split(' , foo, bar, ', ','));
- $this->assertSame(array('foo bar'), HeaderUtils::split('foo "bar"', ','));
- $this->assertSame(array('foo bar'), HeaderUtils::split('"foo" bar', ','));
- $this->assertSame(array('foo bar'), HeaderUtils::split('"foo" "bar"', ','));
+ $this->assertSame(['foo', 'bar'], HeaderUtils::split('foo,,,, bar', ','));
+ $this->assertSame(['foo', 'bar'], HeaderUtils::split(',foo, bar,', ','));
+ $this->assertSame(['foo', 'bar'], HeaderUtils::split(' , foo, bar, ', ','));
+ $this->assertSame(['foo bar'], HeaderUtils::split('foo "bar"', ','));
+ $this->assertSame(['foo bar'], HeaderUtils::split('"foo" bar', ','));
+ $this->assertSame(['foo bar'], HeaderUtils::split('"foo" "bar"', ','));
// These are not a valid header values. We test that they parse anyway,
// and that both the valid and invalid parts are returned.
- $this->assertSame(array(), HeaderUtils::split('', ','));
- $this->assertSame(array(), HeaderUtils::split(',,,', ','));
- $this->assertSame(array('foo', 'bar', 'baz'), HeaderUtils::split('foo, "bar", "baz', ','));
- $this->assertSame(array('foo', 'bar, baz'), HeaderUtils::split('foo, "bar, baz', ','));
- $this->assertSame(array('foo', 'bar, baz\\'), HeaderUtils::split('foo, "bar, baz\\', ','));
- $this->assertSame(array('foo', 'bar, baz\\'), HeaderUtils::split('foo, "bar, baz\\\\', ','));
+ $this->assertSame([], HeaderUtils::split('', ','));
+ $this->assertSame([], HeaderUtils::split(',,,', ','));
+ $this->assertSame(['foo', 'bar', 'baz'], HeaderUtils::split('foo, "bar", "baz', ','));
+ $this->assertSame(['foo', 'bar, baz'], HeaderUtils::split('foo, "bar, baz', ','));
+ $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\', ','));
+ $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\\\', ','));
}
public function testCombine()
{
- $this->assertSame(array('foo' => '123'), HeaderUtils::combine(array(array('foo', '123'))));
- $this->assertSame(array('foo' => true), HeaderUtils::combine(array(array('foo'))));
- $this->assertSame(array('foo' => true), HeaderUtils::combine(array(array('Foo'))));
- $this->assertSame(array('foo' => '123', 'bar' => true), HeaderUtils::combine(array(array('foo', '123'), array('bar'))));
+ $this->assertSame(['foo' => '123'], HeaderUtils::combine([['foo', '123']]));
+ $this->assertSame(['foo' => true], HeaderUtils::combine([['foo']]));
+ $this->assertSame(['foo' => true], HeaderUtils::combine([['Foo']]));
+ $this->assertSame(['foo' => '123', 'bar' => true], HeaderUtils::combine([['foo', '123'], ['bar']]));
}
public function testToString()
{
- $this->assertSame('foo', HeaderUtils::toString(array('foo' => true), ','));
- $this->assertSame('foo; bar', HeaderUtils::toString(array('foo' => true, 'bar' => true), ';'));
- $this->assertSame('foo=123', HeaderUtils::toString(array('foo' => '123'), ','));
- $this->assertSame('foo="1 2 3"', HeaderUtils::toString(array('foo' => '1 2 3'), ','));
- $this->assertSame('foo="1 2 3", bar', HeaderUtils::toString(array('foo' => '1 2 3', 'bar' => true), ','));
+ $this->assertSame('foo', HeaderUtils::toString(['foo' => true], ','));
+ $this->assertSame('foo; bar', HeaderUtils::toString(['foo' => true, 'bar' => true], ';'));
+ $this->assertSame('foo=123', HeaderUtils::toString(['foo' => '123'], ','));
+ $this->assertSame('foo="1 2 3"', HeaderUtils::toString(['foo' => '1 2 3'], ','));
+ $this->assertSame('foo="1 2 3", bar', HeaderUtils::toString(['foo' => '1 2 3', 'bar' => true], ','));
}
public function testQuote()
@@ -101,14 +101,14 @@ class HeaderUtilsTest extends TestCase
public function provideMakeDisposition()
{
- return array(
- array('attachment', 'foo.html', 'foo.html', 'attachment; filename=foo.html'),
- array('attachment', 'foo.html', '', 'attachment; filename=foo.html'),
- array('attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'),
- array('attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'),
- array('attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'),
- array('attachment', 'föö.html', 'foo.html', 'attachment; filename=foo.html; filename*=utf-8\'\'f%C3%B6%C3%B6.html'),
- );
+ return [
+ ['attachment', 'foo.html', 'foo.html', 'attachment; filename=foo.html'],
+ ['attachment', 'foo.html', '', 'attachment; filename=foo.html'],
+ ['attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'],
+ ['attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'],
+ ['attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'],
+ ['attachment', 'föö.html', 'foo.html', 'attachment; filename=foo.html; filename*=utf-8\'\'f%C3%B6%C3%B6.html'],
+ ];
}
/**
@@ -122,13 +122,13 @@ class HeaderUtilsTest extends TestCase
public function provideMakeDispositionFail()
{
- return array(
- array('attachment', 'foo%20bar.html'),
- array('attachment', 'foo/bar.html'),
- array('attachment', '/foo.html'),
- array('attachment', 'foo\bar.html'),
- array('attachment', '\foo.html'),
- array('attachment', 'föö.html'),
- );
+ return [
+ ['attachment', 'foo%20bar.html'],
+ ['attachment', 'foo/bar.html'],
+ ['attachment', '/foo.html'],
+ ['attachment', 'foo\bar.html'],
+ ['attachment', '\foo.html'],
+ ['attachment', 'föö.html'],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
index 232a2040..c7f76b5d 100644
--- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
+++ b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php
@@ -26,20 +26,20 @@ class IpUtilsTest extends TestCase
public function getIpv4Data()
{
- return array(
- array(true, '192.168.1.1', '192.168.1.1'),
- array(true, '192.168.1.1', '192.168.1.1/1'),
- array(true, '192.168.1.1', '192.168.1.0/24'),
- array(false, '192.168.1.1', '1.2.3.4/1'),
- array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet
- array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')),
- array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')),
- array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')),
- array(true, '1.2.3.4', '0.0.0.0/0'),
- array(true, '1.2.3.4', '192.168.1.0/0'),
- array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation
- array(false, 'an_invalid_ip', '192.168.1.0/24'),
- );
+ return [
+ [true, '192.168.1.1', '192.168.1.1'],
+ [true, '192.168.1.1', '192.168.1.1/1'],
+ [true, '192.168.1.1', '192.168.1.0/24'],
+ [false, '192.168.1.1', '1.2.3.4/1'],
+ [false, '192.168.1.1', '192.168.1.1/33'], // invalid subnet
+ [true, '192.168.1.1', ['1.2.3.4/1', '192.168.1.0/24']],
+ [true, '192.168.1.1', ['192.168.1.0/24', '1.2.3.4/1']],
+ [false, '192.168.1.1', ['1.2.3.4/1', '4.3.2.1/1']],
+ [true, '1.2.3.4', '0.0.0.0/0'],
+ [true, '1.2.3.4', '192.168.1.0/0'],
+ [false, '1.2.3.4', '256.256.256/0'], // invalid CIDR notation
+ [false, 'an_invalid_ip', '192.168.1.0/24'],
+ ];
}
/**
@@ -56,20 +56,20 @@ class IpUtilsTest extends TestCase
public function getIpv6Data()
{
- return array(
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'),
- array(true, '0:0:0:0:0:0:0:1', '::1'),
- array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'),
- array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')),
- array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')),
- array(false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'),
- array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'),
- );
+ return [
+ [true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'],
+ [false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'],
+ [false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'],
+ [true, '0:0:0:0:0:0:0:1', '::1'],
+ [false, '0:0:603:0:396e:4789:8e99:0001', '::1'],
+ [true, '0:0:603:0:396e:4789:8e99:0001', '::/0'],
+ [true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'],
+ [true, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '2a01:198:603:0::/65']],
+ [true, '2a01:198:603:0:396e:4789:8e99:890f', ['2a01:198:603:0::/65', '::1']],
+ [false, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '1a01:198:603:0::/65']],
+ [false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'],
+ [false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'],
+ ];
}
/**
@@ -95,10 +95,10 @@ class IpUtilsTest extends TestCase
public function invalidIpAddressData()
{
- return array(
- 'invalid proxy wildcard' => array('192.168.20.13', '*'),
- 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'),
- 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'),
- );
+ return [
+ 'invalid proxy wildcard' => ['192.168.20.13', '*'],
+ 'invalid proxy missing netmask' => ['192.168.20.13', '0.0.0.0'],
+ 'invalid request IP with invalid proxy wildcard' => ['0.0.0.0', '*'],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
index 201839f8..261c9d3e 100644
--- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php
@@ -24,13 +24,13 @@ class JsonResponseTest extends TestCase
public function testConstructorWithArrayCreatesJsonArray()
{
- $response = new JsonResponse(array(0, 1, 2, 3));
+ $response = new JsonResponse([0, 1, 2, 3]);
$this->assertSame('[0,1,2,3]', $response->getContent());
}
public function testConstructorWithAssocArrayCreatesJsonObject()
{
- $response = new JsonResponse(array('foo' => 'bar'));
+ $response = new JsonResponse(['foo' => 'bar']);
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
@@ -43,7 +43,8 @@ class JsonResponseTest extends TestCase
$this->assertSame('0', $response->getContent());
$response = new JsonResponse(0.1);
- $this->assertSame('0.1', $response->getContent());
+ $this->assertEquals('0.1', $response->getContent());
+ $this->assertInternalType('string', $response->getContent());
$response = new JsonResponse(true);
$this->assertSame('true', $response->getContent());
@@ -51,7 +52,7 @@ class JsonResponseTest extends TestCase
public function testConstructorWithCustomStatus()
{
- $response = new JsonResponse(array(), 202);
+ $response = new JsonResponse([], 202);
$this->assertSame(202, $response->getStatusCode());
}
@@ -63,35 +64,35 @@ class JsonResponseTest extends TestCase
public function testConstructorWithCustomHeaders()
{
- $response = new JsonResponse(array(), 200, array('ETag' => 'foo'));
+ $response = new JsonResponse([], 200, ['ETag' => 'foo']);
$this->assertSame('application/json', $response->headers->get('Content-Type'));
$this->assertSame('foo', $response->headers->get('ETag'));
}
public function testConstructorWithCustomContentType()
{
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
+ $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json'];
- $response = new JsonResponse(array(), 200, $headers);
+ $response = new JsonResponse([], 200, $headers);
$this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
}
public function testSetJson()
{
- $response = new JsonResponse('1', 200, array(), true);
+ $response = new JsonResponse('1', 200, [], true);
$this->assertEquals('1', $response->getContent());
- $response = new JsonResponse('[1]', 200, array(), true);
+ $response = new JsonResponse('[1]', 200, [], true);
$this->assertEquals('[1]', $response->getContent());
- $response = new JsonResponse(null, 200, array());
+ $response = new JsonResponse(null, 200, []);
$response->setJson('true');
$this->assertEquals('true', $response->getContent());
}
public function testCreate()
{
- $response = JsonResponse::create(array('foo' => 'bar'), 204);
+ $response = JsonResponse::create(['foo' => 'bar'], 204);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertEquals('{"foo":"bar"}', $response->getContent());
@@ -107,14 +108,14 @@ class JsonResponseTest extends TestCase
public function testStaticCreateJsonArray()
{
- $response = JsonResponse::create(array(0, 1, 2, 3));
+ $response = JsonResponse::create([0, 1, 2, 3]);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertSame('[0,1,2,3]', $response->getContent());
}
public function testStaticCreateJsonObject()
{
- $response = JsonResponse::create(array('foo' => 'bar'));
+ $response = JsonResponse::create(['foo' => 'bar']);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
@@ -131,7 +132,8 @@ class JsonResponseTest extends TestCase
$response = JsonResponse::create(0.1);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
- $this->assertSame('0.1', $response->getContent());
+ $this->assertEquals('0.1', $response->getContent());
+ $this->assertInternalType('string', $response->getContent());
$response = JsonResponse::create(true);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
@@ -140,7 +142,7 @@ class JsonResponseTest extends TestCase
public function testStaticCreateWithCustomStatus()
{
- $response = JsonResponse::create(array(), 202);
+ $response = JsonResponse::create([], 202);
$this->assertSame(202, $response->getStatusCode());
}
@@ -152,22 +154,22 @@ class JsonResponseTest extends TestCase
public function testStaticCreateWithCustomHeaders()
{
- $response = JsonResponse::create(array(), 200, array('ETag' => 'foo'));
+ $response = JsonResponse::create([], 200, ['ETag' => 'foo']);
$this->assertSame('application/json', $response->headers->get('Content-Type'));
$this->assertSame('foo', $response->headers->get('ETag'));
}
public function testStaticCreateWithCustomContentType()
{
- $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
+ $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json'];
- $response = JsonResponse::create(array(), 200, $headers);
+ $response = JsonResponse::create([], 200, $headers);
$this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
}
public function testSetCallback()
{
- $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback');
+ $response = JsonResponse::create(['foo' => 'bar'])->setCallback('callback');
$this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent());
$this->assertEquals('text/javascript', $response->headers->get('Content-Type'));
@@ -190,7 +192,7 @@ class JsonResponseTest extends TestCase
public function testSetEncodingOptions()
{
$response = new JsonResponse();
- $response->setData(array(array(1, 2, 3)));
+ $response->setData([[1, 2, 3]]);
$this->assertEquals('[[1,2,3]]', $response->getContent());
@@ -239,7 +241,7 @@ class JsonResponseTest extends TestCase
public function testSetComplexCallback()
{
- $response = JsonResponse::create(array('foo' => 'bar'));
+ $response = JsonResponse::create(['foo' => 'bar']);
$response->setCallback('ಠ_ಠ["foo"].bar[0]');
$this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent());
diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
index dccfd4f3..d2a5c991 100644
--- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php
@@ -23,44 +23,44 @@ class ParameterBagTest extends TestCase
public function testAll()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input');
+ $bag = new ParameterBag(['foo' => 'bar']);
+ $this->assertEquals(['foo' => 'bar'], $bag->all(), '->all() gets all the input');
}
public function testKeys()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
- $this->assertEquals(array('foo'), $bag->keys());
+ $bag = new ParameterBag(['foo' => 'bar']);
+ $this->assertEquals(['foo'], $bag->keys());
}
public function testAdd()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
+ $bag = new ParameterBag(['foo' => 'bar']);
+ $bag->add(['bar' => 'bas']);
+ $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all());
}
public function testRemove()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
- $bag->add(array('bar' => 'bas'));
- $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all());
+ $bag = new ParameterBag(['foo' => 'bar']);
+ $bag->add(['bar' => 'bas']);
+ $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all());
$bag->remove('bar');
- $this->assertEquals(array('foo' => 'bar'), $bag->all());
+ $this->assertEquals(['foo' => 'bar'], $bag->all());
}
public function testReplace()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
+ $bag = new ParameterBag(['foo' => 'bar']);
- $bag->replace(array('FOO' => 'BAR'));
- $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument');
+ $bag->replace(['FOO' => 'BAR']);
+ $this->assertEquals(['FOO' => 'BAR'], $bag->all(), '->replace() replaces the input with the argument');
$this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
}
public function testGet()
{
- $bag = new ParameterBag(array('foo' => 'bar', 'null' => null));
+ $bag = new ParameterBag(['foo' => 'bar', 'null' => null]);
$this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter');
$this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined');
@@ -69,14 +69,14 @@ class ParameterBagTest extends TestCase
public function testGetDoesNotUseDeepByDefault()
{
- $bag = new ParameterBag(array('foo' => array('bar' => 'moo')));
+ $bag = new ParameterBag(['foo' => ['bar' => 'moo']]);
$this->assertNull($bag->get('foo[bar]'));
}
public function testSet()
{
- $bag = new ParameterBag(array());
+ $bag = new ParameterBag([]);
$bag->set('foo', 'bar');
$this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter');
@@ -87,7 +87,7 @@ class ParameterBagTest extends TestCase
public function testHas()
{
- $bag = new ParameterBag(array('foo' => 'bar'));
+ $bag = new ParameterBag(['foo' => 'bar']);
$this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined');
$this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined');
@@ -95,7 +95,7 @@ class ParameterBagTest extends TestCase
public function testGetAlpha()
{
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
+ $bag = new ParameterBag(['word' => 'foo_BAR_012']);
$this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters');
$this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined');
@@ -103,7 +103,7 @@ class ParameterBagTest extends TestCase
public function testGetAlnum()
{
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
+ $bag = new ParameterBag(['word' => 'foo_BAR_012']);
$this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters');
$this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined');
@@ -111,7 +111,7 @@ class ParameterBagTest extends TestCase
public function testGetDigits()
{
- $bag = new ParameterBag(array('word' => 'foo_BAR_012'));
+ $bag = new ParameterBag(['word' => 'foo_BAR_012']);
$this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string');
$this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined');
@@ -119,7 +119,7 @@ class ParameterBagTest extends TestCase
public function testGetInt()
{
- $bag = new ParameterBag(array('digits' => '0123'));
+ $bag = new ParameterBag(['digits' => '0123']);
$this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer');
$this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined');
@@ -127,14 +127,14 @@ class ParameterBagTest extends TestCase
public function testFilter()
{
- $bag = new ParameterBag(array(
+ $bag = new ParameterBag([
'digits' => '0123ab',
'email' => 'example@example.com',
'url' => 'http://example.com/foo',
'dec' => '256',
'hex' => '0x100',
- 'array' => array('bang'),
- ));
+ 'array' => ['bang'],
+ ]);
$this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found');
@@ -142,27 +142,27 @@ class ParameterBagTest extends TestCase
$this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
- $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
+ $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, ['flags' => FILTER_FLAG_PATH_REQUIRED]), '->filter() gets a value of parameter as URL with a path');
// This test is repeated for code-coverage
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
- $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array(
+ $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, [
'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
+ 'options' => ['min_range' => 1, 'max_range' => 0xff],
+ ]), '->filter() gets a value of parameter as integer between boundaries');
- $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array(
+ $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, [
'flags' => FILTER_FLAG_ALLOW_HEX,
- 'options' => array('min_range' => 1, 'max_range' => 0xff),
- )), '->filter() gets a value of parameter as integer between boundaries');
+ 'options' => ['min_range' => 1, 'max_range' => 0xff],
+ ]), '->filter() gets a value of parameter as integer between boundaries');
- $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array');
+ $this->assertEquals(['bang'], $bag->filter('array', ''), '->filter() gets a value of parameter as an array');
}
public function testGetIterator()
{
- $parameters = array('foo' => 'bar', 'hello' => 'world');
+ $parameters = ['foo' => 'bar', 'hello' => 'world'];
$bag = new ParameterBag($parameters);
$i = 0;
@@ -176,7 +176,7 @@ class ParameterBagTest extends TestCase
public function testCount()
{
- $parameters = array('foo' => 'bar', 'hello' => 'world');
+ $parameters = ['foo' => 'bar', 'hello' => 'world'];
$bag = new ParameterBag($parameters);
$this->assertCount(\count($parameters), $bag);
@@ -184,7 +184,7 @@ class ParameterBagTest extends TestCase
public function testGetBoolean()
{
- $parameters = array('string_true' => 'true', 'string_false' => 'false');
+ $parameters = ['string_true' => 'true', 'string_false' => 'false'];
$bag = new ParameterBag($parameters);
$this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true');
diff --git a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
index d389e83d..5f6a8ac0 100644
--- a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php
@@ -22,7 +22,7 @@ class RedirectResponseTest extends TestCase
$this->assertEquals(1, preg_match(
'##',
- preg_replace(array('/\s+/', '/\'/'), array(' ', '"'), $response->getContent())
+ preg_replace(['/\s+/', '/\'/'], [' ', '"'], $response->getContent())
));
}
@@ -87,7 +87,11 @@ class RedirectResponseTest extends TestCase
$response = new RedirectResponse('foo.bar', 301);
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
- $response = new RedirectResponse('foo.bar', 301, array('cache-control' => 'max-age=86400'));
+ $response = new RedirectResponse('foo.bar', 301, ['cache-control' => 'max-age=86400']);
+ $this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
+ $this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
+
+ $response = new RedirectResponse('foo.bar', 301, ['Cache-Control' => 'max-age=86400']);
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
diff --git a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php
index cc35ad63..57e9c3d3 100644
--- a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php
+++ b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php
@@ -34,20 +34,20 @@ class RequestMatcherTest extends TestCase
public function getMethodData()
{
- return array(
- array('get', 'get', true),
- array('get', array('get', 'post'), true),
- array('get', 'post', false),
- array('get', 'GET', true),
- array('get', array('GET', 'POST'), true),
- array('get', 'POST', false),
- );
+ return [
+ ['get', 'get', true],
+ ['get', ['get', 'post'], true],
+ ['get', 'post', false],
+ ['get', 'GET', true],
+ ['get', ['GET', 'POST'], true],
+ ['get', 'POST', false],
+ ];
}
public function testScheme()
{
$httpRequest = $request = $request = Request::create('');
- $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array('HTTPS' => 'on'));
+ $httpsRequest = $request = $request = Request::create('', 'get', [], [], [], ['HTTPS' => 'on']);
$matcher = new RequestMatcher();
$matcher->matchScheme('https');
@@ -69,7 +69,7 @@ class RequestMatcherTest extends TestCase
public function testHost($pattern, $isMatch)
{
$matcher = new RequestMatcher();
- $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => 'foo.example.com'));
+ $request = Request::create('', 'get', [], [], [], ['HTTP_HOST' => 'foo.example.com']);
$matcher->matchHost($pattern);
$this->assertSame($isMatch, $matcher->matches($request));
@@ -81,7 +81,7 @@ class RequestMatcherTest extends TestCase
public function testPort()
{
$matcher = new RequestMatcher();
- $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => null, 'SERVER_PORT' => 8000));
+ $request = Request::create('', 'get', [], [], [], ['HTTP_HOST' => null, 'SERVER_PORT' => 8000]);
$matcher->matchPort(8000);
$this->assertTrue($matcher->matches($request));
@@ -89,22 +89,22 @@ class RequestMatcherTest extends TestCase
$matcher->matchPort(9000);
$this->assertFalse($matcher->matches($request));
- $matcher = new RequestMatcher(null, null, null, null, array(), null, 8000);
+ $matcher = new RequestMatcher(null, null, null, null, [], null, 8000);
$this->assertTrue($matcher->matches($request));
}
public function getHostData()
{
- return array(
- array('.*\.example\.com', true),
- array('\.example\.com$', true),
- array('^.*\.example\.com$', true),
- array('.*\.sensio\.com', false),
- array('.*\.example\.COM', true),
- array('\.example\.COM$', true),
- array('^.*\.example\.COM$', true),
- array('.*\.sensio\.COM', false),
- );
+ return [
+ ['.*\.example\.com', true],
+ ['\.example\.com$', true],
+ ['^.*\.example\.com$', true],
+ ['.*\.sensio\.com', false],
+ ['.*\.example\.COM', true],
+ ['\.example\.COM$', true],
+ ['^.*\.example\.COM$', true],
+ ['.*\.sensio\.COM', false],
+ ];
}
public function testPath()
diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php
index 36a94913..ab0dcf68 100644
--- a/vendor/symfony/http-foundation/Tests/RequestTest.php
+++ b/vendor/symfony/http-foundation/Tests/RequestTest.php
@@ -21,24 +21,24 @@ class RequestTest extends TestCase
{
protected function tearDown()
{
- Request::setTrustedProxies(array(), -1);
- Request::setTrustedHosts(array());
+ Request::setTrustedProxies([], -1);
+ Request::setTrustedHosts([]);
}
public function testInitialize()
{
$request = new Request();
- $request->initialize(array('foo' => 'bar'));
+ $request->initialize(['foo' => 'bar']);
$this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument');
- $request->initialize(array(), array('foo' => 'bar'));
+ $request->initialize([], ['foo' => 'bar']);
$this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument');
- $request->initialize(array(), array(), array('foo' => 'bar'));
+ $request->initialize([], [], ['foo' => 'bar']);
$this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument');
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar'));
+ $request->initialize([], [], [], [], [], ['HTTP_FOO' => 'bar']);
$this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument');
}
@@ -101,7 +101,7 @@ class RequestTest extends TestCase
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertFalse($request->isSecure());
- $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz'));
+ $request = Request::create('http://test.com/foo', 'GET', ['bar' => 'baz']);
$this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('bar=baz', $request->getQueryString());
@@ -109,7 +109,7 @@ class RequestTest extends TestCase
$this->assertEquals('test.com', $request->getHttpHost());
$this->assertFalse($request->isSecure());
- $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz'));
+ $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']);
$this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
$this->assertEquals('bar=baz', $request->getQueryString());
@@ -166,7 +166,7 @@ class RequestTest extends TestCase
$this->assertTrue($request->isSecure());
$json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}';
- $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json);
+ $request = Request::create('http://example.com/jsonrpc', 'POST', [], [], [], [], $json);
$this->assertEquals($json, $request->getContent());
$this->assertFalse($request->isSecure());
@@ -216,16 +216,16 @@ class RequestTest extends TestCase
$request = Request::create('http://test.com/?foo');
$this->assertEquals('/?foo', $request->getRequestUri());
- $this->assertEquals(array('foo' => ''), $request->query->all());
+ $this->assertEquals(['foo' => ''], $request->query->all());
// assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory
- $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(),
- array(
+ $request = Request::create('http://test.com/apparthotel-1234', 'GET', [], [], [],
+ [
'DOCUMENT_ROOT' => '/var/www/www.test.com',
'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php',
'SCRIPT_NAME' => '/app/app.php',
'PHP_SELF' => '/app/app.php/apparthotel-1234',
- ));
+ ]);
$this->assertEquals('http://test.com/apparthotel-1234', $request->getUri());
$this->assertEquals('/apparthotel-1234', $request->getPathInfo());
$this->assertEquals('', $request->getQueryString());
@@ -258,7 +258,7 @@ class RequestTest extends TestCase
$this->assertEquals(8080, $request->getPort());
$this->assertFalse($request->isSecure());
- $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz'));
+ $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']);
$request->server->set('REQUEST_URI', 'http://test.com/foo?bar=foo');
$this->assertEquals('http://test.com/foo?bar=baz', $request->getUri());
$this->assertEquals('/foo', $request->getPathInfo());
@@ -289,13 +289,13 @@ class RequestTest extends TestCase
public function testGetRequestUri($serverRequestUri, $expected, $message)
{
$request = new Request();
- $request->server->add(array(
+ $request->server->add([
'REQUEST_URI' => $serverRequestUri,
// For having http://test.com
'SERVER_NAME' => 'test.com',
'SERVER_PORT' => 80,
- ));
+ ]);
$this->assertSame($expected, $request->getRequestUri(), $message);
$this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.');
@@ -304,21 +304,21 @@ class RequestTest extends TestCase
public function getRequestUriData()
{
$message = 'Do not modify the path.';
- yield array('/foo', '/foo', $message);
- yield array('//bar/foo', '//bar/foo', $message);
- yield array('///bar/foo', '///bar/foo', $message);
+ yield ['/foo', '/foo', $message];
+ yield ['//bar/foo', '//bar/foo', $message];
+ yield ['///bar/foo', '///bar/foo', $message];
$message = 'Handle when the scheme, host are on REQUEST_URI.';
- yield array('http://test.com/foo?bar=baz', '/foo?bar=baz', $message);
+ yield ['http://test.com/foo?bar=baz', '/foo?bar=baz', $message];
$message = 'Handle when the scheme, host and port are on REQUEST_URI.';
- yield array('http://test.com:80/foo', '/foo', $message);
- yield array('https://test.com:8080/foo', '/foo', $message);
- yield array('https://test.com:443/foo', '/foo', $message);
+ yield ['http://test.com:80/foo', '/foo', $message];
+ yield ['https://test.com:8080/foo', '/foo', $message];
+ yield ['https://test.com:443/foo', '/foo', $message];
$message = 'Fragment should not be included in the URI';
- yield array('http://test.com/foo#bar', '/foo', $message);
- yield array('/foo#bar', '/foo', $message);
+ yield ['http://test.com/foo#bar', '/foo', $message];
+ yield ['/foo#bar', '/foo', $message];
}
public function testGetRequestUriWithoutRequiredHeader()
@@ -335,7 +335,7 @@ class RequestTest extends TestCase
public function testCreateCheckPrecedence()
{
// server is used by default
- $request = Request::create('/', 'DELETE', array(), array(), array(), array(
+ $request = Request::create('/', 'DELETE', [], [], [], [
'HTTP_HOST' => 'example.com',
'HTTPS' => 'on',
'SERVER_PORT' => 443,
@@ -343,7 +343,7 @@ class RequestTest extends TestCase
'PHP_AUTH_PW' => 'pa$$',
'QUERY_STRING' => 'foo=bar',
'CONTENT_TYPE' => 'application/json',
- ));
+ ]);
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(443, $request->getPort());
$this->assertTrue($request->isSecure());
@@ -353,11 +353,11 @@ class RequestTest extends TestCase
$this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE'));
// URI has precedence over server
- $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', [], [], [], [
'HTTP_HOST' => 'example.com',
'HTTPS' => 'on',
'SERVER_PORT' => 443,
- ));
+ ]);
$this->assertEquals('example.net', $request->getHost());
$this->assertEquals(8080, $request->getPort());
$this->assertFalse($request->isSecure());
@@ -368,7 +368,7 @@ class RequestTest extends TestCase
public function testDuplicate()
{
- $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar'));
+ $request = new Request(['foo' => 'bar'], ['foo' => 'bar'], ['foo' => 'bar'], [], [], ['HTTP_FOO' => 'bar']);
$dup = $request->duplicate();
$this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters');
@@ -376,17 +376,17 @@ class RequestTest extends TestCase
$this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes');
$this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers');
- $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar'));
+ $dup = $request->duplicate(['foo' => 'foobar'], ['foo' => 'foobar'], ['foo' => 'foobar'], [], [], ['HTTP_FOO' => 'foobar']);
- $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided');
- $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided');
- $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided');
- $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided');
+ $this->assertEquals(['foo' => 'foobar'], $dup->query->all(), '->duplicate() overrides the query parameters if provided');
+ $this->assertEquals(['foo' => 'foobar'], $dup->request->all(), '->duplicate() overrides the request parameters if provided');
+ $this->assertEquals(['foo' => 'foobar'], $dup->attributes->all(), '->duplicate() overrides the attributes if provided');
+ $this->assertEquals(['foo' => ['foobar']], $dup->headers->all(), '->duplicate() overrides the HTTP header if provided');
}
public function testDuplicateWithFormat()
{
- $request = new Request(array(), array(), array('_format' => 'json'));
+ $request = new Request([], [], ['_format' => 'json']);
$dup = $request->duplicate();
$this->assertEquals('json', $dup->getRequestFormat());
@@ -421,7 +421,7 @@ class RequestTest extends TestCase
public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat()
{
return array_merge(
- array(array(null, array(null, 'unexistent-mime-type'))),
+ [[null, [null, 'unexistent-mime-type']]],
$this->getFormatToMimeTypeMapProvider()
);
}
@@ -456,7 +456,7 @@ class RequestTest extends TestCase
{
$request = new Request();
$this->assertNull($request->getMimeType('foo'));
- $this->assertEquals(array(), Request::getMimeTypes('foo'));
+ $this->assertEquals([], Request::getMimeTypes('foo'));
}
public function testGetFormatWithCustomMimeType()
@@ -468,21 +468,21 @@ class RequestTest extends TestCase
public function getFormatToMimeTypeMapProvider()
{
- return array(
- array('txt', array('text/plain')),
- array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')),
- array('css', array('text/css')),
- array('json', array('application/json', 'application/x-json')),
- array('jsonld', array('application/ld+json')),
- array('xml', array('text/xml', 'application/xml', 'application/x-xml')),
- array('rdf', array('application/rdf+xml')),
- array('atom', array('application/atom+xml')),
- );
+ return [
+ ['txt', ['text/plain']],
+ ['js', ['application/javascript', 'application/x-javascript', 'text/javascript']],
+ ['css', ['text/css']],
+ ['json', ['application/json', 'application/x-json']],
+ ['jsonld', ['application/ld+json']],
+ ['xml', ['text/xml', 'application/xml', 'application/x-xml']],
+ ['rdf', ['application/rdf+xml']],
+ ['atom', ['application/atom+xml']],
+ ];
}
public function testGetUri()
{
- $server = array();
+ $server = [];
// Standard Request on non default PORT
// http://host:8080/index.php/path/info?query=string
@@ -501,7 +501,7 @@ class RequestTest extends TestCase
$request = new Request();
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port');
@@ -510,7 +510,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port');
@@ -519,7 +519,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER');
@@ -527,7 +527,7 @@ class RequestTest extends TestCase
// RewriteCond %{REQUEST_FILENAME} !-f
// RewriteRule ^(.*)$ index.php [QSA,L]
// http://host:8080/path/info?query=string
- $server = array();
+ $server = [];
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@@ -541,7 +541,7 @@ class RequestTest extends TestCase
$server['PHP_SELF'] = '/index.php';
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite');
// Use std port number
@@ -550,7 +550,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port');
@@ -559,13 +559,13 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER');
// With encoded characters
- $server = array(
+ $server = [
'HTTP_HOST' => 'host:8080',
'SERVER_NAME' => 'servername',
'SERVER_PORT' => '8080',
@@ -575,9 +575,9 @@ class RequestTest extends TestCase
'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo',
'PHP_SELF' => '/ba se/index_dev.php/path/info',
'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php',
- );
+ ];
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals(
'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string',
@@ -587,11 +587,11 @@ class RequestTest extends TestCase
// with user info
$server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
$server['PHP_AUTH_PW'] = 'symfony';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri());
}
@@ -609,7 +609,7 @@ class RequestTest extends TestCase
$request = Request::create('https://test.com:90/foo?bar=baz');
$this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path'));
- $server = array();
+ $server = [];
// Standard Request on non default PORT
// http://host:8080/index.php/path/info?query=string
@@ -628,7 +628,7 @@ class RequestTest extends TestCase
$request = new Request();
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port');
@@ -637,7 +637,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port');
@@ -646,7 +646,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER');
@@ -654,7 +654,7 @@ class RequestTest extends TestCase
// RewriteCond %{REQUEST_FILENAME} !-f
// RewriteRule ^(.*)$ index.php [QSA,L]
// http://host:8080/path/info?query=string
- $server = array();
+ $server = [];
$server['HTTP_HOST'] = 'host:8080';
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '8080';
@@ -668,7 +668,7 @@ class RequestTest extends TestCase
$server['PHP_SELF'] = '/index.php';
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite');
// Use std port number
@@ -677,7 +677,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port');
@@ -686,7 +686,7 @@ class RequestTest extends TestCase
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '80';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER');
$this->assertEquals('servername', $request->getHttpHost());
@@ -694,11 +694,11 @@ class RequestTest extends TestCase
// with user info
$server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'));
$server['PHP_AUTH_PW'] = 'symfony';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'));
}
@@ -712,30 +712,30 @@ class RequestTest extends TestCase
public function getRelativeUriForPathData()
{
- return array(
- array('me.png', '/foo', '/me.png'),
- array('../me.png', '/foo/bar', '/me.png'),
- array('me.png', '/foo/bar', '/foo/me.png'),
- array('../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'),
- array('../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'),
- array('baz/me.png', '/foo/bar/b', 'baz/me.png'),
- );
+ return [
+ ['me.png', '/foo', '/me.png'],
+ ['../me.png', '/foo/bar', '/me.png'],
+ ['me.png', '/foo/bar', '/foo/me.png'],
+ ['../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'],
+ ['../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'],
+ ['baz/me.png', '/foo/bar/b', 'baz/me.png'],
+ ];
}
public function testGetUserInfo()
{
$request = new Request();
- $server = array('PHP_AUTH_USER' => 'fabien');
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $server = ['PHP_AUTH_USER' => 'fabien'];
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('fabien', $request->getUserInfo());
$server['PHP_AUTH_USER'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('0', $request->getUserInfo());
$server['PHP_AUTH_PW'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('0:0', $request->getUserInfo());
}
@@ -743,22 +743,22 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array();
+ $server = [];
$server['SERVER_NAME'] = 'servername';
$server['SERVER_PORT'] = '90';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
$server['PHP_AUTH_USER'] = 'fabien';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
$server['PHP_AUTH_USER'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
$server['PHP_AUTH_PW'] = '0';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost());
}
@@ -775,35 +775,35 @@ class RequestTest extends TestCase
public function getQueryStringNormalizationData()
{
- return array(
- array('foo', 'foo=', 'works with valueless parameters'),
- array('foo=', 'foo=', 'includes a dangling equal sign'),
- array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'),
- array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'),
+ return [
+ ['foo', 'foo=', 'works with valueless parameters'],
+ ['foo=', 'foo=', 'includes a dangling equal sign'],
+ ['bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'],
+ ['foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'],
// GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
// PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str.
- array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'),
+ ['baz=Foo%20Baz&bar=Foo+Bar', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes spaces in both encodings "%20" and "+"'],
- array('foo[]=1&foo[]=2', 'foo%5B0%5D=1&foo%5B1%5D=2', 'allows array notation'),
- array('foo=1&foo=2', 'foo=2', 'merges repeated parameters'),
- array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'),
- array('0', '0=', 'allows "0"'),
- array('Jane Doe&John%20Doe', 'Jane_Doe=&John_Doe=', 'normalizes encoding in keys'),
- array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'),
- array('foo=bar&&&test&&', 'foo=bar&test=', 'removes unneeded delimiters'),
- array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'),
+ ['foo[]=1&foo[]=2', 'foo%5B0%5D=1&foo%5B1%5D=2', 'allows array notation'],
+ ['foo=1&foo=2', 'foo=2', 'merges repeated parameters'],
+ ['pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'],
+ ['0', '0=', 'allows "0"'],
+ ['Foo Bar&Foo%20Baz', 'Foo_Bar=&Foo_Baz=', 'normalizes encoding in keys'],
+ ['bar=Foo Bar&baz=Foo%20Baz', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes encoding in values'],
+ ['foo=bar&&&test&&', 'foo=bar&test=', 'removes unneeded delimiters'],
+ ['formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'],
// Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
// PHP also does not include them when building _GET.
- array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'),
+ ['foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'],
// Don't reorder nested query string keys
- array('foo[]=Z&foo[]=A', 'foo%5B0%5D=Z&foo%5B1%5D=A', 'keeps order of values'),
- array('foo[Z]=B&foo[A]=B', 'foo%5BZ%5D=B&foo%5BA%5D=B', 'keeps order of keys'),
+ ['foo[]=Z&foo[]=A', 'foo%5B0%5D=Z&foo%5B1%5D=A', 'keeps order of values'],
+ ['foo[Z]=B&foo[A]=B', 'foo%5BZ%5D=B&foo%5BA%5D=B', 'keeps order of keys'],
- array('utf8=✓', 'utf8=%E2%9C%93', 'encodes UTF-8'),
- );
+ ['utf8=✓', 'utf8=%E2%9C%93', 'encodes UTF-8'],
+ ];
}
public function testGetQueryStringReturnsNull()
@@ -820,74 +820,74 @@ class RequestTest extends TestCase
{
$request = new Request();
- $request->initialize(array('foo' => 'bar'));
+ $request->initialize(['foo' => 'bar']);
$this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized');
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com'));
+ $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com']);
$this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header');
// Host header with port number
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080'));
+ $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com:8080']);
$this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number');
// Server values
- $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com'));
+ $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com']);
$this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name');
- $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com'));
+ $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com']);
$this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME ');
}
public function testGetPort()
{
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'https',
'HTTP_X_FORWARDED_PORT' => '443',
- ));
+ ]);
$port = $request->getPort();
$this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.');
- Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL);
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL);
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'https',
'HTTP_X_FORWARDED_PORT' => '8443',
- ));
+ ]);
$this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.');
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'https',
- ));
+ ]);
$this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.');
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'http',
- ));
+ ]);
$this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.');
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'On',
- ));
+ ]);
$this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.');
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => '1',
- ));
+ ]);
$this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.');
- $request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
+ $request = Request::create('http://example.com', 'GET', [], [], [], [
'HTTP_X_FORWARDED_PROTO' => 'something-else',
- ));
+ ]);
$port = $request->getPort();
$this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.');
}
@@ -898,7 +898,7 @@ class RequestTest extends TestCase
public function testGetHostWithFakeHttpHostValue()
{
$request = new Request();
- $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string'));
+ $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.host.com?query=string']);
$request->getHost();
}
@@ -958,7 +958,7 @@ class RequestTest extends TestCase
$request = new Request();
$request->setMethod('POST');
- $request->query->set('_method', array('delete', 'patch'));
+ $request->query->set('_method', ['delete', 'patch']);
$this->assertSame('POST', $request->getMethod(), '->getMethod() returns the request method if invalid type is defined in query');
}
@@ -995,69 +995,69 @@ class RequestTest extends TestCase
public function getClientIpsForwardedProvider()
{
// $expected $remoteAddr $httpForwarded $trustedProxies
- return array(
- array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null),
- array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')),
- array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')),
- array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')),
- array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for="[2620:0:1cfe:face:b00c::3]"', array('::1')),
- array(array('2001:db8:cafe::17'), '::1', 'for="[2001:db8:cafe::17]:4711', array('::1')),
- );
+ return [
+ [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', null],
+ [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', ['127.0.0.1']],
+ [['88.88.88.88'], '127.0.0.1', 'for="88.88.88.88:80"', ['127.0.0.1']],
+ [['192.0.2.60'], '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', ['::1']],
+ [['2620:0:1cfe:face:b00c::3', '192.0.2.43'], '::1', 'for=192.0.2.43, for="[2620:0:1cfe:face:b00c::3]"', ['::1']],
+ [['2001:db8:cafe::17'], '::1', 'for="[2001:db8:cafe::17]:4711', ['::1']],
+ ];
}
public function getClientIpsProvider()
{
// $expected $remoteAddr $httpForwardedFor $trustedProxies
- return array(
+ return [
// simple IPv4
- array(array('88.88.88.88'), '88.88.88.88', null, null),
+ [['88.88.88.88'], '88.88.88.88', null, null],
// trust the IPv4 remote addr
- array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')),
+ [['88.88.88.88'], '88.88.88.88', null, ['88.88.88.88']],
// simple IPv6
- array(array('::1'), '::1', null, null),
+ [['::1'], '::1', null, null],
// trust the IPv6 remote addr
- array(array('::1'), '::1', null, array('::1')),
+ [['::1'], '::1', null, ['::1']],
// forwarded for with remote IPv4 addr not trusted
- array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null),
+ [['127.0.0.1'], '127.0.0.1', '88.88.88.88', null],
// forwarded for with remote IPv4 addr trusted + comma
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88,', array('127.0.0.1')),
+ [['88.88.88.88'], '127.0.0.1', '88.88.88.88,', ['127.0.0.1']],
// forwarded for with remote IPv4 and all FF addrs trusted
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')),
+ [['88.88.88.88'], '127.0.0.1', '88.88.88.88', ['127.0.0.1', '88.88.88.88']],
// forwarded for with remote IPv4 range trusted
- array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')),
+ [['88.88.88.88'], '123.45.67.89', '88.88.88.88', ['123.45.67.0/24']],
// forwarded for with remote IPv6 addr not trusted
- array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null),
+ [['1620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null],
// forwarded for with remote IPv6 addr trusted
- array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')),
+ [['2620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']],
// forwarded for with remote IPv6 range trusted
- array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')),
+ [['88.88.88.88'], '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', ['2a01:198:603:0::/65']],
// multiple forwarded for with remote IPv4 addr trusted
- array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')),
+ [['88.88.88.88', '87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89']],
// multiple forwarded for with remote IPv4 addr and some reverse proxies trusted
- array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')),
+ [['87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '88.88.88.88']],
// multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle
- array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')),
+ [['88.88.88.88', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21']],
// multiple forwarded for with remote IPv4 addr and all reverse proxies trusted
- array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')),
+ [['127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1']],
// multiple forwarded for with remote IPv6 addr trusted
- array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')),
+ [['2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']],
// multiple forwarded for with remote IPv6 addr and some reverse proxies trusted
- array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')),
+ [['3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3']],
// multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle
- array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')),
+ [['2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3']],
// client IP with port
- array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')),
+ [['88.88.88.88'], '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', ['127.0.0.1']],
// invalid forwarded IP is ignored
- array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')),
- array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', array('127.0.0.1')),
- );
+ [['88.88.88.88'], '127.0.0.1', 'unknown,88.88.88.88', ['127.0.0.1']],
+ [['88.88.88.88'], '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', ['127.0.0.1']],
+ ];
}
/**
@@ -1068,15 +1068,15 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array(
+ $server = [
'REMOTE_ADDR' => '88.88.88.88',
'HTTP_FORWARDED' => $httpForwarded,
'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
+ ];
- Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED);
+ Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED);
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$request->getClientIps();
}
@@ -1088,15 +1088,15 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array(
+ $server = [
'REMOTE_ADDR' => '88.88.88.88',
'HTTP_FORWARDED' => $httpForwarded,
'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
+ ];
- Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR);
+ Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_FOR);
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps());
}
@@ -1104,13 +1104,13 @@ class RequestTest extends TestCase
public function getClientIpsWithConflictingHeadersProvider()
{
// $httpForwarded $httpXForwardedFor
- return array(
- array('for=87.65.43.21', '192.0.2.60'),
- array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'),
- array('for=192.0.2.60', '192.0.2.60,87.65.43.21'),
- array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'),
- array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'),
- );
+ return [
+ ['for=87.65.43.21', '192.0.2.60'],
+ ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60'],
+ ['for=192.0.2.60', '192.0.2.60,87.65.43.21'],
+ ['for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'],
+ ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'],
+ ];
}
/**
@@ -1120,15 +1120,15 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array(
+ $server = [
'REMOTE_ADDR' => '88.88.88.88',
'HTTP_FORWARDED' => $httpForwarded,
'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor,
- );
+ ];
- Request::setTrustedProxies(array('88.88.88.88'), -1);
+ Request::setTrustedProxies(['88.88.88.88'], -1);
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$clientIps = $request->getClientIps();
@@ -1138,14 +1138,14 @@ class RequestTest extends TestCase
public function getClientIpsWithAgreeingHeadersProvider()
{
// $httpForwarded $httpXForwardedFor
- return array(
- array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')),
- array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')),
- array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')),
- array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')),
- array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')),
- array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')),
- );
+ return [
+ ['for="192.0.2.60"', '192.0.2.60', ['192.0.2.60']],
+ ['for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', ['87.65.43.21', '192.0.2.60']],
+ ['for="[::face]", for=192.0.2.60', '::face,192.0.2.60', ['192.0.2.60', '::face']],
+ ['for="192.0.2.60:80"', '192.0.2.60', ['192.0.2.60']],
+ ['for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', ['192.0.2.60']],
+ ['for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', ['2001:db8:cafe::17']],
+ ];
}
public function testGetContentWorksTwiceInDefaultMode()
@@ -1166,7 +1166,7 @@ class RequestTest extends TestCase
public function testGetContentReturnsResourceWhenContentSetInConstructor()
{
- $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent');
+ $req = new Request([], [], [], [], [], [], 'MyContent');
$resource = $req->getContent(true);
$this->assertInternalType('resource', $resource);
@@ -1179,17 +1179,17 @@ class RequestTest extends TestCase
fwrite($resource, 'My other content');
rewind($resource);
- $req = new Request(array(), array(), array(), array(), array(), array(), $resource);
+ $req = new Request([], [], [], [], [], [], $resource);
$this->assertEquals('My other content', stream_get_contents($req->getContent(true)));
$this->assertEquals('My other content', $req->getContent());
}
public function getContentCantBeCalledTwiceWithResourcesProvider()
{
- return array(
- 'Resource then fetch' => array(true, false),
- 'Resource then resource' => array(true, true),
- );
+ return [
+ 'Resource then fetch' => [true, false],
+ 'Resource then resource' => [true, true],
+ ];
}
/**
@@ -1214,24 +1214,24 @@ class RequestTest extends TestCase
public function getContentCanBeCalledTwiceWithResourcesProvider()
{
- return array(
- 'Fetch then fetch' => array(false, false),
- 'Fetch then resource' => array(false, true),
- 'Resource then fetch' => array(true, false),
- 'Resource then resource' => array(true, true),
- );
+ return [
+ 'Fetch then fetch' => [false, false],
+ 'Fetch then resource' => [false, true],
+ 'Resource then fetch' => [true, false],
+ 'Resource then resource' => [true, true],
+ ];
}
public function provideOverloadedMethods()
{
- return array(
- array('PUT'),
- array('DELETE'),
- array('PATCH'),
- array('put'),
- array('delete'),
- array('patch'),
- );
+ return [
+ ['PUT'],
+ ['DELETE'],
+ ['PATCH'],
+ ['put'],
+ ['delete'],
+ ['patch'],
+ ];
}
/**
@@ -1244,14 +1244,14 @@ class RequestTest extends TestCase
$_GET['foo1'] = 'bar1';
$_POST['foo2'] = 'bar2';
$_COOKIE['foo3'] = 'bar3';
- $_FILES['foo4'] = array('bar4');
+ $_FILES['foo4'] = ['bar4'];
$_SERVER['foo5'] = 'bar5';
$request = Request::createFromGlobals();
$this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET');
$this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST');
$this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE');
- $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES');
+ $this->assertEquals(['bar4'], $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES');
$this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER');
unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']);
@@ -1281,25 +1281,25 @@ class RequestTest extends TestCase
public function testOverrideGlobals()
{
$request = new Request();
- $request->initialize(array('foo' => 'bar'));
+ $request->initialize(['foo' => 'bar']);
// as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it
$server = $_SERVER;
$request->overrideGlobals();
- $this->assertEquals(array('foo' => 'bar'), $_GET);
+ $this->assertEquals(['foo' => 'bar'], $_GET);
- $request->initialize(array(), array('foo' => 'bar'));
+ $request->initialize([], ['foo' => 'bar']);
$request->overrideGlobals();
- $this->assertEquals(array('foo' => 'bar'), $_POST);
+ $this->assertEquals(['foo' => 'bar'], $_POST);
$this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
$request->headers->set('X_FORWARDED_PROTO', 'https');
- Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL);
$this->assertFalse($request->isSecure());
$request->server->set('REMOTE_ADDR', '1.1.1.1');
$this->assertTrue($request->isSecure());
@@ -1316,12 +1316,12 @@ class RequestTest extends TestCase
$this->assertArrayHasKey('CONTENT_TYPE', $_SERVER);
$this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER);
- $request->initialize(array('foo' => 'bar', 'baz' => 'foo'));
+ $request->initialize(['foo' => 'bar', 'baz' => 'foo']);
$request->query->remove('baz');
$request->overrideGlobals();
- $this->assertEquals(array('foo' => 'bar'), $_GET);
+ $this->assertEquals(['foo' => 'bar'], $_GET);
$this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']);
$this->assertEquals('foo=bar', $request->server->get('QUERY_STRING'));
@@ -1334,23 +1334,23 @@ class RequestTest extends TestCase
$request = new Request();
$this->assertEquals('', $request->getScriptName());
- $server = array();
+ $server = [];
$server['SCRIPT_NAME'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/index.php', $request->getScriptName());
- $server = array();
+ $server = [];
$server['ORIG_SCRIPT_NAME'] = '/frontend.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/frontend.php', $request->getScriptName());
- $server = array();
+ $server = [];
$server['SCRIPT_NAME'] = '/index.php';
$server['ORIG_SCRIPT_NAME'] = '/frontend.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/index.php', $request->getScriptName());
}
@@ -1360,29 +1360,29 @@ class RequestTest extends TestCase
$request = new Request();
$this->assertEquals('', $request->getBasePath());
- $server = array();
+ $server = [];
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('', $request->getBasePath());
- $server = array();
+ $server = [];
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
$server['SCRIPT_NAME'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('', $request->getBasePath());
- $server = array();
+ $server = [];
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
$server['PHP_SELF'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('', $request->getBasePath());
- $server = array();
+ $server = [];
$server['SCRIPT_FILENAME'] = '/some/where/index.php';
$server['ORIG_SCRIPT_NAME'] = '/index.php';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('', $request->getBasePath());
}
@@ -1392,21 +1392,21 @@ class RequestTest extends TestCase
$request = new Request();
$this->assertEquals('/', $request->getPathInfo());
- $server = array();
+ $server = [];
$server['REQUEST_URI'] = '/path/info';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/path/info', $request->getPathInfo());
- $server = array();
+ $server = [];
$server['REQUEST_URI'] = '/path%20test/info';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/path%20test/info', $request->getPathInfo());
- $server = array();
+ $server = [];
$server['REQUEST_URI'] = '?a=b';
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
$this->assertEquals('/', $request->getPathInfo());
}
@@ -1434,27 +1434,27 @@ class RequestTest extends TestCase
{
$request = new Request();
$this->assertNull($request->getPreferredLanguage());
- $this->assertNull($request->getPreferredLanguage(array()));
- $this->assertEquals('fr', $request->getPreferredLanguage(array('fr')));
- $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en')));
- $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr')));
- $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr')));
+ $this->assertNull($request->getPreferredLanguage([]));
+ $this->assertEquals('fr', $request->getPreferredLanguage(['fr']));
+ $this->assertEquals('fr', $request->getPreferredLanguage(['fr', 'en']));
+ $this->assertEquals('en', $request->getPreferredLanguage(['en', 'fr']));
+ $this->assertEquals('fr-ch', $request->getPreferredLanguage(['fr-ch', 'fr-fr']));
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us')));
+ $this->assertEquals('en', $request->getPreferredLanguage(['en', 'en-us']));
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
+ $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en']));
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
+ $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en']));
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5');
- $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en')));
+ $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en']));
}
public function testIsXmlHttpRequest()
@@ -1492,72 +1492,72 @@ class RequestTest extends TestCase
public function testGetCharsets()
{
$request = new Request();
- $this->assertEquals(array(), $request->getCharsets());
+ $this->assertEquals([], $request->getCharsets());
$request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
- $this->assertEquals(array(), $request->getCharsets()); // testing caching
+ $this->assertEquals([], $request->getCharsets()); // testing caching
$request = new Request();
$request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
- $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets());
+ $this->assertEquals(['ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'], $request->getCharsets());
$request = new Request();
$request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
- $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets());
+ $this->assertEquals(['ISO-8859-1', 'utf-8', '*'], $request->getCharsets());
}
public function testGetEncodings()
{
$request = new Request();
- $this->assertEquals(array(), $request->getEncodings());
+ $this->assertEquals([], $request->getEncodings());
$request->headers->set('Accept-Encoding', 'gzip,deflate,sdch');
- $this->assertEquals(array(), $request->getEncodings()); // testing caching
+ $this->assertEquals([], $request->getEncodings()); // testing caching
$request = new Request();
$request->headers->set('Accept-Encoding', 'gzip,deflate,sdch');
- $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings());
+ $this->assertEquals(['gzip', 'deflate', 'sdch'], $request->getEncodings());
$request = new Request();
$request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7');
- $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings());
+ $this->assertEquals(['deflate', 'compress', 'gzip'], $request->getEncodings());
}
public function testGetAcceptableContentTypes()
{
$request = new Request();
- $this->assertEquals(array(), $request->getAcceptableContentTypes());
+ $this->assertEquals([], $request->getAcceptableContentTypes());
$request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
- $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching
+ $this->assertEquals([], $request->getAcceptableContentTypes()); // testing caching
$request = new Request();
$request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
- $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes());
+ $this->assertEquals(['application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'], $request->getAcceptableContentTypes());
}
public function testGetLanguages()
{
$request = new Request();
- $this->assertEquals(array(), $request->getLanguages());
+ $this->assertEquals([], $request->getLanguages());
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6');
- $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages());
- $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages());
+ $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
+ $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages());
$request = new Request();
$request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8');
- $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues
+ $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test out of order qvalues
$request = new Request();
$request->headers->set('Accept-language', 'zh, en, en-us');
- $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues
+ $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test equal weighting without qvalues
$request = new Request();
$request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6');
- $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues
+ $this->assertEquals(['en', 'zh', 'en_US'], $request->getLanguages()); // Test equal weighting with qvalues
$request = new Request();
$request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6');
- $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages());
+ $this->assertEquals(['zh', 'cherokee'], $request->getLanguages());
}
public function testGetRequestFormat()
@@ -1577,7 +1577,7 @@ class RequestTest extends TestCase
$this->assertNull($request->setRequestFormat('foo'));
$this->assertEquals('foo', $request->getRequestFormat(null));
- $request = new Request(array('_format' => 'foo'));
+ $request = new Request(['_format' => 'foo']);
$this->assertEquals('html', $request->getRequestFormat());
}
@@ -1663,7 +1663,7 @@ class RequestTest extends TestCase
*/
public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo)
{
- $request = Request::create($uri, 'GET', array(), array(), array(), $server);
+ $request = Request::create($uri, 'GET', [], [], [], $server);
$this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl');
$this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo');
@@ -1671,78 +1671,78 @@ class RequestTest extends TestCase
public function getBaseUrlData()
{
- return array(
- array(
+ return [
+ [
'/fruit/strawberry/1234index.php/blah',
- array(
+ [
'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php',
'SCRIPT_NAME' => '/fruit/index.php',
'PHP_SELF' => '/fruit/index.php',
- ),
+ ],
'/fruit',
'/strawberry/1234index.php/blah',
- ),
- array(
+ ],
+ [
'/fruit/strawberry/1234index.php/blah',
- array(
+ [
'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php',
'SCRIPT_NAME' => '/index.php',
'PHP_SELF' => '/index.php',
- ),
+ ],
'',
'/fruit/strawberry/1234index.php/blah',
- ),
- array(
+ ],
+ [
'/foo%20bar/',
- array(
+ [
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
'SCRIPT_NAME' => '/foo bar/app.php',
'PHP_SELF' => '/foo bar/app.php',
- ),
+ ],
'/foo%20bar',
'/',
- ),
- array(
+ ],
+ [
'/foo%20bar/home',
- array(
+ [
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
'SCRIPT_NAME' => '/foo bar/app.php',
'PHP_SELF' => '/foo bar/app.php',
- ),
+ ],
'/foo%20bar',
'/home',
- ),
- array(
+ ],
+ [
'/foo%20bar/app.php/home',
- array(
+ [
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
'SCRIPT_NAME' => '/foo bar/app.php',
'PHP_SELF' => '/foo bar/app.php',
- ),
+ ],
'/foo%20bar/app.php',
'/home',
- ),
- array(
+ ],
+ [
'/foo%20bar/app.php/home%3Dbaz',
- array(
+ [
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php',
'SCRIPT_NAME' => '/foo bar/app.php',
'PHP_SELF' => '/foo bar/app.php',
- ),
+ ],
'/foo%20bar/app.php',
'/home%3Dbaz',
- ),
- array(
+ ],
+ [
'/foo/bar+baz',
- array(
+ [
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php',
'SCRIPT_NAME' => '/foo/app.php',
'PHP_SELF' => '/foo/app.php',
- ),
+ ],
'/foo',
'/bar+baz',
- ),
- );
+ ],
+ ];
}
/**
@@ -1760,16 +1760,16 @@ class RequestTest extends TestCase
public function urlencodedStringPrefixData()
{
- return array(
- array('foo', 'foo', 'foo'),
- array('fo%6f', 'foo', 'fo%6f'),
- array('foo/bar', 'foo', 'foo'),
- array('fo%6f/bar', 'foo', 'fo%6f'),
- array('f%6f%6f/bar', 'foo', 'f%6f%6f'),
- array('%66%6F%6F/bar', 'foo', '%66%6F%6F'),
- array('fo+o/bar', 'fo+o', 'fo+o'),
- array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'),
- );
+ return [
+ ['foo', 'foo', 'foo'],
+ ['fo%6f', 'foo', 'fo%6f'],
+ ['foo/bar', 'foo', 'foo'],
+ ['fo%6f/bar', 'foo', 'fo%6f'],
+ ['f%6f%6f/bar', 'foo', 'f%6f%6f'],
+ ['%66%6F%6F/bar', 'foo', '%66%6F%6F'],
+ ['fo+o/bar', 'fo+o', 'fo+o'],
+ ['fo%2Bo/bar', 'fo+o', 'fo%2Bo'],
+ ];
}
private function disableHttpMethodParameterOverride()
@@ -1784,7 +1784,7 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array('REMOTE_ADDR' => $remoteAddr);
+ $server = ['REMOTE_ADDR' => $remoteAddr];
if (null !== $httpForwardedFor) {
$server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor;
}
@@ -1793,7 +1793,7 @@ class RequestTest extends TestCase
Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL);
}
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
return $request;
}
@@ -1802,7 +1802,7 @@ class RequestTest extends TestCase
{
$request = new Request();
- $server = array('REMOTE_ADDR' => $remoteAddr);
+ $server = ['REMOTE_ADDR' => $remoteAddr];
if (null !== $httpForwarded) {
$server['HTTP_FORWARDED'] = $httpForwarded;
@@ -1812,7 +1812,7 @@ class RequestTest extends TestCase
Request::setTrustedProxies($trustedProxies, Request::HEADER_FORWARDED);
}
- $request->initialize(array(), array(), array(), array(), array(), $server);
+ $request->initialize([], [], [], [], [], $server);
return $request;
}
@@ -1833,35 +1833,35 @@ class RequestTest extends TestCase
$this->assertFalse($request->isSecure());
// disabling proxy trusting
- Request::setTrustedProxies(array(), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies([], Request::HEADER_X_FORWARDED_ALL);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// request is forwarded by a non-trusted proxy
- Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_X_FORWARDED_ALL);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL);
$this->assertEquals('1.1.1.1', $request->getClientIp());
$this->assertEquals('foo.example.com', $request->getHost());
$this->assertEquals(443, $request->getPort());
$this->assertTrue($request->isSecure());
// trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// check various X_FORWARDED_PROTO header values
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL);
+ Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL);
$request->headers->set('X_FORWARDED_PROTO', 'ssl');
$this->assertTrue($request->isSecure());
@@ -1882,35 +1882,35 @@ class RequestTest extends TestCase
$this->assertFalse($request->isSecure());
// disabling proxy trusting
- Request::setTrustedProxies(array(), Request::HEADER_FORWARDED);
+ Request::setTrustedProxies([], Request::HEADER_FORWARDED);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// request is forwarded by a non-trusted proxy
- Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_FORWARDED);
+ Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_FORWARDED);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED);
+ Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED);
$this->assertEquals('1.1.1.1', $request->getClientIp());
$this->assertEquals('foo.example.com', $request->getHost());
$this->assertEquals(8080, $request->getPort());
$this->assertTrue($request->isSecure());
// trusted proxy via setTrustedProxies()
- Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_FORWARDED);
+ Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_FORWARDED);
$this->assertEquals('3.3.3.3', $request->getClientIp());
$this->assertEquals('example.com', $request->getHost());
$this->assertEquals(80, $request->getPort());
$this->assertFalse($request->isSecure());
// check various X_FORWARDED_PROTO header values
- Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED);
+ Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED);
$request->headers->set('FORWARDED', 'proto=ssl');
$this->assertTrue($request->isSecure());
@@ -1930,37 +1930,37 @@ class RequestTest extends TestCase
$this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct');
$subRequestUri = '/bar/foo';
- $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all());
+ $subRequest = Request::create($subRequestUri, 'get', [], [], [], $request->server->all());
$this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request');
}
public function iisRequestUriProvider()
{
- return array(
- array(
- array(),
- array(
+ return [
+ [
+ [],
+ [
'IIS_WasUrlRewritten' => '1',
'UNENCODED_URL' => '/foo/bar',
- ),
+ ],
'/foo/bar',
- ),
- array(
- array(),
- array(
+ ],
+ [
+ [],
+ [
'ORIG_PATH_INFO' => '/foo/bar',
- ),
+ ],
'/foo/bar',
- ),
- array(
- array(),
- array(
+ ],
+ [
+ [],
+ [
'ORIG_PATH_INFO' => '/foo/bar',
'QUERY_STRING' => 'foo=bar',
- ),
+ ],
'/foo/bar?foo=bar',
- ),
- );
+ ],
+ ];
}
public function testTrustedHosts()
@@ -1973,7 +1973,7 @@ class RequestTest extends TestCase
$this->assertEquals('evil.com', $request->getHost());
// add a trusted domain and all its subdomains
- Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$'));
+ Request::setTrustedHosts(['^([a-z]{9}\.)?trusted\.com$']);
// untrusted host
$request->headers->set('host', 'evil.com');
@@ -2005,7 +2005,7 @@ class RequestTest extends TestCase
public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters()
{
- Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost'));
+ Request::setTrustedHosts(['localhost(\.local){0,1}#,example.com', 'localhost']);
$request = Request::create('/');
$request->headers->set('host', 'localhost');
@@ -2014,7 +2014,7 @@ class RequestTest extends TestCase
public function testFactory()
{
- Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) {
+ Request::setFactory(function (array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) {
return new NewRequest();
});
@@ -2063,23 +2063,23 @@ class RequestTest extends TestCase
public function getHostValidities()
{
- return array(
- array('.a', false),
- array('a..', false),
- array('a.', true),
- array("\xE9", false),
- array('[::1]', true),
- array('[::1]:80', true, '[::1]', 80),
- array(str_repeat('.', 101), false),
- );
+ return [
+ ['.a', false],
+ ['a..', false],
+ ['a.', true],
+ ["\xE9", false],
+ ['[::1]', true],
+ ['[::1]:80', true, '[::1]', 80],
+ [str_repeat('.', 101), false],
+ ];
}
public function getLongHostNames()
{
- return array(
- array('a'.str_repeat('.a', 40000)),
- array(str_repeat(':', 101)),
- );
+ return [
+ ['a'.str_repeat('.a', 40000)],
+ [str_repeat(':', 101)],
+ ];
}
/**
@@ -2094,18 +2094,18 @@ class RequestTest extends TestCase
public function methodIdempotentProvider()
{
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', true),
- array('PATCH', false),
- array('DELETE', true),
- array('PURGE', true),
- array('OPTIONS', true),
- array('TRACE', true),
- array('CONNECT', false),
- );
+ return [
+ ['HEAD', true],
+ ['GET', true],
+ ['POST', false],
+ ['PUT', true],
+ ['PATCH', false],
+ ['DELETE', true],
+ ['PURGE', true],
+ ['OPTIONS', true],
+ ['TRACE', true],
+ ['CONNECT', false],
+ ];
}
/**
@@ -2120,18 +2120,18 @@ class RequestTest extends TestCase
public function methodSafeProvider()
{
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', false),
- array('PATCH', false),
- array('DELETE', false),
- array('PURGE', false),
- array('OPTIONS', true),
- array('TRACE', true),
- array('CONNECT', false),
- );
+ return [
+ ['HEAD', true],
+ ['GET', true],
+ ['POST', false],
+ ['PUT', false],
+ ['PATCH', false],
+ ['DELETE', false],
+ ['PURGE', false],
+ ['OPTIONS', true],
+ ['TRACE', true],
+ ['CONNECT', false],
+ ];
}
/**
@@ -2156,18 +2156,18 @@ class RequestTest extends TestCase
public function methodCacheableProvider()
{
- return array(
- array('HEAD', true),
- array('GET', true),
- array('POST', false),
- array('PUT', false),
- array('PATCH', false),
- array('DELETE', false),
- array('PURGE', false),
- array('OPTIONS', false),
- array('TRACE', false),
- array('CONNECT', false),
- );
+ return [
+ ['HEAD', true],
+ ['GET', true],
+ ['POST', false],
+ ['PUT', false],
+ ['PATCH', false],
+ ['DELETE', false],
+ ['PURGE', false],
+ ['OPTIONS', false],
+ ['TRACE', false],
+ ['CONNECT', false],
+ ];
}
/**
@@ -2176,7 +2176,7 @@ class RequestTest extends TestCase
public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expected)
{
if ($trustedProxy) {
- Request::setTrustedProxies(array('1.1.1.1'), -1);
+ Request::setTrustedProxies(['1.1.1.1'], -1);
}
$request = new Request();
@@ -2189,41 +2189,41 @@ class RequestTest extends TestCase
public function protocolVersionProvider()
{
- return array(
- 'untrusted without via' => array('HTTP/2.0', false, '', 'HTTP/2.0'),
- 'untrusted with via' => array('HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'),
- 'trusted without via' => array('HTTP/2.0', true, '', 'HTTP/2.0'),
- 'trusted with via' => array('HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'),
- 'trusted with via and protocol name' => array('HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'),
- 'trusted with broken via' => array('HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'),
- 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'),
- );
+ return [
+ 'untrusted without via' => ['HTTP/2.0', false, '', 'HTTP/2.0'],
+ 'untrusted with via' => ['HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'],
+ 'trusted without via' => ['HTTP/2.0', true, '', 'HTTP/2.0'],
+ 'trusted with via' => ['HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'],
+ 'trusted with via and protocol name' => ['HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'],
+ 'trusted with broken via' => ['HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'],
+ 'trusted with partially-broken via' => ['HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'],
+ ];
}
public function nonstandardRequestsData()
{
- return array(
- array('', '', '/', 'http://host:8080/', ''),
- array('/', '', '/', 'http://host:8080/', ''),
+ return [
+ ['', '', '/', 'http://host:8080/', ''],
+ ['/', '', '/', 'http://host:8080/', ''],
- array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'),
- array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'),
+ ['hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'],
+ ['/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'],
- array('', 'a=b', '/', 'http://host:8080/?a=b'),
- array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'),
- array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'),
+ ['', 'a=b', '/', 'http://host:8080/?a=b'],
+ ['?a=b', 'a=b', '/', 'http://host:8080/?a=b'],
+ ['/?a=b', 'a=b', '/', 'http://host:8080/?a=b'],
- array('x', 'a=b', '/x', 'http://host:8080/x?a=b'),
- array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'),
- array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'),
+ ['x', 'a=b', '/x', 'http://host:8080/x?a=b'],
+ ['x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'],
+ ['/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'],
- array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'),
- array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'),
+ ['hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'],
+ ['/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'],
- array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'),
- );
+ ['hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'],
+ ['hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'],
+ ['/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'],
+ ];
}
/**
@@ -2235,16 +2235,16 @@ class RequestTest extends TestCase
$expectedBaseUrl = $expectedBasePath;
}
- $server = array(
+ $server = [
'HTTP_HOST' => 'host:8080',
'SERVER_PORT' => '8080',
'QUERY_STRING' => $queryString,
'PHP_SELF' => '/hello/app.php',
'SCRIPT_FILENAME' => '/some/path/app.php',
'REQUEST_URI' => $requestUri,
- );
+ ];
- $request = new Request(array(), array(), array(), array(), array(), $server);
+ $request = new Request([], [], [], [], [], $server);
$this->assertEquals($expectedPathInfo, $request->getPathInfo());
$this->assertEquals($expectedUri, $request->getUri());
@@ -2257,7 +2257,7 @@ class RequestTest extends TestCase
public function testTrustedHost()
{
- Request::setTrustedProxies(array('1.1.1.1'), -1);
+ Request::setTrustedProxies(['1.1.1.1'], -1);
$request = Request::create('/');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
@@ -2279,7 +2279,7 @@ class RequestTest extends TestCase
public function testTrustedPort()
{
- Request::setTrustedProxies(array('1.1.1.1'), -1);
+ Request::setTrustedProxies(['1.1.1.1'], -1);
$request = Request::create('/');
$request->server->set('REMOTE_ADDR', '1.1.1.1');
@@ -2309,7 +2309,7 @@ class RequestContentProxy extends Request
{
public function getContent($asResource = false)
{
- return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&');
+ return http_build_query(['_method' => 'PUT', 'content' => 'mycontent'], '', '&');
}
}
diff --git a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php
index 22f25e97..3d3e696c 100644
--- a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php
+++ b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php
@@ -22,10 +22,10 @@ class ResponseFunctionalTest extends TestCase
public static function setUpBeforeClass()
{
- $spec = array(
- 1 => array('file', '/dev/null', 'w'),
- 2 => array('file', '/dev/null', 'w'),
- );
+ $spec = [
+ 1 => ['file', '/dev/null', 'w'],
+ 2 => ['file', '/dev/null', 'w'],
+ ];
if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) {
self::markTestSkipped('PHP server unable to start.');
}
@@ -52,7 +52,7 @@ class ResponseFunctionalTest extends TestCase
public function provideCookie()
{
foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) {
- yield array(pathinfo($file, PATHINFO_FILENAME));
+ yield [pathinfo($file, PATHINFO_FILENAME)];
}
}
}
diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
index f6ddb98e..35df36c1 100644
--- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
@@ -22,7 +22,7 @@ class ResponseHeaderBagTest extends TestCase
{
public function testAllPreserveCase()
{
- $headers = array(
+ $headers = [
'fOo' => 'BAR',
'ETag' => 'xyzzy',
'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==',
@@ -30,7 +30,7 @@ class ResponseHeaderBagTest extends TestCase
'WWW-Authenticate' => 'Basic realm="WallyWorld"',
'X-UA-Compatible' => 'IE=edge,chrome=1',
'X-XSS-Protection' => '1; mode=block',
- );
+ ];
$bag = new ResponseHeaderBag($headers);
$allPreservedCase = $bag->allPreserveCase();
@@ -42,45 +42,45 @@ class ResponseHeaderBagTest extends TestCase
public function testCacheControlHeader()
{
- $bag = new ResponseHeaderBag(array());
+ $bag = new ResponseHeaderBag([]);
$this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('no-cache'));
- $bag = new ResponseHeaderBag(array('Cache-Control' => 'public'));
+ $bag = new ResponseHeaderBag(['Cache-Control' => 'public']);
$this->assertEquals('public', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('public'));
- $bag = new ResponseHeaderBag(array('ETag' => 'abcde'));
+ $bag = new ResponseHeaderBag(['ETag' => 'abcde']);
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('private'));
$this->assertTrue($bag->hasCacheControlDirective('must-revalidate'));
$this->assertFalse($bag->hasCacheControlDirective('max-age'));
- $bag = new ResponseHeaderBag(array('Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT'));
+ $bag = new ResponseHeaderBag(['Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT']);
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array(
+ $bag = new ResponseHeaderBag([
'Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT',
'Cache-Control' => 'max-age=3600',
- ));
+ ]);
$this->assertEquals('max-age=3600, private', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('Last-Modified' => 'abcde'));
+ $bag = new ResponseHeaderBag(['Last-Modified' => 'abcde']);
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('Etag' => 'abcde', 'Last-Modified' => 'abcde'));
+ $bag = new ResponseHeaderBag(['Etag' => 'abcde', 'Last-Modified' => 'abcde']);
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('cache-control' => 'max-age=100'));
+ $bag = new ResponseHeaderBag(['cache-control' => 'max-age=100']);
$this->assertEquals('max-age=100, private', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('cache-control' => 's-maxage=100'));
+ $bag = new ResponseHeaderBag(['cache-control' => 's-maxage=100']);
$this->assertEquals('s-maxage=100', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('cache-control' => 'private, max-age=100'));
+ $bag = new ResponseHeaderBag(['cache-control' => 'private, max-age=100']);
$this->assertEquals('max-age=100, private', $bag->get('Cache-Control'));
- $bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100'));
+ $bag = new ResponseHeaderBag(['cache-control' => 'public, max-age=100']);
$this->assertEquals('max-age=100, public', $bag->get('Cache-Control'));
$bag = new ResponseHeaderBag();
@@ -88,7 +88,7 @@ class ResponseHeaderBagTest extends TestCase
$this->assertEquals('private, must-revalidate', $bag->get('Cache-Control'));
$bag = new ResponseHeaderBag();
- $bag->set('Cache-Control', array('public', 'must-revalidate'));
+ $bag->set('Cache-Control', ['public', 'must-revalidate']);
$this->assertCount(1, $bag->get('Cache-Control', null, false));
$this->assertEquals('must-revalidate, public', $bag->get('Cache-Control'));
@@ -101,7 +101,7 @@ class ResponseHeaderBagTest extends TestCase
public function testCacheControlClone()
{
- $headers = array('foo' => 'bar');
+ $headers = ['foo' => 'bar'];
$bag1 = new ResponseHeaderBag($headers);
$bag2 = new ResponseHeaderBag($bag1->allPreserveCase());
$this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase());
@@ -109,7 +109,7 @@ class ResponseHeaderBagTest extends TestCase
public function testToStringIncludesCookieHeaders()
{
- $bag = new ResponseHeaderBag(array());
+ $bag = new ResponseHeaderBag([]);
$bag->setCookie(Cookie::create('foo', 'bar'));
$this->assertSetCookieHeader('foo=bar; path=/; httponly; samesite=lax', $bag);
@@ -121,7 +121,7 @@ class ResponseHeaderBagTest extends TestCase
public function testClearCookieSecureNotHttpOnly()
{
- $bag = new ResponseHeaderBag(array());
+ $bag = new ResponseHeaderBag([]);
$bag->clearCookie('foo', '/', null, true, false);
@@ -130,23 +130,23 @@ class ResponseHeaderBagTest extends TestCase
public function testReplace()
{
- $bag = new ResponseHeaderBag(array());
+ $bag = new ResponseHeaderBag([]);
$this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('no-cache'));
- $bag->replace(array('Cache-Control' => 'public'));
+ $bag->replace(['Cache-Control' => 'public']);
$this->assertEquals('public', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('public'));
}
public function testReplaceWithRemove()
{
- $bag = new ResponseHeaderBag(array());
+ $bag = new ResponseHeaderBag([]);
$this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('no-cache'));
$bag->remove('Cache-Control');
- $bag->replace(array());
+ $bag->replace([]);
$this->assertEquals('no-cache, private', $bag->get('Cache-Control'));
$this->assertTrue($bag->hasCacheControlDirective('no-cache'));
}
@@ -161,12 +161,12 @@ class ResponseHeaderBagTest extends TestCase
$this->assertCount(4, $bag->getCookies());
$this->assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax', $bag->get('set-cookie'));
- $this->assertEquals(array(
+ $this->assertEquals([
'foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax',
'foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax',
'foo=bar; path=/path/bar; domain=bar.foo; httponly; samesite=lax',
'foo=bar; path=/; httponly; samesite=lax',
- ), $bag->get('set-cookie', null, false));
+ ], $bag->get('set-cookie', null, false));
$this->assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax', $bag);
$this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax', $bag);
@@ -228,16 +228,16 @@ class ResponseHeaderBagTest extends TestCase
{
$bag = new ResponseHeaderBag();
$bag->set('set-cookie', 'foo=bar');
- $this->assertEquals(array(Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null)), $bag->getCookies());
+ $this->assertEquals([Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null)], $bag->getCookies());
$bag->set('set-cookie', 'foo2=bar2', false);
- $this->assertEquals(array(
+ $this->assertEquals([
Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null),
Cookie::create('foo2', 'bar2', 0, '/', null, false, false, true, null),
- ), $bag->getCookies());
+ ], $bag->getCookies());
$bag->remove('set-cookie');
- $this->assertEquals(array(), $bag->getCookies());
+ $this->assertEquals([], $bag->getCookies());
}
/**
@@ -260,8 +260,8 @@ class ResponseHeaderBagTest extends TestCase
(string) $headers;
$allHeaders = $headers->allPreserveCase();
- $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']);
- $this->assertEquals(array('text/html'), $allHeaders['Content-type']);
+ $this->assertEquals(['http://www.symfony.com'], $allHeaders['Location']);
+ $this->assertEquals(['text/html'], $allHeaders['Content-type']);
}
public function testDateHeaderAddedOnCreation()
@@ -277,7 +277,7 @@ class ResponseHeaderBagTest extends TestCase
public function testDateHeaderCanBeSetOnCreation()
{
$someDate = 'Thu, 23 Mar 2017 09:15:12 GMT';
- $bag = new ResponseHeaderBag(array('Date' => $someDate));
+ $bag = new ResponseHeaderBag(['Date' => $someDate]);
$this->assertEquals($someDate, $bag->get('Date'));
}
@@ -285,7 +285,7 @@ class ResponseHeaderBagTest extends TestCase
public function testDateHeaderWillBeRecreatedWhenRemoved()
{
$someDate = 'Thu, 23 Mar 2017 09:15:12 GMT';
- $bag = new ResponseHeaderBag(array('Date' => $someDate));
+ $bag = new ResponseHeaderBag(['Date' => $someDate]);
$bag->remove('Date');
// a (new) Date header is still present
@@ -296,7 +296,7 @@ class ResponseHeaderBagTest extends TestCase
public function testDateHeaderWillBeRecreatedWhenHeadersAreReplaced()
{
$bag = new ResponseHeaderBag();
- $bag->replace(array());
+ $bag->replace([]);
$this->assertTrue($bag->has('Date'));
}
diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php
index 03dcc11a..7856a77c 100644
--- a/vendor/symfony/http-foundation/Tests/ResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php
@@ -22,7 +22,7 @@ class ResponseTest extends ResponseTestCase
{
public function testCreate()
{
- $response = Response::create('foo', 301, array('Foo' => 'bar'));
+ $response = Response::create('foo', 301, ['Foo' => 'bar']);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
$this->assertEquals(301, $response->getStatusCode());
@@ -254,10 +254,10 @@ class ResponseTest extends ResponseTestCase
public function testIsValidateable()
{
- $response = new Response('', 200, array('Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
+ $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]);
$this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present');
- $response = new Response('', 200, array('ETag' => '"12345"'));
+ $response = new Response('', 200, ['ETag' => '"12345"']);
$this->assertTrue($response->isValidateable(), '->isValidateable() returns true if ETag is present');
$response = new Response();
@@ -267,7 +267,7 @@ class ResponseTest extends ResponseTestCase
public function testGetDate()
{
$oneHourAgo = $this->createDateTimeOneHourAgo();
- $response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822)));
+ $response = new Response('', 200, ['Date' => $oneHourAgo->format(DATE_RFC2822)]);
$date = $response->getDate();
$this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present');
@@ -275,7 +275,7 @@ class ResponseTest extends ResponseTestCase
$date = $response->getDate();
$this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present');
- $response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
+ $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]);
$now = $this->createDateTimeNow();
$response->headers->set('Date', $now->format(DATE_RFC2822));
$date = $response->getDate();
@@ -415,21 +415,21 @@ class ResponseTest extends ResponseTestCase
public function testGetVary()
{
$response = new Response();
- $this->assertEquals(array(), $response->getVary(), '->getVary() returns an empty array if no Vary header is present');
+ $this->assertEquals([], $response->getVary(), '->getVary() returns an empty array if no Vary header is present');
$response = new Response();
$response->headers->set('Vary', 'Accept-Language');
- $this->assertEquals(array('Accept-Language'), $response->getVary(), '->getVary() parses a single header name value');
+ $this->assertEquals(['Accept-Language'], $response->getVary(), '->getVary() parses a single header name value');
$response = new Response();
$response->headers->set('Vary', 'Accept-Language User-Agent X-Foo');
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by spaces');
+ $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by spaces');
$response = new Response();
$response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo');
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas');
+ $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by commas');
- $vary = array('Accept-Language', 'User-Agent', 'X-foo');
+ $vary = ['Accept-Language', 'User-Agent', 'X-foo'];
$response = new Response();
$response->headers->set('Vary', $vary);
@@ -444,18 +444,18 @@ class ResponseTest extends ResponseTestCase
{
$response = new Response();
$response->setVary('Accept-Language');
- $this->assertEquals(array('Accept-Language'), $response->getVary());
+ $this->assertEquals(['Accept-Language'], $response->getVary());
$response->setVary('Accept-Language, User-Agent');
- $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default');
+ $this->assertEquals(['Accept-Language', 'User-Agent'], $response->getVary(), '->setVary() replace the vary header by default');
$response->setVary('X-Foo', false);
- $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false');
+ $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false');
}
public function testDefaultContentType()
{
- $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock();
+ $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(['set'])->getMock();
$headerMock->expects($this->at(0))
->method('set')
->with('Content-Type', 'text/html');
@@ -595,55 +595,55 @@ class ResponseTest extends ResponseTestCase
public function testSetCache()
{
$response = new Response();
- //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
+ // ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public']
try {
- $response->setCache(array('wrong option' => 'value'));
+ $response->setCache(['wrong option' => 'value']);
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
$this->assertContains('"wrong option"', $e->getMessage());
}
- $options = array('etag' => '"whatever"');
+ $options = ['etag' => '"whatever"'];
$response->setCache($options);
$this->assertEquals($response->getEtag(), '"whatever"');
$now = $this->createDateTimeNow();
- $options = array('last_modified' => $now);
+ $options = ['last_modified' => $now];
$response->setCache($options);
$this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp());
- $options = array('max_age' => 100);
+ $options = ['max_age' => 100];
$response->setCache($options);
$this->assertEquals($response->getMaxAge(), 100);
- $options = array('s_maxage' => 200);
+ $options = ['s_maxage' => 200];
$response->setCache($options);
$this->assertEquals($response->getMaxAge(), 200);
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
- $response->setCache(array('public' => true));
+ $response->setCache(['public' => true]);
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
- $response->setCache(array('public' => false));
+ $response->setCache(['public' => false]);
$this->assertFalse($response->headers->hasCacheControlDirective('public'));
$this->assertTrue($response->headers->hasCacheControlDirective('private'));
- $response->setCache(array('private' => true));
+ $response->setCache(['private' => true]);
$this->assertFalse($response->headers->hasCacheControlDirective('public'));
$this->assertTrue($response->headers->hasCacheControlDirective('private'));
- $response->setCache(array('private' => false));
+ $response->setCache(['private' => false]);
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
- $response->setCache(array('immutable' => true));
+ $response->setCache(['immutable' => true]);
$this->assertTrue($response->headers->hasCacheControlDirective('immutable'));
- $response->setCache(array('immutable' => false));
+ $response->setCache(['immutable' => false]);
$this->assertFalse($response->headers->hasCacheControlDirective('immutable'));
}
@@ -780,14 +780,14 @@ class ResponseTest extends ResponseTestCase
public function getStatusCodeFixtures()
{
- return array(
- array('200', null, 'OK'),
- array('200', false, ''),
- array('200', 'foo', 'foo'),
- array('199', null, 'unknown status'),
- array('199', false, ''),
- array('199', 'foo', 'foo'),
- );
+ return [
+ ['200', null, 'OK'],
+ ['200', false, ''],
+ ['200', 'foo', 'foo'],
+ ['199', null, 'unknown status'],
+ ['199', false, ''],
+ ['199', 'foo', 'foo'],
+ ];
}
public function testIsInformational()
@@ -801,7 +801,7 @@ class ResponseTest extends ResponseTestCase
public function testIsRedirectRedirection()
{
- foreach (array(301, 302, 303, 307) as $code) {
+ foreach ([301, 302, 303, 307] as $code) {
$response = new Response('', $code);
$this->assertTrue($response->isRedirection());
$this->assertTrue($response->isRedirect());
@@ -819,7 +819,7 @@ class ResponseTest extends ResponseTestCase
$this->assertFalse($response->isRedirection());
$this->assertFalse($response->isRedirect());
- $response = new Response('', 301, array('Location' => '/good-uri'));
+ $response = new Response('', 301, ['Location' => '/good-uri']);
$this->assertFalse($response->isRedirect('/bad-uri'));
$this->assertTrue($response->isRedirect('/good-uri'));
}
@@ -835,7 +835,7 @@ class ResponseTest extends ResponseTestCase
public function testIsEmpty()
{
- foreach (array(204, 304) as $code) {
+ foreach ([204, 304] as $code) {
$response = new Response('', $code);
$this->assertTrue($response->isEmpty());
}
@@ -884,7 +884,7 @@ class ResponseTest extends ResponseTestCase
public function testSetEtag()
{
- $response = new Response('', 200, array('ETag' => '"12345"'));
+ $response = new Response('', 200, ['ETag' => '"12345"']);
$response->setEtag();
$this->assertNull($response->headers->get('Etag'), '->setEtag() removes Etags when call with null');
@@ -914,7 +914,7 @@ class ResponseTest extends ResponseTestCase
{
$response = new Response();
- $setters = array(
+ $setters = [
'setProtocolVersion' => '1.0',
'setCharset' => 'UTF-8',
'setPublic' => null,
@@ -925,7 +925,7 @@ class ResponseTest extends ResponseTestCase
'setSharedMaxAge' => 1,
'setTtl' => 1,
'setClientTtl' => 1,
- );
+ ];
foreach ($setters as $setter => $arg) {
$this->assertEquals($response, $response->{$setter}($arg));
@@ -944,20 +944,20 @@ class ResponseTest extends ResponseTestCase
public function validContentProvider()
{
- return array(
- 'obj' => array(new StringableObject()),
- 'string' => array('Foo'),
- 'int' => array(2),
- );
+ return [
+ 'obj' => [new StringableObject()],
+ 'string' => ['Foo'],
+ 'int' => [2],
+ ];
}
public function invalidContentProvider()
{
- return array(
- 'obj' => array(new \stdClass()),
- 'array' => array(array()),
- 'bool' => array(true, '1'),
- );
+ return [
+ 'obj' => [new \stdClass()],
+ 'array' => [[]],
+ 'bool' => [true, '1'],
+ ];
}
protected function createDateTimeOneHourAgo()
@@ -1004,19 +1004,20 @@ class ResponseTest extends ResponseTestCase
$ianaHttpStatusCodes = new \DOMDocument();
- libxml_set_streams_context(stream_context_create(array(
- 'http' => array(
+ $context = stream_context_create([
+ 'http' => [
'method' => 'GET',
'timeout' => 30,
- ),
- )));
+ 'user_agent' => __METHOD__,
+ ],
+ ]);
- $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml');
+ $ianaHttpStatusCodes->loadXML(file_get_contents('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml', false, $context));
if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
self::fail('Invalid IANA\'s HTTP status code list.');
}
- $ianaCodesReasonPhrases = array();
+ $ianaCodesReasonPhrases = [];
$xpath = new \DOMXPath($ianaHttpStatusCodes);
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');
@@ -1026,16 +1027,16 @@ class ResponseTest extends ResponseTestCase
$value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
$description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue;
- if (\in_array($description, array('Unassigned', '(Unused)'), true)) {
+ if (\in_array($description, ['Unassigned', '(Unused)'], true)) {
continue;
}
if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) {
for ($value = $matches[1]; $value <= $matches[2]; ++$value) {
- $ianaCodesReasonPhrases[] = array($value, $description);
+ $ianaCodesReasonPhrases[] = [$value, $description];
}
} else {
- $ianaCodesReasonPhrases[] = array($value, $description);
+ $ianaCodesReasonPhrases[] = [$value, $description];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/vendor/symfony/http-foundation/Tests/ServerBagTest.php
index f8becec5..0663b118 100644
--- a/vendor/symfony/http-foundation/Tests/ServerBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/ServerBagTest.php
@@ -23,7 +23,7 @@ class ServerBagTest extends TestCase
{
public function testShouldExtractHeadersFromServerArray()
{
- $server = array(
+ $server = [
'SOME_SERVER_VARIABLE' => 'value',
'SOME_SERVER_VARIABLE2' => 'value',
'ROOT' => 'value',
@@ -32,45 +32,45 @@ class ServerBagTest extends TestCase
'HTTP_ETAG' => 'asdf',
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => 'bar',
- );
+ ];
$bag = new ServerBag($server);
- $this->assertEquals(array(
+ $this->assertEquals([
'CONTENT_TYPE' => 'text/html',
'CONTENT_LENGTH' => '0',
'ETAG' => 'asdf',
'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'),
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => 'bar',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpPasswordIsOptional()
{
- $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo'));
+ $bag = new ServerBag(['PHP_AUTH_USER' => 'foo']);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => 'Basic '.base64_encode('foo:'),
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpBasicAuthWithPhpCgi()
{
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'),
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => 'bar',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpBasicAuthWithPhpCgiBogus()
{
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')]);
// Username and passwords should not be set as the header is bogus
$headers = $bag->getHeaders();
@@ -80,41 +80,41 @@ class ServerBagTest extends TestCase
public function testHttpBasicAuthWithPhpCgiRedirect()
{
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')));
+ $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'),
'PHP_AUTH_USER' => 'username',
'PHP_AUTH_PW' => 'pass:word',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpBasicAuthWithPhpCgiEmptyPassword()
{
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => 'Basic '.base64_encode('foo:'),
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpDigestAuthWithPhpCgi()
{
$digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => $digest,
'PHP_AUTH_DIGEST' => $digest,
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testHttpDigestAuthWithPhpCgiBogus()
{
$digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]);
// Username and passwords should not be set as the header is bogus
$headers = $bag->getHeaders();
@@ -125,32 +125,32 @@ class ServerBagTest extends TestCase
public function testHttpDigestAuthWithPhpCgiRedirect()
{
$digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"';
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $digest));
+ $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $digest]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => $digest,
'PHP_AUTH_DIGEST' => $digest,
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testOAuthBearerAuth()
{
$headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent));
+ $bag = new ServerBag(['HTTP_AUTHORIZATION' => $headerContent]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => $headerContent,
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
public function testOAuthBearerAuthWithRedirect()
{
$headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $headerContent));
+ $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $headerContent]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => $headerContent,
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
/**
@@ -159,12 +159,12 @@ class ServerBagTest extends TestCase
public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet()
{
$headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo';
- $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent));
+ $bag = new ServerBag(['PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent]);
- $this->assertEquals(array(
+ $this->assertEquals([
'AUTHORIZATION' => $headerContent,
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => '',
- ), $bag->getHeaders());
+ ], $bag->getHeaders());
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php
index 8c41e475..44c8174e 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php
@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
*/
class AttributeBagTest extends TestCase
{
- private $array = array();
+ private $array = [];
/**
* @var AttributeBag
@@ -30,21 +30,21 @@ class AttributeBagTest extends TestCase
protected function setUp()
{
- $this->array = array(
+ $this->array = [
'hello' => 'world',
'always' => 'be happy',
'user.login' => 'drak',
- 'csrf.token' => array(
+ 'csrf.token' => [
'a' => '1234',
'b' => '4321',
- ),
- 'category' => array(
- 'fishing' => array(
+ ],
+ 'category' => [
+ 'fishing' => [
'first' => 'cod',
'second' => 'sole',
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->bag = new AttributeBag('_sf');
$this->bag->initialize($this->array);
}
@@ -52,7 +52,7 @@ class AttributeBagTest extends TestCase
protected function tearDown()
{
$this->bag = null;
- $this->array = array();
+ $this->array = [];
}
public function testInitialize()
@@ -60,7 +60,7 @@ class AttributeBagTest extends TestCase
$bag = new AttributeBag();
$bag->initialize($this->array);
$this->assertEquals($this->array, $bag->all());
- $array = array('should' => 'change');
+ $array = ['should' => 'change'];
$bag->initialize($array);
$this->assertEquals($array, $bag->all());
}
@@ -122,7 +122,7 @@ class AttributeBagTest extends TestCase
public function testReplace()
{
- $array = array();
+ $array = [];
$array['name'] = 'jack';
$array['foo.bar'] = 'beep';
$this->bag->replace($array);
@@ -150,22 +150,22 @@ class AttributeBagTest extends TestCase
public function testClear()
{
$this->bag->clear();
- $this->assertEquals(array(), $this->bag->all());
+ $this->assertEquals([], $this->bag->all());
}
public function attributesProvider()
{
- return array(
- array('hello', 'world', true),
- array('always', 'be happy', true),
- array('user.login', 'drak', true),
- array('csrf.token', array('a' => '1234', 'b' => '4321'), true),
- array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true),
- array('user2.login', null, false),
- array('never', null, false),
- array('bye', null, false),
- array('bye/for/now', null, false),
- );
+ return [
+ ['hello', 'world', true],
+ ['always', 'be happy', true],
+ ['user.login', 'drak', true],
+ ['csrf.token', ['a' => '1234', 'b' => '4321'], true],
+ ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true],
+ ['user2.login', null, false],
+ ['never', null, false],
+ ['bye', null, false],
+ ['bye/for/now', null, false],
+ ];
}
public function testGetIterator()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
index ec4cd5ad..6b4bb17d 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php
@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
*/
class NamespacedAttributeBagTest extends TestCase
{
- private $array = array();
+ private $array = [];
/**
* @var NamespacedAttributeBag
@@ -30,21 +30,21 @@ class NamespacedAttributeBagTest extends TestCase
protected function setUp()
{
- $this->array = array(
+ $this->array = [
'hello' => 'world',
'always' => 'be happy',
'user.login' => 'drak',
- 'csrf.token' => array(
+ 'csrf.token' => [
'a' => '1234',
'b' => '4321',
- ),
- 'category' => array(
- 'fishing' => array(
+ ],
+ 'category' => [
+ 'fishing' => [
'first' => 'cod',
'second' => 'sole',
- ),
- ),
- );
+ ],
+ ],
+ ];
$this->bag = new NamespacedAttributeBag('_sf2', '/');
$this->bag->initialize($this->array);
}
@@ -52,7 +52,7 @@ class NamespacedAttributeBagTest extends TestCase
protected function tearDown()
{
$this->bag = null;
- $this->array = array();
+ $this->array = [];
}
public function testInitialize()
@@ -60,7 +60,7 @@ class NamespacedAttributeBagTest extends TestCase
$bag = new NamespacedAttributeBag();
$bag->initialize($this->array);
$this->assertEquals($this->array, $this->bag->all());
- $array = array('should' => 'not stick');
+ $array = ['should' => 'not stick'];
$bag->initialize($array);
// should have remained the same
@@ -139,7 +139,7 @@ class NamespacedAttributeBagTest extends TestCase
public function testReplace()
{
- $array = array();
+ $array = [];
$array['name'] = 'jack';
$array['foo.bar'] = 'beep';
$this->bag->replace($array);
@@ -177,28 +177,28 @@ class NamespacedAttributeBagTest extends TestCase
public function testClear()
{
$this->bag->clear();
- $this->assertEquals(array(), $this->bag->all());
+ $this->assertEquals([], $this->bag->all());
}
public function attributesProvider()
{
- return array(
- array('hello', 'world', true),
- array('always', 'be happy', true),
- array('user.login', 'drak', true),
- array('csrf.token', array('a' => '1234', 'b' => '4321'), true),
- array('csrf.token/a', '1234', true),
- array('csrf.token/b', '4321', true),
- array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true),
- array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true),
- array('category/fishing/missing/first', null, false),
- array('category/fishing/first', 'cod', true),
- array('category/fishing/second', 'sole', true),
- array('category/fishing/missing/second', null, false),
- array('user2.login', null, false),
- array('never', null, false),
- array('bye', null, false),
- array('bye/for/now', null, false),
- );
+ return [
+ ['hello', 'world', true],
+ ['always', 'be happy', true],
+ ['user.login', 'drak', true],
+ ['csrf.token', ['a' => '1234', 'b' => '4321'], true],
+ ['csrf.token/a', '1234', true],
+ ['csrf.token/b', '4321', true],
+ ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true],
+ ['category/fishing', ['first' => 'cod', 'second' => 'sole'], true],
+ ['category/fishing/missing/first', null, false],
+ ['category/fishing/first', 'cod', true],
+ ['category/fishing/second', 'sole', true],
+ ['category/fishing/missing/second', null, false],
+ ['user2.login', null, false],
+ ['never', null, false],
+ ['bye', null, false],
+ ['bye/for/now', null, false],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
index fa8626ab..b4e2c3a5 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php
@@ -26,13 +26,13 @@ class AutoExpireFlashBagTest extends TestCase
*/
private $bag;
- protected $array = array();
+ protected $array = [];
protected function setUp()
{
parent::setUp();
$this->bag = new FlashBag();
- $this->array = array('new' => array('notice' => array('A previous flash message')));
+ $this->array = ['new' => ['notice' => ['A previous flash message']]];
$this->bag->initialize($this->array);
}
@@ -45,16 +45,16 @@ class AutoExpireFlashBagTest extends TestCase
public function testInitialize()
{
$bag = new FlashBag();
- $array = array('new' => array('notice' => array('A previous flash message')));
+ $array = ['new' => ['notice' => ['A previous flash message']]];
$bag->initialize($array);
- $this->assertEquals(array('A previous flash message'), $bag->peek('notice'));
- $array = array('new' => array(
- 'notice' => array('Something else'),
- 'error' => array('a'),
- ));
+ $this->assertEquals(['A previous flash message'], $bag->peek('notice'));
+ $array = ['new' => [
+ 'notice' => ['Something else'],
+ 'error' => ['a'],
+ ]];
$bag->initialize($array);
- $this->assertEquals(array('Something else'), $bag->peek('notice'));
- $this->assertEquals(array('a'), $bag->peek('error'));
+ $this->assertEquals(['Something else'], $bag->peek('notice'));
+ $this->assertEquals(['a'], $bag->peek('error'));
}
public function testGetStorageKey()
@@ -73,16 +73,16 @@ class AutoExpireFlashBagTest extends TestCase
public function testPeek()
{
- $this->assertEquals(array(), $this->bag->peek('non_existing'));
- $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
+ $this->assertEquals([], $this->bag->peek('non_existing'));
+ $this->assertEquals(['default'], $this->bag->peek('non_existing', ['default']));
+ $this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
+ $this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
}
public function testSet()
{
$this->bag->set('notice', 'Foo');
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
+ $this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
}
public function testHas()
@@ -93,43 +93,43 @@ class AutoExpireFlashBagTest extends TestCase
public function testKeys()
{
- $this->assertEquals(array('notice'), $this->bag->keys());
+ $this->assertEquals(['notice'], $this->bag->keys());
}
public function testPeekAll()
{
- $array = array(
- 'new' => array(
+ $array = [
+ 'new' => [
'notice' => 'Foo',
'error' => 'Bar',
- ),
- );
+ ],
+ ];
$this->bag->initialize($array);
- $this->assertEquals(array(
+ $this->assertEquals([
'notice' => 'Foo',
'error' => 'Bar',
- ), $this->bag->peekAll()
+ ], $this->bag->peekAll()
);
- $this->assertEquals(array(
+ $this->assertEquals([
'notice' => 'Foo',
'error' => 'Bar',
- ), $this->bag->peekAll()
+ ], $this->bag->peekAll()
);
}
public function testGet()
{
- $this->assertEquals(array(), $this->bag->get('non_existing'));
- $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->get('notice'));
- $this->assertEquals(array(), $this->bag->get('notice'));
+ $this->assertEquals([], $this->bag->get('non_existing'));
+ $this->assertEquals(['default'], $this->bag->get('non_existing', ['default']));
+ $this->assertEquals(['A previous flash message'], $this->bag->get('notice'));
+ $this->assertEquals([], $this->bag->get('notice'));
}
public function testSetAll()
{
- $this->bag->setAll(array('a' => 'first', 'b' => 'second'));
+ $this->bag->setAll(['a' => 'first', 'b' => 'second']);
$this->assertFalse($this->bag->has('a'));
$this->assertFalse($this->bag->has('b'));
}
@@ -138,17 +138,17 @@ class AutoExpireFlashBagTest extends TestCase
{
$this->bag->set('notice', 'Foo');
$this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('A previous flash message'),
- ), $this->bag->all()
+ $this->assertEquals([
+ 'notice' => ['A previous flash message'],
+ ], $this->bag->all()
);
- $this->assertEquals(array(), $this->bag->all());
+ $this->assertEquals([], $this->bag->all());
}
public function testClear()
{
- $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear());
+ $this->assertEquals(['notice' => ['A previous flash message']], $this->bag->clear());
}
public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes()
@@ -156,6 +156,6 @@ class AutoExpireFlashBagTest extends TestCase
$this->bag->add('success', 'Something');
$this->bag->all();
- $this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array);
+ $this->assertEquals(['new' => ['success' => ['Something']], 'display' => []], $this->array);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
index 905a1f75..6d8619e0 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php
@@ -26,13 +26,13 @@ class FlashBagTest extends TestCase
*/
private $bag;
- protected $array = array();
+ protected $array = [];
protected function setUp()
{
parent::setUp();
$this->bag = new FlashBag();
- $this->array = array('notice' => array('A previous flash message'));
+ $this->array = ['notice' => ['A previous flash message']];
$this->bag->initialize($this->array);
}
@@ -47,7 +47,7 @@ class FlashBagTest extends TestCase
$bag = new FlashBag();
$bag->initialize($this->array);
$this->assertEquals($this->array, $bag->peekAll());
- $array = array('should' => array('change'));
+ $array = ['should' => ['change']];
$bag->initialize($array);
$this->assertEquals($array, $bag->peekAll());
}
@@ -68,49 +68,49 @@ class FlashBagTest extends TestCase
public function testPeek()
{
- $this->assertEquals(array(), $this->bag->peek('non_existing'));
- $this->assertEquals(array('default'), $this->bag->peek('not_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
- $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice'));
+ $this->assertEquals([], $this->bag->peek('non_existing'));
+ $this->assertEquals(['default'], $this->bag->peek('not_existing', ['default']));
+ $this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
+ $this->assertEquals(['A previous flash message'], $this->bag->peek('notice'));
}
public function testAdd()
{
- $tab = array('bar' => 'baz');
+ $tab = ['bar' => 'baz'];
$this->bag->add('string_message', 'lorem');
$this->bag->add('object_message', new \stdClass());
$this->bag->add('array_message', $tab);
- $this->assertEquals(array('lorem'), $this->bag->get('string_message'));
- $this->assertEquals(array(new \stdClass()), $this->bag->get('object_message'));
- $this->assertEquals(array($tab), $this->bag->get('array_message'));
+ $this->assertEquals(['lorem'], $this->bag->get('string_message'));
+ $this->assertEquals([new \stdClass()], $this->bag->get('object_message'));
+ $this->assertEquals([$tab], $this->bag->get('array_message'));
}
public function testGet()
{
- $this->assertEquals(array(), $this->bag->get('non_existing'));
- $this->assertEquals(array('default'), $this->bag->get('not_existing', array('default')));
- $this->assertEquals(array('A previous flash message'), $this->bag->get('notice'));
- $this->assertEquals(array(), $this->bag->get('notice'));
+ $this->assertEquals([], $this->bag->get('non_existing'));
+ $this->assertEquals(['default'], $this->bag->get('not_existing', ['default']));
+ $this->assertEquals(['A previous flash message'], $this->bag->get('notice'));
+ $this->assertEquals([], $this->bag->get('notice'));
}
public function testAll()
{
$this->bag->set('notice', 'Foo');
$this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'), ), $this->bag->all()
+ $this->assertEquals([
+ 'notice' => ['Foo'],
+ 'error' => ['Bar'], ], $this->bag->all()
);
- $this->assertEquals(array(), $this->bag->all());
+ $this->assertEquals([], $this->bag->all());
}
public function testSet()
{
$this->bag->set('notice', 'Foo');
$this->bag->set('notice', 'Bar');
- $this->assertEquals(array('Bar'), $this->bag->peek('notice'));
+ $this->assertEquals(['Bar'], $this->bag->peek('notice'));
}
public function testHas()
@@ -121,7 +121,7 @@ class FlashBagTest extends TestCase
public function testKeys()
{
- $this->assertEquals(array('notice'), $this->bag->keys());
+ $this->assertEquals(['notice'], $this->bag->keys());
}
public function testSetAll()
@@ -130,28 +130,28 @@ class FlashBagTest extends TestCase
$this->bag->add('another_flash', 'Bar');
$this->assertTrue($this->bag->has('one_flash'));
$this->assertTrue($this->bag->has('another_flash'));
- $this->bag->setAll(array('unique_flash' => 'FooBar'));
+ $this->bag->setAll(['unique_flash' => 'FooBar']);
$this->assertFalse($this->bag->has('one_flash'));
$this->assertFalse($this->bag->has('another_flash'));
- $this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all());
- $this->assertSame(array(), $this->bag->all());
+ $this->assertSame(['unique_flash' => 'FooBar'], $this->bag->all());
+ $this->assertSame([], $this->bag->all());
}
public function testPeekAll()
{
$this->bag->set('notice', 'Foo');
$this->bag->set('error', 'Bar');
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'),
- ), $this->bag->peekAll()
+ $this->assertEquals([
+ 'notice' => ['Foo'],
+ 'error' => ['Bar'],
+ ], $this->bag->peekAll()
);
$this->assertTrue($this->bag->has('notice'));
$this->assertTrue($this->bag->has('error'));
- $this->assertEquals(array(
- 'notice' => array('Foo'),
- 'error' => array('Bar'),
- ), $this->bag->peekAll()
+ $this->assertEquals([
+ 'notice' => ['Foo'],
+ 'error' => ['Bar'],
+ ], $this->bag->peekAll()
);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
index 63351e57..afa00fc7 100644
--- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php
@@ -127,10 +127,10 @@ class SessionTest extends TestCase
public function testReplace()
{
- $this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome'));
- $this->assertEquals(array('happiness' => 'be good', 'symfony' => 'awesome'), $this->session->all());
- $this->session->replace(array());
- $this->assertEquals(array(), $this->session->all());
+ $this->session->replace(['happiness' => 'be good', 'symfony' => 'awesome']);
+ $this->assertEquals(['happiness' => 'be good', 'symfony' => 'awesome'], $this->session->all());
+ $this->session->replace([]);
+ $this->assertEquals([], $this->session->all());
}
/**
@@ -150,16 +150,16 @@ class SessionTest extends TestCase
$this->session->set('hi', 'fabien');
$this->session->set($key, $value);
$this->session->clear();
- $this->assertEquals(array(), $this->session->all());
+ $this->assertEquals([], $this->session->all());
}
public function setProvider()
{
- return array(
- array('foo', 'bar', array('foo' => 'bar')),
- array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')),
- array('great', 'symfony is great', array('great' => 'symfony is great')),
- );
+ return [
+ ['foo', 'bar', ['foo' => 'bar']],
+ ['foo.bar', 'too much beer', ['foo.bar' => 'too much beer']],
+ ['great', 'symfony is great', ['great' => 'symfony is great']],
+ ];
}
/**
@@ -170,14 +170,14 @@ class SessionTest extends TestCase
$this->session->set('hi.world', 'have a nice day');
$this->session->set($key, $value);
$this->session->remove($key);
- $this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all());
+ $this->assertEquals(['hi.world' => 'have a nice day'], $this->session->all());
}
public function testInvalidate()
{
$this->session->set('invalidate', 123);
$this->session->invalidate();
- $this->assertEquals(array(), $this->session->all());
+ $this->assertEquals([], $this->session->all());
}
public function testMigrate()
@@ -216,7 +216,7 @@ class SessionTest extends TestCase
public function testGetIterator()
{
- $attributes = array('hello' => 'world', 'symfony' => 'rocks');
+ $attributes = ['hello' => 'world', 'symfony' => 'rocks'];
foreach ($attributes as $key => $val) {
$this->session->set($key, $val);
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php
index a2bf168d..c0651498 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php
@@ -50,7 +50,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
$this->redisClient = $this->createRedisClient($host);
$this->storage = new RedisSessionHandler(
$this->redisClient,
- array('prefix' => self::PREFIX)
+ ['prefix' => self::PREFIX]
);
}
@@ -117,7 +117,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
$lowTtl = 10;
$this->redisClient->setex(self::PREFIX.'id', $lowTtl, 'foo');
- $this->storage->updateTimestamp('id', array());
+ $this->storage->updateTimestamp('id', []);
$this->assertGreaterThan($lowTtl, $this->redisClient->ttl(self::PREFIX.'id'));
}
@@ -137,9 +137,9 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase
public function getOptionFixtures(): array
{
- return array(
- array(array('prefix' => 'session'), true),
- array(array('prefix' => 'sfs', 'foo' => 'bar'), false),
- );
+ return [
+ [['prefix' => 'session'], true],
+ [['prefix' => 'sfs', 'foo' => 'bar'], false],
+ ];
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
index 6566d6ee..f65e62b5 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php
@@ -19,10 +19,10 @@ class AbstractSessionHandlerTest extends TestCase
public static function setUpBeforeClass()
{
- $spec = array(
- 1 => array('file', '/dev/null', 'w'),
- 2 => array('file', '/dev/null', 'w'),
- );
+ $spec = [
+ 1 => ['file', '/dev/null', 'w'],
+ 2 => ['file', '/dev/null', 'w'],
+ ];
if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) {
self::markTestSkipped('PHP server unable to start.');
}
@@ -42,7 +42,7 @@ class AbstractSessionHandlerTest extends TestCase
*/
public function testSession($fixture)
{
- $context = array('http' => array('header' => "Cookie: sid=123abc\r\n"));
+ $context = ['http' => ['header' => "Cookie: sid=123abc\r\n"]];
$context = stream_context_create($context);
$result = file_get_contents(sprintf('http://localhost:8053/%s.php', $fixture), false, $context);
@@ -52,7 +52,7 @@ class AbstractSessionHandlerTest extends TestCase
public function provideSession()
{
foreach (glob(__DIR__.'/Fixtures/*.php') as $file) {
- yield array(pathinfo($file, PATHINFO_FILENAME));
+ yield [pathinfo($file, PATHINFO_FILENAME)];
}
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
index 2d32792a..fc2c4182 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php
@@ -4,10 +4,10 @@ require __DIR__.'/common.inc';
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-$storage = new NativeSessionStorage(array('cookie_samesite' => 'lax'));
+$storage = new NativeSessionStorage(['cookie_samesite' => 'lax']);
$storage->setSaveHandler(new TestSessionHandler());
$storage->start();
-$_SESSION = array('foo' => 'bar');
+$_SESSION = ['foo' => 'bar'];
ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); });
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
index e0ff64b9..a28b6fed 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
@@ -4,11 +4,11 @@ require __DIR__.'/common.inc';
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
-$storage = new NativeSessionStorage(array('cookie_samesite' => 'lax'));
+$storage = new NativeSessionStorage(['cookie_samesite' => 'lax']);
$storage->setSaveHandler(new TestSessionHandler());
$storage->start();
-$_SESSION = array('foo' => 'bar');
+$_SESSION = ['foo' => 'bar'];
$storage->regenerate(true);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
index 5bb2db06..2393ddf1 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
@@ -41,7 +41,7 @@ class MemcachedSessionHandlerTest extends TestCase
$this->memcached = $this->getMockBuilder('Memcached')->getMock();
$this->storage = new MemcachedSessionHandler(
$this->memcached,
- array('prefix' => self::PREFIX, 'expiretime' => self::TTL)
+ ['prefix' => self::PREFIX, 'expiretime' => self::TTL]
);
}
@@ -59,6 +59,12 @@ class MemcachedSessionHandlerTest extends TestCase
public function testCloseSession()
{
+ $this->memcached
+ ->expects($this->once())
+ ->method('quit')
+ ->willReturn(true)
+ ;
+
$this->assertTrue($this->storage->close());
}
@@ -79,7 +85,7 @@ class MemcachedSessionHandlerTest extends TestCase
->expects($this->once())
->method('set')
->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2))
- ->will($this->returnValue(true))
+ ->willReturn(true)
;
$this->assertTrue($this->storage->write('id', 'data'));
@@ -91,7 +97,7 @@ class MemcachedSessionHandlerTest extends TestCase
->expects($this->once())
->method('delete')
->with(self::PREFIX.'id')
- ->will($this->returnValue(true))
+ ->willReturn(true)
;
$this->assertTrue($this->storage->destroy('id'));
@@ -117,12 +123,12 @@ class MemcachedSessionHandlerTest extends TestCase
public function getOptionFixtures()
{
- return array(
- array(array('prefix' => 'session'), true),
- array(array('expiretime' => 100), true),
- array(array('prefix' => 'session', 'expiretime' => 200), true),
- array(array('expiretime' => 100, 'foo' => 'bar'), false),
- );
+ return [
+ [['prefix' => 'session'], true],
+ [['expiretime' => 100], true],
+ [['prefix' => 'session', 'expiretime' => 200], true],
+ [['expiretime' => 100, 'foo' => 'bar'], false],
+ ];
}
public function testGetConnection()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php
index 1c0f3ca6..6dc5b0cb 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php
@@ -38,11 +38,11 @@ class MigratingSessionHandlerTest extends TestCase
{
$this->currentHandler->expects($this->once())
->method('close')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('close')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->close();
@@ -56,12 +56,12 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('destroy')
->with($sessionId)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('destroy')
->with($sessionId)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->destroy($sessionId);
@@ -75,12 +75,12 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('gc')
->with($maxlifetime)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('gc')
->with($maxlifetime)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->gc($maxlifetime);
$this->assertTrue($result);
@@ -94,12 +94,12 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('open')
->with($savePath, $sessionName)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('open')
->with($savePath, $sessionName)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->open($savePath, $sessionName);
@@ -114,7 +114,7 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('read')
->with($sessionId)
- ->will($this->returnValue($readValue));
+ ->willReturn($readValue);
$this->writeOnlyHandler->expects($this->never())
->method('read')
@@ -133,12 +133,12 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('write')
->with($sessionId, $data)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('write')
->with($sessionId, $data)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->write($sessionId, $data);
@@ -153,7 +153,7 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('read')
->with($sessionId)
- ->will($this->returnValue($readValue));
+ ->willReturn($readValue);
$this->writeOnlyHandler->expects($this->never())
->method('read')
@@ -172,12 +172,12 @@ class MigratingSessionHandlerTest extends TestCase
$this->currentHandler->expects($this->once())
->method('write')
->with($sessionId, $data)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->writeOnlyHandler->expects($this->once())
->method('write')
->with($sessionId, $data)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$result = $this->dualHandler->updateTimestamp($sessionId, $data);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
index c585fd4f..5fcdad9b 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
@@ -40,14 +40,14 @@ class MongoDbSessionHandlerTest extends TestCase
->disableOriginalConstructor()
->getMock();
- $this->options = array(
+ $this->options = [
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
'expiry_field' => 'expires_at',
'database' => 'sf-test',
'collection' => 'session-test',
- );
+ ];
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
}
@@ -57,7 +57,7 @@ class MongoDbSessionHandlerTest extends TestCase
*/
public function testConstructorShouldThrowExceptionForMissingOptions()
{
- new MongoDbSessionHandler($this->mongo, array());
+ new MongoDbSessionHandler($this->mongo, []);
}
public function testOpenMethodAlwaysReturnTrue()
@@ -77,7 +77,7 @@ class MongoDbSessionHandlerTest extends TestCase
$this->mongo->expects($this->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
+ ->willReturn($collection);
// defining the timeout before the actual method call
// allows to test for "greater than" values in the $criteria
@@ -85,7 +85,7 @@ class MongoDbSessionHandlerTest extends TestCase
$collection->expects($this->once())
->method('findOne')
- ->will($this->returnCallback(function ($criteria) use ($testTimeout) {
+ ->willReturnCallback(function ($criteria) use ($testTimeout) {
$this->assertArrayHasKey($this->options['id_field'], $criteria);
$this->assertEquals($criteria[$this->options['id_field']], 'foo');
@@ -95,12 +95,12 @@ class MongoDbSessionHandlerTest extends TestCase
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$gte']);
$this->assertGreaterThanOrEqual(round((string) $criteria[$this->options['expiry_field']]['$gte'] / 1000), $testTimeout);
- return array(
+ return [
$this->options['id_field'] => 'foo',
$this->options['expiry_field'] => new \MongoDB\BSON\UTCDateTime(),
$this->options['data_field'] => new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
- );
- }));
+ ];
+ });
$this->assertEquals('bar', $this->storage->read('foo'));
}
@@ -112,13 +112,13 @@ class MongoDbSessionHandlerTest extends TestCase
$this->mongo->expects($this->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
+ ->willReturn($collection);
$collection->expects($this->once())
->method('updateOne')
- ->will($this->returnCallback(function ($criteria, $updateData, $options) {
- $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria);
- $this->assertEquals(array('upsert' => true), $options);
+ ->willReturnCallback(function ($criteria, $updateData, $options) {
+ $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria);
+ $this->assertEquals(['upsert' => true], $options);
$data = $updateData['$set'];
$expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime');
@@ -127,7 +127,7 @@ class MongoDbSessionHandlerTest extends TestCase
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['time_field']]);
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $data[$this->options['expiry_field']]);
$this->assertGreaterThanOrEqual($expectedExpiry, round((string) $data[$this->options['expiry_field']] / 1000));
- }));
+ });
$this->assertTrue($this->storage->write('foo', 'bar'));
}
@@ -139,15 +139,15 @@ class MongoDbSessionHandlerTest extends TestCase
$this->mongo->expects($this->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
+ ->willReturn($collection);
- $data = array();
+ $data = [];
$collection->expects($this->exactly(2))
->method('updateOne')
- ->will($this->returnCallback(function ($criteria, $updateData, $options) use (&$data) {
+ ->willReturnCallback(function ($criteria, $updateData, $options) use (&$data) {
$data = $updateData;
- }));
+ });
$this->storage->write('foo', 'bar');
$this->storage->write('foo', 'foobar');
@@ -162,11 +162,11 @@ class MongoDbSessionHandlerTest extends TestCase
$this->mongo->expects($this->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
+ ->willReturn($collection);
$collection->expects($this->once())
->method('deleteOne')
- ->with(array($this->options['id_field'] => 'foo'));
+ ->with([$this->options['id_field'] => 'foo']);
$this->assertTrue($this->storage->destroy('foo'));
}
@@ -178,14 +178,14 @@ class MongoDbSessionHandlerTest extends TestCase
$this->mongo->expects($this->once())
->method('selectCollection')
->with($this->options['database'], $this->options['collection'])
- ->will($this->returnValue($collection));
+ ->willReturn($collection);
$collection->expects($this->once())
->method('deleteMany')
- ->will($this->returnCallback(function ($criteria) {
+ ->willReturnCallback(function ($criteria) {
$this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$lt']);
$this->assertGreaterThanOrEqual(time() - 1, round((string) $criteria[$this->options['expiry_field']]['$lt'] / 1000));
- }));
+ });
$this->assertTrue($this->storage->gc(1));
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
index 95e725f4..e227bebf 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -27,7 +27,7 @@ class NativeFileSessionHandlerTest extends TestCase
{
public function testConstruct()
{
- $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir()));
+ $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir()));
$this->assertEquals('user', ini_get('session.save_handler'));
@@ -51,11 +51,11 @@ class NativeFileSessionHandlerTest extends TestCase
{
$base = sys_get_temp_dir();
- return array(
- array("$base/foo", "$base/foo", "$base/foo"),
- array("5;$base/foo", "5;$base/foo", "$base/foo"),
- array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"),
- );
+ return [
+ ["$base/foo", "$base/foo", "$base/foo"],
+ ["5;$base/foo", "5;$base/foo", "$base/foo"],
+ ["5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"],
+ ];
}
/**
@@ -69,7 +69,7 @@ class NativeFileSessionHandlerTest extends TestCase
public function testConstructDefault()
{
$path = ini_get('session.save_path');
- $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler());
+ $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler());
$this->assertEquals($path, ini_get('session.save_path'));
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
index 9a2212b8..0d246e1a 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php
@@ -54,6 +54,6 @@ class NullSessionHandlerTest extends TestCase
public function getStorage()
{
- return new NativeSessionStorage(array(), new NullSessionHandler());
+ return new NativeSessionStorage([], new NullSessionHandler());
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
index 0edda00a..380b4d7d 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -64,7 +64,7 @@ class PdoSessionHandlerTest extends TestCase
*/
public function testInexistentTable()
{
- $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), array('db_table' => 'inexistent_table'));
+ $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), ['db_table' => 'inexistent_table']);
$storage->open('', 'sid');
$storage->read('id');
$storage->write('id', 'data');
@@ -143,7 +143,7 @@ class PdoSessionHandlerTest extends TestCase
$stream = $this->createStream($content);
$pdo->prepareResult->expects($this->once())->method('fetchAll')
- ->will($this->returnValue(array(array($stream, 42, time()))));
+ ->willReturn([[$stream, 42, time()]]);
$storage = new PdoSessionHandler($pdo);
$result = $storage->read('foo');
@@ -170,14 +170,14 @@ class PdoSessionHandlerTest extends TestCase
$exception = null;
$selectStmt->expects($this->atLeast(2))->method('fetchAll')
- ->will($this->returnCallback(function () use (&$exception, $stream) {
- return $exception ? array(array($stream, 42, time())) : array();
- }));
+ ->willReturnCallback(function () use (&$exception, $stream) {
+ return $exception ? [[$stream, 42, time()]] : [];
+ });
$insertStmt->expects($this->once())->method('execute')
- ->will($this->returnCallback(function () use (&$exception) {
+ ->willReturnCallback(function () use (&$exception) {
throw $exception = new \PDOException('', '23');
- }));
+ });
$storage = new PdoSessionHandler($pdo);
$result = $storage->read('foo');
@@ -337,19 +337,19 @@ class PdoSessionHandlerTest extends TestCase
public function provideUrlDsnPairs()
{
- yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;');
- yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;');
- yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd');
- yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;');
- yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;');
- yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd');
- yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test');
- yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test');
- yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test');
- yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test');
- yield array('sqlite://localhost/:memory:', 'sqlite::memory:');
- yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test');
- yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test');
+ yield ['mysql://localhost/test', 'mysql:host=localhost;dbname=test;'];
+ yield ['mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;'];
+ yield ['mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd'];
+ yield ['postgres://localhost/test', 'pgsql:host=localhost;dbname=test;'];
+ yield ['postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;'];
+ yield ['postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd'];
+ yield 'sqlite relative path' => ['sqlite://localhost/tmp/test', 'sqlite:tmp/test'];
+ yield 'sqlite absolute path' => ['sqlite://localhost//tmp/test', 'sqlite:/tmp/test'];
+ yield 'sqlite relative path without host' => ['sqlite:///tmp/test', 'sqlite:tmp/test'];
+ yield 'sqlite absolute path without host' => ['sqlite3:////tmp/test', 'sqlite:/tmp/test'];
+ yield ['sqlite://localhost/:memory:', 'sqlite::memory:'];
+ yield ['mssql://localhost/test', 'sqlsrv:server=localhost;Database=test'];
+ yield ['mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test'];
}
private function createStream($content)
@@ -387,7 +387,7 @@ class MockPdo extends \PDO
return parent::getAttribute($attribute);
}
- public function prepare($statement, $driverOptions = array())
+ public function prepare($statement, $driverOptions = [])
{
return \is_callable($this->prepareResult)
? ($this->prepareResult)($statement, $driverOptions)
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php
index 45810010..622b42da 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php
@@ -17,6 +17,6 @@ class PredisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCas
{
protected function createRedisClient(string $host): Client
{
- return new Client(array(array('host' => $host)));
+ return new Client([['host' => $host]]);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php
index a9db4eb1..5ecab116 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php
@@ -17,6 +17,6 @@ class PredisSessionHandlerTest extends AbstractRedisSessionHandlerTestCase
{
protected function createRedisClient(string $host): Client
{
- return new Client(array('host' => $host));
+ return new Client(['host' => $host]);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php
index d263e18f..b03a3723 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php
@@ -15,6 +15,6 @@ class RedisArraySessionHandlerTest extends AbstractRedisSessionHandlerTestCase
{
protected function createRedisClient(string $host): \RedisArray
{
- return new \RedisArray(array($host));
+ return new \RedisArray([$host]);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
index b02c41ae..6a0d1687 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
@@ -84,7 +84,7 @@ class StrictSessionHandlerTest extends TestCase
{
$handler = $this->getMockBuilder('SessionHandlerInterface')->getMock();
$handler->expects($this->exactly(2))->method('read')
- ->withConsecutive(array('id1'), array('id2'))
+ ->withConsecutive(['id1'], ['id2'])
->will($this->onConsecutiveCalls('data1', 'data2'));
$proxy = new StrictSessionHandler($handler);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
index 69cf6163..2c4758b9 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php
@@ -26,26 +26,26 @@ class MetadataBagTest extends TestCase
*/
protected $bag;
- protected $array = array();
+ protected $array = [];
protected function setUp()
{
parent::setUp();
$this->bag = new MetadataBag();
- $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0);
+ $this->array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0];
$this->bag->initialize($this->array);
}
protected function tearDown()
{
- $this->array = array();
+ $this->array = [];
$this->bag = null;
parent::tearDown();
}
public function testInitialize()
{
- $sessionMetadata = array();
+ $sessionMetadata = [];
$bag1 = new MetadataBag();
$bag1->initialize($sessionMetadata);
@@ -82,7 +82,7 @@ class MetadataBagTest extends TestCase
public function testGetLifetime()
{
$bag = new MetadataBag();
- $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000);
+ $array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000];
$bag->initialize($array);
$this->assertEquals(1000, $bag->getLifetime());
}
@@ -111,11 +111,11 @@ class MetadataBagTest extends TestCase
$timeStamp = time();
$created = $timeStamp - 15;
- $sessionMetadata = array(
+ $sessionMetadata = [
MetadataBag::CREATED => $created,
MetadataBag::UPDATED => $created,
MetadataBag::LIFETIME => 1000,
- );
+ ];
$bag->initialize($sessionMetadata);
$this->assertEquals($created, $sessionMetadata[MetadataBag::UPDATED]);
@@ -127,11 +127,11 @@ class MetadataBagTest extends TestCase
$timeStamp = time();
$created = $timeStamp - 45;
- $sessionMetadata = array(
+ $sessionMetadata = [
MetadataBag::CREATED => $created,
MetadataBag::UPDATED => $created,
MetadataBag::LIFETIME => 1000,
- );
+ ];
$bag->initialize($sessionMetadata);
$this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
index 893e120c..2e3024ef 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php
@@ -45,10 +45,10 @@ class MockArraySessionStorageTest extends TestCase
$this->attributes = new AttributeBag();
$this->flashes = new FlashBag();
- $this->data = array(
- $this->attributes->getStorageKey() => array('foo' => 'bar'),
- $this->flashes->getStorageKey() => array('notice' => 'hello'),
- );
+ $this->data = [
+ $this->attributes->getStorageKey() => ['foo' => 'bar'],
+ $this->flashes->getStorageKey() => ['notice' => 'hello'],
+ ];
$this->storage = new MockArraySessionStorage();
$this->storage->registerBag($this->flashes);
@@ -80,14 +80,14 @@ class MockArraySessionStorageTest extends TestCase
$id = $this->storage->getId();
$this->storage->regenerate();
$this->assertNotEquals($id, $this->storage->getId());
- $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
- $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
+ $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all());
+ $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll());
$id = $this->storage->getId();
$this->storage->regenerate(true);
$this->assertNotEquals($id, $this->storage->getId());
- $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all());
- $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll());
+ $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all());
+ $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll());
}
public function testGetId()
@@ -101,8 +101,8 @@ class MockArraySessionStorageTest extends TestCase
{
$this->storage->clear();
- $this->assertSame(array(), $this->storage->getBag('attributes')->all());
- $this->assertSame(array(), $this->storage->getBag('flashes')->peekAll());
+ $this->assertSame([], $this->storage->getBag('attributes')->all());
+ $this->assertSame([], $this->storage->getBag('flashes')->peekAll());
}
public function testClearStartsSession()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php
index f8394d8c..062769e2 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php
@@ -91,7 +91,7 @@ class MockFileSessionStorageTest extends TestCase
$storage->start();
$this->assertEquals('108', $storage->getBag('attributes')->get('new'));
$this->assertTrue($storage->getBag('flashes')->has('newkey'));
- $this->assertEquals(array('test'), $storage->getBag('flashes')->peek('newkey'));
+ $this->assertEquals(['test'], $storage->getBag('flashes')->peek('newkey'));
}
public function testMultipleInstances()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 8ce703b3..d97973e2 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -56,7 +56,7 @@ class NativeSessionStorageTest extends TestCase
/**
* @return NativeSessionStorage
*/
- protected function getStorage(array $options = array())
+ protected function getStorage(array $options = [])
{
$storage = new NativeSessionStorage($options);
$storage->registerBag(new AttributeBag());
@@ -157,19 +157,19 @@ class NativeSessionStorageTest extends TestCase
{
$this->iniSet('session.cache_limiter', 'nocache');
- $storage = new NativeSessionStorage(array('cache_limiter' => 'public'));
+ $storage = new NativeSessionStorage(['cache_limiter' => 'public']);
$this->assertEquals('public', ini_get('session.cache_limiter'));
}
public function testCookieOptions()
{
- $options = array(
+ $options = [
'cookie_lifetime' => 123456,
'cookie_path' => '/my/cookie/path',
'cookie_domain' => 'symfony.example.com',
'cookie_secure' => true,
'cookie_httponly' => false,
- );
+ ];
if (\PHP_VERSION_ID >= 70300) {
$options['cookie_samesite'] = 'lax';
@@ -177,7 +177,7 @@ class NativeSessionStorageTest extends TestCase
$this->getStorage($options);
$temp = session_get_cookie_params();
- $gco = array();
+ $gco = [];
foreach ($temp as $key => $value) {
$gco['cookie_'.$key] = $value;
@@ -192,10 +192,10 @@ class NativeSessionStorageTest extends TestCase
$this->markTestSkipped('HHVM is not handled in this test case.');
}
- $options = array(
+ $options = [
'url_rewriter.tags' => 'a=href',
'cache_expire' => '200',
- );
+ ];
$this->getStorage($options);
@@ -276,9 +276,9 @@ class NativeSessionStorageTest extends TestCase
public function testSetSessionOptionsOnceSessionStartedIsIgnored()
{
session_start();
- $this->getStorage(array(
+ $this->getStorage([
'name' => 'something-else',
- ));
+ ]);
// Assert no exception has been thrown by `getStorage()`
$this->addToAssertionCount(1);
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
index a5a85614..43324002 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
@@ -86,10 +86,10 @@ class PhpBridgeSessionStorageTest extends TestCase
$_SESSION['drak'] = 'loves symfony';
$storage->getBag('attributes')->set('symfony', 'greatness');
$key = $storage->getBag('attributes')->getStorageKey();
- $this->assertEquals($_SESSION[$key], array('symfony' => 'greatness'));
+ $this->assertEquals($_SESSION[$key], ['symfony' => 'greatness']);
$this->assertEquals($_SESSION['drak'], 'loves symfony');
$storage->clear();
- $this->assertEquals($_SESSION[$key], array());
+ $this->assertEquals($_SESSION[$key], []);
$this->assertEquals($_SESSION['drak'], 'loves symfony');
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
index 0b48250e..b6e0da99 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -50,7 +50,7 @@ class SessionHandlerProxyTest extends TestCase
{
$this->mock->expects($this->once())
->method('open')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertFalse($this->proxy->isActive());
$this->proxy->open('name', 'id');
@@ -61,7 +61,7 @@ class SessionHandlerProxyTest extends TestCase
{
$this->mock->expects($this->once())
->method('open')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->proxy->isActive());
$this->proxy->open('name', 'id');
@@ -72,7 +72,7 @@ class SessionHandlerProxyTest extends TestCase
{
$this->mock->expects($this->once())
->method('close')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->assertFalse($this->proxy->isActive());
$this->proxy->close();
@@ -83,7 +83,7 @@ class SessionHandlerProxyTest extends TestCase
{
$this->mock->expects($this->once())
->method('close')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->assertFalse($this->proxy->isActive());
$this->proxy->close();
@@ -127,7 +127,7 @@ class SessionHandlerProxyTest extends TestCase
*/
public function testValidateId()
{
- $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
+ $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock();
$mock->expects($this->once())
->method('validateId');
@@ -142,7 +142,7 @@ class SessionHandlerProxyTest extends TestCase
*/
public function testUpdateTimestamp()
{
- $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock();
+ $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock();
$mock->expects($this->once())
->method('updateTimestamp');
diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
index 699222e3..62dfc9bc 100644
--- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
+++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php
@@ -19,7 +19,7 @@ class StreamedResponseTest extends TestCase
{
public function testConstructor()
{
- $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain'));
+ $response = new StreamedResponse(function () { echo 'foo'; }, 404, ['Content-Type' => 'text/plain']);
$this->assertEquals(404, $response->getStatusCode());
$this->assertEquals('text/plain', $response->headers->get('Content-Type'));
@@ -51,7 +51,7 @@ class StreamedResponseTest extends TestCase
public function testPrepareWithHeadRequest()
{
- $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123'));
+ $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Content-Length' => '123']);
$request = Request::create('/', 'HEAD');
$response->prepare($request);
@@ -61,7 +61,7 @@ class StreamedResponseTest extends TestCase
public function testPrepareWithCacheHeaders()
{
- $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public'));
+ $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Cache-Control' => 'max-age=600, public']);
$request = Request::create('/', 'GET');
$response->prepare($request);
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/RequestAttributeValueSameTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/RequestAttributeValueSameTest.php
new file mode 100644
index 00000000..eca8aed2
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/RequestAttributeValueSameTest.php
@@ -0,0 +1,41 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Test\Constraint\RequestAttributeValueSame;
+
+class RequestAttributeValueSameTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $request = new Request();
+ $request->attributes->set('foo', 'bar');
+ $constraint = new RequestAttributeValueSame('foo', 'bar');
+ $this->assertTrue($constraint->evaluate($request, '', true));
+ $constraint = new RequestAttributeValueSame('bar', 'foo');
+ $this->assertFalse($constraint->evaluate($request, '', true));
+
+ try {
+ $constraint->evaluate($request);
+ } catch (ExpectationFailedException $e) {
+ $this->assertEquals("Failed asserting that the Request has attribute \"bar\" with value \"foo\".\n", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseCookieValueSameTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseCookieValueSameTest.php
new file mode 100644
index 00000000..778879c3
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseCookieValueSameTest.php
@@ -0,0 +1,44 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Cookie;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseCookieValueSame;
+
+class ResponseCookieValueSameTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $response = new Response();
+ $response->headers->setCookie(Cookie::create('foo', 'bar', 0, '/path'));
+ $constraint = new ResponseCookieValueSame('foo', 'bar', '/path');
+ $this->assertTrue($constraint->evaluate($response, '', true));
+ $constraint = new ResponseCookieValueSame('foo', 'bar', '/path');
+ $this->assertTrue($constraint->evaluate($response, '', true));
+ $constraint = new ResponseCookieValueSame('foo', 'babar', '/path');
+ $this->assertFalse($constraint->evaluate($response, '', true));
+
+ try {
+ $constraint->evaluate($response);
+ } catch (ExpectationFailedException $e) {
+ $this->assertEquals("Failed asserting that the Response has cookie \"foo\" with path \"/path\" with value \"babar\".\n", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasCookieTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasCookieTest.php
new file mode 100644
index 00000000..05ca95fb
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasCookieTest.php
@@ -0,0 +1,42 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Cookie;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseHasCookie;
+
+class ResponseHasCookieTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $response = new Response();
+ $response->headers->setCookie(Cookie::create('foo', 'bar'));
+ $constraint = new ResponseHasCookie('foo');
+ $this->assertTrue($constraint->evaluate($response, '', true));
+ $constraint = new ResponseHasCookie('bar');
+ $this->assertFalse($constraint->evaluate($response, '', true));
+
+ try {
+ $constraint->evaluate($response);
+ } catch (ExpectationFailedException $e) {
+ $this->assertEquals("Failed asserting that the Response has cookie \"bar\".\n", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasHeaderTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasHeaderTest.php
new file mode 100644
index 00000000..7b811a64
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHasHeaderTest.php
@@ -0,0 +1,39 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseHasHeader;
+
+class ResponseHasHeaderTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $constraint = new ResponseHasHeader('Date');
+ $this->assertTrue($constraint->evaluate(new Response(), '', true));
+ $constraint = new ResponseHasHeader('X-Date');
+ $this->assertFalse($constraint->evaluate(new Response(), '', true));
+
+ try {
+ $constraint->evaluate(new Response());
+ } catch (ExpectationFailedException $e) {
+ $this->assertEquals("Failed asserting that the Response has header \"X-Date\".\n", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHeaderSameTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHeaderSameTest.php
new file mode 100644
index 00000000..d527f35d
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseHeaderSameTest.php
@@ -0,0 +1,39 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseHeaderSame;
+
+class ResponseHeaderSameTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $constraint = new ResponseHeaderSame('Cache-Control', 'no-cache, private');
+ $this->assertTrue($constraint->evaluate(new Response(), '', true));
+ $constraint = new ResponseHeaderSame('Cache-Control', 'public');
+ $this->assertFalse($constraint->evaluate(new Response(), '', true));
+
+ try {
+ $constraint->evaluate(new Response());
+ } catch (ExpectationFailedException $e) {
+ $this->assertEquals("Failed asserting that the Response has header \"Cache-Control\" with value \"public\".\n", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsRedirectedTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsRedirectedTest.php
new file mode 100644
index 00000000..a3a46063
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsRedirectedTest.php
@@ -0,0 +1,39 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsRedirected;
+
+class ResponseIsRedirectedTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $constraint = new ResponseIsRedirected();
+
+ $this->assertTrue($constraint->evaluate(new Response('', 301), '', true));
+ $this->assertFalse($constraint->evaluate(new Response(), '', true));
+
+ try {
+ $constraint->evaluate(new Response());
+ } catch (ExpectationFailedException $e) {
+ $this->assertContains("Failed asserting that the Response is redirected.\nHTTP/1.0 200 OK", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsSuccessfulTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsSuccessfulTest.php
new file mode 100644
index 00000000..0c99a5e4
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseIsSuccessfulTest.php
@@ -0,0 +1,39 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseIsSuccessful;
+
+class ResponseIsSuccessfulTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $constraint = new ResponseIsSuccessful();
+
+ $this->assertTrue($constraint->evaluate(new Response(), '', true));
+ $this->assertFalse($constraint->evaluate(new Response('', 404), '', true));
+
+ try {
+ $constraint->evaluate(new Response('', 404));
+ } catch (ExpectationFailedException $e) {
+ $this->assertContains("Failed asserting that the Response is successful.\nHTTP/1.0 404 Not Found", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseStatusCodeSameTest.php b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseStatusCodeSameTest.php
new file mode 100644
index 00000000..3e15e906
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Test/Constraint/ResponseStatusCodeSameTest.php
@@ -0,0 +1,41 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests\Test\Constraint;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestFailure;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\HttpFoundation\Test\Constraint\ResponseStatusCodeSame;
+
+class ResponseStatusCodeSameTest extends TestCase
+{
+ public function testConstraint(): void
+ {
+ $constraint = new ResponseStatusCodeSame(200);
+ $this->assertTrue($constraint->evaluate(new Response(), '', true));
+ $this->assertFalse($constraint->evaluate(new Response('', 404), '', true));
+ $constraint = new ResponseStatusCodeSame(404);
+ $this->assertTrue($constraint->evaluate(new Response('', 404), '', true));
+
+ $constraint = new ResponseStatusCodeSame(200);
+ try {
+ $constraint->evaluate(new Response('', 404));
+ } catch (ExpectationFailedException $e) {
+ $this->assertContains("Failed asserting that the Response status code is 200.\nHTTP/1.0 404 Not Found", TestFailure::exceptionToString($e));
+
+ return;
+ }
+
+ $this->fail();
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/UrlHelperTest.php b/vendor/symfony/http-foundation/Tests/UrlHelperTest.php
new file mode 100644
index 00000000..9a750bd8
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/UrlHelperTest.php
@@ -0,0 +1,143 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\HttpFoundation\UrlHelper;
+use Symfony\Component\Routing\RequestContext;
+
+class UrlHelperTest extends TestCase
+{
+ /**
+ * @dataProvider getGenerateAbsoluteUrlData()
+ */
+ public function testGenerateAbsoluteUrl($expected, $path, $pathinfo)
+ {
+ $stack = new RequestStack();
+ $stack->push(Request::create($pathinfo));
+ $helper = new UrlHelper($stack);
+
+ $this->assertEquals($expected, $helper->getAbsoluteUrl($path));
+ }
+
+ public function getGenerateAbsoluteUrlData()
+ {
+ return [
+ ['http://localhost/foo.png', '/foo.png', '/foo/bar.html'],
+ ['http://localhost/foo/foo.png', 'foo.png', '/foo/bar.html'],
+ ['http://localhost/foo/foo.png', 'foo.png', '/foo/bar'],
+ ['http://localhost/foo/bar/foo.png', 'foo.png', '/foo/bar/'],
+
+ ['http://example.com/baz', 'http://example.com/baz', '/'],
+ ['https://example.com/baz', 'https://example.com/baz', '/'],
+ ['//example.com/baz', '//example.com/baz', '/'],
+
+ ['http://localhost/foo/bar?baz', '?baz', '/foo/bar'],
+ ['http://localhost/foo/bar?baz=1', '?baz=1', '/foo/bar?foo=1'],
+ ['http://localhost/foo/baz?baz=1', 'baz?baz=1', '/foo/bar?foo=1'],
+
+ ['http://localhost/foo/bar#baz', '#baz', '/foo/bar'],
+ ['http://localhost/foo/bar?0#baz', '#baz', '/foo/bar?0'],
+ ['http://localhost/foo/bar?baz=1#baz', '?baz=1#baz', '/foo/bar?foo=1'],
+ ['http://localhost/foo/baz?baz=1#baz', 'baz?baz=1#baz', '/foo/bar?foo=1'],
+ ];
+ }
+
+ /**
+ * @dataProvider getGenerateAbsoluteUrlRequestContextData
+ */
+ public function testGenerateAbsoluteUrlWithRequestContext($path, $baseUrl, $host, $scheme, $httpPort, $httpsPort, $expected)
+ {
+ if (!class_exists('Symfony\Component\Routing\RequestContext')) {
+ $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.');
+ }
+
+ $requestContext = new RequestContext($baseUrl, 'GET', $host, $scheme, $httpPort, $httpsPort, $path);
+ $helper = new UrlHelper(new RequestStack(), $requestContext);
+
+ $this->assertEquals($expected, $helper->getAbsoluteUrl($path));
+ }
+
+ /**
+ * @dataProvider getGenerateAbsoluteUrlRequestContextData
+ */
+ public function testGenerateAbsoluteUrlWithoutRequestAndRequestContext($path)
+ {
+ if (!class_exists('Symfony\Component\Routing\RequestContext')) {
+ $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.');
+ }
+
+ $helper = new UrlHelper(new RequestStack());
+
+ $this->assertEquals($path, $helper->getAbsoluteUrl($path));
+ }
+
+ public function getGenerateAbsoluteUrlRequestContextData()
+ {
+ return [
+ ['/foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo.png'],
+ ['foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo/foo.png'],
+ ['foo.png', '/foo/bar/', 'localhost', 'http', 80, 443, 'http://localhost/foo/bar/foo.png'],
+ ['/foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo.png'],
+ ['foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo/foo.png'],
+ ['foo.png', '/foo/bar/', 'localhost', 'https', 80, 443, 'https://localhost/foo/bar/foo.png'],
+ ['/foo.png', '/foo', 'localhost', 'http', 443, 80, 'http://localhost:443/foo.png'],
+ ['/foo.png', '/foo', 'localhost', 'https', 443, 80, 'https://localhost:80/foo.png'],
+ ];
+ }
+
+ public function testGenerateAbsoluteUrlWithScriptFileName()
+ {
+ $request = Request::create('http://localhost/app/web/app_dev.php');
+ $request->server->set('SCRIPT_FILENAME', '/var/www/app/web/app_dev.php');
+
+ $stack = new RequestStack();
+ $stack->push($request);
+ $helper = new UrlHelper($stack);
+
+ $this->assertEquals(
+ 'http://localhost/app/web/bundles/framework/css/structure.css',
+ $helper->getAbsoluteUrl('/app/web/bundles/framework/css/structure.css')
+ );
+ }
+
+ /**
+ * @dataProvider getGenerateRelativePathData()
+ */
+ public function testGenerateRelativePath($expected, $path, $pathinfo)
+ {
+ if (!method_exists('Symfony\Component\HttpFoundation\Request', 'getRelativeUriForPath')) {
+ $this->markTestSkipped('Your version of Symfony HttpFoundation is too old.');
+ }
+
+ $stack = new RequestStack();
+ $stack->push(Request::create($pathinfo));
+ $urlHelper = new UrlHelper($stack);
+
+ $this->assertEquals($expected, $urlHelper->getRelativePath($path));
+ }
+
+ public function getGenerateRelativePathData()
+ {
+ return [
+ ['../foo.png', '/foo.png', '/foo/bar.html'],
+ ['../baz/foo.png', '/baz/foo.png', '/foo/bar.html'],
+ ['baz/foo.png', 'baz/foo.png', '/foo/bar.html'],
+
+ ['http://example.com/baz', 'http://example.com/baz', '/'],
+ ['https://example.com/baz', 'https://example.com/baz', '/'],
+ ['//example.com/baz', '//example.com/baz', '/'],
+ ];
+ }
+}
diff --git a/vendor/symfony/http-foundation/UrlHelper.php b/vendor/symfony/http-foundation/UrlHelper.php
new file mode 100644
index 00000000..3c06e932
--- /dev/null
+++ b/vendor/symfony/http-foundation/UrlHelper.php
@@ -0,0 +1,102 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation;
+
+use Symfony\Component\Routing\RequestContext;
+
+/**
+ * A helper service for manipulating URLs within and outside the request scope.
+ *
+ * @author Valentin Udaltsov
+ */
+final class UrlHelper
+{
+ private $requestStack;
+ private $requestContext;
+
+ public function __construct(RequestStack $requestStack, ?RequestContext $requestContext = null)
+ {
+ $this->requestStack = $requestStack;
+ $this->requestContext = $requestContext;
+ }
+
+ public function getAbsoluteUrl(string $path): string
+ {
+ if (false !== strpos($path, '://') || '//' === substr($path, 0, 2)) {
+ return $path;
+ }
+
+ if (null === $request = $this->requestStack->getMasterRequest()) {
+ return $this->getAbsoluteUrlFromContext($path);
+ }
+
+ if ('#' === $path[0]) {
+ $path = $request->getRequestUri().$path;
+ } elseif ('?' === $path[0]) {
+ $path = $request->getPathInfo().$path;
+ }
+
+ if (!$path || '/' !== $path[0]) {
+ $prefix = $request->getPathInfo();
+ $last = \strlen($prefix) - 1;
+ if ($last !== $pos = strrpos($prefix, '/')) {
+ $prefix = substr($prefix, 0, $pos).'/';
+ }
+
+ return $request->getUriForPath($prefix.$path);
+ }
+
+ return $request->getSchemeAndHttpHost().$path;
+ }
+
+ public function getRelativePath(string $path): string
+ {
+ if (false !== strpos($path, '://') || '//' === substr($path, 0, 2)) {
+ return $path;
+ }
+
+ if (null === $request = $this->requestStack->getMasterRequest()) {
+ return $path;
+ }
+
+ return $request->getRelativeUriForPath($path);
+ }
+
+ private function getAbsoluteUrlFromContext(string $path): string
+ {
+ if (null === $this->requestContext || '' === $host = $this->requestContext->getHost()) {
+ return $path;
+ }
+
+ $scheme = $this->requestContext->getScheme();
+ $port = '';
+
+ if ('http' === $scheme && 80 !== $this->requestContext->getHttpPort()) {
+ $port = ':'.$this->requestContext->getHttpPort();
+ } elseif ('https' === $scheme && 443 !== $this->requestContext->getHttpsPort()) {
+ $port = ':'.$this->requestContext->getHttpsPort();
+ }
+
+ if ('#' === $path[0]) {
+ $queryString = $this->requestContext->getQueryString();
+ $path = $this->requestContext->getPathInfo().($queryString ? '?'.$queryString : '').$path;
+ } elseif ('?' === $path[0]) {
+ $path = $this->requestContext->getPathInfo().$path;
+ }
+
+ if ('/' !== $path[0]) {
+ $path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path;
+ }
+
+ return $scheme.'://'.$host.$port.$path;
+ }
+}
diff --git a/vendor/symfony/http-foundation/composer.json b/vendor/symfony/http-foundation/composer.json
index 76381a7c..f3097511 100644
--- a/vendor/symfony/http-foundation/composer.json
+++ b/vendor/symfony/http-foundation/composer.json
@@ -17,6 +17,7 @@
],
"require": {
"php": "^7.1.3",
+ "symfony/mime": "^4.3",
"symfony/polyfill-mbstring": "~1.1"
},
"require-dev": {
@@ -32,7 +33,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
}
}
diff --git a/vendor/symfony/http-kernel/CHANGELOG.md b/vendor/symfony/http-kernel/CHANGELOG.md
index b96b4aef..b1a5f510 100644
--- a/vendor/symfony/http-kernel/CHANGELOG.md
+++ b/vendor/symfony/http-kernel/CHANGELOG.md
@@ -1,6 +1,31 @@
CHANGELOG
=========
+4.3.0
+-----
+
+ * renamed `Client` to `HttpKernelBrowser`
+ * `KernelInterface` doesn't extend `Serializable` anymore
+ * deprecated the `Kernel::serialize()` and `unserialize()` methods
+ * increased the priority of `Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener`
+ * made `Symfony\Component\HttpKernel\EventListener\LocaleListener` set the default locale early
+ * deprecated `TranslatorListener` in favor of `LocaleAwareListener`
+ * added the registration of all `LocaleAwareInterface` implementations into the `LocaleAwareListener`
+ * made `FileLinkFormatter` final and not implement `Serializable` anymore
+ * the base `DataCollector` doesn't implement `Serializable` anymore, you should
+ store all the serialized state in the data property instead
+ * `DumpDataCollector` has been marked as `final`
+ * added an event listener to prevent search engines from indexing applications in debug mode.
+ * renamed `FilterControllerArgumentsEvent` to `ControllerArgumentsEvent`
+ * renamed `FilterControllerEvent` to `ControllerEvent`
+ * renamed `FilterResponseEvent` to `ResponseEvent`
+ * renamed `GetResponseEvent` to `RequestEvent`
+ * renamed `GetResponseForControllerResultEvent` to `ViewEvent`
+ * renamed `GetResponseForExceptionEvent` to `ExceptionEvent`
+ * renamed `PostResponseEvent` to `TerminateEvent`
+ * added `HttpClientKernel` for handling requests with an `HttpClientInterface` instance
+ * added `trace_header` and `trace_level` configuration options to `HttpCache`
+
4.2.0
-----
diff --git a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php
index a646119d..5061a8d1 100644
--- a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php
+++ b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php
@@ -22,7 +22,7 @@ class ChainCacheClearer implements CacheClearerInterface
{
private $clearers;
- public function __construct(iterable $clearers = array())
+ public function __construct(iterable $clearers = [])
{
$this->clearers = $clearers;
}
diff --git a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php
index d7db0270..47a6ece5 100644
--- a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php
+++ b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php
@@ -16,9 +16,9 @@ namespace Symfony\Component\HttpKernel\CacheClearer;
*/
class Psr6CacheClearer implements CacheClearerInterface
{
- private $pools = array();
+ private $pools = [];
- public function __construct(array $pools = array())
+ public function __construct(array $pools = [])
{
$this->pools = $pools;
}
diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php
index 171b3859..dd527708 100644
--- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php
+++ b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php
@@ -26,7 +26,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
private $optionalsEnabled = false;
private $onlyOptionalsEnabled = false;
- public function __construct(iterable $warmers = array(), bool $debug = false, string $deprecationLogsFilepath = null)
+ public function __construct(iterable $warmers = [], bool $debug = false, string $deprecationLogsFilepath = null)
{
$this->warmers = $warmers;
$this->debug = $debug;
@@ -51,7 +51,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
public function warmUp($cacheDir)
{
if ($this->debug) {
- $collectedLogs = array();
+ $collectedLogs = [];
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
@@ -73,14 +73,14 @@ class CacheWarmerAggregate implements CacheWarmerInterface
}
}
- $collectedLogs[$message] = array(
+ $collectedLogs[$message] = [
'type' => $type,
'message' => $message,
'file' => $file,
'line' => $line,
'trace' => $backtrace,
'count' => 1,
- );
+ ];
});
}
diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php
index 62555e9a..66ce0649 100644
--- a/vendor/symfony/http-kernel/Client.php
+++ b/vendor/symfony/http-kernel/Client.php
@@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel;
-use Symfony\Component\BrowserKit\Client as BaseClient;
+use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\History;
use Symfony\Component\BrowserKit\Request as DomRequest;
@@ -21,14 +21,11 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
- * Client simulates a browser and makes requests to a Kernel object.
+ * Client simulates a browser and makes requests to an HttpKernel instance.
*
- * @author Fabien Potencier
- *
- * @method Request getRequest() A Request instance
- * @method Response getResponse() A Response instance
+ * @deprecated since Symfony 4.3, use HttpKernelBrowser instead.
*/
-class Client extends BaseClient
+class Client extends AbstractBrowser
{
protected $kernel;
private $catchExceptions = true;
@@ -39,7 +36,7 @@ class Client extends BaseClient
* @param History $history A History instance to store the browser history
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
*/
- public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
+ public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
{
// These class properties must be set before calling the parent constructor, as it may depend on it.
$this->kernel = $kernel;
@@ -159,7 +156,7 @@ EOF;
*/
protected function filterFiles(array $files)
{
- $filtered = array();
+ $filtered = [];
foreach ($files as $key => $value) {
if (\is_array($value)) {
$filtered[$key] = $this->filterFiles($value);
diff --git a/vendor/symfony/http-kernel/Config/FileLocator.php b/vendor/symfony/http-kernel/Config/FileLocator.php
index 20d91b2f..f88d1684 100644
--- a/vendor/symfony/http-kernel/Config/FileLocator.php
+++ b/vendor/symfony/http-kernel/Config/FileLocator.php
@@ -29,7 +29,7 @@ class FileLocator extends BaseFileLocator
* @param string|null $path The path the global resource directory
* @param array $paths An array of paths where to look for resources
*/
- public function __construct(KernelInterface $kernel, string $path = null, array $paths = array())
+ public function __construct(KernelInterface $kernel, string $path = null, array $paths = [])
{
$this->kernel = $kernel;
if (null !== $path) {
diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php
index 142a6d54..86ceab2f 100644
--- a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php
+++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php
@@ -34,7 +34,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
*/
private $argumentValueResolvers;
- public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = array())
+ public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
{
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
@@ -45,7 +45,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
*/
public function getArguments(Request $request, $controller)
{
- $arguments = array();
+ $arguments = [];
foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) {
foreach ($this->argumentValueResolvers as $resolver) {
@@ -83,12 +83,12 @@ final class ArgumentResolver implements ArgumentResolverInterface
public static function getDefaultArgumentValueResolvers(): iterable
{
- return array(
+ return [
new RequestAttributeValueResolver(),
new RequestValueResolver(),
new SessionValueResolver(),
new DefaultValueResolver(),
new VariadicValueResolver(),
- );
+ ];
}
}
diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php
new file mode 100644
index 00000000..19e324dc
--- /dev/null
+++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php
@@ -0,0 +1,81 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpKernel\Controller\ArgumentResolver;
+
+use Psr\Container\ContainerInterface;
+use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface;
+use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
+
+/**
+ * Provides an intuitive error message when controller fails because it is not registered as a service.
+ *
+ * @author Simeon Kolev
+ */
+final class NotTaggedControllerValueResolver implements ArgumentValueResolverInterface
+{
+ private $container;
+
+ public function __construct(ContainerInterface $container)
+ {
+ $this->container = $container;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supports(Request $request, ArgumentMetadata $argument)
+ {
+ $controller = $request->attributes->get('_controller');
+
+ if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) {
+ $controller = $controller[0].'::'.$controller[1];
+ } elseif (!\is_string($controller) || '' === $controller) {
+ return false;
+ }
+
+ if ('\\' === $controller[0]) {
+ $controller = ltrim($controller, '\\');
+ }
+
+ if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) {
+ $controller = substr($controller, 0, $i).strtolower(substr($controller, $i));
+ }
+
+ return false === $this->container->has($controller);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function resolve(Request $request, ArgumentMetadata $argument)
+ {
+ if (\is_array($controller = $request->attributes->get('_controller'))) {
+ $controller = $controller[0].'::'.$controller[1];
+ }
+
+ if ('\\' === $controller[0]) {
+ $controller = ltrim($controller, '\\');
+ }
+
+ if (!$this->container->has($controller)) {
+ $i = strrpos($controller, ':');
+ $controller = substr($controller, 0, $i).strtolower(substr($controller, $i));
+ }
+
+ $what = sprintf('argument $%s of "%s()"', $argument->getName(), $controller);
+ $message = sprintf('Could not resolve %s, maybe you forgot to register the controller as a service or missed tagging it with the "controller.service_arguments"?', $what);
+
+ throw new RuntimeException($message);
+ }
+}
diff --git a/vendor/symfony/http-kernel/Controller/ControllerReference.php b/vendor/symfony/http-kernel/Controller/ControllerReference.php
index f424fdc8..b4fdadd2 100644
--- a/vendor/symfony/http-kernel/Controller/ControllerReference.php
+++ b/vendor/symfony/http-kernel/Controller/ControllerReference.php
@@ -27,15 +27,15 @@ use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
class ControllerReference
{
public $controller;
- public $attributes = array();
- public $query = array();
+ public $attributes = [];
+ public $query = [];
/**
* @param string $controller The controller name
* @param array $attributes An array of parameters to add to the Request attributes
* @param array $query An array of parameters to add to the Request query string
*/
- public function __construct(string $controller, array $attributes = array(), array $query = array())
+ public function __construct(string $controller, array $attributes = [], array $query = [])
{
$this->controller = $controller;
$this->attributes = $attributes;
diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php
index 04c5fcf5..3cebfb3e 100644
--- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php
+++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php
@@ -107,7 +107,7 @@ class ControllerResolver implements ControllerResolverInterface
list($class, $method) = explode('::', $controller, 2);
try {
- return array($this->instantiateController($class), $method);
+ return [$this->instantiateController($class), $method];
} catch (\Error | \LogicException $e) {
try {
if ((new \ReflectionMethod($class, $method))->isStatic()) {
@@ -155,7 +155,7 @@ class ControllerResolver implements ControllerResolverInterface
}
if (!isset($callable[0]) || !isset($callable[1]) || 2 !== \count($callable)) {
- return 'Invalid array callable, expected array(controller, method).';
+ return 'Invalid array callable, expected [controller, method].';
}
list($controller, $method) = $callable;
@@ -172,7 +172,7 @@ class ControllerResolver implements ControllerResolverInterface
$collection = $this->getClassMethodsWithoutMagicMethods($controller);
- $alternatives = array();
+ $alternatives = [];
foreach ($collection as $item) {
$lev = levenshtein($method, $item);
diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php b/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php
index a54f8b51..8b70a88f 100644
--- a/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php
+++ b/vendor/symfony/http-kernel/Controller/ControllerResolverInterface.php
@@ -29,7 +29,7 @@ interface ControllerResolverInterface
* As several resolvers can exist for a single application, a resolver must
* return false when it is not able to determine the controller.
*
- * The resolver must only throw an exception when it should be able to load
+ * The resolver must only throw an exception when it should be able to load a
* controller but cannot because of some errors made by the developer.
*
* @return callable|false A PHP callable representing the Controller,
diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
index cc2ed9f2..8ee9b0b9 100644
--- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
+++ b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
@@ -23,7 +23,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
*/
public function createArgumentMetadata($controller)
{
- $arguments = array();
+ $arguments = [];
if (\is_array($controller)) {
$reflection = new \ReflectionMethod($controller[0], $controller[1]);
diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php
index f07ac89c..c3c3f94e 100644
--- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php
@@ -57,7 +57,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $this->data = array(
+ $this->data = [
'app_name' => $this->name,
'app_version' => $this->version,
'token' => $response->headers->get('X-Debug-Token'),
@@ -72,9 +72,9 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
'xdebug_enabled' => \extension_loaded('xdebug'),
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
- 'bundles' => array(),
+ 'bundles' => [],
'sapi_name' => \PHP_SAPI,
- );
+ ];
if (isset($this->kernel)) {
foreach ($this->kernel->getBundles() as $name => $bundle) {
@@ -100,7 +100,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function reset()
{
- $this->data = array();
+ $this->data = [];
}
public function lateCollect()
diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php
index a3d8c99d..d3020a31 100644
--- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/DataCollector.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\VarDumper\Caster\CutStub;
+use Symfony\Component\VarDumper\Caster\ReflectionCaster;
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\Stub;
@@ -25,23 +26,36 @@ use Symfony\Component\VarDumper\Cloner\VarCloner;
* @author Fabien Potencier
* @author Bernhard Schussek
*/
-abstract class DataCollector implements DataCollectorInterface, \Serializable
+abstract class DataCollector implements DataCollectorInterface
{
- protected $data = array();
+ protected $data = [];
/**
* @var ClonerInterface
*/
private $cloner;
+ /**
+ * @deprecated since Symfony 4.3, store all the serialized state in the data property instead
+ */
public function serialize()
{
- return serialize($this->data);
+ @trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), E_USER_DEPRECATED);
+
+ $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
+ $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
+
+ return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
}
+ /**
+ * @deprecated since Symfony 4.3, store all the serialized state in the data property instead
+ */
public function unserialize($data)
{
- $this->data = unserialize($data);
+ @trigger_error(sprintf('The "%s" method is deprecated since Symfony 4.3, store all the serialized state in the data property instead.', __METHOD__), E_USER_DEPRECATED);
+
+ $this->data = \is_array($data) ? $data : unserialize($data);
}
/**
@@ -76,7 +90,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
*/
protected function getCasters()
{
- return array(
+ $casters = [
'*' => function ($v, array $a, Stub $s, $isNested) {
if (!$v instanceof Stub) {
foreach ($a as $k => $v) {
@@ -88,6 +102,30 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
return $a;
},
- );
+ ];
+
+ if (method_exists(ReflectionCaster::class, 'unsetClosureFileInfo')) {
+ $casters += ReflectionCaster::UNSET_CLOSURE_FILE_INFO;
+ }
+
+ return $casters;
+ }
+
+ public function __sleep()
+ {
+ if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) {
+ @trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), E_USER_DEPRECATED);
+ $this->data = $this->serialize();
+ }
+
+ return ['data'];
+ }
+
+ public function __wakeup()
+ {
+ if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'unserialize'))->getDeclaringClass()->name) {
+ @trigger_error(sprintf('Implementing the "%s::unserialize()" method is deprecated since Symfony 4.3, store all the serialized state in the "data" property instead.', $c), E_USER_DEPRECATED);
+ $this->unserialize($this->data);
+ }
}
}
diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
index 13694f5a..577eb2ca 100644
--- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
@@ -25,6 +25,8 @@ use Symfony\Component\VarDumper\Server\Connection;
/**
* @author Nicolas Grekas
+ *
+ * @final since Symfony 4.3
*/
class DumpDataCollector extends DataCollector implements DataDumperInterface
{
@@ -52,12 +54,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->dumper = $dumper;
// All clones share these properties by reference:
- $this->rootRefs = array(
+ $this->rootRefs = [
&$this->data,
&$this->dataCount,
&$this->isCollected,
&$this->clonesCount,
- );
+ ];
$this->sourceContextProvider = $dumper instanceof Connection && isset($dumper->getContextProviders()['source']) ? $dumper->getContextProviders()['source'] : new SourceContextProvider($this->charset);
}
@@ -85,6 +87,9 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->isCollected = false;
}
+ if (!$this->dataCount) {
+ $this->data = [];
+ }
$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount;
@@ -95,6 +100,10 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function collect(Request $request, Response $response, \Exception $exception = null)
{
+ if (!$this->dataCount) {
+ $this->data = [];
+ }
+
// Sub-requests and programmatic calls stay in the collected profile.
if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
return;
@@ -110,9 +119,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
) {
if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) {
$dumper = new HtmlDumper('php://output', $this->charset);
- $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+ $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
+ if (method_exists($dumper, 'setDisplayOptions')) {
+ $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
+ }
}
foreach ($this->data as $dump) {
@@ -126,35 +138,45 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ($this->stopwatch) {
$this->stopwatch->reset();
}
- $this->data = array();
+ $this->data = [];
$this->dataCount = 0;
$this->isCollected = true;
$this->clonesCount = 0;
$this->clonesIndex = 0;
}
- public function serialize()
+ /**
+ * @internal
+ */
+ public function __sleep()
{
+ if (!$this->dataCount) {
+ $this->data = [];
+ }
+
if ($this->clonesCount !== $this->clonesIndex) {
- return 'a:0:{}';
+ return [];
}
$this->data[] = $this->fileLinkFormat;
$this->data[] = $this->charset;
- $ser = serialize($this->data);
- $this->data = array();
$this->dataCount = 0;
$this->isCollected = true;
- return $ser;
+ return parent::__sleep();
}
- public function unserialize($data)
+ /**
+ * @internal
+ */
+ public function __wakeup()
{
- parent::unserialize($data);
+ parent::__wakeup();
+
$charset = array_pop($this->data);
$fileLinkFormat = array_pop($this->data);
$this->dataCount = \count($this->data);
+
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
}
@@ -169,11 +191,15 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ('html' === $format) {
$dumper = new HtmlDumper($data, $this->charset);
- $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+ $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
}
- $dumps = array();
+ $dumps = [];
+
+ if (!$this->dataCount) {
+ return $this->data = [];
+ }
foreach ($this->data as $dump) {
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
@@ -193,7 +219,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function __destruct()
{
- if (0 === $this->clonesCount-- && !$this->isCollected && $this->data) {
+ if (0 === $this->clonesCount-- && !$this->isCollected && $this->dataCount) {
$this->clonesCount = 0;
$this->isCollected = true;
@@ -207,14 +233,17 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
$html = 'html' === $_SERVER['VAR_DUMPER_FORMAT'];
} else {
- $html = !\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html');
+ $html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html');
}
if ($html) {
$dumper = new HtmlDumper('php://output', $this->charset);
- $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
+ $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
+ if (method_exists($dumper, 'setDisplayOptions')) {
+ $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
+ }
}
foreach ($this->data as $i => $dump) {
@@ -222,7 +251,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line']);
}
- $this->data = array();
+ $this->data = [];
$this->dataCount = 0;
}
}
@@ -236,7 +265,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$s = $this->style('meta', '%s');
$f = strip_tags($this->style('', $file));
$name = strip_tags($this->style('', $name));
- if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
+ if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
$name = sprintf(''.$s.'', strip_tags($this->style('', $link)), $f, $name);
} else {
$name = sprintf(''.$s.'', $f, $name);
diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php
index 3a7e51bf..d918ddf7 100644
--- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php
@@ -13,9 +13,10 @@ namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
+use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Service\ResetInterface;
/**
@@ -26,10 +27,13 @@ use Symfony\Contracts\Service\ResetInterface;
class EventDataCollector extends DataCollector implements LateDataCollectorInterface
{
protected $dispatcher;
+ private $requestStack;
+ private $currentRequest;
- public function __construct(EventDispatcherInterface $dispatcher = null)
+ public function __construct(EventDispatcherInterface $dispatcher = null, RequestStack $requestStack = null)
{
$this->dispatcher = $dispatcher;
+ $this->requestStack = $requestStack;
}
/**
@@ -37,16 +41,17 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $this->data = array(
- 'called_listeners' => array(),
- 'not_called_listeners' => array(),
- 'orphaned_events' => array(),
- );
+ $this->currentRequest = $this->requestStack && $this->requestStack->getMasterRequest() !== $request ? $request : null;
+ $this->data = [
+ 'called_listeners' => [],
+ 'not_called_listeners' => [],
+ 'orphaned_events' => [],
+ ];
}
public function reset()
{
- $this->data = array();
+ $this->data = [];
if ($this->dispatcher instanceof ResetInterface) {
$this->dispatcher->reset();
@@ -56,12 +61,12 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
public function lateCollect()
{
if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
- $this->setCalledListeners($this->dispatcher->getCalledListeners());
- $this->setNotCalledListeners($this->dispatcher->getNotCalledListeners());
+ $this->setCalledListeners($this->dispatcher->getCalledListeners($this->currentRequest));
+ $this->setNotCalledListeners($this->dispatcher->getNotCalledListeners($this->currentRequest));
}
if ($this->dispatcher instanceof TraceableEventDispatcher) {
- $this->setOrphanedEvents($this->dispatcher->getOrphanedEvents());
+ $this->setOrphanedEvents($this->dispatcher->getOrphanedEvents($this->currentRequest));
}
$this->data = $this->cloneVar($this->data);
diff --git a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php
index 7a25f149..c76e7f45 100644
--- a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php
@@ -28,9 +28,9 @@ class ExceptionDataCollector extends DataCollector
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if (null !== $exception) {
- $this->data = array(
+ $this->data = [
'exception' => FlattenException::create($exception),
- );
+ ];
}
}
@@ -39,7 +39,7 @@ class ExceptionDataCollector extends DataCollector
*/
public function reset()
{
- $this->data = array();
+ $this->data = [];
}
/**
diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php
index 3081ac7f..4091b676 100644
--- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php
@@ -55,7 +55,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
if ($this->logger instanceof DebugLoggerInterface) {
$this->logger->clear();
}
- $this->data = array();
+ $this->data = [];
}
/**
@@ -66,7 +66,9 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
if (null !== $this->logger) {
$containerDeprecationLogs = $this->getContainerDeprecationLogs();
$this->data = $this->computeErrorsCount($containerDeprecationLogs);
- $this->data['compiler_logs'] = $this->getContainerCompilerLogs();
+ // get compiler logs later (only when they are needed) to improve performance
+ $this->data['compiler_logs'] = [];
+ $this->data['compiler_logs_filepath'] = $this->containerPathPrefix.'Compiler.log';
$this->data['logs'] = $this->sanitizeLogs(array_merge($this->logger->getLogs($this->currentRequest), $containerDeprecationLogs));
$this->data = $this->cloneVar($this->data);
}
@@ -80,12 +82,12 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function getLogs()
{
- return isset($this->data['logs']) ? $this->data['logs'] : array();
+ return isset($this->data['logs']) ? $this->data['logs'] : [];
}
public function getPriorities()
{
- return isset($this->data['priorities']) ? $this->data['priorities'] : array();
+ return isset($this->data['priorities']) ? $this->data['priorities'] : [];
}
public function countErrors()
@@ -110,7 +112,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
public function getCompilerLogs()
{
- return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : array();
+ return $this->cloneVar($this->getContainerCompilerLogs($this->data['compiler_logs_filepath'] ?? null));
}
/**
@@ -124,13 +126,17 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function getContainerDeprecationLogs()
{
if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) {
- return array();
+ return [];
+ }
+
+ if ('' === $logContent = trim(file_get_contents($file))) {
+ return [];
}
$bootTime = filemtime($file);
- $logs = array();
- foreach (unserialize(file_get_contents($file)) as $log) {
- $log['context'] = array('exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count']));
+ $logs = [];
+ foreach (unserialize($logContent) as $log) {
+ $log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])];
$log['timestamp'] = $bootTime;
$log['priority'] = 100;
$log['priorityName'] = 'DEBUG';
@@ -143,20 +149,20 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
return $logs;
}
- private function getContainerCompilerLogs()
+ private function getContainerCompilerLogs(?string $compilerLogsFilepath = null): array
{
- if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Compiler.log')) {
- return array();
+ if (!file_exists($compilerLogsFilepath)) {
+ return [];
}
- $logs = array();
- foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) {
+ $logs = [];
+ foreach (file($compilerLogsFilepath, FILE_IGNORE_NEW_LINES) as $log) {
$log = explode(': ', $log, 2);
if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) {
- $log = array('Unknown Compiler Pass', implode(': ', $log));
+ $log = ['Unknown Compiler Pass', implode(': ', $log)];
}
- $logs[$log[0]][] = array('message' => $log[1]);
+ $logs[$log[0]][] = ['message' => $log[1]];
}
return $logs;
@@ -164,8 +170,8 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function sanitizeLogs($logs)
{
- $sanitizedLogs = array();
- $silencedLogs = array();
+ $sanitizedLogs = [];
+ $silencedLogs = [];
foreach ($logs as $log) {
if (!$this->isSilencedOrDeprecationErrorLog($log)) {
@@ -184,10 +190,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
$silencedLogs[$h] = true;
if (!isset($sanitizedLogs[$message])) {
- $sanitizedLogs[$message] = $log + array(
+ $sanitizedLogs[$message] = $log + [
'errorCount' => 0,
'scream' => true,
- );
+ ];
}
$sanitizedLogs[$message]['errorCount'] += $exception->count;
@@ -199,10 +205,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
if (isset($sanitizedLogs[$errorId])) {
++$sanitizedLogs[$errorId]['errorCount'];
} else {
- $log += array(
+ $log += [
'errorCount' => 1,
'scream' => false,
- );
+ ];
$sanitizedLogs[$errorId] = $log;
}
@@ -223,7 +229,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
return true;
}
- if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) {
+ if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) {
return true;
}
@@ -232,23 +238,23 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function computeErrorsCount(array $containerDeprecationLogs)
{
- $silencedLogs = array();
- $count = array(
+ $silencedLogs = [];
+ $count = [
'error_count' => $this->logger->countErrors($this->currentRequest),
'deprecation_count' => 0,
'warning_count' => 0,
'scream_count' => 0,
- 'priorities' => array(),
- );
+ 'priorities' => [],
+ ];
foreach ($this->logger->getLogs($this->currentRequest) as $log) {
if (isset($count['priorities'][$log['priority']])) {
++$count['priorities'][$log['priority']]['count'];
} else {
- $count['priorities'][$log['priority']] = array(
+ $count['priorities'][$log['priority']] = [
'count' => 1,
'name' => $log['priorityName'],
- );
+ ];
}
if ('WARNING' === $log['priorityName']) {
++$count['warning_count'];
diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php
index 310b2f91..7a6e1c06 100644
--- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php
@@ -39,10 +39,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function reset()
{
- $this->data = array(
+ $this->data = [
'memory' => 0,
'memory_limit' => $this->convertToBytes(ini_get('memory_limit')),
- );
+ ];
}
/**
diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php
index ed753826..32624c96 100644
--- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php
@@ -38,7 +38,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// attributes are serialized and as they can be anything, they need to be converted to strings.
- $attributes = array();
+ $attributes = [];
$route = '';
foreach ($request->attributes->all() as $key => $value) {
if ('_route' === $key) {
@@ -57,10 +57,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$content = false;
}
- $sessionMetadata = array();
- $sessionAttributes = array();
+ $sessionMetadata = [];
+ $sessionAttributes = [];
$session = null;
- $flashes = array();
+ $flashes = [];
if ($request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
@@ -74,19 +74,19 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$statusCode = $response->getStatusCode();
- $responseCookies = array();
+ $responseCookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$responseCookies[$cookie->getName()] = $cookie;
}
- $dotenvVars = array();
+ $dotenvVars = [];
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$dotenvVars[$name] = $value;
}
}
- $this->data = array(
+ $this->data = [
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
'content' => $content,
@@ -110,7 +110,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
'controller' => 'n/a',
'locale' => $request->getLocale(),
'dotenv_vars' => $dotenvVars,
- );
+ ];
if (isset($this->data['request_headers']['php-auth-pw'])) {
$this->data['request_headers']['php-auth-pw'] = '******';
@@ -147,14 +147,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if ($response->isRedirect()) {
$response->headers->setCookie(new Cookie(
'sf_redirect',
- json_encode(array(
+ json_encode([
'token' => $response->headers->get('x-debug-token'),
'route' => $request->attributes->get('_route', 'n/a'),
'method' => $request->getMethod(),
'controller' => $this->parseController($request->attributes->get('_controller')),
'status_code' => $statusCode,
'status_text' => Response::$statusTexts[(int) $statusCode],
- )),
+ ]),
0, '/', null, $request->isSecure(), true, false, 'lax'
));
}
@@ -173,7 +173,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public function reset()
{
- $this->data = array();
+ $this->data = [];
$this->controllers = new \SplObjectStorage();
}
@@ -252,6 +252,18 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
return $this->data['content'];
}
+ public function isJsonRequest()
+ {
+ return 1 === preg_match('{^application/(?:\w+\++)*json$}i', $this->data['request_headers']['content-type']);
+ }
+
+ public function getPrettyJson()
+ {
+ $decoded = json_decode($this->getContent());
+
+ return JSON_ERROR_NONE === json_last_error() ? json_encode($decoded, JSON_PRETTY_PRINT) : null;
+ }
+
public function getContentType()
{
return $this->data['content_type'];
@@ -308,7 +320,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
*/
public function getRouteParams()
{
- return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : array();
+ return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : [];
}
/**
@@ -338,11 +350,17 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
return isset($this->data['forward_token']) ? $this->data['forward_token'] : null;
}
+ /**
+ * @final since Symfony 4.3
+ */
public function onKernelController(FilterControllerEvent $event)
{
$this->controllers[$event->getRequest()] = $event->getController();
}
+ /**
+ * @final since Symfony 4.3
+ */
public function onKernelResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
@@ -356,10 +374,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public static function getSubscribedEvents()
{
- return array(
+ return [
KernelEvents::CONTROLLER => 'onKernelController',
KernelEvents::RESPONSE => 'onKernelResponse',
- );
+ ];
}
/**
@@ -387,21 +405,21 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
try {
$r = new \ReflectionMethod($controller[0], $controller[1]);
- return array(
+ return [
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
- );
+ ];
} catch (\ReflectionException $e) {
if (\is_callable($controller)) {
// using __call or __callStatic
- return array(
+ return [
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => 'n/a',
'line' => 'n/a',
- );
+ ];
}
}
}
@@ -409,12 +427,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if ($controller instanceof \Closure) {
$r = new \ReflectionFunction($controller);
- $controller = array(
+ $controller = [
'class' => $r->getName(),
'method' => null,
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
- );
+ ];
if (false !== strpos($r->name, '{closure}')) {
return $controller;
@@ -433,12 +451,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if (\is_object($controller)) {
$r = new \ReflectionClass($controller);
- return array(
+ return [
'class' => $r->getName(),
'method' => null,
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
- );
+ ];
}
return \is_string($controller) ? $controller : 'n/a';
diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php
index 481747b3..65fc90dc 100644
--- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php
@@ -17,8 +17,6 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
/**
- * RouterDataCollector.
- *
* @author Fabien Potencier
*/
class RouterDataCollector extends DataCollector
@@ -54,11 +52,11 @@ class RouterDataCollector extends DataCollector
{
$this->controllers = new \SplObjectStorage();
- $this->data = array(
+ $this->data = [
'redirect' => false,
'url' => null,
'route' => null,
- );
+ ];
}
protected function guessRoute(Request $request, $controller)
@@ -68,6 +66,8 @@ class RouterDataCollector extends DataCollector
/**
* Remembers the controller associated to each request.
+ *
+ * @final since Symfony 4.3
*/
public function onKernelController(FilterControllerEvent $event)
{
diff --git a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php
index e489d775..f48db705 100644
--- a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php
@@ -43,11 +43,12 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
$startTime = $request->server->get('REQUEST_TIME_FLOAT');
}
- $this->data = array(
+ $this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'start_time' => $startTime * 1000,
- 'events' => array(),
- );
+ 'events' => [],
+ 'stopwatch_installed' => \class_exists(Stopwatch::class, false),
+ ];
}
/**
@@ -55,7 +56,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
*/
public function reset()
{
- $this->data = array();
+ $this->data = [];
if (null !== $this->stopwatch) {
$this->stopwatch->reset();
@@ -139,6 +140,14 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
return $this->data['start_time'];
}
+ /**
+ * @return bool whether or not the stopwatch component is installed
+ */
+ public function isStopwatchInstalled()
+ {
+ return $this->data['stopwatch_installed'];
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
index 221d3347..eb241675 100644
--- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
+++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
@@ -20,8 +20,10 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
* Formats debug file links.
*
* @author Jérémy Romey
+ *
+ * @final since Symfony 4.3
*/
-class FileLinkFormatter implements \Serializable
+class FileLinkFormatter
{
private $fileLinkFormat;
private $requestStack;
@@ -36,7 +38,7 @@ class FileLinkFormatter implements \Serializable
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
if ($fileLinkFormat && !\is_array($fileLinkFormat)) {
$i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f);
- $fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
+ $fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
}
$this->fileLinkFormat = $fileLinkFormat;
@@ -55,20 +57,20 @@ class FileLinkFormatter implements \Serializable
}
}
- return strtr($fmt[0], array('%f' => $file, '%l' => $line));
+ return strtr($fmt[0], ['%f' => $file, '%l' => $line]);
}
return false;
}
- public function serialize()
+ /**
+ * @internal
+ */
+ public function __sleep(): array
{
- return serialize($this->getFileLinkFormat());
- }
+ $this->fileLinkFormat = $this->getFileLinkFormat();
- public function unserialize($serialized)
- {
- $this->fileLinkFormat = unserialize($serialized, array('allowed_classes' => false));
+ return ['fileLinkFormat'];
}
/**
@@ -88,17 +90,15 @@ class FileLinkFormatter implements \Serializable
if ($this->fileLinkFormat) {
return $this->fileLinkFormat;
}
+
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
$request = $this->requestStack->getMasterRequest();
- if ($request instanceof Request) {
- if ($this->urlFormat instanceof \Closure && !$this->urlFormat = ($this->urlFormat)()) {
- return;
- }
- return array(
+ if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) {
+ return [
$request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat,
$this->baseDir.\DIRECTORY_SEPARATOR, '',
- );
+ ];
}
}
}
diff --git a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php b/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php
index ddf4fa7c..6c96afdf 100644
--- a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php
+++ b/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel\Debug;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher;
-use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpKernel\KernelEvents;
/**
@@ -27,7 +26,7 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
/**
* {@inheritdoc}
*/
- protected function preDispatch($eventName, Event $event)
+ protected function beforeDispatch(string $eventName, $event)
{
switch ($eventName) {
case KernelEvents::REQUEST:
@@ -58,7 +57,7 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
/**
* {@inheritdoc}
*/
- protected function postDispatch($eventName, Event $event)
+ protected function afterDispatch(string $eventName, $event)
{
switch ($eventName) {
case KernelEvents::CONTROLLER_ARGUMENTS:
diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php
index 783e6fbb..2659d34d 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php
@@ -59,7 +59,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
*/
private function expandClasses(array $patterns, array $classes)
{
- $expanded = array();
+ $expanded = [];
// Explicit classes declared in the patterns are returned directly
foreach ($patterns as $key => $pattern) {
@@ -85,7 +85,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
private function getClassesInComposerClassMaps()
{
- $classes = array();
+ $classes = [];
foreach (spl_autoload_functions() as $function) {
if (!\is_array($function)) {
@@ -106,14 +106,14 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
private function patternsToRegexps($patterns)
{
- $regexps = array();
+ $regexps = [];
foreach ($patterns as $pattern) {
// Escape user input
$regex = preg_quote(ltrim($pattern, '\\'));
// Wildcards * and **
- $regex = strtr($regex, array('\\*\\*' => '.*?', '\\*' => '[^\\\\]*?'));
+ $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']);
// If this class does not end by a slash, anchor the end
if ('\\' !== substr($regex, -1)) {
diff --git a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php b/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php
index 77c0e479..705c88db 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php
@@ -52,7 +52,7 @@ class ControllerArgumentValueResolverPass implements CompilerPassInterface
$id = (string) $resolverReference;
$container->register("debug.$id", TraceableValueResolver::class)
->setDecoratedService($id)
- ->setArguments(array(new Reference("debug.$id.inner"), new Reference($this->traceableResolverStopwatch)));
+ ->setArguments([new Reference("debug.$id.inner"), new Reference($this->traceableResolverStopwatch)]);
}
}
diff --git a/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/vendor/symfony/http-kernel/DependencyInjection/Extension.php
index 64787555..db376e6d 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/Extension.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/Extension.php
@@ -20,7 +20,7 @@ use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension;
*/
abstract class Extension extends BaseExtension
{
- private $annotatedClasses = array();
+ private $annotatedClasses = [];
/**
* Gets the annotated classes to cache.
diff --git a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php
index 2a8c1b1b..432f7672 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php
@@ -41,7 +41,7 @@ class FragmentRendererPass implements CompilerPassInterface
}
$definition = $container->getDefinition($this->handlerService);
- $renderers = array();
+ $renderers = [];
foreach ($container->findTaggedServiceIds($this->rendererTag, true) as $id => $tags) {
$def = $container->getDefinition($id);
$class = $container->getParameterBag()->resolveValue($def->getClass());
diff --git a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
index 4bb47902..526c11fa 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
@@ -23,19 +23,19 @@ use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
class LazyLoadingFragmentHandler extends FragmentHandler
{
private $container;
- private $initialized = array();
+ private $initialized = [];
public function __construct(ContainerInterface $container, RequestStack $requestStack, bool $debug = false)
{
$this->container = $container;
- parent::__construct($requestStack, array(), $debug);
+ parent::__construct($requestStack, [], $debug);
}
/**
* {@inheritdoc}
*/
- public function render($uri, $renderer = 'inline', array $options = array())
+ public function render($uri, $renderer = 'inline', array $options = [])
{
if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) {
$this->addRenderer($this->container->get($renderer));
diff --git a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php
index 1dbf7f7b..83e1b758 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php
@@ -32,7 +32,7 @@ class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPas
{
foreach ($this->extensions as $extension) {
if (!\count($container->getExtensionConfig($extension))) {
- $container->loadFromExtension($extension, array());
+ $container->loadFromExtension($extension, []);
}
}
diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
index 125464b1..a3f5012e 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
@@ -34,22 +34,24 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
private $resolverServiceId;
private $controllerTag;
private $controllerLocator;
+ private $notTaggedControllerResolverServiceId;
- public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments', string $controllerLocator = 'argument_resolver.controller_locator')
+ public function __construct(string $resolverServiceId = 'argument_resolver.service', string $controllerTag = 'controller.service_arguments', string $controllerLocator = 'argument_resolver.controller_locator', string $notTaggedControllerResolverServiceId = 'argument_resolver.not_tagged_controller')
{
$this->resolverServiceId = $resolverServiceId;
$this->controllerTag = $controllerTag;
$this->controllerLocator = $controllerLocator;
+ $this->notTaggedControllerResolverServiceId = $notTaggedControllerResolverServiceId;
}
public function process(ContainerBuilder $container)
{
- if (false === $container->hasDefinition($this->resolverServiceId)) {
+ if (false === $container->hasDefinition($this->resolverServiceId) && false === $container->hasDefinition($this->notTaggedControllerResolverServiceId)) {
return;
}
$parameterBag = $container->getParameterBag();
- $controllers = array();
+ $controllers = [];
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
$def = $container->getDefinition($id);
@@ -72,14 +74,14 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
$isContainerAware = $r->implementsInterface(ContainerAwareInterface::class) || is_subclass_of($class, AbstractController::class);
// get regular public methods
- $methods = array();
- $arguments = array();
+ $methods = [];
+ $arguments = [];
foreach ($r->getMethods(\ReflectionMethod::IS_PUBLIC) as $r) {
if ('setContainer' === $r->name && $isContainerAware) {
continue;
}
if (!$r->isConstructor() && !$r->isDestructor() && !$r->isAbstract()) {
- $methods[strtolower($r->name)] = array($r, $r->getParameters());
+ $methods[strtolower($r->name)] = [$r, $r->getParameters()];
}
}
@@ -89,7 +91,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
$autowire = true;
continue;
}
- foreach (array('action', 'argument', 'id') as $k) {
+ foreach (['action', 'argument', 'id'] as $k) {
if (!isset($attributes[$k][0])) {
throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id));
}
@@ -119,7 +121,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
/** @var \ReflectionMethod $r */
// create a per-method map of argument-names to service/type-references
- $args = array();
+ $args = [];
foreach ($parameters as $p) {
/** @var \ReflectionParameter $p */
$type = ltrim($target = ProxyHelper::getTypeHint($r, $p), '\\');
@@ -137,14 +139,14 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
} elseif (isset($bindings[$bindingName = $type.' $'.$p->name]) || isset($bindings[$bindingName = '$'.$p->name]) || isset($bindings[$bindingName = $type])) {
$binding = $bindings[$bindingName];
- list($bindingValue, $bindingId) = $binding->getValues();
- $binding->setValues(array($bindingValue, $bindingId, true));
+ list($bindingValue, $bindingId, , $bindingType, $bindingFile) = $binding->getValues();
+ $binding->setValues([$bindingValue, $bindingId, true, $bindingType, $bindingFile]);
if (!$bindingValue instanceof Reference) {
$args[$p->name] = new Reference('.value.'.$container->hash($bindingValue));
$container->register((string) $args[$p->name], 'mixed')
->setFactory('current')
- ->addArgument(array($bindingValue));
+ ->addArgument([$bindingValue]);
} else {
$args[$p->name] = $bindingValue;
}
@@ -181,8 +183,17 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
}
}
- $container->getDefinition($this->resolverServiceId)
- ->replaceArgument(0, $controllerLocatorRef = ServiceLocatorTagPass::register($container, $controllers));
+ $controllerLocatorRef = ServiceLocatorTagPass::register($container, $controllers);
+
+ if ($container->hasDefinition($this->resolverServiceId)) {
+ $container->getDefinition($this->resolverServiceId)
+ ->replaceArgument(0, $controllerLocatorRef);
+ }
+
+ if ($container->hasDefinition($this->notTaggedControllerResolverServiceId)) {
+ $container->getDefinition($this->notTaggedControllerResolverServiceId)
+ ->replaceArgument(0, $controllerLocatorRef);
+ }
$container->setAlias($this->controllerLocator, (string) $controllerLocatorRef);
}
diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterLocaleAwareServicesPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterLocaleAwareServicesPass.php
new file mode 100644
index 00000000..0efb164b
--- /dev/null
+++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterLocaleAwareServicesPass.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpKernel\DependencyInjection;
+
+use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Reference;
+
+/**
+ * Register all services that have the "kernel.locale_aware" tag into the listener.
+ *
+ * @author Pierre Bobiet
+ */
+class RegisterLocaleAwareServicesPass implements CompilerPassInterface
+{
+ private $listenerServiceId;
+ private $localeAwareTag;
+
+ public function __construct(string $listenerServiceId = 'locale_aware_listener', string $localeAwareTag = 'kernel.locale_aware')
+ {
+ $this->listenerServiceId = $listenerServiceId;
+ $this->localeAwareTag = $localeAwareTag;
+ }
+
+ public function process(ContainerBuilder $container)
+ {
+ if (!$container->hasDefinition($this->listenerServiceId)) {
+ return;
+ }
+
+ $services = [];
+
+ foreach ($container->findTaggedServiceIds($this->localeAwareTag) as $id => $tags) {
+ $services[] = new Reference($id);
+ }
+
+ if (!$services) {
+ $container->removeDefinition($this->listenerServiceId);
+
+ return;
+ }
+
+ $container
+ ->getDefinition($this->listenerServiceId)
+ ->setArgument(0, new IteratorArgument($services))
+ ;
+ }
+}
diff --git a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php
index 564f879c..c1199f63 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php
@@ -39,7 +39,7 @@ class ResettableServicePass implements CompilerPassInterface
return;
}
- $services = $methods = array();
+ $services = $methods = [];
foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) {
$services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE);
diff --git a/vendor/symfony/http-kernel/Event/ControllerArgumentsEvent.php b/vendor/symfony/http-kernel/Event/ControllerArgumentsEvent.php
new file mode 100644
index 00000000..3dc6ea50
--- /dev/null
+++ b/vendor/symfony/http-kernel/Event/ControllerArgumentsEvent.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpKernel\Event;
+
+/**
+ * Allows filtering of controller arguments.
+ *
+ * You can call getController() to retrieve the controller and getArguments
+ * to retrieve the current arguments. With setArguments() you can replace
+ * arguments that are used to call the controller.
+ *
+ * Arguments set in the event must be compatible with the signature of the
+ * controller.
+ *
+ * @author Christophe Coevoet
+ */
+class ControllerArgumentsEvent extends FilterControllerArgumentsEvent
+{
+}
diff --git a/vendor/symfony/http-kernel/Event/ControllerEvent.php b/vendor/symfony/http-kernel/Event/ControllerEvent.php
new file mode 100644
index 00000000..9afb818a
--- /dev/null
+++ b/vendor/symfony/http-kernel/Event/ControllerEvent.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpKernel\Event;
+
+/**
+ * Allows filtering of a controller callable.
+ *
+ * You can call getController() to retrieve the current controller. With
+ * setController() you can set a new controller that is used in the processing
+ * of the request.
+ *
+ * Controllers should be callables.
+ *
+ * @author Bernhard Schussek
+ */
+class ControllerEvent extends FilterControllerEvent
+{
+}
diff --git a/vendor/symfony/http-kernel/Event/ExceptionEvent.php b/vendor/symfony/http-kernel/Event/ExceptionEvent.php
new file mode 100644
index 00000000..d3b2d8f6
--- /dev/null
+++ b/vendor/symfony/http-kernel/Event/ExceptionEvent.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpKernel\Event;
+
+/**
+ * Allows to create a response for a thrown exception.
+ *
+ * Call setResponse() to set the response that will be returned for the
+ * current request. The propagation of this event is stopped as soon as a
+ * response is set.
+ *
+ * You can also call setException() to replace the thrown exception. This
+ * exception will be thrown if no response is set during processing of this
+ * event.
+ *
+ * @author Bernhard Schussek