diff --git a/src/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactory.php b/src/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactory.php index 8a251f3..8379721 100644 --- a/src/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactory.php +++ b/src/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactory.php @@ -22,6 +22,8 @@ use FreeDSx\Ldap\Protocol\ServerProtocolHandler\BindHandlerInterface; use FreeDSx\Ldap\Protocol\ServerProtocolHandler\ServerAnonBindHandler; use FreeDSx\Ldap\Protocol\ServerProtocolHandler\ServerBindHandler; +use FreeDSx\Ldap\Server\HandlerFactoryInterface; +use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; /** * Determines the correct bind handler for the request. @@ -30,8 +32,10 @@ */ class ServerBindHandlerFactory { - public function __construct(private readonly ServerQueue $queue) - { + public function __construct( + private readonly ServerQueue $queue, + private readonly HandlerFactoryInterface $handlerFactory, + ) { } /** @@ -42,7 +46,10 @@ public function __construct(private readonly ServerQueue $queue) public function get(RequestInterface $request): BindHandlerInterface { if ($request instanceof SimpleBindRequest) { - return new ServerBindHandler($this->queue); + return new ServerBindHandler( + queue: $this->queue, + dispatcher: $this->handlerFactory->makeRequestHandler(), + ); } elseif ($request instanceof AnonBindRequest) { return new ServerAnonBindHandler($this->queue); } else { diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler.php index 1a42c5b..64e413d 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler.php @@ -49,11 +49,10 @@ class ServerProtocolHandler public function __construct( private readonly ServerQueue $queue, - private readonly HandlerFactoryInterface $handlerFactory, - private readonly ?LoggerInterface $logger, private readonly ServerProtocolHandlerFactory $protocolHandlerFactory, private readonly ServerAuthorization $authorizer, private readonly ServerBindHandlerFactory $bindHandlerFactory, + private readonly ?LoggerInterface $logger, private readonly ResponseFactory $responseFactory = new ResponseFactory() ) { } @@ -92,14 +91,14 @@ public function handle(array $defaultContext = []): void ) ); } catch (EncoderException | ProtocolException) { - # Per RFC 4511, 4.1.1 if the PDU cannot be parsed or is otherwise malformed a disconnect should be sent with a - # result code of protocol error. + # Per RFC 4511, 4.1.1 if the PDU cannot be parsed or is otherwise malformed a disconnect should be sent with + # a result code of protocol error. $this->sendNoticeOfDisconnect('The message encoding is malformed.'); $this->logError( 'The client sent a malformed request. Terminating their connection.', $defaultContext ); - } catch (Exception | Throwable $e) { + } catch (Throwable $e) { $this->logError( 'An unexpected exception was caught while handling the client. Terminating their connection.', array_merge( @@ -223,11 +222,9 @@ private function handleAuthRequest(LdapMessageRequest $message): TokenInterface ); } - return $this->bindHandlerFactory->get($message->getRequest())->handleBind( - $message, - $this->handlerFactory->makeRequestHandler(), - $this->queue - ); + return $this->bindHandlerFactory + ->get($message->getRequest()) + ->handleBind($message); } /** diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BaseServerHandler.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BaseServerHandler.php deleted file mode 100644 index 5c1d953..0000000 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BaseServerHandler.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace FreeDSx\Ldap\Protocol\ServerProtocolHandler; - -use FreeDSx\Ldap\Protocol\Factory\ResponseFactory; - -/** - * Base handler (easy access to the response factory). - * - * @author Chad Sikorra - */ -abstract class BaseServerHandler -{ - public function __construct(protected readonly ResponseFactory $responseFactory = new ResponseFactory()) - { - } -} diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindHandlerInterface.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindHandlerInterface.php index ecef8ed..23e98e8 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindHandlerInterface.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindHandlerInterface.php @@ -15,8 +15,6 @@ use FreeDSx\Ldap\Exception\OperationException; use FreeDSx\Ldap\Protocol\LdapMessageRequest; -use FreeDSx\Ldap\Protocol\Queue\ServerQueue; -use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; use FreeDSx\Ldap\Server\Token\TokenInterface; /** @@ -31,9 +29,5 @@ interface BindHandlerInterface * * @throws OperationException */ - public function handleBind( - LdapMessageRequest $message, - RequestHandlerInterface $dispatcher, - ServerQueue $queue - ): TokenInterface; + public function handleBind(LdapMessageRequest $message): TokenInterface; } diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindVersionValidatorTrait.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindVersionValidatorTrait.php new file mode 100644 index 0000000..71afc03 --- /dev/null +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/BindVersionValidatorTrait.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FreeDSx\Ldap\Protocol\ServerProtocolHandler; + +use FreeDSx\Ldap\Exception\OperationException; +use FreeDSx\Ldap\Operation\Request\BindRequest; +use FreeDSx\Ldap\Operation\ResultCode; + +trait BindVersionValidatorTrait +{ + /** + * @throws OperationException + */ + private static function validateVersion(BindRequest $request): void + { + # Per RFC 4.2, a result code of protocol error must be sent back for unsupported versions. + if ($request->getVersion() !== 3) { + throw new OperationException( + 'Only LDAP version 3 is supported.', + ResultCode::PROTOCOL_ERROR + ); + } + } +} diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandler.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandler.php index 57f15dd..7777088 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandler.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandler.php @@ -17,9 +17,9 @@ use FreeDSx\Ldap\Exception\OperationException; use FreeDSx\Ldap\Exception\RuntimeException; use FreeDSx\Ldap\Operation\Request\AnonBindRequest; +use FreeDSx\Ldap\Protocol\Factory\ResponseFactory; use FreeDSx\Ldap\Protocol\LdapMessageRequest; use FreeDSx\Ldap\Protocol\Queue\ServerQueue; -use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; use FreeDSx\Ldap\Server\Token\AnonToken; use FreeDSx\Ldap\Server\Token\TokenInterface; @@ -28,11 +28,14 @@ * * @author Chad Sikorra */ -class ServerAnonBindHandler extends ServerBindHandler +class ServerAnonBindHandler implements BindHandlerInterface { - public function __construct(private readonly ServerQueue $queue) - { - parent::__construct($this->queue); + use BindVersionValidatorTrait; + + public function __construct( + private readonly ServerQueue $queue, + private readonly ResponseFactory $responseFactory = new ResponseFactory() + ) { } /** @@ -41,11 +44,8 @@ public function __construct(private readonly ServerQueue $queue) * @throws OperationException * @throws RuntimeException */ - public function handleBind( - LdapMessageRequest $message, - RequestHandlerInterface $dispatcher, - ServerQueue $queue - ): TokenInterface { + public function handleBind(LdapMessageRequest $message): TokenInterface + { $request = $message->getRequest(); if (!$request instanceof AnonBindRequest) { throw new RuntimeException(sprintf( @@ -54,12 +54,12 @@ public function handleBind( )); } - $this->validateVersion($request); + self::validateVersion($request); $this->queue->sendMessage($this->responseFactory->getStandardResponse($message)); return new AnonToken( $request->getUsername(), - $request->getVersion() + $request->getVersion(), ); } } diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandler.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandler.php index 8fd2ad8..05900b2 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandler.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandler.php @@ -18,6 +18,7 @@ use FreeDSx\Ldap\Operation\Request\BindRequest; use FreeDSx\Ldap\Operation\Request\SimpleBindRequest; use FreeDSx\Ldap\Operation\ResultCode; +use FreeDSx\Ldap\Protocol\Factory\ResponseFactory; use FreeDSx\Ldap\Protocol\LdapMessageRequest; use FreeDSx\Ldap\Protocol\Queue\ServerQueue; use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; @@ -29,11 +30,15 @@ * * @author Chad Sikorra */ -class ServerBindHandler extends BaseServerHandler implements BindHandlerInterface +class ServerBindHandler implements BindHandlerInterface { - public function __construct(private readonly ServerQueue $queue) - { - parent::__construct(); + use BindVersionValidatorTrait; + + public function __construct( + private readonly ServerQueue $queue, + private readonly RequestHandlerInterface $dispatcher, + private readonly ResponseFactory $responseFactory = new ResponseFactory(), + ) { } /** @@ -41,11 +46,8 @@ public function __construct(private readonly ServerQueue $queue) * @throws RuntimeException * @throws OperationException */ - public function handleBind( - LdapMessageRequest $message, - RequestHandlerInterface $dispatcher, - ServerQueue $queue - ): TokenInterface { + public function handleBind(LdapMessageRequest $message): TokenInterface + { /** @var BindRequest $request */ $request = $message->getRequest(); if (!$request instanceof SimpleBindRequest) { @@ -55,8 +57,8 @@ public function handleBind( )); } - $this->validateVersion($request); - $token = $this->simpleBind($dispatcher, $request); + self::validateVersion($request); + $token = $this->simpleBind($request); $this->queue->sendMessage($this->responseFactory->getStandardResponse($message)); return $token; @@ -65,31 +67,18 @@ public function handleBind( /** * @throws OperationException */ - protected function validateVersion(BindRequest $request): void + private function simpleBind(SimpleBindRequest $request): TokenInterface { - # Per RFC 4.2, a result code of protocol error must be sent back for unsupported versions. - if ($request->getVersion() !== 3) { - throw new OperationException( - 'Only LDAP version 3 is supported.', - ResultCode::PROTOCOL_ERROR - ); - } - } - - /** - * @throws OperationException - */ - private function simpleBind( - RequestHandlerInterface $dispatcher, - SimpleBindRequest $request - ): TokenInterface { - if (!$dispatcher->bind($request->getUsername(), $request->getPassword())) { + if (!$this->dispatcher->bind($request->getUsername(), $request->getPassword())) { throw new OperationException( 'Invalid credentials.', ResultCode::INVALID_CREDENTIALS ); } - return new BindToken($request->getUsername(), $request->getPassword()); + return new BindToken( + $request->getUsername(), + $request->getPassword() + ); } } diff --git a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerDispatchHandler.php b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerDispatchHandler.php index 74774aa..f394eaa 100644 --- a/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerDispatchHandler.php +++ b/src/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerDispatchHandler.php @@ -17,6 +17,7 @@ use FreeDSx\Ldap\Exception\OperationException; use FreeDSx\Ldap\Operation\Request; use FreeDSx\Ldap\Operation\ResultCode; +use FreeDSx\Ldap\Protocol\Factory\ResponseFactory; use FreeDSx\Ldap\Protocol\LdapMessageRequest; use FreeDSx\Ldap\Protocol\Queue\ServerQueue; use FreeDSx\Ldap\Server\RequestContext; @@ -28,13 +29,13 @@ * * @author Chad Sikorra */ -class ServerDispatchHandler extends BaseServerHandler implements ServerProtocolHandlerInterface +class ServerDispatchHandler implements ServerProtocolHandlerInterface { public function __construct( private readonly ServerQueue $queue, private readonly RequestHandlerInterface $dispatcher, + private readonly ResponseFactory $responseFactory = new ResponseFactory(), ) { - parent::__construct(); } /** diff --git a/src/FreeDSx/Ldap/Server/ServerProtocolFactory.php b/src/FreeDSx/Ldap/Server/ServerProtocolFactory.php index 8245104..16260db 100644 --- a/src/FreeDSx/Ldap/Server/ServerProtocolFactory.php +++ b/src/FreeDSx/Ldap/Server/ServerProtocolFactory.php @@ -36,8 +36,6 @@ public function make(Socket $socket): ServerProtocolHandler return new ServerProtocolHandler( queue: $serverQueue, - handlerFactory: $this->handlerFactory, - logger: $this->options->getLogger(), protocolHandlerFactory: new ServerProtocolHandlerFactory( handlerFactory: $this->handlerFactory, options: $this->options, @@ -45,7 +43,11 @@ public function make(Socket $socket): ServerProtocolHandler queue: $serverQueue, ), authorizer: $this->serverAuthorization, - bindHandlerFactory: new ServerBindHandlerFactory($serverQueue), + bindHandlerFactory: new ServerBindHandlerFactory( + queue: $serverQueue, + handlerFactory: $this->handlerFactory, + ), + logger: $this->options->getLogger(), ); } } diff --git a/tests/spec/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactorySpec.php b/tests/spec/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactorySpec.php index 6701ace..5d6e2b6 100644 --- a/tests/spec/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactorySpec.php +++ b/tests/spec/FreeDSx/Ldap/Protocol/Factory/ServerBindHandlerFactorySpec.php @@ -21,13 +21,21 @@ use FreeDSx\Ldap\Protocol\Queue\ServerQueue; use FreeDSx\Ldap\Protocol\ServerProtocolHandler\ServerAnonBindHandler; use FreeDSx\Ldap\Protocol\ServerProtocolHandler\ServerBindHandler; +use FreeDSx\Ldap\Server\HandlerFactoryInterface; +use FreeDSx\Ldap\Server\RequestHandler\GenericRequestHandler; +use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; use PhpSpec\ObjectBehavior; class ServerBindHandlerFactorySpec extends ObjectBehavior { - public function let(ServerQueue $queue): void - { - $this->beConstructedWith($queue); + public function let( + ServerQueue $queue, + HandlerFactoryInterface $handlerFactory, + ): void { + $this->beConstructedWith( + $queue, + $handlerFactory, + ); } public function it_is_initializable(): void @@ -41,14 +49,19 @@ public function it_should_get_an_anon_bind_handler(): void ->shouldBeAnInstanceOf(ServerAnonBindHandler::class); } - public function it_should_get_a_simple_bind_handler(): void + public function it_should_get_a_simple_bind_handler(HandlerFactoryInterface $handlerFactory): void { + $handlerFactory + ->makeRequestHandler() + ->willReturn(new GenericRequestHandler()); + $this->get(new SimpleBindRequest('foo', 'bar')) ->shouldBeAnInstanceOf(ServerBindHandler::class); } public function it_should_throw_an_exception_on_an_unknown_bind_type(BindRequest $request): void { - $this->shouldThrow(OperationException::class)->during('get', [$request]); + $this->shouldThrow(OperationException::class) + ->during('get', [$request]); } } diff --git a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandlerSpec.php b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandlerSpec.php index c66469a..4da93fb 100644 --- a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandlerSpec.php +++ b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerAnonBindHandlerSpec.php @@ -64,7 +64,7 @@ public function it_should_return_an_anon_token_with_the_supplied_username(Server new LdapResult(0) )))->shouldBeCalled()->willReturn($queue); - $this->handleBind($bind, $dispatcher, $queue)->shouldBeLike( + $this->handleBind($bind)->shouldBeLike( new AnonToken('foo') ); } diff --git a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandlerSpec.php b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandlerSpec.php index 0e346a3..d063bf5 100644 --- a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandlerSpec.php +++ b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandler/ServerBindHandlerSpec.php @@ -29,9 +29,14 @@ class ServerBindHandlerSpec extends ObjectBehavior { - public function let(ServerQueue $queue): void - { - $this->beConstructedWith($queue); + public function let( + ServerQueue $queue, + RequestHandlerInterface $dispatcher, + ): void { + $this->beConstructedWith( + $queue, + $dispatcher, + ); } public function it_is_initializable(): void @@ -39,8 +44,10 @@ public function it_is_initializable(): void $this->shouldHaveType(ServerBindHandler::class); } - public function it_should_return_a_token_on_success(ServerQueue $queue, RequestHandlerInterface $dispatcher): void - { + public function it_should_return_a_token_on_success( + ServerQueue $queue, + RequestHandlerInterface $dispatcher, + ): void { $bind = new LdapMessageRequest(1, new SimpleBindRequest('foo@bar', 'bar')); $dispatcher->bind('foo@bar', 'bar') @@ -50,13 +57,15 @@ public function it_should_return_a_token_on_success(ServerQueue $queue, RequestH new LdapResult(0) )))->shouldBeCalled()->willReturn($queue); - $this->handleBind($bind, $dispatcher, $queue)->shouldBeLike( + $this->handleBind($bind)->shouldBeLike( new BindToken('foo@bar', 'bar') ); } - public function it_should_throw_an_operations_exception_with_invalid_credentials_if_they_are_wrong(ServerQueue $queue, RequestHandlerInterface $dispatcher): void - { + public function it_should_throw_an_operations_exception_with_invalid_credentials_if_they_are_wrong( + ServerQueue $queue, + RequestHandlerInterface $dispatcher, + ): void { $bind = new LdapMessageRequest(1, new SimpleBindRequest('foo@bar', 'bar')); $dispatcher->bind('foo@bar', 'bar') @@ -67,11 +76,11 @@ public function it_should_throw_an_operations_exception_with_invalid_credentials $this->shouldThrow(new OperationException('Invalid credentials.', ResultCode::INVALID_CREDENTIALS)) ->during( 'handleBind', - [$bind, $dispatcher, $queue] + [$bind] ); } - public function it_should_validate_the_version(ServerQueue $queue, RequestHandlerInterface $dispatcher): void + public function it_should_validate_the_version(ServerQueue $queue, ): void { $bind = new LdapMessageRequest(1, new SimpleBindRequest('foo@bar', 'bar', 5)); @@ -80,7 +89,7 @@ public function it_should_validate_the_version(ServerQueue $queue, RequestHandle $this->shouldThrow(OperationException::class) ->during( 'handleBind', - [$bind, $dispatcher, $queue] + [$bind] ); } } diff --git a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandlerSpec.php b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandlerSpec.php index 541d2db..06c593c 100644 --- a/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandlerSpec.php +++ b/tests/spec/FreeDSx/Ldap/Protocol/ServerProtocolHandlerSpec.php @@ -34,7 +34,6 @@ use FreeDSx\Ldap\Protocol\Queue\ServerQueue; use FreeDSx\Ldap\Protocol\ServerAuthorization; use FreeDSx\Ldap\Protocol\ServerProtocolHandler; -use FreeDSx\Ldap\Server\HandlerFactoryInterface; use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; use FreeDSx\Ldap\Server\Token\BindToken; use FreeDSx\Ldap\ServerOptions; @@ -49,7 +48,6 @@ public function let( ServerQueue $queue, ServerProtocolHandlerFactory $protocolHandlerFactory, LoggerInterface $logger, - HandlerFactoryInterface $handlerFactory, ServerBindHandlerFactory $bindHandlerFactory, RequestHandlerInterface $dispatcher, ServerProtocolHandler\BindHandlerInterface $bindHandler, @@ -61,15 +59,13 @@ public function let( $queue->sendMessage(Argument::any())->willReturn($queue); $bindHandlerFactory->get(Argument::any())->willReturn($bindHandler); $protocolHandlerFactory->get(Argument::any(), Argument::any())->willReturn($protocolHandler); - $handlerFactory->makeRequestHandler()->willReturn($dispatcher); $this->beConstructedWith( $queue, - $handlerFactory, - $logger, $protocolHandlerFactory, new ServerAuthorization(new ServerOptions()), $bindHandlerFactory, + $logger, ); } @@ -106,7 +102,7 @@ public function it_should_not_allow_a_previous_message_ID_from_a_new_request(Ser null ); - $bindHandler->handleBind(Argument::any(), Argument::any(), Argument::any())->willReturn( + $bindHandler->handleBind(Argument::any())->willReturn( new BindToken('foo', 'bar') ); $protocolHandler->handleRequest(Argument::any(), Argument::any()) @@ -201,7 +197,7 @@ public function it_should_send_a_bind_request_to_the_bind_request_handler(Server null ); - $bindHandler->handleBind(Argument::any(), Argument::any(), Argument::any()) + $bindHandler->handleBind(Argument::any()) ->shouldBeCalledOnce() ->willReturn(new BindToken('foo@bar', 'bar')); $protocolHandler->handleRequest(Argument::any(), Argument::any()) @@ -222,7 +218,7 @@ public function it_should_handle_operation_errors_thrown_from_the_request_handle null ); - $bindHandler->handleBind(Argument::any(), Argument::any(), Argument::any()) + $bindHandler->handleBind(Argument::any()) ->willReturn(new BindToken('foo@bar', 'bar')); $protocolHandler->handleRequest(Argument::any(), Argument::any()) diff --git a/tests/spec/FreeDSx/Ldap/Server/SocketServerFactorySpec.php b/tests/spec/FreeDSx/Ldap/Server/SocketServerFactorySpec.php index 59640ad..1188ea5 100644 --- a/tests/spec/FreeDSx/Ldap/Server/SocketServerFactorySpec.php +++ b/tests/spec/FreeDSx/Ldap/Server/SocketServerFactorySpec.php @@ -31,7 +31,7 @@ public function let(LoggerInterface $logger): void $this->tmpUnixSocketFilePath = stream_get_meta_data($this->tmpUnixSocketResource)['uri']; $this->beConstructedWith( - (new ServerOptions) + (new ServerOptions()) ->setPort(3390), $logger, ); @@ -54,7 +54,7 @@ public function it_should_make_a_unix_based_socket_server(LoggerInterface $logge throw new SkippingException('Cannot construct unix based socket on Windows.'); } $this->beConstructedWith( - (new ServerOptions) + (new ServerOptions()) ->setUnixSocket($this->tmpUnixSocketFilePath) ->setTransport('unix'), $logger,