diff --git a/src/Facing.php b/src/Facing.php index 90fd1b2..7c583fd 100644 --- a/src/Facing.php +++ b/src/Facing.php @@ -50,7 +50,7 @@ public function axis() : Axis{ } /** - * @phpstan-return non-empty-array + * @phpstan-return array{-1|0|1, -1|0|1, -1|0|1} */ public function offset() : array{ return match($this){ @@ -87,7 +87,7 @@ public function opposite() : Facing{ /** * Rotates the given direction around the axis. * - * @throws \InvalidArgumentException + * @throws \InvalidArgumentException if not possible to rotate this direction around $axis */ public function rotate(Axis $axis, bool $clockwise) : Facing{ $rotated = match($axis){ @@ -96,21 +96,21 @@ public function rotate(Axis $axis, bool $clockwise) : Facing{ self::EAST => self::SOUTH, self::SOUTH => self::WEST, self::WEST => self::NORTH, - default => throw new \InvalidArgumentException("Face " . strtolower($this->name) . " not match with Axis " . strtolower($axis->name)) + default => throw new \InvalidArgumentException("Cannot rotate facing \"" . strtolower($this->name) . "\" around axis \"" . strtolower($axis->name) . "\"") }, Axis::Z => match($this){ self::UP => self::EAST, self::EAST => self::DOWN, self::DOWN => self::WEST, self::WEST => self::UP, - default => throw new \InvalidArgumentException("Face " . strtolower($this->name) . " not match with Axis " . strtolower($axis->name)) + default => throw new \InvalidArgumentException("Cannot rotate facing \"" . strtolower($this->name) . "\" around axis \"" . strtolower($axis->name) . "\"") }, Axis::X => match($this){ self::UP => self::NORTH, self::NORTH => self::DOWN, self::DOWN => self::SOUTH, self::SOUTH => self::UP, - default => throw new \InvalidArgumentException("Face " . strtolower($this->name) . " not match with Axis " . strtolower($axis->name)) + default => throw new \InvalidArgumentException("Cannot rotate facing \"" . strtolower($this->name) . "\" around axis \"" . strtolower($axis->name) . "\"") } };