Infrastructure/Functions.php
public static function removeLastCharsFromString(string $input, int $numChars = 1): string 
    {
        if ($numChars > strlen($input)) {
            throw new \InvalidArgumentException("Cannot remove $numChars from $input");
        }
        return substr($input, 0, strlen($input) - $numChars);
    }
public static function removeLastCharsFromString(string $input, int $numChars = 1): string 
    {
        if ($numChars > strlen($input)) {
            throw new \InvalidArgumentException("Cannot remove $numChars from $input");
        }
        return substr($input, 0, strlen($input) - $numChars);
    }
public static function removeLastCharsFromString ( string $ input , int $ numChars = 1 ) : string { if ( $ numChars > strlen ( $ input ) ) { throw new \ InvalidArgumentException ( "Cannot remove $numChars from $input" ) ; } return substr ( $ input , 0 , strlen ( $ input ) - $ numChars ) ; }
string length must be >= numChars
string length must be > = numChars