stricter typehint

This commit is contained in:
Dennis Eichhorn 2019-12-21 21:41:05 +01:00
parent db48bcdb8d
commit 266ae61e53
2 changed files with 11 additions and 11 deletions

View File

@ -456,7 +456,7 @@ final class JumpPointSearch implements PathFinderInterface
* *
* @param null|JumpPointNode $node Node to find jump point from * @param null|JumpPointNode $node Node to find jump point from
* @param null|JumpPointNode $pNode Parent node * @param null|JumpPointNode $pNode Parent node
* @param null|JumpPointNode $endNode End node to find path to * @param JumpPointNode $endNode End node to find path to
* @param int $movement Movement type * @param int $movement Movement type
* @param Grid $grid Grid of the nodes * @param Grid $grid Grid of the nodes
* *
@ -482,7 +482,7 @@ final class JumpPointSearch implements PathFinderInterface
* *
* @param null|JumpPointNode $node Node to find jump point from * @param null|JumpPointNode $node Node to find jump point from
* @param null|JumpPointNode $pNode Parent node * @param null|JumpPointNode $pNode Parent node
* @param null|JumpPointNode $endNode End node to find path to * @param JumpPointNode $endNode End node to find path to
* @param Grid $grid Grid of the nodes * @param Grid $grid Grid of the nodes
* *
* @return null|JumpPointNode * @return null|JumpPointNode
@ -491,7 +491,7 @@ final class JumpPointSearch implements PathFinderInterface
*/ */
private static function jumpStraight(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode private static function jumpStraight(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode
{ {
if ($node === null || !$node->isWalkable()) { if ($node === null || $pNode === null || !$node->isWalkable()) {
return null; return null;
} }
@ -538,7 +538,7 @@ final class JumpPointSearch implements PathFinderInterface
* *
* @param null|JumpPointNode $node Node to find jump point from * @param null|JumpPointNode $node Node to find jump point from
* @param null|JumpPointNode $pNode Parent node * @param null|JumpPointNode $pNode Parent node
* @param null|JumpPointNode $endNode End node to find path to * @param JumpPointNode $endNode End node to find path to
* @param Grid $grid Grid of the nodes * @param Grid $grid Grid of the nodes
* *
* @return null|JumpPointNode * @return null|JumpPointNode
@ -547,7 +547,7 @@ final class JumpPointSearch implements PathFinderInterface
*/ */
private static function jumpDiagonal(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode private static function jumpDiagonal(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode
{ {
if ($node === null || !$node->isWalkable()) { if ($node === null || $pNode === null || !$node->isWalkable()) {
return null; return null;
} }
@ -598,7 +598,7 @@ final class JumpPointSearch implements PathFinderInterface
* *
* @param null|JumpPointNode $node Node to find jump point from * @param null|JumpPointNode $node Node to find jump point from
* @param null|JumpPointNode $pNode Parent node * @param null|JumpPointNode $pNode Parent node
* @param null|JumpPointNode $endNode End node to find path to * @param JumpPointNode $endNode End node to find path to
* @param Grid $grid Grid of the nodes * @param Grid $grid Grid of the nodes
* *
* @return null|JumpPointNode * @return null|JumpPointNode
@ -607,7 +607,7 @@ final class JumpPointSearch implements PathFinderInterface
*/ */
private static function jumpDiagonalOneObstacle(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode private static function jumpDiagonalOneObstacle(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode
{ {
if ($node === null || !$node->isWalkable()) { if ($node === null || $pNode === null || !$node->isWalkable()) {
return null; return null;
} }
@ -662,7 +662,7 @@ final class JumpPointSearch implements PathFinderInterface
* *
* @param null|JumpPointNode $node Node to find jump point from * @param null|JumpPointNode $node Node to find jump point from
* @param null|JumpPointNode $pNode Parent node * @param null|JumpPointNode $pNode Parent node
* @param null|JumpPointNode $endNode End node to find path to * @param JumpPointNode $endNode End node to find path to
* @param Grid $grid Grid of the nodes * @param Grid $grid Grid of the nodes
* *
* @return null|JumpPointNode * @return null|JumpPointNode
@ -671,7 +671,7 @@ final class JumpPointSearch implements PathFinderInterface
*/ */
private static function jumpDiagonalNoObstacle(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode private static function jumpDiagonalNoObstacle(?JumpPointNode $node, ?JumpPointNode $pNode, JumpPointNode $endNode, Grid $grid) : ?JumpPointNode
{ {
if ($node === null || !$node->isWalkable()) { if ($node === null || $pNode === null || !$node->isWalkable()) {
return null; return null;
} }

View File

@ -27,7 +27,7 @@ class Path
/** /**
* Nodes in the path * Nodes in the path
* *
* @var Nodes[] * @var Node[]
* @since 1.0.0 * @since 1.0.0
*/ */
public array $nodes = []; public array $nodes = [];
@ -43,7 +43,7 @@ class Path
/** /**
* Nodes in the path * Nodes in the path
* *
* @var Nodes[] * @var Node[]
* @since 1.0.0 * @since 1.0.0
*/ */
private array $expandedNodes = []; private array $expandedNodes = [];