1 | <?php |
||
2 | |||
3 | require_once __DIR__.'/../vendor/autoload.php'; |
||
4 | |||
5 | use Swarrot\Broker\Message; |
||
6 | use Swarrot\Broker\PeclPackageMessageProvider; |
||
0 ignored issues
–
show
|
|||
7 | use Swarrot\Consumer; |
||
8 | use Swarrot\Processor\ProcessorInterface; |
||
9 | |||
10 | class Processor implements ProcessorInterface |
||
11 | { |
||
12 | public function process(Message $message, array $options) |
||
13 | { |
||
14 | printf("Consume message #%d\n", $message->getId()); |
||
0 ignored issues
–
show
The expression
ImplicitReturnNode returns the type null which is incompatible with the return type mandated by Swarrot\Processor\ProcessorInterface::process() of boolean .
In the issue above, the returned value is violating the contract defined by the mentioned interface. Let's take a look at an example: interface HasName {
/** @return string */
public function getName();
}
class Name {
public $name;
}
class User implements HasName {
/** @return string|Name */
public function getName() {
return new Name('foo'); // This is a violation of the ``HasName`` interface
// which only allows a string value to be returned.
}
}
Loading history...
|
|||
15 | } |
||
16 | } |
||
17 | |||
18 | $connection = new \AMQPConnection(); |
||
19 | $connection->connect(); |
||
20 | $channel = new \AMQPChannel($connection); |
||
21 | $queue = new \AMQPQueue($channel); |
||
22 | $queue->setName('global'); |
||
23 | |||
24 | $messageProvider = new PeclPackageMessageProvider($queue); |
||
25 | |||
26 | $consumer = new Consumer($messageProvider, new Processor()); |
||
27 | $consumer->consume(); |
||
28 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths