Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions system/ThirdParty/Kint/CallFinder.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -138,7 +138,7 @@ class CallFinder
/**
* @psalm-param callable-array|callable-string $function
*
* @param mixed $function
* @psalm-return list<array{parameters: list, modifiers: list<PhpToken>}>
*
* @return array List of matching calls on the relevant line
*/
Expand DownExpand Up@@ -187,6 +187,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$identifier[T_NAME_RELATIVE] = true;
}

/** @psalm-var list<PhpToken> */
$tokens = \token_get_all($source);
$cursor = 1;
$function_calls = [];
Expand DownExpand Up@@ -449,8 +450,6 @@ private static function realTokenIndex(array $tokens, int $index): ?int
* for `$token[0]` then "..." will incorrectly match the "." operator.
*
* @psalm-param PhpToken $token The token to check
*
* @param mixed $token
*/
private static function tokenIsOperator($token): bool
{
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Kint.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,7 +133,7 @@ class Kint implements FacadeInterface
public static $aliases = [
['Kint\\Kint', 'dump'],
['Kint\\Kint', 'trace'],
['Kint\\Kint', 'dumpArray'],
['Kint\\Kint', 'dumpAll'],
];

/**
Expand DownExpand Up@@ -537,7 +537,7 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @param mixed ...$args
* @psalm-param array ...$args
*
* @return int|string
*/
Expand DownExpand Up@@ -599,6 +599,7 @@ public static function shortenPath(string $file): string
$match = '/';

foreach (static::$app_root_dirs as $path => $alias) {
/** @psalm-var string $path */
if (empty($path)) {
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,7 @@

use Kint\Zval\InstanceValue;
use Kint\Zval\Value;
use Psr\Container\ContainerInterface;

class BlacklistPlugin extends AbstractPlugin
{
Expand All@@ -44,7 +45,7 @@ class BlacklistPlugin extends AbstractPlugin
*
* @var array
*/
public static $shallow_blacklist = ['Psr\\Container\\ContainerInterface'];
public static $shallow_blacklist = [ContainerInterface::class];

public function getTypes(): array
{
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/ClosurePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,7 +67,7 @@ public function parse(&$var, Value &$o, int $trigger): void
}

$p = new Representation('Parameters');
$p->contents = &$o->parameters;
$p->contents = $o->parameters;
$o->addRepresentation($p, 0);

$statics = [];
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ class Parser
* @param int $depth_limit Maximum depth to parse data
* @param ?string $caller Caller class name
*/
public function __construct(int $depth_limit = 0, ?string $caller = null)
public function __construct(int $depth_limit = 0, string $caller = null)
{
$this->marker = "kint\0".\random_bytes(16);

Expand All@@ -83,7 +83,7 @@ public function __construct(int $depth_limit = 0, ?string $caller = null)
/**
* Set the caller class.
*/
public function setCallerClass(?string $caller = null): void
public function setCallerClass(string $caller = null): void
{
$this->noRecurseCall();

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/PluginInterface.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ public function getTypes(): array;
public function getTriggers(): int;

/**
* @param mixed &$var
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}
6 changes: 6 additions & 0 deletions system/ThirdParty/Kint/Parser/TablePlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,12 @@
use Kint\Zval\Representation\Representation;
use Kint\Zval\Value;

// Note: Interaction with ArrayLimitPlugin:
// Any array limited children will be shown in tables identically to
// non-array-limited children since the table only shows that it is an array
// and it's size anyway. Because ArrayLimitPlugin halts the parse on finding
// a limit all other plugins including this one are stopped, so you cannot get
// a tabular representation of an array that is longer than the limit.
class TablePlugin extends AbstractPlugin
{
public function getTypes(): array
Expand Down
76 changes: 49 additions & 27 deletions system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -140,6 +140,13 @@ class RichRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public static $needs_pre_render = true;
public static $needs_folder_render = true;

Expand DownExpand Up@@ -465,29 +472,7 @@ public function postRender(): string
$output .= '<nav></nav>';
}

if (isset($this->call_info['callee']['file'])) {
$output .= 'Called from '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}
$output .= $this->calledFrom();

if (!empty($this->call_info['trace']) && \count($this->call_info['trace']) > 1) {
$output .= '<ol>';
Expand All@@ -497,8 +482,8 @@ public function postRender(): string
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
if (isset($step['function'])
&& !\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
$output .= ' [';
$output .= $step['class'] ?? '';
Expand All@@ -516,8 +501,6 @@ public function postRender(): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -559,6 +542,45 @@ public function ideLink(string $file, int $line): string
return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
}

protected function calledFrom(): string
{
$output = '';

if (isset($this->call_info['callee']['file'])) {
$output .= ' '.$this->ideLink(
$this->call_info['callee']['file'],
$this->call_info['callee']['line']
);
}

if (
isset($this->call_info['callee']['function']) &&
(
!empty($this->call_info['callee']['class']) ||
!\in_array(
$this->call_info['callee']['function'],
['include', 'include_once', 'require', 'require_once'],
true
)
)
) {
$output .= ' [';
$output .= $this->call_info['callee']['class'] ?? '';
$output .= $this->call_info['callee']['type'] ?? '';
$output .= $this->call_info['callee']['function'].'()]';
}

if ('' !== $output) {
$output = 'Called from'.$output;
}

if (null !== self::$timestamp) {
$output .= ' '.\date(self::$timestamp);
}

return $output;
}

protected function renderTab(Value $o, Representation $rep): string
{
if (($plugin = $this->getPlugin(self::$tab_plugins, $rep->hints)) && $plugin instanceof TabPluginInterface) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/Text/AbstractPlugin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

public function renderLockedHeader(Value $o, ?string $content = null): string
public function renderLockedHeader(Value $o, string $content = null): string
{
$out = '';

Expand Down
18 changes: 15 additions & 3 deletions system/ThirdParty/Kint/Renderer/TextRenderer.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,13 @@ class TextRenderer extends AbstractRenderer
*/
public static $sort = self::SORT_NONE;

/**
* Timestamp to print in footer in date() format.
*
* @var ?string
*/
public static $timestamp = null;

public $header_width = 80;
public $indent_width = 4;

Expand DownExpand Up@@ -300,7 +307,7 @@ public function filterParserPlugins(array $plugins): array
{
$return = [];

foreach ($plugins as $index => $plugin) {
foreach ($plugins as $plugin) {
foreach (self::$parser_plugin_whitelist as $whitelist) {
if ($plugin instanceof $whitelist) {
$return[] = $plugin;
Expand All@@ -319,8 +326,6 @@ public function ideLink(string $file, int $line): string

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public function escape(string $string, $encoding = false): string
{
Expand DownExpand Up@@ -355,6 +360,13 @@ protected function calledFrom(): string
$output .= $this->call_info['callee']['function'].'()]';
}

if (null !== self::$timestamp) {
if (\strlen($output)) {
$output .= ' ';
}
$output .= \date(self::$timestamp);
}

return $output;
}

Expand Down
2 changes: 0 additions & 2 deletions system/ThirdParty/Kint/Utils.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -255,8 +255,6 @@ public static function normalizeAliases(array &$aliases): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function truncateString(string $input, int $length = PHP_INT_MAX, string $end = '...', $encoding = false): string
{
Expand Down
6 changes: 1 addition & 5 deletions system/ThirdParty/Kint/Zval/BlobValue.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,8 +122,6 @@ public function transplant(Value $old): void

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function strlen(string $string, $encoding = false): int
{
Expand All@@ -142,10 +140,8 @@ public static function strlen(string $string, $encoding = false): int

/**
* @psalm-param Encoding $encoding
*
* @param mixed $encoding
*/
public static function substr(string $string, int $start, ?int $length = null, $encoding = false): string
public static function substr(string $string, int $start, int $length = null, $encoding = false): string
{
if (\function_exists('mb_substr')) {
if (false === $encoding) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -211,7 +211,7 @@ public function __construct(string $value)
$this->setValues($value);
}

public function getColor(?int $variant = null): ?string
public function getColor(int $variant = null): ?string
{
if (!$variant) {
$variant = $this->variant;
Expand DownExpand Up@@ -275,7 +275,7 @@ public function getColor(?int $variant = null): ?string
return null;
}

public function hasAlpha(?int $variant = null): bool
public function hasAlpha(int $variant = null): bool
{
if (null === $variant) {
$variant = $this->variant;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ class MicrotimeRepresentation extends Representation
public $mem_peak_real = 0;
public $hints = ['microtime'];

public function __construct(int $seconds, int $microseconds, int $group, ?float $lap = null, ?float $total = null, int $i = 0)
public function __construct(int $seconds, int $microseconds, int $group, float $lap = null, float $total = null, int $i = 0)
{
parent::__construct('Microtime');

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ class Representation

protected $name;

public function __construct(string $label, ?string $name = null)
public function __construct(string $label, string $name = null)
{
$this->label = $label;

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ public function __construct(string $filename, int $line, int $padding = 7)
* @param int $start_line The first line to display (1 based)
* @param null|int $length Amount of lines to show
*/
public static function getSource(string $filename, int $start_line = 1, ?int $length = null): ?array
public static function getSource(string $filename, int $start_line = 1, int $length = null): ?array
{
if (!$filename || !\file_exists($filename) || !\is_readable($filename)) {
return null;
Expand Down
8 changes: 4 additions & 4 deletions system/ThirdParty/Kint/Zval/Value.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,16 +53,16 @@ class Value
public $reference = false;
public $depth = 0;
public $size;
public $value;
public $hints = [];
public $value;

protected $representations = [];

public function __construct()
{
}

public function addRepresentation(Representation $rep, ?int $pos = null): bool
public function addRepresentation(Representation $rep, int $pos = null): bool
{
if (isset($this->representations[$rep->getName()])) {
return false;
Expand All@@ -81,7 +81,7 @@ public function addRepresentation(Representation $rep, ?int $pos = null): bool
return true;
}

public function replaceRepresentation(Representation $rep, ?int $pos = null): void
public function replaceRepresentation(Representation $rep, int $pos = null): void
{
if (null === $pos) {
$this->representations[$rep->getName()] = $rep;
Expand DownExpand Up@@ -234,7 +234,7 @@ public function transplant(self $old): void
/**
* Creates a new basic object with a name and access path.
*/
public static function blank(?string $name = null, ?string $access_path = null): self
public static function blank(string $name = null, string $access_path = null): self
{
$o = new self();
$o->name = $name;
Expand Down
Loading