Skip to content

Commit

Permalink
Handle psalm errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Nov 11, 2023
1 parent cfe83ed commit b4f3ffb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
Binary file modified build/kint.phar
Binary file not shown.
4 changes: 4 additions & 0 deletions init_helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
/**
* Alias of Kint::dump().
*
* @psalm-param mixed ...$args
*
* @return int|string
*/
function d(...$args)
Expand All @@ -51,6 +53,8 @@ function d(...$args)
*
* If run in CLI colors are disabled
*
* @psalm-param mixed ...$args
*
* @return int|string
*/
function s(...$args)
Expand Down
1 change: 1 addition & 0 deletions src/CallFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,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 Down
3 changes: 3 additions & 0 deletions src/Kint.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ public static function trace()
*
* Functionally equivalent to Kint::dump(1) or Kint::dump(debug_backtrace())
*
* @psalm-param array ...$args

This comment has been minimized.

Copy link
@jefvhal

jefvhal Aug 2, 2024

this will throw new IDE warnings when one of the following snippets is used

  • kint::dump(1234) (integer)
  • kint::dump('1234') (string)

This comment has been minimized.

Copy link
@jnvsor

jnvsor Aug 2, 2024

Author Member

Noted. Will be fixed in next release (69d1a1c)

*
* @return int|string
*/
public static function dump(...$args)
Expand Down Expand Up @@ -597,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
2 changes: 1 addition & 1 deletion src/Parser/ClosurePlugin.php
Original file line number Diff line number Diff 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
3 changes: 3 additions & 0 deletions src/Parser/PluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ public function getTypes(): array;

public function getTriggers(): int;

/**
* @psalm-param mixed &$var
*/
public function parse(&$var, Value &$o, int $trigger): void;
}

0 comments on commit b4f3ffb

Please sign in to comment.