for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* ArrayAccessTrait
*
* @package php-deferred-callchain
* @author Jean Claveau
*/
namespace JClaveau\Async;
use BadMethodCallException;
* Trait gathering support of array entries access
trait ArrayAccessTrait
{
* ArrayAccess interface
* @param string $key The entry to acces
public function &offsetGet($key)
$caller = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
$this->stack[] = [
stack
'entry' => $key,
'file' => isset($caller['file']) ? $caller['file'] : null,
'line' => isset($caller['line']) ? $caller['line'] : null,
];
return $this;
}
* Unused part of the ArrayAccess interface
* @param $offset
* @param $value
* @throws \BadMethodCallException
public function offsetSet($offset, $value)
$offset
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function offsetSet(/** @scrutinizer ignore-unused */ $offset, $value)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$value
public function offsetSet($offset, /** @scrutinizer ignore-unused */ $value)
throw new BadMethodCallException(
"not implemented"
);
public function offsetExists($offset)
public function offsetExists(/** @scrutinizer ignore-unused */ $offset)
public function offsetUnset($offset)
public function offsetUnset(/** @scrutinizer ignore-unused */ $offset)
/**/