Skip to content

Commit

Permalink
PHP84 explicit nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Sep 16, 2024
1 parent 58ee298 commit 1684b97
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'nullable_type_declaration_for_default_null_value' => true,
])
;
6 changes: 3 additions & 3 deletions src/Xml/Dom/Xpath.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function locate(callable $locator)
* @throws RuntimeException
* @return NodeList<\DOM\Node>
*/
public function query(string $expression, \DOM\Node $contextNode = null): NodeList
public function query(string $expression, ?\DOM\Node $contextNode = null): NodeList
{
return $this->locate(query($expression, $contextNode));
}
Expand All @@ -73,7 +73,7 @@ public function query(string $expression, \DOM\Node $contextNode = null): NodeLi
* @throws RuntimeException
* @throws InvalidArgumentException
*/
public function querySingle(string $expression, \DOM\Node $contextNode = null): \DOM\Node
public function querySingle(string $expression, ?\DOM\Node $contextNode = null): \DOM\Node
{
return $this->locate(query_single($expression, $contextNode));
}
Expand All @@ -86,7 +86,7 @@ public function querySingle(string $expression, \DOM\Node $contextNode = null):
* @return T
* @throws RuntimeException
*/
public function evaluate(string $expression, TypeInterface $type, \DOM\Node $contextNode = null)
public function evaluate(string $expression, TypeInterface $type, ?\DOM\Node $contextNode = null)
{
return $this->locate(evaluate($expression, $type, $contextNode));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/evaluate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @return Closure(\DOM\XPath): T
*/
function evaluate(string $query, TypeInterface $type, \DOM\Node $node = null): Closure
function evaluate(string $query, TypeInterface $type, ?\DOM\Node $node = null): Closure
{
return
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* @return Closure(\DOM\XPath): NodeList<\DOM\Node>
*/
function query(string $query, \DOM\Node $node = null): Closure
function query(string $query, ?\DOM\Node $node = null): Closure
{
return static function (\DOM\XPath $xpath) use ($query, $node): NodeList {
$node = $node ?? $xpath->document->documentElement;
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Dom/Xpath/Locator/query_single.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @return Closure(\DOM\XPath): \DOM\Node
*/
function query_single(string $query, \DOM\Node $node = null): Closure
function query_single(string $query, ?\DOM\Node $node = null): Closure
{
return
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Encoding/Exception/EncodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class EncodingException extends Exception implements ExceptionInterface
{
private function __construct(string $message, Exception $previous = null)
private function __construct(string $message, ?Exception $previous = null)
{
parent::__construct(
$message,
Expand Down
2 changes: 1 addition & 1 deletion src/Xml/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class RuntimeException extends \RuntimeException implements ExceptionInterface
{
private function __construct(string $message, Throwable $previous = null)
private function __construct(string $message, ?Throwable $previous = null)
{
parent::__construct(
$message,
Expand Down

0 comments on commit 1684b97

Please sign in to comment.