for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @link http://phpdoc.org
*/
namespace phpDocumentor\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
* Event Dispatching class.
* This class provides a bridge to the Symfony2 EventDispatcher.
* At current this is provided by inheritance but future iterations should
* solve this by making it an adapter pattern.
* The class is implemented as (mockable) Singleton as this was the best
* solution to make the functionality available in every class of the project.
class Dispatcher extends EventDispatcher
{
/** @var Dispatcher[] Keep track of an array of instances. */
protected static $instances = [];
* Returns a named instance of the Event Dispatcher.
public static function getInstance(string $name = 'default') : self
if (!isset(self::$instances[$name])) {
self::setInstance($name, new self());
new self()
object<phpDocumentor\Event\Dispatcher>
object<self>
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 self::$instances[$name];
* Sets a names instance of the Event Dispatcher.
public static function setInstance(string $name, self $instance) : void
self::$instances[$name] = $instance;
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: