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: v6.0.19
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: v6.1.0
Choose a head ref
  • 20 commits
  • 29 files changed
  • 4 contributors

Commits on Dec 8, 2021

  1. Copy the full SHA
    e3c930a View commit details

Commits on Dec 13, 2021

  1. Copy the full SHA
    d5ba019 View commit details

Commits on Dec 16, 2021

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [6.0] cs fixes
      [5.4] cs fixes
      [5.3] cs fixes
      [Cache] Fix saving items with no expiration through ProxyAdapter
      CS fixes
      fix merge
      Remove pointless assignment
      [HttpClient] Fix tracing requests made after calling withOptions()
      [Cache] disable lock on CLI
      Revert "feature #41989 [Cache] make `LockRegistry` use semaphores when possible (nicolas-grekas)"
      [HttpKernel] fix how configuring log-level and status-code by exception works
      [VarDumper] add more "transient-on-macos" groups
    nicolas-grekas committed Dec 16, 2021
    Copy the full SHA
    8b64473 View commit details
  2. Copy the full SHA
    110f257 View commit details

Commits on Dec 29, 2021

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [Lock] Release DoctrineDbalPostgreSqlStore connection lock on failure
      [DependencyInjection][HttpKernel] Fix enum typed bindings
      make login link handler tests time sensitive
      [CI] Remove macOS jobs
      Suppress psalm error for UndefinedDocblockClass for PHP 8.1 classes
    nicolas-grekas committed Dec 29, 2021
    Copy the full SHA
    f8d30f4 View commit details

Commits on Jan 2, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0: (22 commits)
      Bump license year
      Bump license year
      [Validator] Error using CssColor with doctrine annotations
      [HttpClient] Turn negative timeout to a very long timeout
      Features goes to 6.x branch
      [Translation] [LocoProvider] Fix use of asset ids
      fix lowest required PropertyInfo component release
      [Validator] throw when Constraint::_construct() has not been called
      Bump Symfony version to 6.0.3
      Update VERSION for 6.0.2
      Update CHANGELOG for 6.0.2
      Bump Symfony version to 5.4.3
      Update VERSION for 5.4.2
      Update CHANGELOG for 5.4.2
      Bump Symfony version to 5.3.14
      Update VERSION for 5.3.13
      Update CHANGELOG for 5.3.13
      Bump Symfony version to 4.4.37
      Update VERSION for 4.4.36
      Update CONTRIBUTORS for 4.4.36
      ...
    fabpot committed Jan 2, 2022
    Copy the full SHA
    09c2fb4 View commit details

Commits on Jan 17, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [VarDumper] fix tests
    nicolas-grekas committed Jan 17, 2022
    Copy the full SHA
    89d8bba View commit details

Commits on Feb 4, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [Semaphore] fix tests
      [HttpClient] fix destructing CurlResponse
      [Cache] Fix connecting to Redis via a socket file
      [DependencyInjection][FrameworkBundle] Fix using PHP 8.1 enum as parameters
      [PropertyAccessor] Add missing TypeError catch
      [HttpKernel] Fixed error count by log not displayed in WebProfilerBundle
      Added `kernel.event_listener` to the default list of behavior describing tags, fixing AsEventListener attribute not working on decorators.
      [HttpKernel] Fix FileLinkFormatter with empty xdebug.file_link_format
      [WebProfilerBundle] Fixes weird spacing in log message context/trace output
      [Notifier] fix Microsoft Teams webhook url
      [FrameworkBundle] Fix log channel of TagAwareAdapter
      [Postmark] ensure only a single tag can be used with Postmark
      [Mailer] allow Mailchimp to handle multiple TagHeader's
      [HttpClient] Fix Content-Length header when possible
      [Routing] AnnotationDirectoryLoader::load() may return null
      [DependencyInjection] Don't dump polyfilled classes in preload script
    nicolas-grekas committed Feb 4, 2022
    Copy the full SHA
    559036f View commit details

Commits on Feb 21, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [Messenger] Fix dealing with unexpected payload in Redis transport
      [Filesystem] Update some PHPDoc of the Path class
      [VarDumper] Fix dumping mysqli_driver instances
      Fix missing ReturnTypeWillChange attributes
      [Cache] Add missing log when saving namespace
      [HttpKernel] Reset services between requests performed by KernelBrowser
      [HttpKernel] Remove unused argument in ArgumentMetadataFactory
      [Stopwatch] Fix test expectation
      [SecurityBundle] fix autoconfiguring Monolog's ProcessorInterface
      KernelTestCase resets internal state on tearDown
      [Security/Http] Fix getting password-upgrader when user-loader is a closure
      [HttpKernel] Fix extracting controller name from closures
      [Intl] fix wrong offset timezone PHP 8.1
      Fix type binding
      Remove duplicated test
      [Dotenv] Fix reading config for symfony/runtime when running dump command
      [Serializer] Remove unnecessary break
      [Runtime] Fix dotenv_overload with commands
      Make document type nodes ignorable
      Initialize Symfony\Component\Security\Core\Exception\AccountStatusException:: property
    nicolas-grekas committed Feb 21, 2022
    Copy the full SHA
    410963d View commit details

Commits on Feb 25, 2022

  1. Bump minimum version of PHP to 8.1

    nicolas-grekas authored and fabpot committed Feb 25, 2022
    Copy the full SHA
    a9191b6 View commit details

Commits on Mar 2, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      -
      -
      Fix merge
      Fix merge
      [HttpKernel] Guard against bad profile data
      Fix merge
      [FrameworkBundle] Fix resetting container between tests
      Fix deprecations on PHP 8.2
    nicolas-grekas committed Mar 2, 2022
    Copy the full SHA
    8de9f30 View commit details

Commits on Apr 1, 2022

  1. Copy the full SHA
    163bb4e View commit details

Commits on Apr 12, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0: (22 commits)
      Add missing license header
      Add missing license header
      [Workflow] Catch error when trying to get an uninitialized marking
      Add missing license header
      Allow usage of Provider domains if possible
      Use reference date in reverse transform Fixes #40997
      Fix env resolution in lock configuration
      Fix Symfony not working on SMB share #45990
      [Messenger] DoctrineTransportFactory works with notify and decorated PostgreSQL driver
      [Cache] make LockRegistry use static properties instead of static variables
      fix: return-path has higher priority for envelope address than from address (fixes #41322)
      [HttpClient] Fix sending content-length when streaming the body
      [Console] Header with column max width is now well wrap with separator
      Fix use_cookies framework session configuration
      [FrameworkBundle] [Command] Fix `debug:router --no-interaction` error …
      [Intl] Update the ICU data to 71.1 - 5.4
      [Intl] Update the ICU data to 71.1 - 4.4
      Add tests to messenger connection get for OraclePlatform
      [RateLimiter] Adding default empty value
      [DependencyInjection] Add TaggedIteratorArgument unit tests
      ...
    nicolas-grekas committed Apr 12, 2022
    Copy the full SHA
    9a18d9b View commit details

Commits on Apr 15, 2022

  1. Copy the full SHA
    034e230 View commit details

Commits on Apr 19, 2022

  1. Copy the full SHA
    0b8eee9 View commit details

Commits on Apr 22, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      Use mb_convert_encoding instead of utf8_decode
      [SecurityBundle] Remove forgotten unused code
      Minor @requires function tests cleanup
      [FrameworkBundle] Always add CacheCollectorPass
      Fix "Notice: Undefined index: headers" in messenger with Oracle
      [String] Fix ansi escape sequences regex
      Indicate support for doctrine/persistence 3
      [Routing] fix router base url when default uri has trailing slash
      Replace deprecated String.prototype.substr()
    derrabus committed Apr 22, 2022
    Copy the full SHA
    f94fa31 View commit details

Commits on Apr 26, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [DependencyInjection] Properly declare #[When] as allowed on functions
      [VarDumper] Fix dumping floats on PHP8
      Fix dumping enums on PHP 8.2
      [Cache] Prevent fatal errors on php 8 when running concurrently with TagAwareAdapter v6.1
    nicolas-grekas committed Apr 26, 2022
    Copy the full SHA
    da0eaed View commit details

Commits on May 4, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      Remove former core members from code owners
      [Form] fix populating single widget time view data with different timezones
      [DomCrawler][VarDumper] Fix html-encoding emojis
    nicolas-grekas committed May 4, 2022
    Copy the full SHA
    ef23465 View commit details

Commits on May 17, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      [VarDumper] fix tests on PHP 8.2
      [Mime] Add null check for EmailHeaderSame
      Add approriate description to CollectionToArrayTransformer::reverseTransform docblock
      [PropertyInfo] CS fixes
      [VarDumper] fix test on PHP 8.2
      [Config] Fix looking for single files in phars with GlobResource
      Revert "bug #46327 [HttpKernel] Allow ErrorHandler ^5.0 to be used in HttpKernel 4.4 (mpdude)"
    nicolas-grekas committed May 17, 2022
    Copy the full SHA
    948502b View commit details

Commits on May 21, 2022

  1. Merge branch '6.0' into 6.1

    * 6.0:
      Fix merge
      [Mime] Throw exception when body in Email attach method is not ok
      [VarDumper][VarExporter] Deal with DatePeriod->include_end_date on PHP 8.2
      [Cache] Throw when "redis_sentinel" is used with a non-Predis "class" option
      fix merge
      Bootstrap 4 fieldset for row errors
      [Form] Fix same choice loader with different choice values
      [Filesystem] Safeguard (sym)link calls
      Fix dumping extension config without bundle
      [HttpClient] Honor "max_duration" when replacing requests with async decorators
      [HttpClient] Add missing HttpOptions::setMaxDuration()
      [HttpKernel] Fix missing null type in `ErrorListener::__construct()`
      [HttpFoundation] [Session] Overwrite invalid session id
    nicolas-grekas committed May 21, 2022
    Copy the full SHA
    98587d9 View commit details
2 changes: 1 addition & 1 deletion Caster/ArgsStub.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ private static function getParameters(string $function, ?string $class): array

try {
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
} catch (\ReflectionException $e) {
} catch (\ReflectionException) {
return [null, null];
}

4 changes: 2 additions & 2 deletions Caster/Caster.php
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public static function castObject(object $obj, string $class, bool $hasDebugInfo
if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Exception $e) {
} catch (\Exception) {
// ignore failing __debugInfo()
$hasDebugInfo = false;
}
@@ -61,7 +61,7 @@ public static function castObject(object $obj, string $class, bool $hasDebugInfo

if ($a) {
static $publicProperties = [];
$debugClass = $debugClass ?? get_debug_type($obj);
$debugClass ??= get_debug_type($obj);

$i = 0;
$prefixedKeys = [];
4 changes: 2 additions & 2 deletions Caster/ClassStub.php
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public function __construct(string $identifier, callable|array|string $callable
if (\is_array($r)) {
try {
$r = new \ReflectionMethod($r[0], $r[1]);
} catch (\ReflectionException $e) {
} catch (\ReflectionException) {
$r = new \ReflectionClass($r[0]);
}
}
@@ -71,7 +71,7 @@ public function __construct(string $identifier, callable|array|string $callable
$this->value .= $s;
}
}
} catch (\ReflectionException $e) {
} catch (\ReflectionException) {
return;
} finally {
if (0 < $i = strrpos($this->value, '\\')) {
37 changes: 0 additions & 37 deletions Caster/DOMCaster.php
Original file line number Diff line number Diff line change
@@ -208,43 +208,6 @@ public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNes
return $a;
}

public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'typeName' => $dom->typeName,
'typeNamespace' => $dom->typeNamespace,
];

return $a;
}

public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'severity' => $dom->severity,
'message' => $dom->message,
'type' => $dom->type,
'relatedException' => $dom->relatedException,
'related_data' => $dom->related_data,
'location' => $dom->location,
];

return $a;
}

public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
'lineNumber' => $dom->lineNumber,
'columnNumber' => $dom->columnNumber,
'offset' => $dom->offset,
'relatedNode' => $dom->relatedNode,
'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
];

return $a;
}

public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
2 changes: 1 addition & 1 deletion Caster/ExceptionCaster.php
Original file line number Diff line number Diff line change
@@ -337,7 +337,7 @@ private static function extractSource(string $srcLines, int $line, int $srcConte
$stub->attr['file'] = $f;
$stub->attr['line'] = $caller->getStartLine();
}
} catch (\ReflectionException $e) {
} catch (\ReflectionException) {
// ignore fake class/function
}

2 changes: 1 addition & 1 deletion Caster/PdoCaster.php
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
if ($v && isset($v[$attr[$k]])) {
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
}
} catch (\Exception $e) {
} catch (\Exception) {
}
}
if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
4 changes: 2 additions & 2 deletions Caster/RdKafkaCaster.php
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub,

try {
$assignment = $c->getAssignment();
} catch (RdKafkaException $e) {
} catch (RdKafkaException) {
$assignment = [];
}

@@ -172,7 +172,7 @@ private static function extractMetadata(KafkaConsumer|\RdKafka $c)

try {
$m = $c->getMetadata(true, null, 500);
} catch (RdKafkaException $e) {
} catch (RdKafkaException) {
return [];
}

6 changes: 3 additions & 3 deletions Caster/ReflectionCaster.php
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $
// Cannot create ReflectionGenerator based on a terminated Generator
try {
$reflectionGenerator = new \ReflectionGenerator($c);
} catch (\Exception $e) {
} catch (\Exception) {
$a[Caster::PREFIX_VIRTUAL.'closed'] = true;

return $a;
@@ -144,7 +144,7 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100),
'line' => $function->getExecutingLine(),
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
@@ -298,7 +298,7 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException $e) {
} catch (\ReflectionException) {
}
}

9 changes: 0 additions & 9 deletions Caster/ResourceCaster.php
Original file line number Diff line number Diff line change
@@ -63,15 +63,6 @@ public static function castGd($gd, array $a, Stub $stub, bool $isNested)
return $a;
}

public static function castMysqlLink($h, array $a, Stub $stub, bool $isNested)
{
$a['host'] = mysql_get_host_info($h);
$a['protocol'] = mysql_get_proto_info($h);
$a['server'] = mysql_get_server_info($h);

return $a;
}

public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested)
{
$stub->cut = -1;
4 changes: 2 additions & 2 deletions Caster/SplCaster.php
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool
foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception $e) {
} catch (\Exception) {
}
}

@@ -155,7 +155,7 @@ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, b
foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception $e) {
} catch (\Exception) {
}
}

2 changes: 1 addition & 1 deletion Caster/XmlReaderCaster.php
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, b
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
];
} catch (\Error $e) {
} catch (\Error) {
$properties = [
'LOADDTD' => false,
'DEFAULTATTRS' => false,
4 changes: 0 additions & 4 deletions Cloner/AbstractCloner.php
Original file line number Diff line number Diff line change
@@ -66,9 +66,6 @@ abstract class AbstractCloner implements ClonerInterface
'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'],
'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'],
'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'],
'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
@@ -163,7 +160,6 @@ abstract class AbstractCloner implements ClonerInterface
'GdImage' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],

':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'],
':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
42 changes: 2 additions & 40 deletions Cloner/VarCloner.php
Original file line number Diff line number Diff line change
@@ -121,46 +121,8 @@ protected function doClone(mixed $var): array
}
$stub = $arrayStub;

if (\PHP_VERSION_ID >= 80100) {
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
$a = $v;
break;
}

$stub->class = Stub::ARRAY_INDEXED;

$j = -1;
foreach ($v as $gk => $gv) {
if ($gk !== ++$j) {
$stub->class = Stub::ARRAY_ASSOC;
$a = $v;
$a[$gid] = true;
break;
}
}

// Copies of $GLOBALS have very strange behavior,
// let's detect them with some black magic
if (isset($v[$gid])) {
unset($v[$gid]);
$a = [];
foreach ($v as $gk => &$gv) {
if ($v === $gv && !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()])) {
unset($v);
$v = new Stub();
$v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0];
$v->handle = -1;
$gv = &$a[$gk];
$hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv;
$gv = $v;
}

$a[$gk] = &$gv;
}
unset($gv);
} else {
$a = $v;
}
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
$a = $v;
break;

case \is_object($v):
2 changes: 1 addition & 1 deletion Command/Descriptor/CliDescriptor.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
*/
class CliDescriptor implements DumpDescriptorInterface
{
private $dumper;
private CliDumper $dumper;
private mixed $lastIdentifier = null;

public function __construct(CliDumper $dumper)
2 changes: 1 addition & 1 deletion Command/Descriptor/HtmlDescriptor.php
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
*/
class HtmlDescriptor implements DumpDescriptorInterface
{
private $dumper;
private HtmlDumper $dumper;
private bool $initialized = false;

public function __construct(HtmlDumper $dumper)
2 changes: 1 addition & 1 deletion Command/ServerDumpCommand.php
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@
#[AsCommand(name: 'server:dump', description: 'Start a dump server that collects and displays dumps in a single place')]
class ServerDumpCommand extends Command
{
private $server;
private DumpServer $server;

/** @var DumpDescriptorInterface[] */
private array $descriptors;
2 changes: 1 addition & 1 deletion Dumper/AbstractDumper.php
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ public function setOutput($output)
$output = fopen($output, 'w');
}
$this->outputStream = $output;
$this->lineDumper = [$this, 'echoLine'];
$this->lineDumper = $this->echoLine(...);
}

return $prev;
2 changes: 1 addition & 1 deletion Dumper/CliDumper.php
Original file line number Diff line number Diff line change
@@ -204,7 +204,7 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
];
$str = $bin && false !== strpos($str, "\0") ? [$str] : explode("\n", $str);
$str = $bin && str_contains($str, "\0") ? [$str] : explode("\n", $str);
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
unset($str[1]);
$str[0] .= "\n";
4 changes: 2 additions & 2 deletions Dumper/ContextProvider/RequestContextProvider.php
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@
*/
final class RequestContextProvider implements ContextProviderInterface
{
private $requestStack;
private $cloner;
private RequestStack $requestStack;
private VarCloner $cloner;

public function __construct(RequestStack $requestStack)
{
2 changes: 1 addition & 1 deletion Dumper/ContextProvider/SourceContextProvider.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ final class SourceContextProvider implements ContextProviderInterface
private int $limit;
private ?string $charset;
private ?string $projectDir;
private $fileLinkFormatter;
private ?FileLinkFormatter $fileLinkFormatter;

public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter $fileLinkFormatter = null, int $limit = 9)
{
2 changes: 1 addition & 1 deletion Dumper/ContextualizedDumper.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
*/
class ContextualizedDumper implements DataDumperInterface
{
private $wrappedDumper;
private DataDumperInterface $wrappedDumper;
private array $contextProviders;

/**
4 changes: 2 additions & 2 deletions Dumper/ServerDumper.php
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@
*/
class ServerDumper implements DataDumperInterface
{
private $connection;
private $wrappedDumper;
private Connection $connection;
private ?DataDumperInterface $wrappedDumper;

/**
* @param string $host The server host
14 changes: 4 additions & 10 deletions Server/DumpServer.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
class DumpServer
{
private string $host;
private $logger;
private ?LoggerInterface $logger;

/**
* @var resource|null
@@ -56,25 +56,19 @@ public function listen(callable $callback): void
}

foreach ($this->getMessages() as $clientId => $message) {
if ($this->logger) {
$this->logger->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
}
$this->logger?->info('Received a payload from client {clientId}', ['clientId' => $clientId]);

$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]);

// Impossible to decode the message, give up.
if (false === $payload) {
if ($this->logger) {
$this->logger->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);
}
$this->logger?->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]);

continue;
}

if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) {
if ($this->logger) {
$this->logger->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);
}
$this->logger?->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]);

continue;
}
54 changes: 20 additions & 34 deletions Tests/Caster/ReflectionCasterTest.php
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ public function testReflectionParameter()

public function testReflectionParameterScalar()
{
$f = eval('return function (int $a) {};');
$f = function (int $a) {};
$var = new \ReflectionParameter($f, 0);

$this->assertDumpMatchesFormat(
@@ -170,7 +170,7 @@ public function testReflectionParameterScalar()

public function testReflectionParameterMixed()
{
$f = eval('return function (mixed $a) {};');
$f = function (mixed $a) {};
$var = new \ReflectionParameter($f, 0);

$this->assertDumpMatchesFormat(
@@ -188,7 +188,7 @@ public function testReflectionParameterMixed()

public function testReflectionParameterUnion()
{
$f = eval('return function (int|float $a) {};');
$f = function (int|float $a) {};
$var = new \ReflectionParameter($f, 0);

$this->assertDumpMatchesFormat(
@@ -205,7 +205,7 @@ public function testReflectionParameterUnion()

public function testReflectionParameterNullableUnion()
{
$f = eval('return function (int|float|null $a) {};');
$f = function (int|float|null $a) {};
$var = new \ReflectionParameter($f, 0);

$this->assertDumpMatchesFormat(
@@ -221,12 +221,9 @@ public function testReflectionParameterNullableUnion()
);
}

/**
* @requires PHP 8.1
*/
public function testReflectionParameterIntersection()
{
$f = eval('return function (Traversable&Countable $a) {};');
$f = function (\Traversable&\Countable $a) {};
$var = new \ReflectionParameter($f, 0);

$this->assertDumpMatchesFormat(
@@ -296,9 +293,6 @@ public function testReflectionUnionType()
);
}

/**
* @requires PHP 8.1
*/
public function testReflectionIntersectionType()
{
$var = (new \ReflectionProperty(ReflectionIntersectionTypeFixture::class, 'a'))->getType();
@@ -339,17 +333,16 @@ public function testExtendsReflectionType()

public function testReturnType()
{
$f = eval('return function ():int {};');
$line = __LINE__ - 1;
$f = function ():int {};

$this->assertDumpMatchesFormat(
<<<EOTXT
Closure(): int {
returnType: "int"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
file: "%sReflectionCasterTest.php($line) : eval()'d code"
line: "1 to 1"
file: "%s"
line: "%s"
}
EOTXT
, $f
@@ -358,17 +351,16 @@ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"

public function testMixedReturnType()
{
$f = eval('return function (): mixed {};');
$line = __LINE__ - 1;
$f = function (): mixed {};

$this->assertDumpMatchesFormat(
<<<EOTXT
Closure(): mixed {
returnType: "mixed"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
file: "%sReflectionCasterTest.php($line) : eval()'d code"
line: "1 to 1"
file: "%s"
line: "%s"
}
EOTXT
, $f
@@ -377,17 +369,16 @@ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"

public function testUnionReturnType()
{
$f = eval('return function (): int|float {};');
$line = __LINE__ - 1;
$f = function (): int|float {};

$this->assertDumpMatchesFormat(
<<<EOTXT
Closure(): int|float {
returnType: "int|float"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
file: "%sReflectionCasterTest.php($line) : eval()'d code"
line: "1 to 1"
file: "%s"
line: "%s"
}
EOTXT
, $f
@@ -396,17 +387,16 @@ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"

public function testNullableUnionReturnType()
{
$f = eval('return function (): int|float|null {};');
$line = __LINE__ - 1;
$f = function (): int|float|null {};

$this->assertDumpMatchesFormat(
<<<EOTXT
Closure(): int|float|null {
returnType: "int|float|null"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
file: "%sReflectionCasterTest.php($line) : eval()'d code"
line: "1 to 1"
file: "%s"
line: "%s"
}
EOTXT
, $f
@@ -485,21 +475,17 @@ public function testGenerator()
$this->assertDumpMatchesFormat($expectedDump, $generator);
}

/**
* @requires PHP 8.1
*/
public function testNewInInitializer()
{
$f = eval('return function ($a = new stdClass()) {};');
$line = __LINE__ - 1;
$f = function ($a = new \stdClass()) {};

$this->assertDumpMatchesFormat(
<<<EOTXT
Closure(\$a = new stdClass) {
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
file: "%sReflectionCasterTest.php($line) : eval()'d code"
line: "1 to 1"
file: "%s"
line: "%s"
}
EOTXT
, $f
3 changes: 0 additions & 3 deletions Tests/Cloner/VarClonerTest.php
Original file line number Diff line number Diff line change
@@ -571,9 +571,6 @@ public function testPhp74()
$this->assertStringMatchesFormat($expected, print_r($clone, true));
}

/**
* @requires PHP 8.1
*/
public function testPhp81Enums()
{
$data = new Php81Enums();
4 changes: 0 additions & 4 deletions Tests/Command/ServerDumpCommandTest.php
Original file line number Diff line number Diff line change
@@ -23,10 +23,6 @@ class ServerDumpCommandTest extends TestCase
*/
public function testComplete(array $input, array $expectedSuggestions)
{
if (!class_exists(CommandCompletionTester::class)) {
$this->markTestSkipped('Test command completion requires symfony/console 5.4+.');
}

$tester = new CommandCompletionTester($this->createCommand());

$this->assertSame($expectedSuggestions, $tester->complete($input));
69 changes: 0 additions & 69 deletions Tests/Dumper/CliDumperTest.php
Original file line number Diff line number Diff line change
@@ -377,75 +377,6 @@ public function testRefsInProperties()
+"bar": &1 "foo"
}
EOTXT
,
$out
);
}

/**
* @runInSeparateProcess
* @preserveGlobalState disabled
* @requires PHP < 8.1
*/
public function testSpecialVars56()
{
$var = $this->getSpecialVars();

$this->assertDumpEquals(
<<<'EOTXT'
array:3 [
0 => array:1 [
0 => &1 array:1 [
0 => &1 array:1 [&1]
]
]
1 => array:1 [
"GLOBALS" => & array:1 [ …1]
]
2 => &3 array:1 [
"GLOBALS" => &3 array:1 [&3]
]
]
EOTXT
,
$var
);
}

/**
* @runInSeparateProcess
* @preserveGlobalState disabled
* @requires PHP < 8.1
*/
public function testGlobals()
{
$var = $this->getSpecialVars();
unset($var[0]);
$out = '';

$dumper = new CliDumper(function ($line, $depth) use (&$out) {
if ($depth >= 0) {
$out .= str_repeat(' ', $depth).$line."\n";
}
});
$dumper->setColors(false);
$cloner = new VarCloner();

$data = $cloner->cloneVar($var);
$dumper->dump($data);

$this->assertSame(
<<<'EOTXT'
array:2 [
1 => array:1 [
"GLOBALS" => & array:1 [ …1]
]
2 => &2 array:1 [
"GLOBALS" => &2 array:1 [&2]
]
]

EOTXT
,
$out
4 changes: 2 additions & 2 deletions Tests/Fixtures/Php81Enums.php
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@

class Php81Enums
{
public $e1;
public $e2;
public UnitEnumFixture $e1;
public BackedEnumFixture $e2;

public function __construct()
{
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=8.0.2",
"php": ">=8.1",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {