Skip to content

Commit

Permalink
Change value param name to $v
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Oct 19, 2024
1 parent efe483d commit 3fae5bd
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 71 deletions.
Binary file modified build/kint.phar
Binary file not shown.
14 changes: 7 additions & 7 deletions src/Renderer/Rich/AbstractPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public function __construct(RichRenderer $r)
/**
* @param string $content The replacement for the getValueShort contents
*/
public function renderLockedHeader(AbstractValue $o, string $content): string
public function renderLockedHeader(AbstractValue $v, string $content): string
{
$header = '<dt class="kint-parent kint-locked">';

$c = $o->getContext();
$c = $v->getContext();

if (RichRenderer::$access_paths && $c->getDepth() > 0 && null !== ($ap = $c->getAccessPath())) {
$header .= '<span class="kint-access-path-trigger" title="Show access path">&rlarr;</span>';
Expand All @@ -61,7 +61,7 @@ public function renderLockedHeader(AbstractValue $o, string $content): string
$header .= '<var>'.$c->getModifiers().'</var> ';
}

$header .= '<dfn>'.$this->renderer->escape($o->getDisplayName()).'</dfn> ';
$header .= '<dfn>'.$this->renderer->escape($v->getDisplayName()).'</dfn> ';

if ($c instanceof PropertyContext && null !== ($s = $c->getHooks())) {
$header .= '<var>'.$this->renderer->escape($s).'</var> ';
Expand All @@ -71,7 +71,7 @@ public function renderLockedHeader(AbstractValue $o, string $content): string
$header .= $this->renderer->escape($s, 'ASCII').' ';
}

$s = $o->getDisplayType();
$s = $v->getDisplayType();

if (RichRenderer::$escape_types) {
$s = $this->renderer->escape($s);
Expand All @@ -83,13 +83,13 @@ public function renderLockedHeader(AbstractValue $o, string $content): string

$header .= '<var>'.$s.'</var>';

if ($o instanceof InstanceValue && $this->renderer->shouldRenderObjectIds()) {
$header .= '#'.$o->getSplObjectId();
if ($v instanceof InstanceValue && $this->renderer->shouldRenderObjectIds()) {
$header .= '#'.$v->getSplObjectId();
}

$header .= ' ';

if (null !== ($s = $o->getDisplaySize())) {
if (null !== ($s = $v->getDisplaySize())) {
if (RichRenderer::$escape_types) {
$s = $this->renderer->escape($s);
}
Expand Down
20 changes: 10 additions & 10 deletions src/Renderer/Rich/CallablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,49 +37,49 @@ class CallablePlugin extends AbstractPlugin implements ValuePluginInterface
{
protected static array $method_cache = [];

public function renderValue(AbstractValue $o): ?string
public function renderValue(AbstractValue $v): ?string
{
if (!$o instanceof MethodValue) {
if (!$v instanceof MethodValue) {
return null;
}

$c = $o->getContext();
$c = $v->getContext();

if (!$c instanceof MethodContext) {
return null;
}

if (!isset(self::$method_cache[$c->owner_class][$c->name])) {
$children = $this->renderer->renderChildren($o);
$children = $this->renderer->renderChildren($v);

$header = '<var>'.$c->getModifiers();

if ($o->getCallableBag()->return_reference) {
if ($v->getCallableBag()->return_reference) {
$header .= ' &amp;';
}

$header .= '</var> ';

$function = $this->renderer->escape($o->getDisplayName());
$function = $this->renderer->escape($v->getDisplayName());

if (null !== ($url = $o->getPhpDocUrl())) {
if (null !== ($url = $v->getPhpDocUrl())) {
$function = '<a href="'.$url.'" target=_blank>'.$function.'</a>';
}

$header .= '<dfn>'.$function.'</dfn>';

if (null !== ($rt = $o->getCallableBag()->returntype)) {
if (null !== ($rt = $v->getCallableBag()->returntype)) {
$header .= ': <var>';
$header .= $this->renderer->escape($rt).'</var>';
} elseif (null !== ($ds = $o->getCallableBag()->docstring)) {
} elseif (null !== ($ds = $v->getCallableBag()->docstring)) {
if (\preg_match('/@return\\s+(.*)\\r?\\n/m', $ds, $matches)) {
if (\trim($matches[1])) {
$header .= ': <var>'.$this->renderer->escape(\trim($matches[1])).'</var>';
}
}
}

if (null !== ($s = $o->getDisplayValue())) {
if (null !== ($s = $v->getDisplayValue())) {
if (RichRenderer::$strlen_max) {
$s = Utils::truncateString($s, RichRenderer::$strlen_max);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Renderer/Rich/ColorPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@

class ColorPlugin extends AbstractPlugin implements TabPluginInterface, ValuePluginInterface
{
public function renderValue(AbstractValue $o): ?string
public function renderValue(AbstractValue $v): ?string
{
$r = $o->getRepresentation('color');
$r = $v->getRepresentation('color');

if (!$r instanceof ColorRepresentation) {
return null;
}

$children = $this->renderer->renderChildren($o);
$children = $this->renderer->renderChildren($v);

$header = $this->renderer->renderHeader($o);
$header = $this->renderer->renderHeader($v);
$header .= '<div class="kint-color-preview"><div style="background:';
$header .= $r->getColor(ColorRepresentation::COLOR_RGBA);
$header .= '"></div></div>';

$header = $this->renderer->renderHeaderWrapper($o->getContext(), (bool) \strlen($children), $header);
$header = $this->renderer->renderHeaderWrapper($v->getContext(), (bool) \strlen($children), $header);

return '<dl>'.$header.$children.'</dl>';
}
Expand Down
12 changes: 6 additions & 6 deletions src/Renderer/Rich/LockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@

class LockPlugin extends AbstractPlugin implements ValuePluginInterface
{
public function renderValue(AbstractValue $o): ?string
public function renderValue(AbstractValue $v): ?string
{
foreach ($o->getHints() as $hint => $_) {
foreach ($v->getHints() as $hint => $_) {
switch ($hint) {
case 'array_limit':
return '<dl>'.$this->renderLockedHeader($o, '<var>Array Limit</var>').'</dl>';
return '<dl>'.$this->renderLockedHeader($v, '<var>Array Limit</var>').'</dl>';
case 'blacklist':
return '<dl>'.$this->renderLockedHeader($o, '<var>Blacklisted</var>').'</dl>';
return '<dl>'.$this->renderLockedHeader($v, '<var>Blacklisted</var>').'</dl>';
case 'depth_limit':
return '<dl>'.$this->renderLockedHeader($o, '<var>Depth Limit</var>').'</dl>';
return '<dl>'.$this->renderLockedHeader($v, '<var>Depth Limit</var>').'</dl>';
case 'recursion':
return '<dl>'.$this->renderLockedHeader($o, '<var>Recursion</var>').'</dl>';
return '<dl>'.$this->renderLockedHeader($v, '<var>Recursion</var>').'</dl>';
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Renderer/Rich/TraceFramePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@

class TraceFramePlugin extends AbstractPlugin implements ValuePluginInterface
{
public function renderValue(AbstractValue $o): ?string
public function renderValue(AbstractValue $v): ?string
{
if (!$o instanceof TraceFrameValue) {
if (!$v instanceof TraceFrameValue) {
return null;
}

if (null !== ($file = $o->getFile()) && null !== ($line = $o->getLine())) {
if (null !== ($file = $v->getFile()) && null !== ($line = $v->getLine())) {
$header = '<var>'.$this->renderer->ideLink($file, $line).'</var> ';
} else {
$header = '<var>PHP internal call</var> ';
}

if ($callable = $o->getCallable()) {
if ($callable = $v->getCallable()) {
if ($callable instanceof MethodValue) {
$header .= $this->renderer->escape($callable->getContext()->owner_class.$callable->getContext()->getOperator());
}
Expand All @@ -58,8 +58,8 @@ public function renderValue(AbstractValue $o): ?string
$header .= '<dfn>'.$function.'</dfn>';
}

$children = $this->renderer->renderChildren($o);
$header = $this->renderer->renderHeaderWrapper($o->getContext(), (bool) \strlen($children), $header);
$children = $this->renderer->renderChildren($v);
$header = $this->renderer->renderHeaderWrapper($v->getContext(), (bool) \strlen($children), $header);

return '<dl>'.$header.$children.'</dl>';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Rich/ValuePluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@

interface ValuePluginInterface extends PluginInterface
{
public function renderValue(AbstractValue $o): ?string;
public function renderValue(AbstractValue $v): ?string;
}
8 changes: 4 additions & 4 deletions src/Renderer/Text/AbstractPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function __construct(TextRenderer $r)
$this->renderer = $r;
}

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

if (0 === $o->getContext()->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($o)).PHP_EOL;
if (0 === $v->getContext()->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($v)).PHP_EOL;
}

$out .= $this->renderer->renderHeader($o);
$out .= $this->renderer->renderHeader($v);

if (null !== $content) {
$out .= ' '.$this->renderer->colorValue($content);
Expand Down
4 changes: 2 additions & 2 deletions src/Renderer/Text/EnumPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

class EnumPlugin extends AbstractPlugin
{
public function render(AbstractValue $o): string
public function render(AbstractValue $v): string
{
return $this->renderLockedHeader($o);
return $this->renderLockedHeader($v);
}
}
12 changes: 6 additions & 6 deletions src/Renderer/Text/LockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@

class LockPlugin extends AbstractPlugin
{
public function render(AbstractValue $o): ?string
public function render(AbstractValue $v): ?string
{
foreach ($o->getHints() as $hint => $_) {
foreach ($v->getHints() as $hint => $_) {
switch ($hint) {
case 'array_limit':
return $this->renderLockedHeader($o, 'ARRAY LIMIT');
return $this->renderLockedHeader($v, 'ARRAY LIMIT');
case 'blacklist':
return $this->renderLockedHeader($o, 'BLACKLISTED');
return $this->renderLockedHeader($v, 'BLACKLISTED');
case 'depth_limit':
return $this->renderLockedHeader($o, 'DEPTH LIMIT');
return $this->renderLockedHeader($v, 'DEPTH LIMIT');
case 'recursion':
return $this->renderLockedHeader($o, 'RECURSION');
return $this->renderLockedHeader($v, 'RECURSION');
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Renderer/Text/MicrotimePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ public function __construct(TextRenderer $r)
}
}

public function render(AbstractValue $o): ?string
public function render(AbstractValue $v): ?string
{
$r = $o->getRepresentation('microtime');
$r = $v->getRepresentation('microtime');

if (!$r instanceof MicrotimeRepresentation || !($dt = $r->getDateTime())) {
return null;
}

$c = $o->getContext();
$c = $v->getContext();

$out = '';

if (0 === $c->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($o)).PHP_EOL;
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($v)).PHP_EOL;
}

$out .= $this->renderer->renderHeader($o);
$out .= $this->renderer->renderChildren($o).PHP_EOL;
$out .= $this->renderer->renderHeader($v);
$out .= $this->renderer->renderChildren($v).PHP_EOL;

$indent = \str_repeat(' ', ($c->getDepth() + 1) * $this->renderer->indent_width);

Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Text/PluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ interface PluginInterface
{
public function __construct(TextRenderer $r);

public function render(AbstractValue $o): ?string;
public function render(AbstractValue $v): ?string;
}
10 changes: 5 additions & 5 deletions src/Renderer/Text/SplFileInfoPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@

class SplFileInfoPlugin extends AbstractPlugin
{
public function render(AbstractValue $o): ?string
public function render(AbstractValue $v): ?string
{
$contents = $o->getRepresentation('splfileinfo')->contents ?? null;
$contents = $v->getRepresentation('splfileinfo')->contents ?? null;

if (null === $contents) {
return null;
}

$out = '';

$c = $o->getContext();
$c = $v->getContext();

if (0 === $c->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($o)).PHP_EOL;
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($v)).PHP_EOL;
}

$out .= $this->renderer->renderHeader($o);
$out .= $this->renderer->renderHeader($v);
$out .= ' '.$contents.PHP_EOL;

return $out;
Expand Down
12 changes: 6 additions & 6 deletions src/Renderer/Text/StreamPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@

class StreamPlugin extends AbstractPlugin
{
public function render(AbstractValue $o): ?string
public function render(AbstractValue $v): ?string
{
if (!$o instanceof StreamValue) {
if (!$v instanceof StreamValue) {
return null;
}

$r = $o->getRepresentation('stream');
$r = $v->getRepresentation('stream');
if (!\is_array($r->contents ?? null)) {
return null;
}

$out = '';

$c = $o->getContext();
$c = $v->getContext();

if (0 === $c->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($o)).PHP_EOL;
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($v)).PHP_EOL;
}

$out .= $this->renderer->renderHeader($o);
$out .= $this->renderer->renderHeader($v);

/**
* @psalm-var AbstractValue[] $r->contents
Expand Down
12 changes: 6 additions & 6 deletions src/Renderer/Text/TracePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@

class TracePlugin extends AbstractPlugin
{
public function render(AbstractValue $o): ?string
public function render(AbstractValue $v): ?string
{
if (!$o instanceof TraceValue) {
if (!$v instanceof TraceValue) {
return null;
}

$c = $o->getContext();
$c = $v->getContext();

$out = '';

if (0 === $c->getDepth()) {
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($o)).PHP_EOL;
$out .= $this->renderer->colorTitle($this->renderer->renderTitle($v)).PHP_EOL;
}

$out .= $this->renderer->renderHeader($o).':'.PHP_EOL;
$out .= $this->renderer->renderHeader($v).':'.PHP_EOL;

$indent = \str_repeat(' ', ($c->getDepth() + 1) * $this->renderer->indent_width);

$i = 1;
foreach ($o->getContents() as $frame) {
foreach ($v->getContents() as $frame) {
if (!$frame instanceof TraceFrameValue) {
continue;
}
Expand Down

0 comments on commit 3fae5bd

Please sign in to comment.