PHP: Add lexit function for easy exiting with text

This commit is contained in:
Tim
2025-05-19 18:41:49 +02:00
parent ea00b5c47e
commit 7f610dc31a
3 changed files with 19 additions and 17 deletions

View File

@ -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);
}