PHP: Add lexit function for easy exiting with text
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
function path(...$segments): string
|
||||
{
|
||||
return implode(DIRECTORY_SEPARATOR, $segments);
|
||||
@ -8,4 +10,10 @@ function path(...$segments): string
|
||||
function line(string $line): void
|
||||
{
|
||||
echo $line . PHP_EOL;
|
||||
}
|
||||
|
||||
#[NoReturn] function lexit(string $line, int $code = 0): void
|
||||
{
|
||||
line($line);
|
||||
exit($code);
|
||||
}
|
Reference in New Issue
Block a user