for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the mytheam/yii2-schedule.
*
* (c) mytheam <[email protected]>
* This source file is subject to the BSD license that is bundled
* with this source code in the file LICENSE.
*/
namespace mythteam\schedule;
use yii\base\Component;
use yii\base\Application;
class Schedule extends Component
{
/**
* @var array All the events to scheduled
protected $_events = [];
* Register a callback style schedule event.
* @param \Closure $callback
* @param array $parameters
* @return Event
public function call($callback, array $parameters = [])
$this->_events[] = $event = new CallbackEvent($callback, $parameters);
$callback
object<Closure>
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);
return $event;
}
* Register a yii console command.
* @param string $command
public function command($command)
return $this->exec(PHP_BINARY . ' yii ' . $command);
* Register a new command event to schedule.
public function exec($command)
$this->_events[] = $event = new Event($command);
* Get all scheduled events.
* @return array
public function getEvents()
return $this->_events;
* Get all of the events on the schedule that are due.
* @param Application $app
public function dueEvents(Application $app)
return array_filter($this->_events, function (Event $event) use ($app) {
return $event->isDue($app);
});
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: