@@ -50,7 +50,7 @@ public function axis() : Axis{
50
50
}
51
51
52
52
/**
53
- * @phpstan-return non-empty-array<int>
53
+ * @phpstan-return array{-1|0|1, -1|0|1, -1|0|1}
54
54
*/
55
55
public function offset () : array {
56
56
return match ($ this ){
@@ -87,7 +87,7 @@ public function opposite() : Facing{
87
87
/**
88
88
* Rotates the given direction around the axis.
89
89
*
90
- * @throws \InvalidArgumentException
90
+ * @throws \InvalidArgumentException if not possible to rotate this direction around $axis
91
91
*/
92
92
public function rotate (Axis $ axis , bool $ clockwise ) : Facing {
93
93
$ rotated = match ($ axis ){
@@ -96,21 +96,21 @@ public function rotate(Axis $axis, bool $clockwise) : Facing{
96
96
self ::EAST => self ::SOUTH ,
97
97
self ::SOUTH => self ::WEST ,
98
98
self ::WEST => self ::NORTH ,
99
- default => throw new \InvalidArgumentException ("Face " . strtolower ($ this ->name ) . " not match with Axis " . strtolower ($ axis ->name ))
99
+ default => throw new \InvalidArgumentException ("Cannot rotate facing \"" . strtolower ($ this ->name ) . "\" around axis \"" . strtolower ($ axis ->name ) . "\"" )
100
100
},
101
101
Axis::Z => match ($ this ){
102
102
self ::UP => self ::EAST ,
103
103
self ::EAST => self ::DOWN ,
104
104
self ::DOWN => self ::WEST ,
105
105
self ::WEST => self ::UP ,
106
- default => throw new \InvalidArgumentException ("Face " . strtolower ($ this ->name ) . " not match with Axis " . strtolower ($ axis ->name ))
106
+ default => throw new \InvalidArgumentException ("Cannot rotate facing \"" . strtolower ($ this ->name ) . "\" around axis \"" . strtolower ($ axis ->name ) . "\"" )
107
107
},
108
108
Axis::X => match ($ this ){
109
109
self ::UP => self ::NORTH ,
110
110
self ::NORTH => self ::DOWN ,
111
111
self ::DOWN => self ::SOUTH ,
112
112
self ::SOUTH => self ::UP ,
113
- default => throw new \InvalidArgumentException ("Face " . strtolower ($ this ->name ) . " not match with Axis " . strtolower ($ axis ->name ))
113
+ default => throw new \InvalidArgumentException ("Cannot rotate facing \"" . strtolower ($ this ->name ) . "\" around axis \"" . strtolower ($ axis ->name ) . "\"" )
114
114
}
115
115
};
116
116
0 commit comments