Updated Rector to commit aa89fde52b

aa89fde52b link the token
This commit is contained in:
Tomas Votruba 2022-04-27 22:40:38 +00:00
parent 152dec0c68
commit 3912bd3674
37 changed files with 494 additions and 199 deletions

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '0f83ac3c878728be3118805933959e99b0939716';
public const PACKAGE_VERSION = '0.12.22';
/**
* @var string
*/
public const RELEASE_DATE = '2022-04-27 16:44:22';
public const RELEASE_DATE = '2022-04-28 00:32:10';
/**
* @var string
*/

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6::getLoader();
return ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6
class ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticIniteba52c594f8dcec20de823d418066a25::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6::$files;
$includeFiles = \Composer\Autoload\ComposerStaticIniteba52c594f8dcec20de823d418066a25::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire82f60f6813cf83c438e038c48caaa5e6($fileIdentifier, $file);
composerRequireeba52c594f8dcec20de823d418066a25($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6
* @param string $file
* @return void
*/
function composerRequire82f60f6813cf83c438e038c48caaa5e6($fileIdentifier, $file)
function composerRequireeba52c594f8dcec20de823d418066a25($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6
class ComposerStaticIniteba52c594f8dcec20de823d418066a25
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@ -3874,9 +3874,9 @@ class ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit82f60f6813cf83c438e038c48caaa5e6::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticIniteba52c594f8dcec20de823d418066a25::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticIniteba52c594f8dcec20de823d418066a25::$prefixDirsPsr4;
$loader->classMap = ComposerStaticIniteba52c594f8dcec20de823d418066a25::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2855,17 +2855,17 @@
},
{
"name": "symfony\/config",
"version": "v6.0.7",
"version_normalized": "6.0.7.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/config.git",
"reference": "22850bfdd2b6090568ad05dece6843c859d933b7"
"reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/22850bfdd2b6090568ad05dece6843c859d933b7",
"reference": "22850bfdd2b6090568ad05dece6843c859d933b7",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/6ac50d559aa64c8e7b5b17640c46241e4accb487",
"reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487",
"shasum": ""
},
"require": {
@ -2888,7 +2888,7 @@
"suggest": {
"symfony\/yaml": "To use the yaml reference dumper"
},
"time": "2022-03-22T16:12:04+00:00",
"time": "2022-04-12T16:11:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2916,7 +2916,7 @@
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.0.7"
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.0.8"
},
"funding": [
{
@ -2936,17 +2936,17 @@
},
{
"name": "symfony\/console",
"version": "v6.0.7",
"version_normalized": "6.0.7.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "70dcf7b2ca2ea08ad6ebcc475f104a024fb5632e"
"reference": "0d00aa289215353aa8746a31d101f8e60826285c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/70dcf7b2ca2ea08ad6ebcc475f104a024fb5632e",
"reference": "70dcf7b2ca2ea08ad6ebcc475f104a024fb5632e",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/0d00aa289215353aa8746a31d101f8e60826285c",
"reference": "0d00aa289215353aa8746a31d101f8e60826285c",
"shasum": ""
},
"require": {
@ -2980,7 +2980,7 @@
"symfony\/lock": "",
"symfony\/process": ""
},
"time": "2022-03-31T17:18:25+00:00",
"time": "2022-04-20T15:01:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3014,7 +3014,7 @@
"terminal"
],
"support": {
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.0.7"
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.0.8"
},
"funding": [
{
@ -3138,17 +3138,17 @@
},
{
"name": "symfony\/dependency-injection",
"version": "v6.0.7",
"version_normalized": "6.0.7.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/dependency-injection.git",
"reference": "3e8a405fcc2eaf4eadb25b5e259ad9bf90499848"
"reference": "571041cd7e765664cc527b461ee41be3013aa08e"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/3e8a405fcc2eaf4eadb25b5e259ad9bf90499848",
"reference": "3e8a405fcc2eaf4eadb25b5e259ad9bf90499848",
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/571041cd7e765664cc527b461ee41be3013aa08e",
"reference": "571041cd7e765664cc527b461ee41be3013aa08e",
"shasum": ""
},
"require": {
@ -3181,7 +3181,7 @@
"symfony\/proxy-manager-bridge": "Generate service proxies to lazy load them",
"symfony\/yaml": ""
},
"time": "2022-03-08T15:43:52+00:00",
"time": "2022-04-26T13:22:23+00:00",
"type": "library",
"extra": {
"patches_applied": [
@ -3215,7 +3215,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.0.7"
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.0.8"
},
"funding": [
{
@ -3301,23 +3301,23 @@
},
{
"name": "symfony\/finder",
"version": "v6.0.3",
"version_normalized": "6.0.3.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/finder.git",
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430"
"reference": "af7edab28d17caecd1f40a9219fc646ae751c21f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/8661b74dbabc23223f38c9b99d3f8ade71170430",
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/af7edab28d17caecd1f40a9219fc646ae751c21f",
"reference": "af7edab28d17caecd1f40a9219fc646ae751c21f",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
},
"time": "2022-01-26T17:23:29+00:00",
"time": "2022-04-15T08:07:58+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3345,7 +3345,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.0.3"
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.0.8"
},
"funding": [
{
@ -3789,23 +3789,23 @@
},
{
"name": "symfony\/process",
"version": "v6.0.7",
"version_normalized": "6.0.7.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/process.git",
"reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4"
"reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
"reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/d074154ea8b1443a96391f6e39f9e547b2dd01b9",
"reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
},
"time": "2022-03-18T16:21:55+00:00",
"time": "2022-04-12T16:11:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3833,7 +3833,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.0.7"
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.0.8"
},
"funding": [
{
@ -3853,17 +3853,17 @@
},
{
"name": "symfony\/string",
"version": "v6.0.3",
"version_normalized": "6.0.3.0",
"version": "v6.0.8",
"version_normalized": "6.0.8.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/string.git",
"reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2"
"reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/522144f0c4c004c80d56fa47e40e17028e2eefc2",
"reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d",
"shasum": ""
},
"require": {
@ -3882,7 +3882,7 @@
"symfony\/translation-contracts": "^2.0|^3.0",
"symfony\/var-exporter": "^5.4|^6.0"
},
"time": "2022-01-02T09:55:41+00:00",
"time": "2022-04-22T08:18:02+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3921,7 +3921,7 @@
"utf8"
],
"support": {
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.0.3"
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.0.8"
},
"funding": [
{
@ -4950,17 +4950,17 @@
},
{
"name": "tracy\/tracy",
"version": "v2.9.1",
"version_normalized": "2.9.1.0",
"version": "v2.9.2",
"version_normalized": "2.9.2.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/nette\/tracy.git",
"reference": "4180b3221ff852fe10d5eab30d80be6f6ab7221e"
"reference": "e527e9be56abeed5b9312a68a4e85feffeb3877c"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/nette\/tracy\/zipball\/4180b3221ff852fe10d5eab30d80be6f6ab7221e",
"reference": "4180b3221ff852fe10d5eab30d80be6f6ab7221e",
"url": "https:\/\/api.github.com\/repos\/nette\/tracy\/zipball\/e527e9be56abeed5b9312a68a4e85feffeb3877c",
"reference": "e527e9be56abeed5b9312a68a4e85feffeb3877c",
"shasum": ""
},
"require": {
@ -4980,7 +4980,7 @@
"phpstan\/phpstan": "^1.0",
"psr\/log": "^1.0 || ^2.0 || ^3.0"
},
"time": "2022-02-15T16:38:30+00:00",
"time": "2022-04-27T17:55:16+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -5021,7 +5021,7 @@
],
"support": {
"issues": "https:\/\/github.com\/nette\/tracy\/issues",
"source": "https:\/\/github.com\/nette\/tracy\/tree\/v2.9.1"
"source": "https:\/\/github.com\/nette\/tracy\/tree\/v2.9.2"
},
"install-path": "..\/tracy\/tracy"
},

File diff suppressed because one or more lines are too long

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220427\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6', false) && !interface_exists('ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6', false) && !trait_exists('ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6', false)) {
spl_autoload_call('RectorPrefix20220427\ComposerAutoloaderInit82f60f6813cf83c438e038c48caaa5e6');
if (!class_exists('ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25', false) && !interface_exists('ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25', false) && !trait_exists('ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25', false)) {
spl_autoload_call('RectorPrefix20220427\ComposerAutoloaderIniteba52c594f8dcec20de823d418066a25');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220427\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20220427\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire82f60f6813cf83c438e038c48caaa5e6')) {
function composerRequire82f60f6813cf83c438e038c48caaa5e6() {
return \RectorPrefix20220427\composerRequire82f60f6813cf83c438e038c48caaa5e6(...func_get_args());
if (!function_exists('composerRequireeba52c594f8dcec20de823d418066a25')) {
function composerRequireeba52c594f8dcec20de823d418066a25() {
return \RectorPrefix20220427\composerRequireeba52c594f8dcec20de823d418066a25(...func_get_args());
}
}
if (!function_exists('scanPath')) {

View File

@ -314,33 +314,41 @@ class Table
$rows = \array_merge($this->headers, [$divider], $this->rows);
}
$this->calculateNumberOfColumns($rows);
$rows = $this->buildTableRows($rows);
$this->calculateColumnsWidth($rows);
$rowGroups = $this->buildTableRows($rows);
$this->calculateColumnsWidth($rowGroups);
$isHeader = !$this->horizontal;
$isFirstRow = $this->horizontal;
$hasTitle = (bool) $this->headerTitle;
foreach ($rows as $row) {
if ($divider === $row) {
$isHeader = \false;
$isFirstRow = \true;
continue;
}
if ($row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator) {
$this->renderRowSeparator();
continue;
}
if (!$row) {
continue;
}
if ($isHeader || $isFirstRow) {
$this->renderRowSeparator($isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM, $hasTitle ? $this->headerTitle : null, $hasTitle ? $this->style->getHeaderTitleFormat() : null);
$isFirstRow = \false;
$hasTitle = \false;
}
if ($this->horizontal) {
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
} else {
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
foreach ($rowGroups as $rowGroup) {
$isHeaderSeparatorRendered = \false;
foreach ($rowGroup as $row) {
if ($divider === $row) {
$isHeader = \false;
$isFirstRow = \true;
continue;
}
if ($row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator) {
$this->renderRowSeparator();
continue;
}
if (!$row) {
continue;
}
if ($isHeader && !$isHeaderSeparatorRendered) {
$this->renderRowSeparator($isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM, $hasTitle ? $this->headerTitle : null, $hasTitle ? $this->style->getHeaderTitleFormat() : null);
$hasTitle = \false;
$isHeaderSeparatorRendered = \true;
}
if ($isFirstRow) {
$this->renderRowSeparator($isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM, $hasTitle ? $this->headerTitle : null, $hasTitle ? $this->style->getHeaderTitleFormat() : null);
$isFirstRow = \false;
$hasTitle = \false;
}
if ($this->horizontal) {
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
} else {
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
}
}
}
$this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
@ -520,12 +528,13 @@ class Table
}
return new \RectorPrefix20220427\Symfony\Component\Console\Helper\TableRows(function () use($rows, $unmergedRows) : \Traversable {
foreach ($rows as $rowKey => $row) {
(yield $row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator ? $row : $this->fillCells($row));
$rowGroup = [$row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator ? $row : $this->fillCells($row)];
if (isset($unmergedRows[$rowKey])) {
foreach ($unmergedRows[$rowKey] as $row) {
(yield $row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator ? $row : $this->fillCells($row));
$rowGroup[] = $row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator ? $row : $this->fillCells($row);
}
}
(yield $rowGroup);
}
});
}
@ -649,27 +658,29 @@ class Table
/**
* Calculates columns widths.
*/
private function calculateColumnsWidth(iterable $rows)
private function calculateColumnsWidth(iterable $groups)
{
for ($column = 0; $column < $this->numberOfColumns; ++$column) {
$lengths = [];
foreach ($rows as $row) {
if ($row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator) {
continue;
}
foreach ($row as $i => $cell) {
if ($cell instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableCell) {
$textContent = \RectorPrefix20220427\Symfony\Component\Console\Helper\Helper::removeDecoration($this->output->getFormatter(), $cell);
$textLength = \RectorPrefix20220427\Symfony\Component\Console\Helper\Helper::width($textContent);
if ($textLength > 0) {
$contentColumns = \str_split($textContent, \ceil($textLength / $cell->getColspan()));
foreach ($contentColumns as $position => $content) {
$row[$i + $position] = $content;
foreach ($groups as $group) {
foreach ($group as $row) {
if ($row instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableSeparator) {
continue;
}
foreach ($row as $i => $cell) {
if ($cell instanceof \RectorPrefix20220427\Symfony\Component\Console\Helper\TableCell) {
$textContent = \RectorPrefix20220427\Symfony\Component\Console\Helper\Helper::removeDecoration($this->output->getFormatter(), $cell);
$textLength = \RectorPrefix20220427\Symfony\Component\Console\Helper\Helper::width($textContent);
if ($textLength > 0) {
$contentColumns = \str_split($textContent, \ceil($textLength / $cell->getColspan()));
foreach ($contentColumns as $position => $content) {
$row[$i + $position] = $content;
}
}
}
}
$lengths[] = $this->getCellWidth($row, $column);
}
$lengths[] = $this->getCellWidth($row, $column);
}
$this->effectiveColumnWidths[$column] = \max($lengths) + \RectorPrefix20220427\Symfony\Component\Console\Helper\Helper::width($this->style->getCellRowContentFormat()) - 2;
}

View File

@ -15,7 +15,7 @@ namespace RectorPrefix20220427\Symfony\Component\DependencyInjection\Attribute;
*
* @author Nicolas Grekas <p@tchwork.com>
*/
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::TARGET_FUNCTION | \Attribute::IS_REPEATABLE)]
class When
{
/**

View File

@ -71,7 +71,11 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
*/
protected function isRegex(string $str) : bool
{
if (\preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
$availableModifiers = 'imsxuADU';
if (\PHP_VERSION_ID >= 80200) {
$availableModifiers .= 'n';
}
if (\preg_match('/^(.{3,}?)[' . $availableModifiers . ']*$/', $str, $m)) {
$start = \substr($m[1], 0, 1);
$end = \substr($m[1], -1);
if ($start === $end) {

View File

@ -52,7 +52,7 @@ class Process implements \IteratorAggregate
private $hasCallback = \false;
private $commandline;
private $cwd;
private $env;
private $env = [];
private $input;
private $starttime;
private $lastOutputTime;

View File

@ -439,7 +439,7 @@ abstract class AbstractUnicodeString extends \RectorPrefix20220427\Symfony\Compo
foreach (\explode("\n", $s) as $s) {
if ($ignoreAnsiDecoration) {
$s = \preg_replace('/(?:\\x1B(?:
\\[ [\\x30-\\x3F]*+ [\\x20-\\x2F]*+ [0x40-\\x7E]
\\[ [\\x30-\\x3F]*+ [\\x20-\\x2F]*+ [\\x40-\\x7E]
| [P\\]X^_] .*? \\x1B\\\\
| [\\x41-\\x7E]
)|[\\p{Cc}\\x7F]++)/xu', '', $s);

View File

@ -15,7 +15,7 @@ use RectorPrefix20220427\Tracy;
*/
class TracyExtension extends \RectorPrefix20220427\Nette\DI\CompilerExtension
{
private const ERROR_SEVERITY_PATTERN = 'E_(?:ALL|PARSE|STRICT|RECOVERABLE_ERROR|(?:CORE|COMPILE)_(?:ERROR|WARNING)|(?:USER_)?(?:ERROR|WARNING|NOTICE|DEPRECATED))';
private const ErrorSeverityPattern = 'E_(?:ALL|PARSE|STRICT|RECOVERABLE_ERROR|(?:CORE|COMPILE)_(?:ERROR|WARNING)|(?:USER_)?(?:ERROR|WARNING|NOTICE|DEPRECATED))';
/** @var bool */
private $debugMode;
/** @var bool */
@ -27,8 +27,8 @@ class TracyExtension extends \RectorPrefix20220427\Nette\DI\CompilerExtension
}
public function getConfigSchema() : \RectorPrefix20220427\Nette\Schema\Schema
{
$errorSeverity = \RectorPrefix20220427\Nette\Schema\Expect::string()->pattern(self::ERROR_SEVERITY_PATTERN);
$errorSeverityExpr = \RectorPrefix20220427\Nette\Schema\Expect::string()->pattern('(' . self::ERROR_SEVERITY_PATTERN . '|[ &|~()])+');
$errorSeverity = \RectorPrefix20220427\Nette\Schema\Expect::string()->pattern(self::ErrorSeverityPattern);
$errorSeverityExpr = \RectorPrefix20220427\Nette\Schema\Expect::string()->pattern('(' . self::ErrorSeverityPattern . '|[ &|~()])+');
return \RectorPrefix20220427\Nette\Schema\Expect::structure(['email' => \RectorPrefix20220427\Nette\Schema\Expect::anyOf(\RectorPrefix20220427\Nette\Schema\Expect::email(), \RectorPrefix20220427\Nette\Schema\Expect::listOf('email'))->dynamic(), 'fromEmail' => \RectorPrefix20220427\Nette\Schema\Expect::email()->dynamic(), 'emailSnooze' => \RectorPrefix20220427\Nette\Schema\Expect::string()->dynamic(), 'logSeverity' => \RectorPrefix20220427\Nette\Schema\Expect::anyOf(\RectorPrefix20220427\Nette\Schema\Expect::int(), $errorSeverityExpr, \RectorPrefix20220427\Nette\Schema\Expect::listOf($errorSeverity)), 'editor' => \RectorPrefix20220427\Nette\Schema\Expect::type('string|null')->dynamic(), 'browser' => \RectorPrefix20220427\Nette\Schema\Expect::string()->dynamic(), 'errorTemplate' => \RectorPrefix20220427\Nette\Schema\Expect::string()->dynamic(), 'strictMode' => \RectorPrefix20220427\Nette\Schema\Expect::anyOf(\RectorPrefix20220427\Nette\Schema\Expect::bool(), \RectorPrefix20220427\Nette\Schema\Expect::int(), $errorSeverityExpr, \RectorPrefix20220427\Nette\Schema\Expect::listOf($errorSeverity)), 'showBar' => \RectorPrefix20220427\Nette\Schema\Expect::bool()->dynamic(), 'maxLength' => \RectorPrefix20220427\Nette\Schema\Expect::int()->dynamic(), 'maxDepth' => \RectorPrefix20220427\Nette\Schema\Expect::int()->dynamic(), 'maxItems' => \RectorPrefix20220427\Nette\Schema\Expect::int()->dynamic(), 'keysToHide' => \RectorPrefix20220427\Nette\Schema\Expect::array(null)->dynamic(), 'dumpTheme' => \RectorPrefix20220427\Nette\Schema\Expect::string()->dynamic(), 'showLocation' => \RectorPrefix20220427\Nette\Schema\Expect::bool()->dynamic(), 'scream' => \RectorPrefix20220427\Nette\Schema\Expect::anyOf(\RectorPrefix20220427\Nette\Schema\Expect::bool(), \RectorPrefix20220427\Nette\Schema\Expect::int(), $errorSeverityExpr, \RectorPrefix20220427\Nette\Schema\Expect::listOf($errorSeverity)), 'bar' => \RectorPrefix20220427\Nette\Schema\Expect::listOf('RectorPrefix20220427\\string|Nette\\DI\\Definitions\\Statement'), 'blueScreen' => \RectorPrefix20220427\Nette\Schema\Expect::listOf('callable'), 'editorMapping' => \RectorPrefix20220427\Nette\Schema\Expect::arrayOf('string')->dynamic()->default(null), 'netteMailer' => \RectorPrefix20220427\Nette\Schema\Expect::bool(\true)]);
}
public function loadConfiguration()
@ -52,7 +52,7 @@ class TracyExtension extends \RectorPrefix20220427\Nette\DI\CompilerExtension
}
foreach ($options as $key => $value) {
if ($value !== null) {
static $tbl = ['keysToHide' => 'array_push(Tracy\\Debugger::getBlueScreen()->keysToHide, ... ?)', 'fromEmail' => 'Tracy\\Debugger::getLogger()->fromEmail = ?', 'emailSnooze' => 'Tracy\\Debugger::getLogger()->emailSnooze = ?'];
$tbl = ['keysToHide' => 'array_push(Tracy\\Debugger::getBlueScreen()->keysToHide, ... ?)', 'fromEmail' => 'Tracy\\Debugger::getLogger()->fromEmail = ?', 'emailSnooze' => 'Tracy\\Debugger::getLogger()->emailSnooze = ?'];
$initialize->addBody($builder->formatPhp(($tbl[$key] ?? 'Tracy\\Debugger::$' . $key . ' = ?') . ';', \RectorPrefix20220427\Nette\DI\Helpers::filterArguments([$value])));
}
}

View File

@ -15,7 +15,7 @@ use RectorPrefix20220427\Tracy;
class PsrToTracyLoggerAdapter implements \RectorPrefix20220427\Tracy\ILogger
{
/** Tracy logger level to PSR-3 log level mapping */
private const LEVEL_MAP = [\RectorPrefix20220427\Tracy\ILogger::DEBUG => \RectorPrefix20220427\Psr\Log\LogLevel::DEBUG, \RectorPrefix20220427\Tracy\ILogger::INFO => \RectorPrefix20220427\Psr\Log\LogLevel::INFO, \RectorPrefix20220427\Tracy\ILogger::WARNING => \RectorPrefix20220427\Psr\Log\LogLevel::WARNING, \RectorPrefix20220427\Tracy\ILogger::ERROR => \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, \RectorPrefix20220427\Tracy\ILogger::EXCEPTION => \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, \RectorPrefix20220427\Tracy\ILogger::CRITICAL => \RectorPrefix20220427\Psr\Log\LogLevel::CRITICAL];
private const LevelMap = [\RectorPrefix20220427\Tracy\ILogger::DEBUG => \RectorPrefix20220427\Psr\Log\LogLevel::DEBUG, \RectorPrefix20220427\Tracy\ILogger::INFO => \RectorPrefix20220427\Psr\Log\LogLevel::INFO, \RectorPrefix20220427\Tracy\ILogger::WARNING => \RectorPrefix20220427\Psr\Log\LogLevel::WARNING, \RectorPrefix20220427\Tracy\ILogger::ERROR => \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, \RectorPrefix20220427\Tracy\ILogger::EXCEPTION => \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, \RectorPrefix20220427\Tracy\ILogger::CRITICAL => \RectorPrefix20220427\Psr\Log\LogLevel::CRITICAL];
/** @var Psr\Log\LoggerInterface */
private $psrLogger;
public function __construct(\RectorPrefix20220427\Psr\Log\LoggerInterface $psrLogger)
@ -34,6 +34,6 @@ class PsrToTracyLoggerAdapter implements \RectorPrefix20220427\Tracy\ILogger
$message = $value;
$context = [];
}
$this->psrLogger->log(self::LEVEL_MAP[$level] ?? \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, $message, $context);
$this->psrLogger->log(self::LevelMap[$level] ?? \RectorPrefix20220427\Psr\Log\LogLevel::ERROR, $message, $context);
}
}

View File

@ -15,7 +15,7 @@ use RectorPrefix20220427\Tracy;
class TracyToPsrLoggerAdapter extends \RectorPrefix20220427\Psr\Log\AbstractLogger
{
/** PSR-3 log level to Tracy logger level mapping */
private const LEVEL_MAP = [\RectorPrefix20220427\Psr\Log\LogLevel::EMERGENCY => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::ALERT => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::CRITICAL => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::ERROR => \RectorPrefix20220427\Tracy\ILogger::ERROR, \RectorPrefix20220427\Psr\Log\LogLevel::WARNING => \RectorPrefix20220427\Tracy\ILogger::WARNING, \RectorPrefix20220427\Psr\Log\LogLevel::NOTICE => \RectorPrefix20220427\Tracy\ILogger::WARNING, \RectorPrefix20220427\Psr\Log\LogLevel::INFO => \RectorPrefix20220427\Tracy\ILogger::INFO, \RectorPrefix20220427\Psr\Log\LogLevel::DEBUG => \RectorPrefix20220427\Tracy\ILogger::DEBUG];
private const LevelMap = [\RectorPrefix20220427\Psr\Log\LogLevel::EMERGENCY => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::ALERT => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::CRITICAL => \RectorPrefix20220427\Tracy\ILogger::CRITICAL, \RectorPrefix20220427\Psr\Log\LogLevel::ERROR => \RectorPrefix20220427\Tracy\ILogger::ERROR, \RectorPrefix20220427\Psr\Log\LogLevel::WARNING => \RectorPrefix20220427\Tracy\ILogger::WARNING, \RectorPrefix20220427\Psr\Log\LogLevel::NOTICE => \RectorPrefix20220427\Tracy\ILogger::WARNING, \RectorPrefix20220427\Psr\Log\LogLevel::INFO => \RectorPrefix20220427\Tracy\ILogger::INFO, \RectorPrefix20220427\Psr\Log\LogLevel::DEBUG => \RectorPrefix20220427\Tracy\ILogger::DEBUG];
/** @var Tracy\ILogger */
private $tracyLogger;
public function __construct(\RectorPrefix20220427\Tracy\ILogger $tracyLogger)
@ -24,7 +24,7 @@ class TracyToPsrLoggerAdapter extends \RectorPrefix20220427\Psr\Log\AbstractLogg
}
public function log($level, $message, array $context = []) : void
{
$level = self::LEVEL_MAP[$level] ?? \RectorPrefix20220427\Tracy\ILogger::ERROR;
$level = self::LevelMap[$level] ?? \RectorPrefix20220427\Tracy\ILogger::ERROR;
if (isset($context['exception']) && $context['exception'] instanceof \Throwable) {
$this->tracyLogger->log($context['exception'], $level);
unset($context['exception']);

View File

@ -12,7 +12,7 @@ namespace RectorPrefix20220427\Tracy;
*/
class BlueScreen
{
private const MAX_MESSAGE_LENGTH = 2000;
private const MaxMessageLength = 2000;
/** @var string[] */
public $info = [];
/** @var string[] paths to be collapsed in stack trace (e.g. core libraries) */
@ -37,10 +37,13 @@ class BlueScreen
private $fileGenerators = [];
/** @var array */
private $snapshot;
/** @var \WeakMap<\Fiber|\Generator> */
private $fibers;
public function __construct()
{
$this->collapsePaths = \preg_match('#(.+/vendor)/tracy/tracy/src/Tracy/BlueScreen$#', \strtr(__DIR__, '\\', '/'), $m) ? [$m[1] . '/tracy', $m[1] . '/nette', $m[1] . '/latte'] : [\dirname(__DIR__)];
$this->fileGenerators[] = [self::class, 'generateNewPhpFileContents'];
$this->fibers = \PHP_VERSION_ID < 80000 ? new \SplObjectStorage() : new \WeakMap();
}
/**
* Add custom panel as function (?\Throwable $e): ?array
@ -72,6 +75,15 @@ class BlueScreen
$this->fileGenerators[] = $generator;
return $this;
}
/**
* @param \Fiber|\Generator $fiber
* @return static
*/
public function addFiber($fiber) : self
{
$this->fibers[$fiber] = \true;
return $this;
}
/**
* Renders blue screen.
*/
@ -110,6 +122,7 @@ class BlueScreen
}
private function renderTemplate(\Throwable $exception, string $template, $toScreen = \true) : void
{
[$generators, $fibers] = $this->findGeneratorsAndFibers($exception);
$headersSent = \headers_sent($headersFile, $headersLine);
$obStatus = \RectorPrefix20220427\Tracy\Debugger::$obStatus;
$showEnvironment = $this->showEnvironment && \strpos($exception->getMessage(), 'Allowed memory size') === \false;
@ -206,14 +219,14 @@ class BlueScreen
/**
* Returns syntax highlighted source code.
*/
public static function highlightFile(string $file, int $line, int $lines = 15, bool $php = \true) : ?string
public static function highlightFile(string $file, int $line, int $lines = 15, bool $php = \true, int $column = 0) : ?string
{
$source = @\file_get_contents($file);
// @ file may not exist
if ($source === \false) {
return null;
}
$source = $php ? static::highlightPhp($source, $line, $lines) : '<pre class=tracy-code><div>' . static::highlightLine(\htmlspecialchars($source, \ENT_IGNORE, 'UTF-8'), $line, $lines) . '</div></pre>';
$source = $php ? static::highlightPhp($source, $line, $lines, $column) : '<pre class=tracy-code><div>' . static::highlightLine(\htmlspecialchars($source, \ENT_IGNORE, 'UTF-8'), $line, $lines, $column) . '</div></pre>';
if ($editor = \RectorPrefix20220427\Tracy\Helpers::editorUri($file, $line)) {
$source = \substr_replace($source, ' title="Ctrl-Click to open in editor" data-tracy-href="' . \RectorPrefix20220427\Tracy\Helpers::escapeHtml($editor) . '"', 4, 0);
}
@ -222,7 +235,7 @@ class BlueScreen
/**
* Returns syntax highlighted source code.
*/
public static function highlightPhp(string $source, int $line, int $lines = 15) : string
public static function highlightPhp(string $source, int $line, int $lines = 15, int $column = 0) : string
{
if (\function_exists('ini_set')) {
\ini_set('highlight.comment', '#998; font-style: italic');
@ -237,14 +250,14 @@ class BlueScreen
$out = $source[0];
// <code><span color=highlight.html>
$source = \str_replace('<br />', "\n", $source[1]);
$out .= static::highlightLine($source, $line, $lines);
$out .= static::highlightLine($source, $line, $lines, $column);
$out = \str_replace('&nbsp;', ' ', $out);
return "<pre class='tracy-code'><div>{$out}</div></pre>";
}
/**
* Returns highlighted line in HTML code.
*/
public static function highlightLine(string $html, int $line, int $lines = 15) : string
public static function highlightLine(string $html, int $line, int $lines = 15, int $column = 0) : string
{
$source = \explode("\n", "\n" . \str_replace("\r\n", "\n", $html));
$out = '';
@ -268,7 +281,11 @@ class BlueScreen
$s = \str_replace(["\r", "\n"], ['', ''], $s);
\preg_match_all('#<[^>]+>#', $s, $tags);
if ($n == $line) {
$out .= \sprintf("<span class='tracy-line-highlight'>%{$numWidth}s: %s\n</span>%s", $n, \strip_tags($s), \implode('', $tags[0]));
$s = \strip_tags($s);
if ($column) {
$s = \preg_replace('#((?:&.*?;|[^&]){' . ($column - 1) . '})(&.*?;|.)#u', '\\1<span class="tracy-column-highlight">\\2</span>', $s . ' ', 1);
}
$out .= \sprintf("<span class='tracy-line-highlight'>%{$numWidth}s: %s\n</span>%s", $n, $s, \implode('', $tags[0]));
} else {
$out .= \sprintf("<span class='tracy-line'>%{$numWidth}s:</span> %s\n", $n, $s);
}
@ -279,7 +296,7 @@ class BlueScreen
/**
* Returns syntax highlighted source code to Terminal.
*/
public static function highlightPhpCli(string $file, int $line, int $lines = 15) : ?string
public static function highlightPhpCli(string $file, int $line, int $lines = 15, int $column = 0) : ?string
{
$source = @\file_get_contents($file);
// @ file may not exist
@ -324,7 +341,7 @@ class BlueScreen
}
public function formatMessage(\Throwable $exception) : string
{
$msg = \RectorPrefix20220427\Tracy\Helpers::encodeString(\trim((string) $exception->getMessage()), self::MAX_MESSAGE_LENGTH, \false);
$msg = \RectorPrefix20220427\Tracy\Helpers::encodeString(\trim((string) $exception->getMessage()), self::MaxMessageLength, \false);
// highlight 'string'
$msg = \preg_replace('#\'\\S(?:[^\']|\\\\\')*\\S\'|"\\S(?:[^"]|\\\\")*\\S"#', '<i>$0</i>', $msg);
// clickable class & methods
@ -395,4 +412,26 @@ class BlueScreen
}
return $res . "class {$class}\n{\n\$END\$\n}\n";
}
private function findGeneratorsAndFibers(object $object) : array
{
$generators = $fibers = [];
$add = function ($obj) use(&$generators, &$fibers) {
if ($obj instanceof \Generator) {
try {
new \ReflectionGenerator($obj);
$generators[\spl_object_id($obj)] = $obj;
} catch (\ReflectionException $e) {
}
} elseif ($obj instanceof \RectorPrefix20220427\Fiber && $obj->isStarted() && !$obj->isTerminated()) {
$fibers[\spl_object_id($obj)] = $obj;
}
};
foreach ($this->fibers as $obj => $foo) {
$add($obj);
}
if (\PHP_VERSION_ID >= 80000) {
\RectorPrefix20220427\Tracy\Helpers::traverseValue($object, $add);
}
return [$generators, $fibers];
}
}

View File

@ -261,8 +261,15 @@
font-weight: bold;
font-style: normal;
display: block;
padding: 0 .4em;
margin: 0 -.4em;
padding: 0 1ch;
margin: 0 -1ch;
}
#tracy-bs .tracy-column-highlight {
display: inline-block;
backdrop-filter: grayscale(1);
margin: 0 -1px;
padding: 0 1px;
}
#tracy-bs .tracy-line {
@ -291,7 +298,7 @@
#tracy-bs .tracy-caused {
float: right;
padding: .3em .6em;
padding: .3em calc(1.5 * var(--tracy-space));
background: #df8075;
border-radius: 0 0 0 8px;
white-space: nowrap;
@ -358,6 +365,10 @@
background: #cd1818a6;
}
#tracy-bs .tracy-section--error + .tracy-section--stack {
margin-top: calc(1.5 * var(--tracy-space));
}
/* tabs */
#tracy-bs .tracy-tab-bar {

View File

@ -19,6 +19,8 @@ namespace Tracy;
* @var ?string $headersFile
* @var ?int $headersLine
* @var ?array $obStatus
* @var \Generator[] $generators
* @var \Fiber[] $fibers
*/
?>
<tracy-div id="tracy-bs" itemscope>

View File

@ -14,7 +14,7 @@ namespace Tracy;
$code = $exception->getCode() ? ' #' . $exception->getCode() : '';
$nonceAttr = $nonce ? ' nonce="' . Helpers::escapeHtml($nonce) . '"' : '';
$chain = Helpers::getExceptionChain($exception);
?><!DOCTYPE html><!-- "' --></textarea></script></style></pre></xmp></a></iframe></noembed></noframes></noscript></option></select></template></title></table></p>
?><!DOCTYPE html><!-- "' --></textarea></script></style></pre></xmp></a></iframe></noembed></noframes></noscript></option></select></template></title></table></p></code>
<html>
<head>
<meta charset="utf-8">

View File

@ -10,29 +10,10 @@ namespace Tracy;
* @var array[] $actions
* @var callable $dump
* @var BlueScreen $this
* @var \Generator[] $generators
* @var \Fiber[] $fibers
*/
$stack = $ex->getTrace();
$expanded = null;
if (
(!$ex instanceof \ErrorException
|| in_array($ex->getSeverity(), [E_USER_NOTICE, E_USER_WARNING, E_USER_DEPRECATED], true))
&& $this->isCollapsed($ex->getFile())
) {
foreach ($stack as $key => $row) {
if (isset($row['file']) && !$this->isCollapsed($row['file'])) {
$expanded = $key;
break;
}
}
}
if (in_array($stack[0]['class'] ?? null, [DevelopmentStrategy::class, ProductionStrategy::class], true)) {
array_shift($stack);
}
if (($stack[0]['class'] ?? null) === Debugger::class && in_array($stack[0]['function'], ['shutdownHandler', 'errorHandler'], true)) {
array_shift($stack);
}
?>
<?php require __DIR__ . '/section-header.phtml' ?>
@ -46,9 +27,45 @@ if (($stack[0]['class'] ?? null) === Debugger::class && in_array($stack[0]['func
</section>
<?php endforeach ?>
<?php require __DIR__ . '/section-exception-sourceFile.phtml' ?>
<?php if (!$exceptions && ($generators || $fibers)): ?>
<section class="tracy-section tracy-section--stack">
<div class="tracy-section-panel">
<div class="tracy-tabs">
<ul class="tracy-tab-bar">
<li class="tracy-tab-label tracy-active"><a href="#">Main thread</a></li>
<?php require __DIR__ . '/section-exception-callStack.phtml' ?>
<?php foreach ($generators as $id => $generator): ?>
<li class="tracy-tab-label"><a href="#">Generator #<?= $id ?></a></li>
<?php endforeach ?>
<?php foreach ($fibers as $id => $fiber): ?>
<li class="tracy-tab-label"><a href="#">Fiber #<?= $id ?></a></li>
<?php endforeach ?>
</ul>
<div>
<div class="tracy-tab-panel tracy-active">
<?php require __DIR__ . '/section-stack-exception.phtml' ?>
</div>
<?php foreach ($generators as $generator): ?>
<div class="tracy-tab-panel">
<?php require __DIR__ . '/section-stack-generator.phtml' ?>
</div>
<?php endforeach ?>
<?php foreach ($fibers as $fiber): ?>
<div class="tracy-tab-panel">
<?php require __DIR__ . '/section-stack-fiber.phtml' ?>
</div>
<?php endforeach ?>
</div>
</div>
</div>
</section>
<?php else: ?>
<?php require __DIR__ . '/section-stack-exception.phtml' ?>
<?php endif ?>
<?php require __DIR__ . '/section-exception-variables.phtml' ?>

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Tracy;
/**
* @var \Throwable $ex
* @var callable $dump
* @var int $expanded
* @var array $stack
@ -15,6 +14,7 @@ if (!$stack) {
return;
}
?>
<section class="tracy-section">
<h2 class="tracy-section-label"><a href="#" data-tracy-ref="^+" class="tracy-toggle">Call stack</a></h2>

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Tracy;
/**
* @var \Throwable $ex
* @var callable $dump
* @var BlueScreen $this
*/
$stack = $ex->getTrace();
$expanded = null;
if (
(!$ex instanceof \ErrorException
|| in_array($ex->getSeverity(), [E_USER_NOTICE, E_USER_WARNING, E_USER_DEPRECATED], true))
&& $this->isCollapsed($ex->getFile())
) {
foreach ($stack as $key => $row) {
if (isset($row['file']) && !$this->isCollapsed($row['file'])) {
$expanded = $key;
break;
}
}
}
if (in_array($stack[0]['class'] ?? null, [DevelopmentStrategy::class, ProductionStrategy::class], true)) {
array_shift($stack);
}
if (($stack[0]['class'] ?? null) === Debugger::class && in_array($stack[0]['function'], ['shutdownHandler', 'errorHandler'], true)) {
array_shift($stack);
}
$file = $ex->getFile();
$line = $ex->getLine();
require __DIR__ . '/section-stack-sourceFile.phtml';
require __DIR__ . '/section-stack-callStack.phtml';

View File

@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace Tracy;
/**
* @var \Fiber $fiber
* @var callable $dump
*/
$ref = new \ReflectionFiber($fiber);
$stack = $ref->getTrace();
$expanded = 0;
require __DIR__ . '/section-stack-callStack.phtml';

View File

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Tracy;
/**
* @var \Generator $generator
* @var callable $dump
*/
$ref = new \ReflectionGenerator($generator);
$stack = $ref->getTrace();
$expanded = null;
$execGenerator = $ref->getExecutingGenerator();
$refExec = new \ReflectionGenerator($execGenerator);
$file = $refExec->getExecutingFile();
$line = $refExec->getExecutingLine();
require __DIR__ . '/section-stack-sourceFile.phtml';
require __DIR__ . '/section-stack-callStack.phtml';

View File

@ -5,13 +5,15 @@ declare(strict_types=1);
namespace Tracy;
/**
* @var \Throwable $ex
* @var string $file
* @var int $line
* @var int $expanded
*/
$sourceOriginal = $ex->getFile() && is_file($ex->getFile()) ? [$ex->getFile(), $ex->getLine()] : null;
$sourceMapped = $sourceOriginal ? Debugger::mapSource(...$sourceOriginal) : null;
$sourceOriginal = $file && is_file($file) ? [$file, $line] : null;
$sourceMapped = $sourceOriginal ? Debugger::mapSource($file, $line) : null;
?>
<section class="tracy-section">
<h2 class="tracy-section-label"><a href="#" data-tracy-ref="^+" class="tracy-toggle<?= ($collapsed = $expanded !== null) ? ' tracy-collapsed' : '' ?>">Source file</a></h2>
@ -36,7 +38,7 @@ $sourceMapped = $sourceOriginal ? Debugger::mapSource(...$sourceOriginal) : null
</div>
</div>
<?php else: ?>
<p><b>File:</b> <?= Helpers::editorLink($ex->getFile(), $ex->getLine()) ?></p>
<p><b>File:</b> <?= Helpers::editorLink($file, $line) ?></p>
<?php if ($sourceOriginal) echo BlueScreen::highlightFile(...$sourceOriginal) ?>
<?php endif ?>

View File

@ -13,7 +13,7 @@ use ErrorException;
*/
class Debugger
{
public const VERSION = '2.9.1';
public const VERSION = '2.9.2';
/** server modes for Debugger::enable() */
public const DEVELOPMENT = \false, PRODUCTION = \true, DETECT = null;
public const COOKIE_SECRET = 'tracy-debug';

View File

@ -55,7 +55,10 @@ final class DeferredContent
\header('Cache-Control: max-age=864000');
\header_remove('Pragma');
\header_remove('Set-Cookie');
$this->sendJsCss();
$str = $this->buildJsCss();
\header('Content-Length: ' . \strlen($str));
echo $str;
\flush();
return \true;
}
$this->useSession = $this->sessionStorage->isAvailable();
@ -68,12 +71,13 @@ final class DeferredContent
\header('Content-Type: application/javascript; charset=UTF-8');
\header('Cache-Control: max-age=60');
\header_remove('Set-Cookie');
if (!$ajax) {
$this->sendJsCss();
}
$str = $ajax ? '' : $this->buildJsCss();
$data =& $this->getItems('setup');
echo $data[$requestId]['code'] ?? '';
$str .= $data[$requestId]['code'] ?? '';
unset($data[$requestId]);
\header('Content-Length: ' . \strlen($str));
echo $str;
\flush();
return \true;
}
if (\RectorPrefix20220427\Tracy\Helpers::isAjax()) {
@ -82,14 +86,15 @@ final class DeferredContent
}
return \false;
}
private function sendJsCss() : void
private function buildJsCss() : string
{
$css = \array_map('file_get_contents', \array_merge([__DIR__ . '/../assets/reset.css', __DIR__ . '/../Bar/assets/bar.css', __DIR__ . '/../assets/toggle.css', __DIR__ . '/../assets/table-sort.css', __DIR__ . '/../assets/tabs.css', __DIR__ . '/../Dumper/assets/dumper-light.css', __DIR__ . '/../Dumper/assets/dumper-dark.css', __DIR__ . '/../BlueScreen/assets/bluescreen.css'], \RectorPrefix20220427\Tracy\Debugger::$customCssFiles));
echo "'use strict';\n(function(){\n\tvar el = document.createElement('style');\n\tel.setAttribute('nonce', document.currentScript.getAttribute('nonce') || document.currentScript.nonce);\n\tel.className='tracy-debug';\n\tel.textContent=" . \json_encode(\RectorPrefix20220427\Tracy\Helpers::minifyCss(\implode('', $css))) . ";\n\tdocument.head.appendChild(el);})\n();\n";
\array_map(function ($file) {
echo '(function() {', \file_get_contents($file), '})();';
$js1 = \array_map(function ($file) {
return '(function() {' . \file_get_contents($file) . '})();';
}, [__DIR__ . '/../Bar/assets/bar.js', __DIR__ . '/../assets/toggle.js', __DIR__ . '/../assets/table-sort.js', __DIR__ . '/../assets/tabs.js', __DIR__ . '/../Dumper/assets/dumper.js', __DIR__ . '/../BlueScreen/assets/bluescreen.js']);
\array_map('readfile', \RectorPrefix20220427\Tracy\Debugger::$customJsFiles);
$js2 = \array_map('file_get_contents', \RectorPrefix20220427\Tracy\Debugger::$customJsFiles);
$str = "'use strict';\n(function(){\n\tvar el = document.createElement('style');\n\tel.setAttribute('nonce', document.currentScript.getAttribute('nonce') || document.currentScript.nonce);\n\tel.className='tracy-debug';\n\tel.textContent=" . \json_encode(\RectorPrefix20220427\Tracy\Helpers::minifyCss(\implode('', $css))) . ";\n\tdocument.head.appendChild(el);})\n();\n" . \implode('', $js1) . \implode('', $js2);
return $str;
}
public function clean() : void
{

View File

@ -96,6 +96,9 @@ final class DevelopmentStrategy
if (\function_exists('ini_set')) {
\ini_set('display_errors', '1');
}
if (\preg_match('#^Content-Length:#im', \implode("\n", \headers_list()))) {
\RectorPrefix20220427\Tracy\Debugger::log(new \LogicException('Tracy cannot display the Bar because the Content-Length header is being sent'), \RectorPrefix20220427\Tracy\Debugger::EXCEPTION);
}
$this->bar->render($this->defer);
}
}

View File

@ -17,9 +17,9 @@ final class Describer
{
public const HIDDEN_VALUE = '*****';
// Number.MAX_SAFE_INTEGER
private const JS_SAFE_INTEGER = 1 << 53 - 1;
private const JsSafeInteger = 1 << 53 - 1;
/** @var int */
public $maxDepth = 15;
public $maxDepth = 7;
/** @var int */
public $maxLength = 150;
/** @var int */
@ -69,7 +69,7 @@ final class Describer
*/
private function describeInteger(int $num)
{
return $num <= self::JS_SAFE_INTEGER && $num >= -self::JS_SAFE_INTEGER ? $num : new \RectorPrefix20220427\Tracy\Dumper\Value(\RectorPrefix20220427\Tracy\Dumper\Value::TYPE_NUMBER, "{$num}");
return $num <= self::JsSafeInteger && $num >= -self::JsSafeInteger ? $num : new \RectorPrefix20220427\Tracy\Dumper\Value(\RectorPrefix20220427\Tracy\Dumper\Value::TYPE_NUMBER, "{$num}");
}
/**
* @return Value|float

View File

@ -28,7 +28,7 @@ class Dumper
/** @var array */
public static $resources = ['stream' => 'stream_get_meta_data', 'stream-context' => 'stream_context_get_options', 'curl' => 'curl_getinfo'];
/** @var array */
public static $objectExporters = [\Closure::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeClosure'], \RectorPrefix20220427\UnitEnum::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeEnum'], \ArrayObject::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeArrayObject'], \SplFileInfo::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeSplFileInfo'], \SplObjectStorage::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeSplObjectStorage'], \__PHP_Incomplete_Class::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposePhpIncompleteClass'], \DOMNode::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNode'], \DOMNodeList::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNodeList'], \DOMNamedNodeMap::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNodeList'], \Ds\Collection::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDsCollection'], \Ds\Map::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDsMap']];
public static $objectExporters = [\Closure::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeClosure'], \RectorPrefix20220427\UnitEnum::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeEnum'], \ArrayObject::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeArrayObject'], \SplFileInfo::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeSplFileInfo'], \SplObjectStorage::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeSplObjectStorage'], \__PHP_Incomplete_Class::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposePhpIncompleteClass'], \Generator::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeGenerator'], \RectorPrefix20220427\Fiber::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeFiber'], \DOMNode::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNode'], \DOMNodeList::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNodeList'], \DOMNamedNodeMap::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDOMNodeList'], \Ds\Collection::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDsCollection'], \Ds\Map::class => [\RectorPrefix20220427\Tracy\Dumper\Exposer::class, 'exposeDsMap']];
/** @var Describer */
private $describer;
/** @var Renderer */
@ -43,14 +43,12 @@ class Dumper
$useColors = self::$terminalColors && \RectorPrefix20220427\Tracy\Helpers::detectColors();
$dumper = new self($options);
\fwrite(\STDOUT, $dumper->asTerminal($var, $useColors ? self::$terminalColors : []));
} elseif (\preg_match('#^Content-Type: (?!text/html)#im', \implode("\n", \headers_list()))) {
// non-html
echo self::toText($var, $options);
} else {
// html
} elseif (\RectorPrefix20220427\Tracy\Helpers::isHtmlMode()) {
$options[self::LOCATION] = $options[self::LOCATION] ?? \true;
self::renderAssets();
echo self::toHtml($var, $options);
} else {
echo self::toText($var, $options);
}
return $var;
}

View File

@ -111,6 +111,28 @@ final class Exposer
$describer->addPropertyTo($value, 'length', $obj->length, \RectorPrefix20220427\Tracy\Dumper\Value::PROP_PUBLIC);
$describer->addPropertyTo($value, 'items', \iterator_to_array($obj));
}
public static function exposeGenerator(\Generator $gen, \RectorPrefix20220427\Tracy\Dumper\Value $value, \RectorPrefix20220427\Tracy\Dumper\Describer $describer) : void
{
try {
$r = new \ReflectionGenerator($gen);
$describer->addPropertyTo($value, 'file', $r->getExecutingFile() . ':' . $r->getExecutingLine());
$describer->addPropertyTo($value, 'this', $r->getThis());
} catch (\ReflectionException $e) {
$value->value = \get_class($gen) . ' (terminated)';
}
}
public static function exposeFiber(\RectorPrefix20220427\Fiber $fiber, \RectorPrefix20220427\Tracy\Dumper\Value $value, \RectorPrefix20220427\Tracy\Dumper\Describer $describer) : void
{
if ($fiber->isTerminated()) {
$value->value = \get_class($fiber) . ' (terminated)';
} elseif (!$fiber->isStarted()) {
$value->value = \get_class($fiber) . ' (not started)';
} else {
$r = new \RectorPrefix20220427\ReflectionFiber($fiber);
$describer->addPropertyTo($value, 'file', $r->getExecutingFile() . ':' . $r->getExecutingLine());
$describer->addPropertyTo($value, 'callable', $r->getCallable());
}
}
public static function exposeSplFileInfo(\SplFileInfo $obj) : array
{
return ['path' => $obj->getPathname()];

View File

@ -14,7 +14,7 @@ use RectorPrefix20220427\Tracy\Helpers;
*/
final class Renderer
{
private const TYPE_ARRAY_KEY = 'array';
private const TypeArrayKey = 'array';
/** @var int|bool */
public $collapseTop = 14;
/** @var int */
@ -132,11 +132,11 @@ final class Renderer
*/
private function renderString($str, int $depth, $keyType) : string
{
if ($keyType === self::TYPE_ARRAY_KEY) {
if ($keyType === self::TypeArrayKey) {
$indent = '<span class="tracy-dump-indent"> ' . \str_repeat('| ', $depth - 1) . ' </span>';
return '<span class="tracy-dump-string">' . "<span class='tracy-dump-lq'>'</span>" . (\is_string($str) ? \RectorPrefix20220427\Tracy\Helpers::escapeHtml($str) : \str_replace("\n", "\n" . $indent, $str->value)) . "<span>'</span>" . '</span>';
} elseif ($keyType !== null) {
static $classes = [\RectorPrefix20220427\Tracy\Dumper\Value::PROP_PUBLIC => 'tracy-dump-public', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_PROTECTED => 'tracy-dump-protected', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_DYNAMIC => 'tracy-dump-dynamic', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_VIRTUAL => 'tracy-dump-virtual'];
$classes = [\RectorPrefix20220427\Tracy\Dumper\Value::PROP_PUBLIC => 'tracy-dump-public', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_PROTECTED => 'tracy-dump-protected', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_DYNAMIC => 'tracy-dump-dynamic', \RectorPrefix20220427\Tracy\Dumper\Value::PROP_VIRTUAL => 'tracy-dump-virtual'];
$indent = '<span class="tracy-dump-indent"> ' . \str_repeat('| ', $depth - 1) . ' </span>';
$title = \is_string($keyType) ? ' title="declared in ' . \RectorPrefix20220427\Tracy\Helpers::escapeHtml($keyType) . '"' : null;
return '<span class="' . ($title ? 'tracy-dump-private' : $classes[$keyType]) . '"' . $title . '>' . (\is_string($str) ? \RectorPrefix20220427\Tracy\Helpers::escapeHtml($str) : "<span class='tracy-dump-lq'>'</span>" . \str_replace("\n", "\n" . $indent, $str->value) . "<span>'</span>") . '</span>';
@ -183,8 +183,9 @@ final class Renderer
$ref = new \RectorPrefix20220427\Tracy\Dumper\Value(\RectorPrefix20220427\Tracy\Dumper\Value::TYPE_REF, $array->id);
$this->copySnapshot($ref);
return '<span class="tracy-toggle tracy-collapsed" data-tracy-dump=\'' . \json_encode($ref) . "'>" . $out . '</span>';
} elseif ($this->hash) {
return $out . (isset($this->above[$array->id]) ? ' <i>see above</i>' : ' <i>see below</i>');
}
return $out . (isset($this->above[$array->id]) ? ' <i>see above</i>' : ' <i>see below</i>');
}
}
if (!$count) {
@ -202,7 +203,7 @@ final class Renderer
$this->parents[$array->id ?? null] = $this->above[$array->id ?? null] = \true;
foreach ($items as $info) {
[$k, $v, $ref] = $info + [2 => null];
$out .= $indent . $this->renderVar($k, $depth + 1, self::TYPE_ARRAY_KEY) . ' => ' . ($ref && $this->hash ? '<span class="tracy-dump-hash">&' . $ref . '</span> ' : '') . ($tmp = $this->renderVar($v, $depth + 1)) . (\substr($tmp, -6) === '</div>' ? '' : "\n");
$out .= $indent . $this->renderVar($k, $depth + 1, self::TypeArrayKey) . ' => ' . ($ref && $this->hash ? '<span class="tracy-dump-hash">&' . $ref . '</span> ' : '') . ($tmp = $this->renderVar($v, $depth + 1)) . (\substr($tmp, -6) === '</div>' ? '' : "\n");
}
if ($count > \count($items)) {
$out .= $indent . "\n";
@ -229,8 +230,9 @@ final class Renderer
$ref = new \RectorPrefix20220427\Tracy\Dumper\Value(\RectorPrefix20220427\Tracy\Dumper\Value::TYPE_REF, $object->id);
$this->copySnapshot($ref);
return '<span class="tracy-toggle tracy-collapsed" data-tracy-dump=\'' . \json_encode($ref) . "'>" . $out . '</span>';
} elseif ($this->hash) {
return $out . (isset($this->above[$object->id]) ? ' <i>see above</i>' : ' <i>see below</i>');
}
return $out . (isset($this->above[$object->id]) ? ' <i>see above</i>' : ' <i>see below</i>');
}
$collapsed = $object->collapsed ?? ($depth ? $this->lazy === \false || $depth === 1 ? \count($object->items) >= $this->collapseSub : \true : (\is_int($this->collapseTop) ? \count($object->items) >= $this->collapseTop : $this->collapseTop));
$span = '<span class="tracy-toggle' . ($collapsed ? ' tracy-collapsed' : '') . '"';

View File

@ -115,7 +115,7 @@
.tracy-dark .tracy-dump-private::after,
.tracy-dark .tracy-dump-hash {
font-size: 85%;
color: rgba(255, 255, 255, 0.4);
color: rgba(255, 255, 255, 0.35);
}
.tracy-dark .tracy-dump-indent {

View File

@ -115,7 +115,7 @@
.tracy-light .tracy-dump-private::after,
.tracy-light .tracy-dump-hash {
font-size: 85%;
color: rgba(0, 0, 0, 0.5);
color: rgba(0, 0, 0, 0.35);
}
.tracy-light .tracy-dump-indent {

View File

@ -214,7 +214,7 @@ class Helpers
/** @internal */
public static function isHtmlMode() : bool
{
return empty($_SERVER['HTTP_X_REQUESTED_WITH']) && empty($_SERVER['HTTP_X_TRACY_AJAX']) && !self::isCli() && !\preg_match('#^Content-Type: (?!text/html)#im', \implode("\n", \headers_list()));
return empty($_SERVER['HTTP_X_REQUESTED_WITH']) && empty($_SERVER['HTTP_X_TRACY_AJAX']) && isset($_SERVER['HTTP_HOST']) && !self::isCli() && !\preg_match('#^Content-Type: (?!text/html)#im', \implode("\n", \headers_list()));
}
/** @internal */
public static function isAjax() : bool
@ -275,7 +275,7 @@ class Helpers
}
private static function doEncodeString(string $s, bool $utf8, bool $showWhitespaces) : string
{
static $specials = [\true => ["\r" => '<i>\\r</i>', "\n" => "<i>\\n</i>\n", "\t" => '<i>\\t</i> ', "\33" => '<i>\\e</i>', '<' => '&lt;', '&' => '&amp;'], \false => ["\r" => "\r", "\n" => "\n", "\t" => "\t", "\33" => '<i>\\e</i>', '<' => '&lt;', '&' => '&amp;']];
$specials = [\true => ["\r" => '<i>\\r</i>', "\n" => "<i>\\n</i>\n", "\t" => '<i>\\t</i> ', "\33" => '<i>\\e</i>', '<' => '&lt;', '&' => '&amp;'], \false => ["\r" => "\r", "\n" => "\n", "\t" => "\t", "\33" => '<i>\\e</i>', '<' => '&lt;', '&' => '&amp;']];
$special = $specials[$showWhitespaces];
$s = \preg_replace_callback($utf8 ? '#[\\p{C}<&]#u' : '#[\\x00-\\x1F\\x7F-\\xFF<&]#', function ($m) use($special) {
return $special[$m[0]] ?? (\strlen($m[0]) === 1 ? '<i>\\x' . \str_pad(\strtoupper(\dechex(\ord($m[0]))), 2, '0', \STR_PAD_LEFT) . '</i>' : '<i>\\u{' . \strtoupper(\ltrim(\dechex(self::utf8Ord($m[0])), '0')) . '}</i>');
@ -391,7 +391,7 @@ XX
}
public static function detectColors() : bool
{
return self::isCli() && \getenv('NO_COLOR') === \false && (\getenv('FORCE_COLOR') || @\stream_isatty(\STDOUT) || (\defined('PHP_WINDOWS_VERSION_BUILD') && (\function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\STDOUT)) || \getenv('ConEmuANSI') === 'ON' || \getenv('ANSICON') !== \false || \getenv('term') === 'xterm' || \getenv('term') === 'xterm-256color'));
return self::isCli() && \getenv('NO_COLOR') === \false && (\getenv('FORCE_COLOR') || (\function_exists('sapi_windows_vt100_support') ? \sapi_windows_vt100_support(\STDOUT) : @\stream_isatty(\STDOUT)));
}
public static function getExceptionChain(\Throwable $ex) : array
{
@ -401,4 +401,26 @@ XX
}
return $res;
}
public static function traverseValue($val, callable $callback, array &$skip = [], ?string $refId = null) : void
{
if (\is_object($val)) {
$id = \spl_object_id($val);
if (!isset($skip[$id])) {
$skip[$id] = \true;
$callback($val);
self::traverseValue((array) $val, $callback, $skip);
}
} elseif (\is_array($val)) {
if ($refId) {
if (isset($skip[$refId])) {
return;
}
$skip[$refId] = \true;
}
foreach ($val as $k => $v) {
$refId = ($r = \ReflectionReference::fromArrayElement($val, $k)) ? $r->getId() : null;
self::traverseValue($v, $callback, $skip, $refId);
}
}
}
}

View File

@ -9,8 +9,8 @@ namespace RectorPrefix20220427\Tracy;
class FileSession implements \RectorPrefix20220427\Tracy\SessionStorage
{
private const FILE_PREFIX = 'tracy-';
private const COOKIE_LIFETIME = 31557600;
private const FilePrefix = 'tracy-';
private const CookieLifetime = 31557600;
/** @var string */
public $cookieName = 'tracy-session';
/** @var float probability that the clean() routine is started */
@ -35,10 +35,10 @@ class FileSession implements \RectorPrefix20220427\Tracy\SessionStorage
private function open() : void
{
$id = $_COOKIE[$this->cookieName] ?? null;
if (!\is_string($id) || !\preg_match('#^\\w{10}\\z#i', $id) || !($file = @\fopen($path = $this->dir . '/' . self::FILE_PREFIX . $id, 'r+'))) {
if (!\is_string($id) || !\preg_match('#^\\w{10}\\z#i', $id) || !($file = @\fopen($path = $this->dir . '/' . self::FilePrefix . $id, 'r+'))) {
$id = \RectorPrefix20220427\Tracy\Helpers::createId();
\setcookie($this->cookieName, $id, \time() + self::COOKIE_LIFETIME, '/', '', \false, \true);
$file = @\fopen($path = $this->dir . '/' . self::FILE_PREFIX . $id, 'c+');
\setcookie($this->cookieName, $id, \time() + self::CookieLifetime, '/', '', \false, \true);
$file = @\fopen($path = $this->dir . '/' . self::FilePrefix . $id, 'c+');
// intentionally @
if ($file === \false) {
throw new \RuntimeException("Unable to create file '{$path}'. " . \error_get_last()['message']);
@ -62,7 +62,7 @@ class FileSession implements \RectorPrefix20220427\Tracy\SessionStorage
public function clean() : void
{
$old = \strtotime('-1 week');
foreach (\glob($this->dir . '/' . self::FILE_PREFIX . '*') as $file) {
foreach (\glob($this->dir . '/' . self::FilePrefix . '*') as $file) {
if (\filemtime($file) < $old) {
\unlink($file);
}
@ -76,6 +76,7 @@ class FileSession implements \RectorPrefix20220427\Tracy\SessionStorage
\ftruncate($this->file, 0);
\fseek($this->file, 0);
\fwrite($this->file, \serialize($this->data));
\flock($this->file, \LOCK_UN);
\fclose($this->file);
$this->file = null;
}

View File

@ -106,6 +106,87 @@ tracy-div select {
white-space: pre;
}
tracy-div article,
tracy-div aside,
tracy-div details,
tracy-div div,
tracy-div figcaption,
tracy-div footer,
tracy-div form,
tracy-div header,
tracy-div hgroup,
tracy-div main,
tracy-div nav,
tracy-div section,
tracy-div summary,
tracy-div pre,
tracy-div p,
tracy-div dl,
tracy-div dd,
tracy-div dt,
tracy-div blockquote,
tracy-div figure,
tracy-div address,
tracy-div h1,
tracy-div h2,
tracy-div h3,
tracy-div h4,
tracy-div h5,
tracy-div h6,
tracy-div ul,
tracy-div ol,
tracy-div li,
tracy-div hr {
display: block;
}
tracy-div a,
tracy-div b,
tracy-div big,
tracy-div code,
tracy-div em,
tracy-div i,
tracy-div small,
tracy-div span,
tracy-div strong {
display: inline;
}
tracy-div table {
display: table;
}
tracy-div tr {
display: table-row;
}
tracy-div col {
display: table-column;
}
tracy-div colgroup {
display: table-column-group;
}
tracy-div tbody {
display: table-row-group;
}
tracy-div thead {
display: table-header-group;
}
tracy-div tfoot {
display: table-footer-group;
}
tracy-div td {
display: table-cell;
}
tracy-div th {
display: table-cell;
}