Skip to content

Commit

Permalink
Modif toString function
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiven committed Nov 19, 2023
1 parent 69e3791 commit 7886af0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Axis.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ enum Axis: int{
case X = 2;

/**
* @deprecated
* @deprecated use Axis->name
* Returns a human-readable string representation of the given axis.
*/
public static function toString(Axis $axis) : string{

Check failure on line 35 in src/Axis.php

View workflow job for this annotation

GitHub Actions / PHP 8.0

Syntax error, unexpected T_VARIABLE, expecting ')' on line 35
return match($axis){
Axis::Y => "y",
Axis::Z => "z",
Axis::X => "x",
default => throw new \InvalidArgumentException("Invalid axis " . $axis->name)
};
}

Check failure on line 41 in src/Axis.php

View workflow job for this annotation

GitHub Actions / PHP 8.0

Syntax error, unexpected '}', expecting EOF on line 41
}
4 changes: 2 additions & 2 deletions src/Facing.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@ public static function validate(int $facing) : void{
}

/**
* @deprecated use Facing->name
* Returns a human-readable string representation of the given Facing direction.
*/
public static function toString(int $facing) : string{
public static function toString(Facing $facing) : string{
return match($facing){
self::DOWN => "down",
self::UP => "up",
self::NORTH => "north",
self::SOUTH => "south",
self::WEST => "west",
self::EAST => "east",
default => throw new \InvalidArgumentException("Invalid facing $facing")
};
}
}

0 comments on commit 7886af0

Please sign in to comment.