<?php declare(strict_types=1); // ********** test doubles ********** interface ServerRequestInterface {} class ServerRequest implements ServerRequestInterface {} // ********** current interfaces ********** interface DelegateInterface { public function process(ServerRequestInterface $request); } interface MiddlewareInterface { public function process(ServerRequestInterface $request, DelegateInterface $delegate); } // ********** Why I love PHP ********** class MD implements DelegateInterface, MiddlewareInterface { function process(ServerRequestInterface $request, DelegateInterface $delegate = null) { } } // ********** test ********** $md = new MD(); var_dump($md instanceof DelegateInterface); var_dump($md instanceof MiddlewareInterface); $md->process(new ServerRequest(), $md); echo 'I\'m fine'.PHP_EOL;
You have javascript disabled. You will not be able to edit any code.