updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -22,7 +22,7 @@ class CasterTest extends TestCase
{
use VarDumperTestTrait;
private $referenceArray = array(
private $referenceArray = [
'null' => null,
'empty' => false,
'public' => 'pub',
@@ -30,7 +30,7 @@ class CasterTest extends TestCase
"\0+\0dynamic" => 'dyn',
"\0*\0protected" => 'prot',
"\0Foo\0private" => 'priv',
);
];
/**
* @dataProvider provideFilter
@@ -48,107 +48,107 @@ class CasterTest extends TestCase
public function provideFilter()
{
return array(
array(
return [
[
0,
array(),
),
array(
[],
],
[
Caster::EXCLUDE_PUBLIC,
array(
[
'null' => null,
'empty' => false,
'public' => 'pub',
),
),
array(
],
],
[
Caster::EXCLUDE_NULL,
array(
[
'null' => null,
),
),
array(
],
],
[
Caster::EXCLUDE_EMPTY,
array(
[
'null' => null,
'empty' => false,
),
),
array(
],
],
[
Caster::EXCLUDE_VIRTUAL,
array(
[
"\0~\0virtual" => 'virt',
),
),
array(
],
],
[
Caster::EXCLUDE_DYNAMIC,
array(
[
"\0+\0dynamic" => 'dyn',
),
),
array(
],
],
[
Caster::EXCLUDE_PROTECTED,
array(
[
"\0*\0protected" => 'prot',
),
),
array(
],
],
[
Caster::EXCLUDE_PRIVATE,
array(
[
"\0Foo\0private" => 'priv',
),
),
array(
],
],
[
Caster::EXCLUDE_VERBOSE,
array(
[
'public' => 'pub',
"\0*\0protected" => 'prot',
),
array('public', "\0*\0protected"),
),
array(
],
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_NOT_IMPORTANT,
array(
[
'null' => null,
'empty' => false,
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
"\0Foo\0private" => 'priv',
),
array('public', "\0*\0protected"),
),
array(
],
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC,
array(
[
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
),
),
array(
],
],
[
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
$this->referenceArray,
array('public', "\0*\0protected"),
),
array(
['public', "\0*\0protected"],
],
[
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY,
array(
[
'null' => null,
'empty' => false,
"\0~\0virtual" => 'virt',
"\0+\0dynamic" => 'dyn',
"\0*\0protected" => 'prot',
"\0Foo\0private" => 'priv',
),
array('public', 'empty'),
),
array(
],
['public', 'empty'],
],
[
Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT,
array(
[
'empty' => false,
),
array('public', 'empty'),
),
);
],
['public', 'empty'],
],
];
}
public function testAnonymousClass()

View File

@@ -47,7 +47,7 @@ EODUMP;
{
$stub = new Stub();
$date = new \DateTime($time, new \DateTimeZone($timezone));
$cast = DateCaster::castDateTime($date, array('foo' => 'bar'), $stub, false, 0);
$cast = DateCaster::castDateTime($date, ['foo' => 'bar'], $stub, false, 0);
$xDump = <<<EODUMP
array:1 [
@@ -75,18 +75,18 @@ EODUMP;
public function provideDateTimes()
{
return array(
array('2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'),
array('2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'),
array('2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'),
return [
['2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'],
['2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'],
['2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'],
array('2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
array('2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
);
['2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
['2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'],
];
}
/**
@@ -141,7 +141,7 @@ EODUMP;
$interval = $this->createInterval($intervalSpec, $ms, $invert);
$stub = new Stub();
$cast = DateCaster::castInterval($interval, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
$cast = DateCaster::castInterval($interval, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE);
$xDump = <<<EODUMP
array:1 [
@@ -173,35 +173,35 @@ EODUMP;
public function provideIntervals()
{
return array(
array('PT0S', 0, 0, '0s', '0s'),
array('PT0S', 0.1, 0, '+ 00:00:00.100', '%is'),
array('PT1S', 0, 0, '+ 00:00:01.0', '%is'),
array('PT2M', 0, 0, '+ 00:02:00.0', '%is'),
array('PT3H', 0, 0, '+ 03:00:00.0', '%ss'),
array('P4D', 0, 0, '+ 4d', '%ss'),
array('P5M', 0, 0, '+ 5m', null),
array('P6Y', 0, 0, '+ 6y', null),
array('P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null),
array('PT1M60S', 0, 0, '+ 00:02:00.0', null),
array('PT1H60M', 0, 0, '+ 02:00:00.0', null),
array('P1DT24H', 0, 0, '+ 2d', null),
array('P1M32D', 0, 0, '+ 1m 32d', null),
return [
['PT0S', 0, 0, '0s', '0s'],
['PT0S', 0.1, 0, '+ 00:00:00.100', '%is'],
['PT1S', 0, 0, '+ 00:00:01.0', '%is'],
['PT2M', 0, 0, '+ 00:02:00.0', '%is'],
['PT3H', 0, 0, '+ 03:00:00.0', '%ss'],
['P4D', 0, 0, '+ 4d', '%ss'],
['P5M', 0, 0, '+ 5m', null],
['P6Y', 0, 0, '+ 6y', null],
['P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06.0', null],
['PT1M60S', 0, 0, '+ 00:02:00.0', null],
['PT1H60M', 0, 0, '+ 02:00:00.0', null],
['P1DT24H', 0, 0, '+ 2d', null],
['P1M32D', 0, 0, '+ 1m 32d', null],
array('PT0S', 0, 1, '0s', '0s'),
array('PT0S', 0.1, 1, '- 00:00:00.100', '%is'),
array('PT1S', 0, 1, '- 00:00:01.0', '%is'),
array('PT2M', 0, 1, '- 00:02:00.0', '%is'),
array('PT3H', 0, 1, '- 03:00:00.0', '%ss'),
array('P4D', 0, 1, '- 4d', '%ss'),
array('P5M', 0, 1, '- 5m', null),
array('P6Y', 0, 1, '- 6y', null),
array('P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null),
array('PT1M60S', 0, 1, '- 00:02:00.0', null),
array('PT1H60M', 0, 1, '- 02:00:00.0', null),
array('P1DT24H', 0, 1, '- 2d', null),
array('P1M32D', 0, 1, '- 1m 32d', null),
);
['PT0S', 0, 1, '0s', '0s'],
['PT0S', 0.1, 1, '- 00:00:00.100', '%is'],
['PT1S', 0, 1, '- 00:00:01.0', '%is'],
['PT2M', 0, 1, '- 00:02:00.0', '%is'],
['PT3H', 0, 1, '- 03:00:00.0', '%ss'],
['P4D', 0, 1, '- 4d', '%ss'],
['P5M', 0, 1, '- 5m', null],
['P6Y', 0, 1, '- 6y', null],
['P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06.0', null],
['PT1M60S', 0, 1, '- 00:02:00.0', null],
['PT1H60M', 0, 1, '- 02:00:00.0', null],
['P1DT24H', 0, 1, '- 2d', null],
['P1M32D', 0, 1, '- 1m 32d', null],
];
}
/**
@@ -244,7 +244,7 @@ EODUMP;
$timezone = new \DateTimeZone($timezone);
$stub = new Stub();
$cast = DateCaster::castTimeZone($timezone, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
$cast = DateCaster::castTimeZone($timezone, ['foo' => 'bar'], $stub, false, Caster::EXCLUDE_VERBOSE);
$xDump = <<<EODUMP
array:1 [
@@ -274,27 +274,27 @@ EODUMP;
{
$xRegion = \extension_loaded('intl') ? '%s' : '';
return array(
return [
// type 1 (UTC offset)
array('-12:00', '-12:00', ''),
array('+00:00', '+00:00', ''),
array('+14:00', '+14:00', ''),
['-12:00', '-12:00', ''],
['+00:00', '+00:00', ''],
['+14:00', '+14:00', ''],
// type 2 (timezone abbreviation)
array('GMT', '+00:00', ''),
array('a', '+01:00', ''),
array('b', '+02:00', ''),
array('z', '+00:00', ''),
['GMT', '+00:00', ''],
['a', '+01:00', ''],
['b', '+02:00', ''],
['z', '+00:00', ''],
// type 3 (timezone identifier)
array('Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion),
array('America/Panama', 'America/Panama (%s:00)', $xRegion),
array('Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion),
array('Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion),
array('Australia/Perth', 'Australia/Perth (%s:00)', $xRegion),
array('Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion),
array('Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion),
);
['Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion],
['America/Panama', 'America/Panama (%s:00)', $xRegion],
['Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion],
['Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion],
['Australia/Perth', 'Australia/Perth (%s:00)', $xRegion],
['Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion],
['Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion],
];
}
/**
@@ -321,7 +321,7 @@ EODUMP;
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options);
$stub = new Stub();
$cast = DateCaster::castPeriod($p, array(), $stub, false, 0);
$cast = DateCaster::castPeriod($p, [], $stub, false, 0);
$xDump = <<<EODUMP
array:1 [
@@ -349,28 +349,28 @@ EODUMP;
public function providePeriods()
{
$periods = array(
array('2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'),
array('2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'),
$periods = [
['2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'],
['2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'],
array('2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
array('2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
['2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'],
['2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'],
array('2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'),
array('2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'),
['2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'],
['2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'],
array('2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'),
array('2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'),
['2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'],
['2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'],
array('2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
array('2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
['2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'],
['2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'],
array('2017-01-01', 'P1DT1H', '2017-01-03', 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
array('2017-01-01', 'P1DT1H', 1, 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
['2017-01-01', 'P1DT1H', '2017-01-03', 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'],
['2017-01-01', 'P1DT1H', 1, 0, 'every + 1d 01:00:00.0, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'],
array('2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'),
array('2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'),
);
['2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'],
['2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'],
];
if (\PHP_VERSION_ID < 70107) {
array_walk($periods, function (&$i) { $i[5] = ''; });

View File

@@ -36,7 +36,7 @@ class ExceptionCasterTest extends TestCase
public function testDefaultSettings()
{
$ref = array('foo');
$ref = ['foo'];
$e = $this->getTestException('foo', $ref);
$expectedDump = <<<'EODUMP'
@@ -57,7 +57,7 @@ Exception {
EODUMP;
$this->assertDumpMatchesFormat($expectedDump, $e);
$this->assertSame(array('foo'), $ref);
$this->assertSame(['foo'], $ref);
}
public function testSeek()
@@ -166,19 +166,19 @@ EODUMP;
{
require_once \dirname(__DIR__).'/Fixtures/Twig.php';
$f = array(
new FrameStub(array(
$f = [
new FrameStub([
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 20,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
)),
new FrameStub(array(
]),
new FrameStub([
'file' => \dirname(__DIR__).'/Fixtures/Twig.php',
'line' => 21,
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),
)),
);
]),
];
$expectedDump = <<<'EODUMP'
array:2 [

View File

@@ -33,9 +33,9 @@ array:1 [
"\\x00~\\x00value" => %s
]
EODUMP;
$this->assertDumpEquals(sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpOctal), GmpCaster::castGmp($gmpOctal, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmp), GmpCaster::castGmp($gmp, array(), new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpString), GmpCaster::castGmp($gmpString, [], new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmpOctal), GmpCaster::castGmp($gmpOctal, [], new Stub(), false, 0));
$this->assertDumpEquals(sprintf($gmpDump, $gmp), GmpCaster::castGmp($gmp, [], new Stub(), false, 0));
$dump = <<<EODUMP
GMP {

View File

@@ -54,12 +54,12 @@ EOTXT;
$expectedAttribute11 = $var->getAttribute(\NumberFormatter::GROUPING_SIZE);
$expectedAttribute12 = $var->getAttribute(\NumberFormatter::ROUNDING_MODE);
$expectedAttribute13 = number_format($var->getAttribute(\NumberFormatter::ROUNDING_INCREMENT), 1);
$expectedAttribute14 = $var->getAttribute(\NumberFormatter::FORMAT_WIDTH);
$expectedAttribute14 = $this->getDump($var->getAttribute(\NumberFormatter::FORMAT_WIDTH));
$expectedAttribute15 = $var->getAttribute(\NumberFormatter::PADDING_POSITION);
$expectedAttribute16 = $var->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE);
$expectedAttribute17 = $var->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED);
$expectedAttribute18 = $var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS);
$expectedAttribute19 = $var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS);
$expectedAttribute18 = $this->getDump($var->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS));
$expectedAttribute19 = $this->getDump($var->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS));
$expectedAttribute20 = $var->getAttribute(\NumberFormatter::LENIENT_PARSE);
$expectedTextAttribute1 = $var->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX);

View File

@@ -29,9 +29,9 @@ class PdoCasterTest extends TestCase
public function testCastPdo()
{
$pdo = new \PDO('sqlite::memory:');
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, ['PDOStatement', [$pdo]]);
$cast = PdoCaster::castPdo($pdo, array(), new Stub(), false);
$cast = PdoCaster::castPdo($pdo, [], new Stub(), false);
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);

View File

@@ -37,7 +37,7 @@ ReflectionClass {
%A]
constants: array:3 [
"IS_IMPLICIT_ABSTRACT" => 16
"IS_EXPLICIT_ABSTRACT" => 32
"IS_EXPLICIT_ABSTRACT" => %d
"IS_FINAL" => %d
]
properties: array:%d [
@@ -90,10 +90,10 @@ EOTXT
if (\defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('Not for HHVM.');
}
$var = array(
$var = [
(new \ReflectionMethod($this, __FUNCTION__))->getClosure($this),
(new \ReflectionMethod(__CLASS__, 'tearDownAfterClass'))->getClosure(),
);
];
$this->assertDumpMatchesFormat(
<<<EOTXT
@@ -235,7 +235,7 @@ array:2 [
EODUMP;
$r = new \ReflectionGenerator($generator);
$this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator()));
$this->assertDumpMatchesFormat($expectedDump, [$r, $r->getExecutingGenerator()]);
foreach ($generator as $v) {
}

View File

@@ -23,8 +23,8 @@ class SplCasterTest extends TestCase
public function getCastFileInfoTests()
{
return array(
array(__FILE__, <<<'EOTXT'
return [
[__FILE__, <<<'EOTXT'
SplFileInfo {
%Apath: "%sCaster"
filename: "SplCasterTest.php"
@@ -49,8 +49,8 @@ SplFileInfo {
link: false
%A}
EOTXT
),
array('https://google.com/about', <<<'EOTXT'
],
['https://google.com/about', <<<'EOTXT'
SplFileInfo {
%Apath: "https://google.com"
filename: "about"
@@ -60,8 +60,8 @@ SplFileInfo {
realPath: false
%A}
EOTXT
),
);
],
];
}
/** @dataProvider getCastFileInfoTests */
@@ -137,12 +137,12 @@ EOTXT;
public function provideCastSplDoublyLinkedList()
{
return array(
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
);
return [
[\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'],
[\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'],
[\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'],
[\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'],
];
}
public function testCastObjectStorageIsntModified()
@@ -166,7 +166,7 @@ EOTXT;
public function testCastArrayObject()
{
$var = new \ArrayObject(array(123));
$var = new \ArrayObject([123]);
$var->foo = 234;
$expected = <<<EOTXT
@@ -185,7 +185,7 @@ EOTXT;
public function testArrayIterator()
{
$var = new MyArrayIterator(array(234));
$var = new MyArrayIterator([234]);
$expected = <<<EOTXT
Symfony\Component\VarDumper\Tests\Caster\MyArrayIterator {

View File

@@ -26,7 +26,7 @@ class StubCasterTest extends TestCase
public function testArgsStubWithDefaults($foo = 234, $bar = 456)
{
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -41,7 +41,7 @@ EODUMP;
public function testArgsStubWithExtraArgs($foo = 234)
{
$args = array(new ArgsStub(array(123, 456), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123, 456], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -59,7 +59,7 @@ EODUMP;
public function testArgsStubNoParamWithExtraArgs()
{
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
$args = [new ArgsStub([123], __FUNCTION__, __CLASS__)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -74,7 +74,7 @@ EODUMP;
public function testArgsStubWithClosure()
{
$args = array(new ArgsStub(array(123), '{closure}', null));
$args = [new ArgsStub([123], '{closure}', null)];
$expectedDump = <<<'EODUMP'
array:1 [
@@ -89,13 +89,13 @@ EODUMP;
public function testLinkStub()
{
$var = array(new LinkStub(__CLASS__, 0, __FILE__));
$var = [new LinkStub(__CLASS__, 0, __FILE__)];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
$dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']);
$dump = $dumper->dump($cloner->cloneVar($var), true);
$expectedDump = <<<'EODUMP'
@@ -110,13 +110,13 @@ EODUMP;
public function testLinkStubWithNoFileLink()
{
$var = array(new LinkStub('example.com', 0, 'http://example.com'));
$var = [new LinkStub('example.com', 0, 'http://example.com')];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
$dumper->setDisplayOptions(['fileLinkFormat' => '%f:%l']);
$dump = $dumper->dump($cloner->cloneVar($var), true);
$expectedDump = <<<'EODUMP'
@@ -131,13 +131,13 @@ EODUMP;
public function testClassStub()
{
$var = array(new ClassStub('hello', array(FooInterface::class, 'foo')));
$var = [new ClassStub('hello', [FooInterface::class, 'foo'])];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
@@ -151,7 +151,7 @@ EODUMP;
public function testClassStubWithNotExistingClass()
{
$var = array(new ClassStub(NotExisting::class));
$var = [new ClassStub(NotExisting::class)];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
@@ -172,13 +172,13 @@ EODUMP;
public function testClassStubWithNotExistingMethod()
{
$var = array(new ClassStub('hello', array(FooInterface::class, 'missing')));
$var = [new ClassStub('hello', [FooInterface::class, 'missing'])];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
@@ -192,14 +192,14 @@ EODUMP;
public function testClassStubWithAnonymousClass()
{
$var = array(new ClassStub(\get_class(new class() extends \Exception {
})));
$var = [new ClassStub(\get_class(new class() extends \Exception {
}))];
$cloner = new VarCloner();
$dumper = new HtmlDumper();
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
$dump = $dumper->dump($cloner->cloneVar($var), true, ['fileLinkFormat' => '%f:%l']);
$expectedDump = <<<'EODUMP'
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>

View File

@@ -66,15 +66,15 @@ EODUMP;
public function provideNodes()
{
return array(
array(0, <<<'EODUMP'
return [
[0, <<<'EODUMP'
XMLReader {
+nodeType: NONE
…13
}
EODUMP
),
array(1, <<<'EODUMP'
],
[1, <<<'EODUMP'
XMLReader {
+localName: "foo"
+nodeType: ELEMENT
@@ -82,8 +82,8 @@ XMLReader {
…11
}
EODUMP
),
array(2, <<<'EODUMP'
],
[2, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -96,8 +96,8 @@ XMLReader {
…9
}
EODUMP
),
array(3, <<<'EODUMP'
],
[3, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -106,8 +106,8 @@ XMLReader {
…10
}
EODUMP
),
array(4, <<<'EODUMP'
],
[4, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: END_ELEMENT
@@ -116,8 +116,8 @@ XMLReader {
…10
}
EODUMP
),
array(6, <<<'EODUMP'
],
[6, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -127,8 +127,8 @@ XMLReader {
…9
}
EODUMP
),
array(9, <<<'EODUMP'
],
[9, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: TEXT
@@ -138,8 +138,8 @@ XMLReader {
…9
}
EODUMP
),
array(12, <<<'EODUMP'
],
[12, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -149,8 +149,8 @@ XMLReader {
…9
}
EODUMP
),
array(13, <<<'EODUMP'
],
[13, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: END_ELEMENT
@@ -159,8 +159,8 @@ XMLReader {
…10
}
EODUMP
),
array(15, <<<'EODUMP'
],
[15, <<<'EODUMP'
XMLReader {
+localName: "bar"
+nodeType: ELEMENT
@@ -170,8 +170,8 @@ XMLReader {
…9
}
EODUMP
),
array(16, <<<'EODUMP'
],
[16, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -184,8 +184,8 @@ XMLReader {
…9
}
EODUMP
),
array(17, <<<'EODUMP'
],
[17, <<<'EODUMP'
XMLReader {
+localName: "baz"
+prefix: "baz"
@@ -196,8 +196,8 @@ XMLReader {
…8
}
EODUMP
),
array(18, <<<'EODUMP'
],
[18, <<<'EODUMP'
XMLReader {
+localName: "baz"
+prefix: "baz"
@@ -208,8 +208,8 @@ XMLReader {
…8
}
EODUMP
),
array(19, <<<'EODUMP'
],
[19, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -222,8 +222,8 @@ XMLReader {
…9
}
EODUMP
),
array(21, <<<'EODUMP'
],
[21, <<<'EODUMP'
XMLReader {
+localName: "#text"
+nodeType: SIGNIFICANT_WHITESPACE
@@ -233,8 +233,8 @@ XMLReader {
…9
}
EODUMP
),
array(22, <<<'EODUMP'
],
[22, <<<'EODUMP'
XMLReader {
+localName: "foo"
+nodeType: END_ELEMENT
@@ -242,7 +242,7 @@ XMLReader {
…11
}
EODUMP
),
);
],
];
}
}

View File

@@ -21,9 +21,9 @@ class DataTest extends TestCase
{
public function testBasicData()
{
$values = array(1 => 123, 4.5, 'abc', null, false);
$values = [1 => 123, 4.5, 'abc', null, false];
$data = $this->cloneVar($values);
$clonedValues = array();
$clonedValues = [];
$this->assertInstanceOf(Data::class, $data);
$this->assertCount(\count($values), $data);
@@ -62,7 +62,7 @@ class DataTest extends TestCase
public function testArray()
{
$values = array(array(), array(123));
$values = [[], [123]];
$data = $this->cloneVar($values);
$this->assertSame($values, $data->getValue(true));
@@ -83,7 +83,7 @@ class DataTest extends TestCase
public function testStub()
{
$data = $this->cloneVar(array(new ClassStub('stdClass')));
$data = $this->cloneVar([new ClassStub('stdClass')]);
$data = $data[0];
$this->assertSame('string', $data->getType());
@@ -93,15 +93,15 @@ class DataTest extends TestCase
public function testHardRefs()
{
$values = array(array());
$values = [[]];
$values[1] = &$values[0];
$values[2][0] = &$values[2];
$data = $this->cloneVar($values);
$this->assertSame(array(), $data[0]->getValue());
$this->assertSame(array(), $data[1]->getValue());
$this->assertEquals(array($data[2]->getValue()), $data[2]->getValue(true));
$this->assertSame([], $data[0]->getValue());
$this->assertSame([], $data[1]->getValue());
$this->assertEquals([$data[2]->getValue()], $data[2]->getValue(true));
$this->assertSame('array (count=3)', (string) $data);
}

View File

@@ -21,7 +21,7 @@ class VarClonerTest extends TestCase
{
public function testMaxIntBoundary()
{
$data = array(PHP_INT_MAX => 123);
$data = [PHP_INT_MAX => 123];
$cloner = new VarCloner();
$clone = $cloner->cloneVar($data);
@@ -149,42 +149,42 @@ EOTXT;
public function testLimits()
{
// Level 0:
$data = array(
$data = [
// Level 1:
array(
[
// Level 2:
array(
[
// Level 3:
'Level 3 Item 0',
'Level 3 Item 1',
'Level 3 Item 2',
'Level 3 Item 3',
),
array(
],
[
'Level 3 Item 4',
'Level 3 Item 5',
'Level 3 Item 6',
),
array(
],
[
'Level 3 Item 7',
),
),
array(
array(
],
],
[
[
'Level 3 Item 8',
),
],
'Level 2 Item 0',
),
array(
],
[
'Level 2 Item 1',
),
],
'Level 1 Item 0',
array(
[
// Test setMaxString:
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'SHORT',
),
);
],
];
$cloner = new VarCloner();
$cloner->setMinDepth(2);
@@ -381,16 +381,16 @@ EOTXT;
public function testCaster()
{
$cloner = new VarCloner(array(
$cloner = new VarCloner([
'*' => function ($obj, $array) {
return array('foo' => 123);
return ['foo' => 123];
},
__CLASS__ => function ($obj, $array) {
++$array['foo'];
return $array;
},
));
]);
$clone = $cloner->cloneVar($this);
$expected = <<<EOTXT

View File

@@ -42,21 +42,21 @@ class CliDescriptorTest extends TestCase
return $s;
}));
$descriptor->describe($output, new Data(array(array(123))), $context + array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat(trim($expectedOutput), str_replace(PHP_EOL, "\n", trim($output->fetch())));
}
public function provideContext()
{
yield 'source' => array(
array(
'source' => array(
yield 'source' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
),
),
],
],
<<<TXT
Received from client #1
-----------------------
@@ -67,18 +67,18 @@ Received from client #1
file /Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php
-------- ---------------------------------------------------------------------------------------------------
TXT
);
];
yield 'source full' => array(
array(
'source' => array(
yield 'source full' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
),
),
],
],
<<<TXT
Received from client #1
-----------------------
@@ -92,15 +92,15 @@ Received from client #1
Open source in your IDE/browser:
phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30
TXT
);
];
yield 'cli' => array(
array(
'cli' => array(
yield 'cli' => [
[
'cli' => [
'identifier' => 'd8bece1c',
'command_line' => 'bin/phpunit',
),
),
],
],
<<<TXT
$ bin/phpunit
-------------
@@ -109,17 +109,17 @@ $ bin/phpunit
date Fri, 14 Dec 2018 16:17:48 +0000
------ ---------------------------------
TXT
);
];
yield 'request' => array(
array(
'request' => array(
yield 'request' => [
[
'request' => [
'identifier' => 'd8bece1c',
'controller' => new Data(array(array('FooController.php'))),
'controller' => new Data([['FooController.php']]),
'method' => 'GET',
'uri' => 'http://localhost/foo',
),
),
],
],
<<<TXT
GET http://localhost/foo
------------------------
@@ -129,6 +129,6 @@ GET http://localhost/foo
controller "FooController.php"
------------ ---------------------------------
TXT
);
];
}
}

View File

@@ -39,11 +39,11 @@ class HtmlDescriptorTest extends TestCase
$dumper->method('dump')->willReturn('[DUMPED]');
$descriptor = new HtmlDescriptor($dumper);
$descriptor->describe($output, new Data(array(array(123))), array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat('<style>%A</style><script>%A</script>%A', $output->fetch(), 'styles & scripts are output');
$descriptor->describe($output, new Data(array(array(123))), array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), ['timestamp' => 1544804268.3668], 1);
$this->assertStringNotMatchesFormat('<style>%A</style><script>%A</script>%A', $output->fetch(), 'styles & scripts are output only once');
}
@@ -58,21 +58,21 @@ class HtmlDescriptorTest extends TestCase
$dumper->method('dump')->willReturn('[DUMPED]');
$descriptor = new HtmlDescriptor($dumper);
$descriptor->describe($output, new Data(array(array(123))), $context + array('timestamp' => 1544804268.3668), 1);
$descriptor->describe($output, new Data([[123]]), $context + ['timestamp' => 1544804268.3668], 1);
$this->assertStringMatchesFormat(trim($expectedOutput), trim(preg_replace('@<style>.*</style><script>.*</script>@s', '', $output->fetch())));
}
public function provideContext()
{
yield 'source' => array(
array(
'source' => array(
yield 'source' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'line' => 30,
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
),
),
],
],
<<<TXT
<article data-dedup-id="%s">
<header>
@@ -92,19 +92,19 @@ class HtmlDescriptorTest extends TestCase
</section>
</article>
TXT
);
];
yield 'source full' => array(
array(
'source' => array(
yield 'source full' => [
[
'source' => [
'name' => 'CliDescriptorTest.php',
'project_dir' => 'src/Symfony/',
'line' => 30,
'file_relative' => 'src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file' => '/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php',
'file_link' => 'phpstorm://open?file=/Users/ogi/symfony/src/Symfony/Component/VarDumper/Tests/Command/Descriptor/CliDescriptorTest.php&line=30',
),
),
],
],
<<<TXT
<article data-dedup-id="%s">
<header>
@@ -128,15 +128,15 @@ TXT
</section>
</article>
TXT
);
];
yield 'cli' => array(
array(
'cli' => array(
yield 'cli' => [
[
'cli' => [
'identifier' => 'd8bece1c',
'command_line' => 'bin/phpunit',
),
),
],
],
<<<TXT
<article data-dedup-id="d8bece1c">
<header>
@@ -156,17 +156,17 @@ TXT
</section>
</article>
TXT
);
];
yield 'request' => array(
array(
'request' => array(
yield 'request' => [
[
'request' => [
'identifier' => 'd8bece1c',
'controller' => new Data(array(array('FooController.php'))),
'controller' => new Data([['FooController.php']]),
'method' => 'GET',
'uri' => 'http://localhost/foo',
),
),
],
],
<<<TXT
<article data-dedup-id="d8bece1c">
<header>
@@ -190,6 +190,6 @@ TXT
</section>
</article>
TXT
);
];
}
}

View File

@@ -32,13 +32,13 @@ class CliDumperTest extends TestCase
$dumper = new CliDumper('php://output');
$dumper->setColors(false);
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['uri'], $a['wrapper_data']);
return $a;
},
));
]);
$data = $cloner->cloneVar($var);
ob_start();
@@ -121,11 +121,11 @@ EOTXT
$dumper->setColors(false);
$cloner = new VarCloner();
$var = array(
'array' => array('a', 'b'),
$var = [
'array' => ['a', 'b'],
'string' => 'hello',
'multiline string' => "this\nis\na\multiline\nstring",
);
];
$dump = $dumper->dump($cloner->cloneVar($var), true);
@@ -181,7 +181,7 @@ array:3 [
EOTXT;
yield array($expected, CliDumper::DUMP_COMMA_SEPARATOR);
yield [$expected, CliDumper::DUMP_COMMA_SEPARATOR];
$expected = <<<'EOTXT'
array:3 [
@@ -200,7 +200,7 @@ array:3 [
EOTXT;
yield array($expected, CliDumper::DUMP_TRAILING_COMMA);
yield [$expected, CliDumper::DUMP_TRAILING_COMMA];
}
/**
@@ -263,7 +263,7 @@ EOTXT
public function testObjectCast()
{
$var = (object) array(1 => 1);
$var = (object) [1 => 1];
$var->{1} = 2;
if (\PHP_VERSION_ID >= 70200) {
@@ -320,10 +320,10 @@ EOTXT
putenv('DUMP_LIGHT_ARRAY=1');
putenv('DUMP_STRING_LENGTH=1');
$var = array(
$var = [
range(1, 3),
array('foo', 2 => 'bar'),
);
['foo', 2 => 'bar'],
];
$this->assertDumpEquals(
<<<EOTXT
@@ -360,22 +360,22 @@ EOTXT
$dumper = new CliDumper();
$dumper->setColors(false);
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['wrapper_data']);
return $a;
},
));
$cloner->addCasters(array(
]);
$cloner->addCasters([
':stream' => eval('return function () use ($twig) {
try {
$twig->render(array());
$twig->render([]);
} catch (\Twig\Error\RuntimeError $e) {
throw $e->getPrevious();
}
};'),
));
]);
$ref = (int) $out;
$data = $cloner->cloneVar($out);
@@ -416,7 +416,7 @@ EOTXT
public function testRefsInProperties()
{
$var = (object) array('foo' => 'foo');
$var = (object) ['foo' => 'foo'];
$var->bar = &$var->foo;
$dumper = new CliDumper();
@@ -530,12 +530,12 @@ EOTXT
}
$var = function &() {
$var = array();
$var = [];
$var[] = &$var;
return $var;
};
return array($var(), $GLOBALS, &$GLOBALS);
return [$var(), $GLOBALS, &$GLOBALS];
}
}

View File

@@ -43,7 +43,7 @@ class FunctionsTest extends TestCase
$return = dump($var1, $var2, $var3);
$out = ob_get_clean();
$this->assertEquals(array($var1, $var2, $var3), $return);
$this->assertEquals([$var1, $var2, $var3], $return);
}
protected function setupVarDumper()

View File

@@ -32,13 +32,13 @@ class HtmlDumperTest extends TestCase
$dumper->setDumpHeader('<foo></foo>');
$dumper->setDumpBoundaries('<bar>', '</bar>');
$cloner = new VarCloner();
$cloner->addCasters(array(
$cloner->addCasters([
':stream' => function ($res, $a) {
unset($a['uri'], $a['wrapper_data']);
return $a;
},
));
]);
$data = $cloner->cloneVar($var);
ob_start();

View File

@@ -44,14 +44,14 @@ class ServerDumperTest extends TestCase
$cloner = new VarCloner();
$data = $cloner->cloneVar('foo');
$dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper, array(
$dumper = new ServerDumper(self::VAR_DUMPER_SERVER, $wrappedDumper, [
'foo_provider' => new class() implements ContextProviderInterface {
public function getContext(): ?array
{
return array('foo');
return ['foo'];
}
},
));
]);
$dumped = null;
$process = $this->getServerProcess();
@@ -84,10 +84,10 @@ DUMP
private function getServerProcess(): Process
{
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, array(
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [
'COMPONENT_ROOT' => __DIR__.'/../../',
'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER,
));
]);
$process->inheritEnvironmentVariables(true);
return $process->setTimeout(9);

View File

@@ -11,11 +11,11 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
parent::__construct($env);
}
$this->parent = false;
$this->blocks = array();
$this->blocks = [];
$this->path = $path;
}
protected function doDisplay(array $context, array $blocks = array())
protected function doDisplay(array $context, array $blocks = [])
{
// line 2
throw new \Exception('Foobar');
@@ -28,7 +28,7 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
public function getDebugInfo()
{
return array(20 => 1, 21 => 2);
return [20 => 1, 21 => 2];
}
public function getSourceContext()

View File

@@ -14,19 +14,19 @@ $foo->bar = 'bar';
$g = fopen(__FILE__, 'r');
$var = array(
$var = [
'number' => 1, null,
'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX,
'str' => "déjà\n", "\xE9\x00test\t\ning",
'[]' => array(),
'[]' => [],
'res' => $g,
'obj' => $foo,
'closure' => function ($a, \PDO &$b = null) {},
'line' => __LINE__ - 1,
'nobj' => array((object) array()),
);
'nobj' => [(object) []],
];
$r = array();
$r = [];
$r[] = &$r;
$var['recurs'] = &$r;

View File

@@ -26,14 +26,14 @@ class ConnectionTest extends TestCase
{
$cloner = new VarCloner();
$data = $cloner->cloneVar('foo');
$connection = new Connection(self::VAR_DUMPER_SERVER, array(
$connection = new Connection(self::VAR_DUMPER_SERVER, [
'foo_provider' => new class() implements ContextProviderInterface {
public function getContext(): ?array
{
return array('foo');
return ['foo'];
}
},
));
]);
$dumped = null;
$process = $this->getServerProcess();
@@ -77,10 +77,10 @@ DUMP
private function getServerProcess(): Process
{
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, array(
$process = new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/dump_server.php'), null, [
'COMPONENT_ROOT' => __DIR__.'/../../',
'VAR_DUMPER_SERVER' => self::VAR_DUMPER_SERVER,
));
]);
$process->inheritEnvironmentVariables(true);
return $process->setTimeout(9);

View File

@@ -21,7 +21,7 @@ class VarDumperTestTraitTest extends TestCase
public function testItComparesLargeData()
{
$howMany = 700;
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
$data = array_fill_keys(range(0, $howMany), ['a', 'b', 'c', 'd']);
$expected = sprintf("array:%d [\n", $howMany + 1);
for ($i = 0; $i <= $howMany; ++$i) {
@@ -41,6 +41,6 @@ EODUMP;
public function testAllowsNonScalarExpectation()
{
$this->assertDumpEquals(new \ArrayObject(array('bim' => 'bam')), new \ArrayObject(array('bim' => 'bam')));
$this->assertDumpEquals(new \ArrayObject(['bim' => 'bam']), new \ArrayObject(['bim' => 'bam']));
}
}