for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Softonic\GraphQL\Traits;
trait CollectionArrayAccess
{
public function offsetSet($offset, $value)
$offset
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$value
throw new \BadMethodCallException('Try using add() instead');
}
public function offsetExists($offset)
return array_key_exists($offset, $this->arguments);
arguments
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
public function offsetUnset($offset)
throw new \BadMethodCallException('Try using remove() instead');
public function offsetGet($offset)
return isset($this->arguments[$offset]) ? $this->arguments[$offset] : null;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.