for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sandbox\Demos;
require 'autoload.php';
use Redbox\Hooks\Actions;
class Action
{
/**
*/
public function firstFunc()
echo "Called first\n";
}
public function secondFunc()
echo "Called second\n";
* Register and call the actions.
*
* @return string
public function execute()
Actions::addAction('say_hello', [$this, 'firstFunc'], 0);
array($this, 'firstFunc')
array<integer,this<Sandb...Action>","1":"string"}>
string
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);
Actions::addAction('say_hello', [$this, 'secondFunc'], 1);
array($this, 'secondFunc')
return Actions::doAction('say_hello');
$instance = new Action;
* Result should be:
* Called first
* Called second
$instance->execute();
* This is not required in your code. I have to add this to reset my unit tests.
Actions::removeAllActions('say_hello');
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: