for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PEIP\Message;
/*
* This file is part of the PEIP package.
* (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PEIP\Data\ArrayAccess;
/**
* CommandMessage.
* @author Timo Michna <timomichna/yahoo.de>
* @extends \PEIP\Message\GenericMessage
* @implements \PEIP\INF\Base\Buildable, \PEIP\INF\Message\Message, \PEIP\INF\Base\Container, \PEIP\INF\Command\Command
class CommandMessage extends \PEIP\Message\GenericMessage implements \PEIP\INF\Command\Command
{
* @param $content
* @param $headers
* @return
public function __construct($content, ArrayAccess $headers = null)
if (!($content instanceof \PEIP\INF\Command\Command) && !is_callable($content)) {
throw new \BadArgumentException('Argument 1 for CommandMessage::__construct must be callable or implment \PEIP\INF\Command\Command');
}
parent::__construct($content, $headers);
$headers
null|object<PEIP\Data\ArrayAccess>
array|object<PEIP\Message\ArrayAccess>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
public function execute()
if (is_callable($this->getContent())) {
return call_user_func($this->getContent());
} else {
return $this->getContent()->execute();
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: