Skip to content
Closed
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
2 changes: 1 addition & 1 deletion admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"codeigniter/coding-standard": "^1.7",
"fakerphp/faker": "^1.24",
"friendsofphp/php-cs-fixer": "^3.47.1",
"kint-php/kint": "^6.1",
"kint-php/kint": "^6.1.1",
"mikey179/vfsstream": "^1.6.12",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^10.5.16 || ^11.2",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"boundwize/structarmed": "^0.21",
"codeigniter/phpstan-codeigniter": "^2.3",
"fakerphp/faker": "^1.24",
"kint-php/kint": "^6.1",
"kint-php/kint": "^6.1.1",
"mikey179/vfsstream": "^1.6.12",
"nexusphp/tachycardia": "^2.0",
"phpstan/extension-installer": "^1.4",
Expand Down
10 changes: 5 additions & 5 deletions system/ThirdParty/Kint/CallFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public static function getFunctionCalls(string $source, int $line, $function): a
$function_calls = [];

// Performance optimization preventing backwards loops
/** @psalm-var array<PhpToken|null> */
/** @psalm-var array<null|PhpToken> */
$prev_tokens = [null, null, null];

if (\is_array($function)) {
Expand Down Expand Up @@ -522,11 +522,11 @@ public static function getFunctionCalls(string $source, int $line, $function): a
'literal' => $literal,
'new_without_parens' => $new_without_parens,
];
}

// Skip first-class callables
if (KINT_PHP81 && 1 === \count($formatted_parameters) && '...' === \reset($formatted_parameters)['path']) {
continue;
// Skip callable assignment
if ('...' === $path || '?' === $path) {
continue 2;
}
}

// Get the modifiers
Expand Down
18 changes: 6 additions & 12 deletions system/ThirdParty/Kint/Kint.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
* @psalm-type KintCallInfo = array{
* params: ?list<CallParameter>,
* modifiers: array,
* callee: ?callable,
* caller: ?callable,
* callee: ?TraceFrame,
* caller: ?TraceFrame,
* trace: TraceFrame[],
* }
*
Expand Down Expand Up @@ -126,7 +126,7 @@ class Kint implements FacadeInterface
];

/**
* @psalm-var array<RendererInterface|class-string<ConstructableRendererInterface>>
* @psalm-var array<class-string<ConstructableRendererInterface>|RendererInterface>
*
* Array of modes to renderer class names
*/
Expand All @@ -138,7 +138,7 @@ class Kint implements FacadeInterface
];

/**
* @psalm-var array<PluginInterface|class-string<ConstructablePluginInterface>>
* @psalm-var array<class-string<ConstructablePluginInterface>|PluginInterface>
*/
public static array $plugins = [
\Kint\Parser\ArrayLimitPlugin::class,
Expand Down Expand Up @@ -433,16 +433,10 @@ public static function getCallInfo(array $aliases, array $trace, array $args): a
}

foreach ($miniTrace as $index => $frame) {
if ((0 === $index && $callee === $frame) || isset($frame['file'], $frame['line'])) {
unset($frame['object'], $frame['args']);
$miniTrace[$index] = $frame;
} else {
unset($miniTrace[$index]);
}
unset($frame['object'], $frame['args']);
$miniTrace[$index] = $frame;
}

$miniTrace = \array_values($miniTrace);

$call = static::getSingleCall($callee ?: [], $args);

$ret = [
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/BlacklistPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function parseBegin(&$var, ContextInterface $c): ?AbstractValue
*/
protected function blacklistValue(&$var, ContextInterface $c): InstanceValue
{
$object = new InstanceValue($c, \get_class($var), \spl_object_hash($var), \spl_object_id($var));
$object = new InstanceValue($c, \get_class($var), @\spl_object_hash($var), \spl_object_id($var));
$object->flags |= AbstractValue::FLAG_BLACKLIST;

return $object;
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/ClassStaticsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

class ClassStaticsPlugin extends AbstractPlugin implements PluginCompleteInterface
{
/** @psalm-var array<class-string, array<1|0, array<AbstractValue>>> */
/** @psalm-var array<class-string, array<0|1, array<AbstractValue>>> */
private array $cache = [];

public function getTypes(): array
Expand Down Expand Up @@ -137,7 +137,7 @@ private function buildStaticValue(ReflectionProperty $pr, int $depth): AbstractV
}

if (KINT_PHP81 === false) {
$pr->setAccessible(true);
$pr->setAccessible(true); // @codeCoverageIgnore
}

/**
Expand Down
12 changes: 5 additions & 7 deletions system/ThirdParty/Kint/Parser/DomPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private function parseProperty(object $var, string $prop, ContextInterface $c):
}

if (isset(self::$blacklist[$prop])) {
$b = new InstanceValue($c, \get_class($value), \spl_object_hash($value), \spl_object_id($value));
$b = new InstanceValue($c, \get_class($value), @\spl_object_hash($value), \spl_object_id($value));
$b->flags |= AbstractValue::FLAG_GENERATED | AbstractValue::FLAG_BLACKLIST;

return $b;
Expand Down Expand Up @@ -311,7 +311,7 @@ private function parseList(object $var, ContextInterface $c): InstanceValue
if ($var instanceof NodeList || $var instanceof DOMNodeList) {
$v = new DomNodeListValue($c, $var);
} else {
$v = new InstanceValue($c, \get_class($var), \spl_object_hash($var), \spl_object_id($var));
$v = new InstanceValue($c, \get_class($var), @\spl_object_hash($var), \spl_object_id($var));
}

$parser = $this->getParser();
Expand Down Expand Up @@ -461,10 +461,6 @@ public static function getKnownProperties(object $var): array
self::$property_cache[$classname] = [];

foreach ($r->getProperties() as $prop) {
if ($prop->isStatic()) {
continue;
}

$declaring = $prop->getDeclaringClass()->getName();
$name = $prop->name;

Expand All @@ -490,16 +486,18 @@ public static function getKnownProperties(object $var): array

$known_properties = self::$property_cache[$classname];
} else {
// @codeCoverageIgnoreStart
$known_properties = self::DOMNODE_PROPS;
if ($var instanceof DOMElement) {
$known_properties += self::DOMELEMENT_PROPS;
}

foreach (self::DOM_VERSIONS as $key => $val) {
if (false === $val) {
unset($known_properties[$key]); // @codeCoverageIgnore
unset($known_properties[$key]);
}
}
// @codeCoverageIgnoreEnd
}

/** @psalm-var non-empty-array $known_properties */
Expand Down
5 changes: 3 additions & 2 deletions system/ThirdParty/Kint/Parser/FsPathPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Kint\Value\Representation\SplFileInfoRepresentation;
use SplFileInfo;
use TypeError;
use ValueError;

class FsPathPlugin extends AbstractPlugin implements PluginCompleteInterface
{
Expand Down Expand Up @@ -64,8 +65,8 @@ public function parseComplete(&$var, AbstractValue $v, int $trigger): AbstractVa
if (!@\file_exists($var)) {
return $v;
}
} catch (TypeError $e) {// @codeCoverageIgnore
// Only possible in PHP 7
} catch (TypeError|ValueError $e) {// @codeCoverageIgnore
// TypeError only possible in PHP 7, ValueError from 8.6+
return $v; // @codeCoverageIgnore
}

Expand Down
39 changes: 32 additions & 7 deletions system/ThirdParty/Kint/Parser/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@
use Kint\Value\ArrayValue;
use Kint\Value\ClosedResourceValue;
use Kint\Value\Context\ArrayContext;
use Kint\Value\Context\BaseContext;
use Kint\Value\Context\ClassDeclaredContext;
use Kint\Value\Context\ClassOwnedContext;
use Kint\Value\Context\ContextInterface;
use Kint\Value\Context\PropertyContext;
use Kint\Value\FixedWidthValue;
use Kint\Value\InstanceValue;
use Kint\Value\LazyInstanceValue;
use Kint\Value\ProxyInstanceValue;
use Kint\Value\Representation\ContainerRepresentation;
use Kint\Value\Representation\StringRepresentation;
use Kint\Value\ResourceValue;
Expand Down Expand Up @@ -77,6 +80,7 @@ class Parser
public const TRIGGER_SUCCESS = 1 << 1;
public const TRIGGER_RECURSION = 1 << 2;
public const TRIGGER_DEPTH_LIMIT = 1 << 3;
public const TRIGGER_LAZY = 1 << 4;
public const TRIGGER_COMPLETE = self::TRIGGER_SUCCESS | self::TRIGGER_RECURSION | self::TRIGGER_DEPTH_LIMIT;

/** @psalm-var ?class-string */
Expand Down Expand Up @@ -368,7 +372,7 @@ private function getPropsOrderedOld(ReflectionClass $r): array

private function parseObject(object &$var, ContextInterface $c): AbstractValue
{
$hash = \spl_object_hash($var);
$hash = @\spl_object_hash($var);
$classname = \get_class($var);

if (isset($this->object_hashes[$hash])) {
Expand All @@ -383,26 +387,44 @@ private function parseObject(object &$var, ContextInterface $c): AbstractValue

$cdepth = $c->getDepth();
$ap = $c->getAccessPath();
$robj = new ReflectionObject($var);

if (KINT_PHP84 && $robj->isUninitializedLazyObject($var)) {
// Since getProperties on ReflectionObject also gets dynamic
// properties we have to use a ReflectionClass so as not to
// accidentally initialize lazy objects
$robj = new ReflectionClass($var);
$object = new LazyInstanceValue($c, $classname, $hash, \spl_object_id($var));
} elseif (KINT_PHP84 && ($innerVar = $robj->initializeLazyObject($var)) !== $var) {
$innerContext = new BaseContext('instance');
$innerContext->access_path = $ap;
$innerContext->depth = $cdepth + 1;
$inner = $this->parse($innerVar, $innerContext);
$innerContext->access_path = null;

return new ProxyInstanceValue($c, $inner, $classname, $hash, \spl_object_id($var));
} else {
$object = new InstanceValue($c, $classname, $hash, \spl_object_id($var));
}

if ($this->depth_limit && $cdepth >= $this->depth_limit) {
$object = new InstanceValue($c, $classname, $hash, \spl_object_id($var));
$object->flags |= AbstractValue::FLAG_DEPTH_LIMIT;

return $this->applyPluginsComplete($var, $object, self::TRIGGER_DEPTH_LIMIT);
}

if (KINT_PHP81) {
$props = $this->getPropsOrdered(new ReflectionObject($var));
$props = $this->getPropsOrdered($robj);
} else {
$props = $this->getPropsOrderedOld(new ReflectionObject($var)); // @codeCoverageIgnore
$props = $this->getPropsOrderedOld($robj); // @codeCoverageIgnore
}

$values = (array) $var;
$properties = [];

foreach ($props as $rprop) {
if (KINT_PHP81 === false) {
$rprop->setAccessible(true);
$rprop->setAccessible(true); // @codeCoverageIgnore
}

$name = $rprop->getName();
Expand Down Expand Up @@ -503,7 +525,6 @@ private function parseObject(object &$var, ContextInterface $c): AbstractValue
}
}

$object = new InstanceValue($c, $classname, $hash, \spl_object_id($var));
if ($props) {
$object->setChildren($properties);
}
Expand All @@ -512,7 +533,11 @@ private function parseObject(object &$var, ContextInterface $c): AbstractValue
$object->addRepresentation(new ContainerRepresentation('Properties', $properties));
}

return $this->applyPluginsComplete($var, $object, self::TRIGGER_SUCCESS);
return $this->applyPluginsComplete(
$var,
$object,
$object instanceof LazyInstanceValue ? self::TRIGGER_LAZY : self::TRIGGER_SUCCESS,
);
} finally {
unset($this->object_hashes[$hash]);
}
Expand Down
4 changes: 2 additions & 2 deletions system/ThirdParty/Kint/Parser/ProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getTypes(): array

public function getTriggers(): int
{
return Parser::TRIGGER_BEGIN | Parser::TRIGGER_COMPLETE;
return Parser::TRIGGER_BEGIN | Parser::TRIGGER_COMPLETE | Parser::TRIGGER_LAZY;
}

public function parseBegin(&$var, ContextInterface $c): ?AbstractValue
Expand All @@ -65,7 +65,7 @@ public function parseBegin(&$var, ContextInterface $c): ?AbstractValue
}

if (\is_object($var)) {
$hash = \spl_object_hash($var);
$hash = @\spl_object_hash($var);
$this->instance_counts[$hash] ??= 0;
$this->instance_complexity[$hash] ??= 0;
$this->instance_count_stack[$hash] ??= 0;
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Parser/XmlPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class XmlPlugin extends AbstractPlugin implements PluginCompleteInterface
* however it's memory usage is very high and it takes longer to parse and
* render. Plus it's a pain to work with. So SimpleXML is the default.
*
* @psalm-var 'SimpleXML'|'DOMDocument'|'XMLDocument'
* @psalm-var 'DOMDocument'|'SimpleXML'|'XMLDocument'
*/
public static string $parse_method = 'SimpleXML';

Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Renderer/AssetRendererTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait AssetRendererTrait
{
public static ?string $theme = null;

/** @psalm-var array{js?:string, css?:array<path, string|false>} */
/** @psalm-var array{js?:string, css?:array<path, false|string>} */
private static array $assetCache = [];

/** @psalm-api */
Expand Down
5 changes: 4 additions & 1 deletion system/ThirdParty/Kint/Renderer/RichRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ public function postRender(): string
continue;
}

$output .= '<li>'.$this->ideLink($step['file'], $step['line']); // closing tag not required
$output .= '<li>'; // closing tag not required
if (isset($step['file'])) {
$output .= $this->ideLink($step['file'], $step['line']);
}
if (isset($step['function']) &&
!\in_array($step['function'], ['include', 'include_once', 'require', 'require_once'], true)
) {
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Value/ClosureValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ClosureValue extends InstanceValue

public function __construct(ContextInterface $context, Closure $cl)
{
parent::__construct($context, \get_class($cl), \spl_object_hash($cl), \spl_object_id($cl));
parent::__construct($context, \get_class($cl), @\spl_object_hash($cl), \spl_object_id($cl));

/**
* @psalm-suppress UnnecessaryVarAnnotation
Expand Down
6 changes: 2 additions & 4 deletions system/ThirdParty/Kint/Value/Context/ClassDeclaredContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,16 @@ public function isAccessible(?string $scope): bool
if (\is_a($scope, $this->proto_class, true)) {
return true;
}

if (\is_a($this->proto_class, $scope, true)) {
return true;
}
} else {
// @codeCoverageIgnoreStart
if (\is_a($scope, $this->owner_class, true)) {
return true;
}

if (\is_a($this->owner_class, $scope, true)) {
return true;
}
// @codeCoverageIgnoreEnd
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Value/DateTimeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DateTimeValue extends InstanceValue

public function __construct(ContextInterface $context, DateTimeInterface $dt)
{
parent::__construct($context, \get_class($dt), \spl_object_hash($dt), \spl_object_id($dt));
parent::__construct($context, \get_class($dt), @\spl_object_hash($dt), \spl_object_id($dt));

$this->dt = clone $dt;
}
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Value/DomNodeListValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DomNodeListValue extends InstanceValue
*/
public function __construct(ContextInterface $context, object $node)
{
parent::__construct($context, \get_class($node), \spl_object_hash($node), \spl_object_id($node));
parent::__construct($context, \get_class($node), @\spl_object_hash($node), \spl_object_id($node));

$this->length = $node->length;
}
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Kint/Value/DomNodeValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DomNodeValue extends InstanceValue
*/
public function __construct(ContextInterface $context, object $node)
{
parent::__construct($context, \get_class($node), \spl_object_hash($node), \spl_object_id($node));
parent::__construct($context, \get_class($node), @\spl_object_hash($node), \spl_object_id($node));
}

public function getDisplaySize(): ?string
Expand Down
Loading
Loading