Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/var-dumper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.2.1
Choose a base ref
...
head repository: symfony/var-dumper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.2
Choose a head ref

Commits on Dec 26, 2020

  1. Copy the full SHA
    90eca4b View commit details
  2. Copy the full SHA
    697a4ee View commit details
  3. Merge branch '4.4' into 5.1

    * 4.4:
      [VarDumper] Fix display of nullable union return types.
      [VarDumper] fixed displaying "mixed" as "?mixed"
      Handle failure when sending DATA
    derrabus committed Dec 26, 2020
    Copy the full SHA
    fa84224 View commit details
  4. Merge branch '5.1' into 5.2

    * 5.1:
      [VarDumper] Fix display of nullable union return types.
      [VarDumper] fixed displaying "mixed" as "?mixed"
      Handle failure when sending DATA
    derrabus committed Dec 26, 2020
    Copy the full SHA
    a009e6e View commit details
  5. Copy the full SHA
    022d814 View commit details

Commits on Dec 27, 2020

  1. Merge branch '4.4' into 5.1

    * 4.4:
      CS: Apply ternary_to_null_coalescing fixer
    derrabus committed Dec 27, 2020
    Copy the full SHA
    e6e9189 View commit details
  2. Merge branch '5.1' into 5.2

    * 5.1:
      CS: Apply ternary_to_null_coalescing fixer
    derrabus committed Dec 27, 2020
    Copy the full SHA
    d9e51a8 View commit details

Commits on Jan 1, 2021

  1. Bump license year

    fabpot committed Jan 1, 2021
    Copy the full SHA
    2a2ebda View commit details
  2. Merge branch '4.4' into 5.1

    * 4.4:
      Bump license year
      [Form] fix passing null $pattern to IntlDateFormatter
      Update README.md
    fabpot committed Jan 1, 2021
    Copy the full SHA
    ac912d7 View commit details
  3. Merge branch '5.1' into 5.2

    * 5.1:
      Bump license year
      Bump license year
      [Form] fix passing null $pattern to IntlDateFormatter
      Add reference link
      Update README.md
    fabpot committed Jan 1, 2021
    Copy the full SHA
    c1f6cca View commit details

Commits on Jan 6, 2021

  1. Copy the full SHA
    cbeabe3 View commit details

Commits on Jan 7, 2021

  1. Merge branch '4.4' into 5.1

    * 4.4:
      [DependencyInjection] Support PHP 8 builtin types in CheckTypeDeclarationsPass
      [DependencyInjection] Fix InvalidParameterTypeException for function parameters
      [VarDumper] fix mutating $GLOBALS while cloning it
    nicolas-grekas committed Jan 7, 2021
    Copy the full SHA
    048db95 View commit details
  2. Merge branch '5.1' into 5.2

    * 5.1:
      Rename parameter of @method configureContainer
      [DependencyInjection] Support PHP 8 builtin types in CheckTypeDeclarationsPass
      [DependencyInjection] Fix InvalidParameterTypeException for function parameters
      [Notifier] Cleanup changelog (5.1)
      [VarDumper] fix mutating $GLOBALS while cloning it
    nicolas-grekas committed Jan 7, 2021
    Copy the full SHA
    0fb4a9a View commit details

Commits on Jan 10, 2021

  1. Copy the full SHA
    a41200d View commit details
  2. Merge branch '4.4' into 5.1

    * 4.4:
      Improve composer.json descriptions
    fabpot committed Jan 10, 2021
    Copy the full SHA
    92d625b View commit details
  3. Merge branch '5.1' into 5.2

    * 5.1:
      Improve composer.json descriptions
    fabpot committed Jan 10, 2021
    Copy the full SHA
    4e40176 View commit details

Commits on Jan 11, 2021

  1. Copy the full SHA
    3edb156 View commit details
  2. Merge branch '4.4' into 5.1

    * 4.4:
      Use ::class keyword when possible
    fabpot committed Jan 11, 2021
    Copy the full SHA
    8b30c75 View commit details
  3. Merge branch '5.1' into 5.2

    * 5.1:
      Use ::class keyword when possible
    fabpot committed Jan 11, 2021
    Copy the full SHA
    76a2bbb View commit details

Commits on Jan 14, 2021

  1. Copy the full SHA
    3bf0805 View commit details
  2. CS fix

    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    029ccfc View commit details
  3. Merge branch '4.4' into 5.1

    * 4.4:
      CS fix
      [travis] use PHP 8.0 to patch return types and run deps=low
      Update sl_SI translations
      Don't trigger deprecation for deprecated aliases pointing to deprecated definitions
      [HttpFoundation] use atomic writes in MockFileSessionStorage
      [DI] fix param annotation
      [Config] Add \Symfony\Component\Config\Loader::load() return type
      Simplify PHP CS Fixer config
      Rename normalize param
    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    6ea9049 View commit details
  4. µCS fix

    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    059999b View commit details
  5. Merge branch '4.4' into 5.1

    * 4.4:
      µCS fix
    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    193070b View commit details
  6. Merge branch '5.1' into 5.2

    * 5.1:
      µCS fix
      CS fix
      CS fix
      [travis] use PHP 8.0 to patch return types and run deps=low
      Add me as a Notifier code owner
      Update sl_SI translations
      Don't trigger deprecation for deprecated aliases pointing to deprecated definitions
      [HttpFoundation] use atomic writes in MockFileSessionStorage
      Make EmailMessage & SmsMessage transport nullable
      remove unused argument
      [DI] fix param annotation
      [Config] Add \Symfony\Component\Config\Loader::load() return type
      Simplify PHP CS Fixer config
      Rename normalize param
    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    548ebbe View commit details
  7. [VarDumper] Fix tests

    nicolas-grekas committed Jan 14, 2021
    Copy the full SHA
    4847433 View commit details

Commits on Jan 24, 2021

  1. Copy the full SHA
    a0ddfaf View commit details

Commits on Jan 25, 2021

  1. Merge branch '4.4' into 5.1

    * 4.4:
      Changed private static array-properties to const
    nicolas-grekas committed Jan 25, 2021
    Copy the full SHA
    3dd1c05 View commit details
  2. Merge branch '5.1' into 5.2

    * 5.1:
      Changed private static array-properties to const
    nicolas-grekas committed Jan 25, 2021
    Copy the full SHA
    7afc02e View commit details

Commits on Jan 27, 2021

  1. Copy the full SHA
    a1eab2f View commit details
  2. Merge branch '4.4' into 5.1

    * 4.4:
      Use createMock() and use import instead of FQCN
    nicolas-grekas committed Jan 27, 2021
    Copy the full SHA
    cee600a View commit details
  3. Merge branch '5.1' into 5.2

    * 5.1:
      Use createMock() and use import instead of FQCN
    nicolas-grekas committed Jan 27, 2021
    Copy the full SHA
    72ca213 View commit details
8 changes: 4 additions & 4 deletions Caster/AmqpCaster.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*/
class AmqpCaster
{
private static $flags = [
private const FLAGS = [
\AMQP_DURABLE => 'AMQP_DURABLE',
\AMQP_PASSIVE => 'AMQP_PASSIVE',
\AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
@@ -39,7 +39,7 @@ class AmqpCaster
\AMQP_REQUEUE => 'AMQP_REQUEUE',
];

private static $exchangeTypes = [
private const EXCHANGE_TYPES = [
\AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT',
\AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
\AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
@@ -133,7 +133,7 @@ public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool
$prefix.'flags' => self::extractFlags($c->getFlags()),
];

$type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType();
$type = isset(self::EXCHANGE_TYPES[$c->getType()]) ? new ConstStub(self::EXCHANGE_TYPES[$c->getType()], $c->getType()) : $c->getType();

// Recent version of the extension already expose private properties
if (isset($a["\x00AMQPExchange\x00name"])) {
@@ -197,7 +197,7 @@ private static function extractFlags(int $flags): ConstStub
{
$flagsArray = [];

foreach (self::$flags as $value => $name) {
foreach (self::FLAGS as $value => $name) {
if ($flags & $value) {
$flagsArray[] = $name;
}
12 changes: 6 additions & 6 deletions Caster/DOMCaster.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*/
class DOMCaster
{
private static $errorCodes = [
private const ERROR_CODES = [
\DOM_PHP_ERR => 'DOM_PHP_ERR',
\DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
\DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
@@ -42,7 +42,7 @@ class DOMCaster
\DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
];

private static $nodeTypes = [
private const NODE_TYPES = [
\XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
\XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
\XML_TEXT_NODE => 'XML_TEXT_NODE',
@@ -66,8 +66,8 @@ class DOMCaster
public static function castException(\DOMException $e, array $a, Stub $stub, bool $isNested)
{
$k = Caster::PREFIX_PROTECTED.'code';
if (isset($a[$k], self::$errorCodes[$a[$k]])) {
$a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
if (isset($a[$k], self::ERROR_CODES[$a[$k]])) {
$a[$k] = new ConstStub(self::ERROR_CODES[$a[$k]], $a[$k]);
}

return $a;
@@ -97,7 +97,7 @@ public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNes
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
'nodeType' => new ConstStub(self::NODE_TYPES[$dom->nodeType], $dom->nodeType),
'parentNode' => new CutStub($dom->parentNode),
'childNodes' => $dom->childNodes,
'firstChild' => new CutStub($dom->firstChild),
@@ -121,7 +121,7 @@ public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
'nodeType' => new ConstStub(self::NODE_TYPES[$dom->nodeType], $dom->nodeType),
'prefix' => $dom->prefix,
'localName' => $dom->localName,
'namespaceURI' => $dom->namespaceURI,
18 changes: 9 additions & 9 deletions Caster/ExceptionCaster.php
Original file line number Diff line number Diff line change
@@ -138,10 +138,10 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo

$frame = new FrameStub(
[
'object' => isset($f['object']) ? $f['object'] : null,
'class' => isset($f['class']) ? $f['class'] : null,
'type' => isset($f['type']) ? $f['type'] : null,
'function' => isset($f['function']) ? $f['function'] : null,
'object' => $f['object'] ?? null,
'class' => $f['class'] ?? null,
'type' => $f['type'] ?? null,
'function' => $f['function'] ?? null,
] + $frames[$i - 1],
false,
true
@@ -160,7 +160,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, boo
}
$f = $frames[$i - 1];
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
$frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
$frame->value['arguments'] = new ArgsStub($f['args'], $f['function'] ?? null, $f['class'] ?? null);
}
} elseif ('???' !== $lastCall) {
$label = new ClassStub($lastCall);
@@ -209,12 +209,12 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, boo
$srcKey = $f['file'];
$ellipsis = new LinkStub($srcKey, 0);
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
$ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
$ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;
$ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0;
$ellipsis = $ellipsis->attr['ellipsis'] ?? 0;

if (is_file($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
$template = $f['object'] ?? unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));

$ellipsis = 0;
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
@@ -312,7 +312,7 @@ private static function extractSource(string $srcLines, int $line, int $srcConte
$src = [];

for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
$src[] = ($srcLines[$i] ?? '')."\n";
}

if ($frame['function'] ?? false) {
4 changes: 2 additions & 2 deletions Caster/PdoCaster.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*/
class PdoCaster
{
private static $pdoAttributes = [
private const PDO_ATTRIBUTES = [
'CASE' => [
\PDO::CASE_LOWER => 'LOWER',
\PDO::CASE_NATURAL => 'NATURAL',
@@ -65,7 +65,7 @@ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

foreach (self::$pdoAttributes as $k => $v) {
foreach (self::PDO_ATTRIBUTES as $k => $v) {
if (!isset($k[0])) {
$k = $v;
$v = [];
20 changes: 10 additions & 10 deletions Caster/PgSqlCaster.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*/
class PgSqlCaster
{
private static $paramCodes = [
private const PARAM_CODES = [
'server_encoding',
'client_encoding',
'is_superuser',
@@ -35,15 +35,15 @@ class PgSqlCaster
'standard_conforming_strings',
];

private static $transactionStatus = [
private const TRANSACTION_STATUS = [
\PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
\PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
\PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
\PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
\PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
];

private static $resultStatus = [
private const RESULT_STATUS = [
\PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
\PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
\PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
@@ -54,7 +54,7 @@ class PgSqlCaster
\PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
];

private static $diagCodes = [
private const DIAG_CODES = [
'severity' => \PGSQL_DIAG_SEVERITY,
'sqlstate' => \PGSQL_DIAG_SQLSTATE,
'message' => \PGSQL_DIAG_MESSAGE_PRIMARY,
@@ -83,8 +83,8 @@ public static function castLink($link, array $a, Stub $stub, bool $isNested)
$a['busy'] = pg_connection_busy($link);

$a['transaction'] = pg_transaction_status($link);
if (isset(self::$transactionStatus[$a['transaction']])) {
$a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']);
if (isset(self::TRANSACTION_STATUS[$a['transaction']])) {
$a['transaction'] = new ConstStub(self::TRANSACTION_STATUS[$a['transaction']], $a['transaction']);
}

$a['pid'] = pg_get_pid($link);
@@ -96,7 +96,7 @@ public static function castLink($link, array $a, Stub $stub, bool $isNested)
$a['options'] = pg_options($link);
$a['version'] = pg_version($link);

foreach (self::$paramCodes as $v) {
foreach (self::PARAM_CODES as $v) {
if (false !== $s = pg_parameter_status($link, $v)) {
$a['param'][$v] = $s;
}
@@ -112,13 +112,13 @@ public static function castResult($result, array $a, Stub $stub, bool $isNested)
{
$a['num rows'] = pg_num_rows($result);
$a['status'] = pg_result_status($result);
if (isset(self::$resultStatus[$a['status']])) {
$a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
if (isset(self::RESULT_STATUS[$a['status']])) {
$a['status'] = new ConstStub(self::RESULT_STATUS[$a['status']], $a['status']);
}
$a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING);

if (-1 === $a['num rows']) {
foreach (self::$diagCodes as $k => $v) {
foreach (self::DIAG_CODES as $k => $v) {
$a['error'][$k] = pg_result_error_field($result, $v);
}
}
28 changes: 14 additions & 14 deletions Caster/RedisCaster.php
Original file line number Diff line number Diff line change
@@ -22,24 +22,24 @@
*/
class RedisCaster
{
private static $serializer = [
private const SERIALIZERS = [
\Redis::SERIALIZER_NONE => 'NONE',
\Redis::SERIALIZER_PHP => 'PHP',
2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
];

private static $mode = [
private const MODES = [
\Redis::ATOMIC => 'ATOMIC',
\Redis::MULTI => 'MULTI',
\Redis::PIPELINE => 'PIPELINE',
];

private static $compression = [
private const COMPRESSION_MODES = [
0 => 'NONE', // Redis::COMPRESSION_NONE
1 => 'LZF', // Redis::COMPRESSION_LZF
];

private static $failover = [
private const FAILOVER_OPTIONS = [
\RedisCluster::FAILOVER_NONE => 'NONE',
\RedisCluster::FAILOVER_ERROR => 'ERROR',
\RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
@@ -63,7 +63,7 @@ public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
$prefix.'auth' => $c->getAuth(),
$prefix.'mode' => isset(self::$mode[$mode]) ? new ConstStub(self::$mode[$mode], $mode) : $mode,
$prefix.'mode' => isset(self::MODES[$mode]) ? new ConstStub(self::MODES[$mode], $mode) : $mode,
$prefix.'dbNum' => $c->getDbNum(),
$prefix.'timeout' => $c->getTimeout(),
$prefix.'lastError' => $c->getLastError(),
@@ -95,7 +95,7 @@ public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub,
$prefix.'mode' => new ConstStub($c->getMode() ? 'MULTI' : 'ATOMIC', $c->getMode()),
$prefix.'lastError' => $c->getLastError(),
$prefix.'options' => self::getRedisOptions($c, [
'SLAVE_FAILOVER' => isset(self::$failover[$failover]) ? new ConstStub(self::$failover[$failover], $failover) : $failover,
'SLAVE_FAILOVER' => isset(self::FAILOVER_OPTIONS[$failover]) ? new ConstStub(self::FAILOVER_OPTIONS[$failover], $failover) : $failover,
]),
];

@@ -110,23 +110,23 @@ private static function getRedisOptions($redis, array $options = []): EnumStub
$serializer = $redis->getOption(\Redis::OPT_SERIALIZER);
if (\is_array($serializer)) {
foreach ($serializer as &$v) {
if (isset(self::$serializer[$v])) {
$v = new ConstStub(self::$serializer[$v], $v);
if (isset(self::SERIALIZERS[$v])) {
$v = new ConstStub(self::SERIALIZERS[$v], $v);
}
}
} elseif (isset(self::$serializer[$serializer])) {
$serializer = new ConstStub(self::$serializer[$serializer], $serializer);
} elseif (isset(self::SERIALIZERS[$serializer])) {
$serializer = new ConstStub(self::SERIALIZERS[$serializer], $serializer);
}

$compression = \defined('Redis::OPT_COMPRESSION') ? $redis->getOption(\Redis::OPT_COMPRESSION) : 0;
if (\is_array($compression)) {
foreach ($compression as &$v) {
if (isset(self::$compression[$v])) {
$v = new ConstStub(self::$compression[$v], $v);
if (isset(self::COMPRESSION_MODES[$v])) {
$v = new ConstStub(self::COMPRESSION_MODES[$v], $v);
}
}
} elseif (isset(self::$compression[$compression])) {
$compression = new ConstStub(self::$compression[$compression], $compression);
} elseif (isset(self::COMPRESSION_MODES[$compression])) {
$compression = new ConstStub(self::COMPRESSION_MODES[$compression], $compression);
}

$retry = \defined('Redis::OPT_SCAN') ? $redis->getOption(\Redis::OPT_SCAN) : 0;
10 changes: 5 additions & 5 deletions Caster/ReflectionCaster.php
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ class ReflectionCaster
{
public const UNSET_CLOSURE_FILE_INFO = ['Closure' => __CLASS__.'::unsetClosureFileInfo'];

private static $extraMap = [
private const EXTRA_MAP = [
'docComment' => 'getDocComment',
'extension' => 'getExtensionName',
'isDisabled' => 'isDisabled',
@@ -124,7 +124,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a
}
$function = $c->getFunction();
$frame = [
'class' => isset($function->class) ? $function->class : null,
'class' => $function->class ?? null,
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
'function' => $function->name,
'file' => $c->getExecutingFile(),
@@ -195,7 +195,7 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra
if (isset($a[$prefix.'returnType'])) {
$v = $a[$prefix.'returnType'];
$v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType'] instanceof \ReflectionNamedType && $a[$prefix.'returnType']->allowsNull() && 'mixed' !== $v ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
}
if (isset($a[$prefix.'class'])) {
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
@@ -351,7 +351,7 @@ public static function getSignature(array $a)
if (!$type instanceof \ReflectionNamedType) {
$signature .= $type.' ';
} else {
if (!$param->isOptional() && $param->allowsNull()) {
if (!$param->isOptional() && $param->allowsNull() && 'mixed' !== $type->getName()) {
$signature .= '?';
}
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
@@ -398,7 +398,7 @@ private static function addExtra(array &$a, \Reflector $c)
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
}

self::addMap($x, $c, self::$extraMap, '');
self::addMap($x, $c, self::EXTRA_MAP, '');

if ($x) {
$a[Caster::PREFIX_VIRTUAL.'extra'] = new EnumStub($x);
4 changes: 2 additions & 2 deletions Caster/SplCaster.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*/
class SplCaster
{
private static $splFileObjectFlags = [
private const SPL_FILE_OBJECT_FLAGS = [
\SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
\SplFileObject::READ_AHEAD => 'READ_AHEAD',
\SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
@@ -169,7 +169,7 @@ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, b

if (isset($a[$prefix.'flags'])) {
$flagsArray = [];
foreach (self::$splFileObjectFlags as $value => $name) {
foreach (self::SPL_FILE_OBJECT_FLAGS as $value => $name) {
if ($a[$prefix.'flags'] & $value) {
$flagsArray[] = $name;
}
4 changes: 2 additions & 2 deletions Caster/SymfonyCaster.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
*/
class SymfonyCaster
{
private static $requestGetters = [
private const REQUEST_GETTERS = [
'pathInfo' => 'getPathInfo',
'requestUri' => 'getRequestUri',
'baseUrl' => 'getBaseUrl',
@@ -32,7 +32,7 @@ public static function castRequest(Request $request, array $a, Stub $stub, bool
{
$clone = null;

foreach (self::$requestGetters as $prop => $getter) {
foreach (self::REQUEST_GETTERS as $prop => $getter) {
$key = Caster::PREFIX_PROTECTED.$prop;
if (\array_key_exists($key, $a) && null === $a[$key]) {
if (null === $clone) {
Loading