diff --git a/CHANGELOG.md b/CHANGELOG.md index 370c19bf..71fefb9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.0.1 under development -- no changes in this release. +- Bug #175: Fix `serve` under Windows (samdark) ## 2.0.0 February 17, 2023 diff --git a/src/Command/Serve.php b/src/Command/Serve.php index 76bf3727..c8c6e9a0 100644 --- a/src/Command/Serve.php +++ b/src/Command/Serve.php @@ -135,7 +135,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int return ExitCode::OK; } - passthru('PHP_CLI_SERVER_WORKERS=' . $workers . ' "' . PHP_BINARY . '"' . " -S $address -t \"$documentRoot\" $router"); + $command = '"' . PHP_BINARY . '"' . " -S $address -t \"$documentRoot\" $router"; + + if (DIRECTORY_SEPARATOR !== '\\') { + $command = 'PHP_CLI_SERVER_WORKERS=' . $workers . ' ' . $command; + } + + passthru($command); return ExitCode::OK; } diff --git a/src/SymfonyEventDispatcher.php b/src/SymfonyEventDispatcher.php index 3955a128..54062cfe 100644 --- a/src/SymfonyEventDispatcher.php +++ b/src/SymfonyEventDispatcher.php @@ -17,7 +17,9 @@ public function __construct(private PsrEventDispatcherInterface $dispatcher) * Dispatches an event to all registered listeners. * * @psalm-template T as object + * * @psalm-param T $event + * * @psalm-return T */ public function dispatch(object $event, string $eventName = null): object