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

@@ -57,7 +57,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = array(
$this->data = [
'app_name' => $this->name,
'app_version' => $this->version,
'token' => $response->headers->get('X-Debug-Token'),
@@ -72,9 +72,9 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
'xdebug_enabled' => \extension_loaded('xdebug'),
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
'bundles' => array(),
'bundles' => [],
'sapi_name' => \PHP_SAPI,
);
];
if (isset($this->kernel)) {
foreach ($this->kernel->getBundles() as $name => $bundle) {
@@ -100,7 +100,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function reset()
{
$this->data = array();
$this->data = [];
}
public function lateCollect()

View File

@@ -27,7 +27,7 @@ use Symfony\Component\VarDumper\Cloner\VarCloner;
*/
abstract class DataCollector implements DataCollectorInterface, \Serializable
{
protected $data = array();
protected $data = [];
/**
* @var ClonerInterface
@@ -36,12 +36,15 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
public function serialize()
{
return serialize($this->data);
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
return $isCalledFromOverridingMethod ? $this->data : serialize($this->data);
}
public function unserialize($data)
{
$this->data = unserialize($data);
$this->data = \is_array($data) ? $data : unserialize($data);
}
/**
@@ -76,7 +79,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
*/
protected function getCasters()
{
return array(
return [
'*' => function ($v, array $a, Stub $s, $isNested) {
if (!$v instanceof Stub) {
foreach ($a as $k => $v) {
@@ -88,6 +91,6 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
return $a;
},
);
];
}
}

View File

@@ -52,12 +52,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->dumper = $dumper;
// All clones share these properties by reference:
$this->rootRefs = array(
$this->rootRefs = [
&$this->data,
&$this->dataCount,
&$this->isCollected,
&$this->clonesCount,
);
];
$this->sourceContextProvider = $dumper instanceof Connection && isset($dumper->getContextProviders()['source']) ? $dumper->getContextProviders()['source'] : new SourceContextProvider($this->charset);
}
@@ -110,7 +110,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
) {
if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) {
$dumper = new HtmlDumper('php://output', $this->charset);
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
}
@@ -126,7 +126,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ($this->stopwatch) {
$this->stopwatch->reset();
}
$this->data = array();
$this->data = [];
$this->dataCount = 0;
$this->isCollected = true;
$this->clonesCount = 0;
@@ -142,7 +142,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->data[] = $this->fileLinkFormat;
$this->data[] = $this->charset;
$ser = serialize($this->data);
$this->data = array();
$this->data = [];
$this->dataCount = 0;
$this->isCollected = true;
@@ -151,7 +151,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function unserialize($data)
{
parent::unserialize($data);
$this->data = unserialize($data);
$charset = array_pop($this->data);
$fileLinkFormat = array_pop($this->data);
$this->dataCount = \count($this->data);
@@ -169,11 +169,11 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ('html' === $format) {
$dumper = new HtmlDumper($data, $this->charset);
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format));
}
$dumps = array();
$dumps = [];
foreach ($this->data as $dump) {
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
@@ -207,12 +207,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
$html = 'html' === $_SERVER['VAR_DUMPER_FORMAT'];
} else {
$html = !\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html');
$html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html');
}
if ($html) {
$dumper = new HtmlDumper('php://output', $this->charset);
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
$dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]);
} else {
$dumper = new CliDumper('php://output', $this->charset);
}
@@ -222,7 +222,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line']);
}
$this->data = array();
$this->data = [];
$this->dataCount = 0;
}
}
@@ -236,7 +236,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$s = $this->style('meta', '%s');
$f = strip_tags($this->style('', $file));
$name = strip_tags($this->style('', $name));
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) {
if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) {
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name);
} else {
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name);

View File

@@ -37,16 +37,16 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = array(
'called_listeners' => array(),
'not_called_listeners' => array(),
'orphaned_events' => array(),
);
$this->data = [
'called_listeners' => [],
'not_called_listeners' => [],
'orphaned_events' => [],
];
}
public function reset()
{
$this->data = array();
$this->data = [];
if ($this->dispatcher instanceof ResetInterface) {
$this->dispatcher->reset();

View File

@@ -28,9 +28,9 @@ class ExceptionDataCollector extends DataCollector
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if (null !== $exception) {
$this->data = array(
$this->data = [
'exception' => FlattenException::create($exception),
);
];
}
}
@@ -39,7 +39,7 @@ class ExceptionDataCollector extends DataCollector
*/
public function reset()
{
$this->data = array();
$this->data = [];
}
/**

View File

@@ -55,7 +55,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
if ($this->logger instanceof DebugLoggerInterface) {
$this->logger->clear();
}
$this->data = array();
$this->data = [];
}
/**
@@ -80,12 +80,12 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function getLogs()
{
return isset($this->data['logs']) ? $this->data['logs'] : array();
return isset($this->data['logs']) ? $this->data['logs'] : [];
}
public function getPriorities()
{
return isset($this->data['priorities']) ? $this->data['priorities'] : array();
return isset($this->data['priorities']) ? $this->data['priorities'] : [];
}
public function countErrors()
@@ -110,7 +110,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
public function getCompilerLogs()
{
return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : array();
return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : [];
}
/**
@@ -124,13 +124,17 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function getContainerDeprecationLogs()
{
if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) {
return array();
return [];
}
if ('' === $logContent = trim(file_get_contents($file))) {
return [];
}
$bootTime = filemtime($file);
$logs = array();
foreach (unserialize(file_get_contents($file)) as $log) {
$log['context'] = array('exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count']));
$logs = [];
foreach (unserialize($logContent) as $log) {
$log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])];
$log['timestamp'] = $bootTime;
$log['priority'] = 100;
$log['priorityName'] = 'DEBUG';
@@ -146,17 +150,17 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function getContainerCompilerLogs()
{
if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Compiler.log')) {
return array();
return [];
}
$logs = array();
$logs = [];
foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) {
$log = explode(': ', $log, 2);
if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) {
$log = array('Unknown Compiler Pass', implode(': ', $log));
$log = ['Unknown Compiler Pass', implode(': ', $log)];
}
$logs[$log[0]][] = array('message' => $log[1]);
$logs[$log[0]][] = ['message' => $log[1]];
}
return $logs;
@@ -164,8 +168,8 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function sanitizeLogs($logs)
{
$sanitizedLogs = array();
$silencedLogs = array();
$sanitizedLogs = [];
$silencedLogs = [];
foreach ($logs as $log) {
if (!$this->isSilencedOrDeprecationErrorLog($log)) {
@@ -184,10 +188,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
$silencedLogs[$h] = true;
if (!isset($sanitizedLogs[$message])) {
$sanitizedLogs[$message] = $log + array(
$sanitizedLogs[$message] = $log + [
'errorCount' => 0,
'scream' => true,
);
];
}
$sanitizedLogs[$message]['errorCount'] += $exception->count;
@@ -199,10 +203,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
if (isset($sanitizedLogs[$errorId])) {
++$sanitizedLogs[$errorId]['errorCount'];
} else {
$log += array(
$log += [
'errorCount' => 1,
'scream' => false,
);
];
$sanitizedLogs[$errorId] = $log;
}
@@ -223,7 +227,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
return true;
}
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) {
if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) {
return true;
}
@@ -232,23 +236,23 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
private function computeErrorsCount(array $containerDeprecationLogs)
{
$silencedLogs = array();
$count = array(
$silencedLogs = [];
$count = [
'error_count' => $this->logger->countErrors($this->currentRequest),
'deprecation_count' => 0,
'warning_count' => 0,
'scream_count' => 0,
'priorities' => array(),
);
'priorities' => [],
];
foreach ($this->logger->getLogs($this->currentRequest) as $log) {
if (isset($count['priorities'][$log['priority']])) {
++$count['priorities'][$log['priority']]['count'];
} else {
$count['priorities'][$log['priority']] = array(
$count['priorities'][$log['priority']] = [
'count' => 1,
'name' => $log['priorityName'],
);
];
}
if ('WARNING' === $log['priorityName']) {
++$count['warning_count'];

View File

@@ -39,10 +39,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte
*/
public function reset()
{
$this->data = array(
$this->data = [
'memory' => 0,
'memory_limit' => $this->convertToBytes(ini_get('memory_limit')),
);
];
}
/**

View File

@@ -38,7 +38,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// attributes are serialized and as they can be anything, they need to be converted to strings.
$attributes = array();
$attributes = [];
$route = '';
foreach ($request->attributes->all() as $key => $value) {
if ('_route' === $key) {
@@ -57,10 +57,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$content = false;
}
$sessionMetadata = array();
$sessionAttributes = array();
$sessionMetadata = [];
$sessionAttributes = [];
$session = null;
$flashes = array();
$flashes = [];
if ($request->hasSession()) {
$session = $request->getSession();
if ($session->isStarted()) {
@@ -74,19 +74,19 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$statusCode = $response->getStatusCode();
$responseCookies = array();
$responseCookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$responseCookies[$cookie->getName()] = $cookie;
}
$dotenvVars = array();
$dotenvVars = [];
foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) {
if ('' !== $name && false !== $value = getenv($name)) {
$dotenvVars[$name] = $value;
}
}
$this->data = array(
$this->data = [
'method' => $request->getMethod(),
'format' => $request->getRequestFormat(),
'content' => $content,
@@ -110,7 +110,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
'controller' => 'n/a',
'locale' => $request->getLocale(),
'dotenv_vars' => $dotenvVars,
);
];
if (isset($this->data['request_headers']['php-auth-pw'])) {
$this->data['request_headers']['php-auth-pw'] = '******';
@@ -147,14 +147,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if ($response->isRedirect()) {
$response->headers->setCookie(new Cookie(
'sf_redirect',
json_encode(array(
json_encode([
'token' => $response->headers->get('x-debug-token'),
'route' => $request->attributes->get('_route', 'n/a'),
'method' => $request->getMethod(),
'controller' => $this->parseController($request->attributes->get('_controller')),
'status_code' => $statusCode,
'status_text' => Response::$statusTexts[(int) $statusCode],
)),
]),
0, '/', null, $request->isSecure(), true, false, 'lax'
));
}
@@ -173,7 +173,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public function reset()
{
$this->data = array();
$this->data = [];
$this->controllers = new \SplObjectStorage();
}
@@ -308,7 +308,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
*/
public function getRouteParams()
{
return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : array();
return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : [];
}
/**
@@ -356,10 +356,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
public static function getSubscribedEvents()
{
return array(
return [
KernelEvents::CONTROLLER => 'onKernelController',
KernelEvents::RESPONSE => 'onKernelResponse',
);
];
}
/**
@@ -387,21 +387,21 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
try {
$r = new \ReflectionMethod($controller[0], $controller[1]);
return array(
return [
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
];
} catch (\ReflectionException $e) {
if (\is_callable($controller)) {
// using __call or __callStatic
return array(
return [
'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => 'n/a',
'line' => 'n/a',
);
];
}
}
}
@@ -409,12 +409,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if ($controller instanceof \Closure) {
$r = new \ReflectionFunction($controller);
$controller = array(
$controller = [
'class' => $r->getName(),
'method' => null,
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
];
if (false !== strpos($r->name, '{closure}')) {
return $controller;
@@ -433,12 +433,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
if (\is_object($controller)) {
$r = new \ReflectionClass($controller);
return array(
return [
'class' => $r->getName(),
'method' => null,
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
];
}
return \is_string($controller) ? $controller : 'n/a';

View File

@@ -54,11 +54,11 @@ class RouterDataCollector extends DataCollector
{
$this->controllers = new \SplObjectStorage();
$this->data = array(
$this->data = [
'redirect' => false,
'url' => null,
'route' => null,
);
];
}
protected function guessRoute(Request $request, $controller)

View File

@@ -43,11 +43,12 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
$startTime = $request->server->get('REQUEST_TIME_FLOAT');
}
$this->data = array(
$this->data = [
'token' => $response->headers->get('X-Debug-Token'),
'start_time' => $startTime * 1000,
'events' => array(),
);
'events' => [],
'stopwatch_installed' => \class_exists(Stopwatch::class, false),
];
}
/**
@@ -55,7 +56,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
*/
public function reset()
{
$this->data = array();
$this->data = [];
if (null !== $this->stopwatch) {
$this->stopwatch->reset();
@@ -139,6 +140,14 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf
return $this->data['start_time'];
}
/**
* @return bool whether or not the stopwatch component is installed
*/
public function isStopwatchInstalled()
{
return $this->data['stopwatch_installed'];
}
/**
* {@inheritdoc}
*/