for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPDaemon\Structures;
/**
* ObjectStorage
* @package PHPDaemon\Structures
* @author Vasily Zorin <[email protected]>
*/
class ObjectStorage extends \SplObjectStorage
{
use \PHPDaemon\Traits\ClassWatchdog;
use \PHPDaemon\Traits\StaticObjectWatchdog;
* Call given method of all objects in storage
* @param string $method Method name
* @param mixed ...$args Arguments
* @return integer Number of called objects
public function each($method, ...$args)
if ($this->count() === 0) {
return 0;
}
$n = 0;
foreach ($this as $obj) {
$obj->$method(...$args);
++$n;
return $n;
* Remove all objects from this storage, which contained in another storage
* @param \SplObjectStorage $obj
$obj
\SplObjectStorage|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
* @return void
public function removeAll($obj = null)
if ($obj === null) {
$this->removeAllExcept(new \SplObjectStorage);
parent::removeAll($obj);
* Detaches first object and returns it
* @return object
false|object
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function detachFirst()
$this->rewind();
$o = $this->current();
if (!$o) {
return false;
$this->detach($o);
return $o;
* Returns first object
public function getFirst()
return $this->current();
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.