Skip to content

Commit

Permalink
Mark parameters explicit nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jubeki committed Sep 4, 2024
1 parent b243cac commit 6c835a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/AstRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class AstRuntime
private $cachedCount = 0;

public function __construct(
Parser $parser = null,
callable $fnDispatcher = null
?Parser $parser = null,
?callable $fnDispatcher = null
) {
$fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance();
$this->interpreter = new TreeInterpreter($fnDispatcher);
Expand Down
2 changes: 1 addition & 1 deletion src/CompilerRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CompilerRuntime
* @param Parser|null $parser JMESPath parser to utilize
* @throws \RuntimeException if the cache directory cannot be created
*/
public function __construct($dir = null, Parser $parser = null)
public function __construct($dir = null, ?Parser $parser = null)
{
$this->parser = $parser ?: new Parser();
$this->compiler = new TreeCompiler();
Expand Down
8 changes: 4 additions & 4 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Parser
/**
* @param Lexer|null $lexer Lexer used to tokenize expressions
*/
public function __construct(Lexer $lexer = null)
public function __construct(?Lexer $lexer = null)
{
$this->lexer = $lexer ?: new Lexer();
}
Expand Down Expand Up @@ -366,7 +366,7 @@ private function parseKeyValuePair()
];
}

private function parseWildcardObject(array $left = null)
private function parseWildcardObject(?array $left = null)
{
$this->next();

Expand All @@ -380,7 +380,7 @@ private function parseWildcardObject(array $left = null)
];
}

private function parseWildcardArray(array $left = null)
private function parseWildcardArray(?array $left = null)
{
static $getRbracket = [T::T_RBRACKET => true];
$this->next($getRbracket);
Expand Down Expand Up @@ -473,7 +473,7 @@ private function lookahead()
: $this->tokens[$this->tpos + 1]['type'];
}

private function next(array $match = null)
private function next(?array $match = null)
{
if (!isset($this->tokens[$this->tpos + 1])) {
$this->token = self::$nullToken;
Expand Down
2 changes: 1 addition & 1 deletion src/TreeInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TreeInterpreter
* a function name argument and an array of
* function arguments and returns the result.
*/
public function __construct(callable $fnDispatcher = null)
public function __construct(?callable $fnDispatcher = null)
{
$this->fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance();
}
Expand Down

0 comments on commit 6c835a9

Please sign in to comment.