Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Zend\Expressive\Router\RouterInterface" could not be found in the located source #2

Closed
oqq opened this issue Nov 23, 2017 · 8 comments

Comments

@oqq
Copy link
Member

oqq commented Nov 23, 2017

After execution of:

$ vendor/bin/prooph-analyzer project:analyze src -vvv

I got the following output:


Using config ./prooph_analyzer.json

[Roave\BetterReflection\Reflector\Exception\IdentifierNotFound]
Roave\BetterReflection\Reflection\ReflectionClass "Zend\Expressive\Router\RouterInterface" could not be found in the located source  
                                                                                                                                       

Exception trace:
 () at /Users/***/Projects/***/vendor/roave/better-reflection/src/Reflector/Exception/IdentifierNotFound.php:33
 Roave\BetterReflection\Reflector\Exception\IdentifierNotFound::fromIdentifier() at /Users/***/Projects/***/vendor/roave/better-reflection/src/Reflector/ClassReflector.php:40
 Roave\BetterReflection\Reflector\ClassReflector->reflect() at /Users/***/Projects/***/vendor/roave/better-reflection/src/Reflection/ReflectionClass.php:113
 Roave\BetterReflection\Reflection\ReflectionClass::createFromName() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/src/Visitor/MessageHandlerCollector.php:47
 Prooph\MessageFlowAnalyzer\Visitor\MessageHandlerCollector->inspectMethod() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/src/Visitor/MessageHandlerCollector.php:26
 Prooph\MessageFlowAnalyzer\Visitor\MessageHandlerCollector->onClassReflection() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/src/ProjectTraverser.php:117
 Prooph\MessageFlowAnalyzer\ProjectTraverser->handleFile() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/src/ProjectTraverser.php:89
 Prooph\MessageFlowAnalyzer\ProjectTraverser->traverse() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/src/Cli/AnalyzeProjectCommand.php:86
 Prooph\MessageFlowAnalyzer\Cli\AnalyzeProjectCommand->execute() at /Users/***/Projects/***/vendor/symfony/console/Command/Command.php:240
 Symfony\Component\Console\Command\Command->run() at /Users/***/Projects/***/vendor/symfony/console/Application.php:858
 Symfony\Component\Console\Application->doRunCommand() at /Users/***/Projects/***/vendor/symfony/console/Application.php:216
 Symfony\Component\Console\Application->doRun() at /Users/***/Projects/***/vendor/symfony/console/Application.php:122
 Symfony\Component\Console\Application->run() at /Users/***/Projects/***/vendor/prooph/message-flow-analyzer/bin/prooph-analyzer:41

project:analyze [-c|--config [CONFIG]] [-o|--output [OUTPUT]] [-f|--format [FORMAT]] [--] [<dir>]

The tested class file has a content like:

<?php

declare(strict_types=1);

namespace Acme\Middleware;

use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Expressive\Router\RouterInterface;

final class SomeMiddleware implements MiddlewareInterface
{
    private $router;

    public function __construct(RouterInterface $router)
    {
        $this->router = $router;
    }

    public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface
    {
        // some content 
    }
}
@prolic
Copy link
Member

prolic commented Nov 24, 2017

@oqq did you check if this interface really exists in your vendor-dir?

@oqq
Copy link
Member Author

oqq commented Nov 24, 2017

Of course, yes.
The file exists and this middleware is accessible in a running application.

@codeliner
Copy link
Member

@oqq Not sure what exactly goes wrong here. You could try to figure it out.

One idea would be to use a php test script like this one:

<?php

require 'vendor/autoload.php';

use Roave\BetterReflection\Reflection\ReflectionClass;

$reflectedInterface = ReflectionClass::createFromName('Zend\Expressive\Router\RouterInterface');

like it is tried here: https://github.com/prooph/message-flow-analyzer/blob/master/src/Visitor/MessageHandlerCollector.php#L47

@codeliner
Copy link
Member

A workaround would be to use an exclude filter like I did for proophessor-do: https://github.com/prooph/message-flow-analyzer#run-it-against-proophessor-do (see point 5)

But in that case the interface is really not installed so the blacklist filter is the right option to use. In your case the interface seems to be available so the question is why it cannot be autoloaded by BetterReflection to inspect it.

@oqq
Copy link
Member Author

oqq commented Nov 24, 2017

I got same error..
So i will close this issue, go further with tests and will open an issue for the better reflection library.

@oqq oqq closed this as completed Nov 24, 2017
@codeliner
Copy link
Member

ok, let me know the result

@oqq
Copy link
Member Author

oqq commented Jul 24, 2018

Seems to be fixed now. 👍

@codeliner
Copy link
Member

oh nice, need to try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants