Skip to content

Commit

Permalink
Improve exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 23, 2023
1 parent c913158 commit 2b78ffb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/exceptions/ProcessControlExtensionNotLoadedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,33 @@
*/
namespace SebastianBergmann\Invoker;

use function extension_loaded;
use function function_exists;
use function implode;
use RuntimeException;

final class ProcessControlExtensionNotLoadedException extends RuntimeException implements Exception
{
public function __construct()
{
$message = [];

if (!extension_loaded('pcntl')) {
$message[] = 'The pcntl (process control) extension for PHP must be loaded.';
}

if (!function_exists('pcntl_signal')) {
$message[] = 'The pcntl_signal() function must not be disabled.';
}

if (!function_exists('pcntl_async_signals')) {
$message[] = 'The pcntl_async_signals() function must not be disabled.';
}

if (!function_exists('pcntl_alarm')) {
$message[] = 'The pcntl_alarm() function must not be disabled.';
}

parent::__construct(implode(PHP_EOL, $message));
}
}

0 comments on commit 2b78ffb

Please sign in to comment.