/D:\projects\reactre-skeleton\var\strict-php\_proxies\reactre-skeleton\src\App\Action\IndexAction.php
Last active
August 29, 2015 14:24
-
-
Save geerteltink/047b3775403675188e55 to your computer and use it in GitHub Desktop.
Declaration of ... must be compatible with ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Action; | |
| use Psr\Http\Message\ServerRequestInterface as Request; | |
| use Psr\Http\Message\ResponseInterface as Response; | |
| use Reactre\Action\AbstractAction as AbstractAction; | |
| class IndexAction extends IndexAction__AopProxied implements \Go\Aop\Proxy | |
| { | |
| /** | |
| * Property was created automatically, do not change it manually | |
| */ | |
| private static $__joinPoints = array(); | |
| public function __invoke(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, $out = null) | |
| { | |
| return self::$__joinPoints['method:__invoke']->__invoke($this, array($request, $response, $out)); | |
| } | |
| } | |
| \Go\Proxy\ClassProxy::injectJoinPoints('App\Action\IndexAction',array ( | |
| 'method' => | |
| array ( | |
| '__invoke' => | |
| array ( | |
| 0 => 'advisor.StrictPhp\\Aspect\\PrePublicMethodAspect->prePublicMethod', | |
| 1 => 'advisor.StrictPhp\\Aspect\\PostPublicMethodAspect->postPublicMethod', | |
| ), | |
| ), | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Action; | |
| use Psr\Http\Message\ServerRequestInterface as Request; | |
| use Psr\Http\Message\ResponseInterface as Response; | |
| use Reactre\Action\AbstractAction; | |
| class IndexAction__AopProxied extends AbstractAction | |
| { | |
| public function __invoke(Request $request, Response $response, callable $out = null) | |
| { | |
| $response->getBody()->write( | |
| $this->getRenderer()->render('home/index.twig') | |
| ); | |
| if ($request->getMethod() == 'POST') { | |
| dump($request->getParsedBody()); | |
| } | |
| return $response; | |
| } | |
| } | |
| include_once AOP_CACHE_DIR . '/_proxies/reactre-skeleton\\src\\App\\Action\\IndexAction.php'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I probably did something stupid but I keep getting this error: Fatal error: Declaration of App\Action\IndexAction::__invoke() must be compatible with Reactre\Action\AbstractAction::__invoke(Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out = NULL) in D:\projects\reactre-skeleton\var\strict-php\_proxies\reactre-skeleton\src\App\Action\IndexAction.php on line 8 | |
| These are the classes: | |
| ```php | |
| namespace Zend\Stratigility; | |
| use Psr\Http\Message\ServerRequestInterface as Request; | |
| use Psr\Http\Message\ResponseInterface as Response; | |
| interface MiddlewareInterface | |
| { | |
| public function __invoke(Request $request, Response $response, callable $out = null); | |
| } | |
| ``` | |
| ```php | |
| namespace Reactre\Action; | |
| use Psr\Http\Message\ServerRequestInterface as Request; | |
| use Psr\Http\Message\ResponseInterface as Response; | |
| use Zend\Stratigility\MiddlewareInterface; | |
| abstract class AbstractAction implements MiddlewareInterface | |
| { | |
| abstract public function __invoke(Request $request, Response $response, callable $out = null); | |
| } | |
| ``` | |
| ```php | |
| namespace App\Action; | |
| use Psr\Http\Message\ServerRequestInterface as Request; | |
| use Psr\Http\Message\ResponseInterface as Response; | |
| use Reactre\Action\AbstractAction; | |
| class UserAction extends AbstractAction | |
| { | |
| public function __invoke(Request $request, Response $response, callable $out = null) | |
| { | |
| $params = $request->getQueryParams(); | |
| $response->getBody()->write( | |
| $this->getRenderer()->render('users/index.twig', [ | |
| 'params' => $params | |
| ]) | |
| ); | |
| return $response; | |
| } | |
| } | |
| ``` | |
| I've tried changing AbstractAction and UserAction in probably all possible ways but I keep getting the error as soon as I place the __invoke method in UserAction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Fatal error: Declaration of App\Action\IndexAction::__invoke() must be compatible with Zend\Stratigility\MiddlewareInterface::__invoke(Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $out = NULL) in D:\projects\reactre-skeleton\var\strict-php\_proxies\reactre-skeleton\src\App\Action\IndexAction.php on line 8 | |
| Call Stack | |
| # Time Memory Function Location | |
| 1 0.0004 237792 {main}( ) ...\index.php:0 | |
| 2 0.0190 517312 Reactre\Kernel->listen( ) ...\index.php:23 | |
| 3 0.0247 688072 Zend\Diactoros\Server->listen( ) ...\Kernel.php:73 | |
| 4 0.0247 704832 Zend\Stratigility\MiddlewarePipe->__invoke( ) ...\Server.php:166 | |
| 5 0.0268 743624 Zend\Stratigility\Next->__invoke( ) ...\MiddlewarePipe.php:76 | |
| 6 0.0269 744360 Zend\Stratigility\Dispatch->__invoke( ) ...\Next.php:111 | |
| 7 0.0269 744624 call_user_func:{D:\projects\reactre-skeleton\vendor\zendframework\zend-stratigility\src\Dispatch.php:79} ( ) ...\Dispatch.php:79 | |
| 8 0.0269 744808 Reactre\Middleware\JsonDecoder->__invoke( ) ...\Dispatch.php:79 | |
| 9 0.0269 744888 Zend\Stratigility\Next->__invoke( ) ...\JsonDecoder.php:28 | |
| 10 0.0269 745248 Zend\Stratigility\Dispatch->__invoke( ) ...\Next.php:111 | |
| 11 0.0269 745512 call_user_func:{D:\projects\reactre-skeleton\vendor\zendframework\zend-stratigility\src\Dispatch.php:79} ( ) ...\Dispatch.php:79 | |
| 12 0.0270 745744 Reactre\Router\Router->__invoke( ) ...\Dispatch.php:79 | |
| 13 0.0323 852448 spl_autoload_call ( ) ...\Dispatch.php:64 | |
| 14 0.0323 852488 Go\Instrument\ClassLoading\AopComposerLoader->loadClass( ) ...\Dispatch.php:64 | |
| 15 0.0703 2195712 include( 'D:\projects\reactre-skeleton\src\App\Action\IndexAction.php' ) ...\AopComposerLoader.php:133 | |
| 16 0.0706 2202664 include_once( 'D:\projects\reactre-skeleton\var\strict-php\_proxies\reactre-skeleton\src\App\Action\IndexAction.php' ) ...\IndexAction.php:24 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you can see in the temp proxy class it leaves out the callable typehint. It's either that or something stupid on my side.