for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Malezha\Menu\Support;
class MergeAttributes
{
protected $arrays = [];
/**
* @param array $arrays,...
$arrays,...
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @throws \RuntimeException
*/
public function __construct()
if (func_num_args() <= 1) {
throw new \RuntimeException("Must has min two parameters.");
}
$this->arrays = func_get_args();
* @return array
public function merge()
$arrays = $this->arrays;
$keys = [];
foreach ($arrays as $array) {
$keys = array_merge($keys, array_keys($array));
$keys = array_unique($keys);
$merged = array_fill_keys($keys, null);
foreach ($keys as $key) {
if (array_key_exists($key, $array)) {
$merged[$key] = $this->mergeValues($merged[$key], $array[$key]);
return $merged;
* @param string $valueOne
* @param string $valueTwo
* @return string
protected function mergeValues($valueOne, $valueTwo)
if (is_null($valueOne)) {
return $valueTwo;
$valueOne = explode(' ', $valueOne);
$valueTwo = explode(' ', $valueTwo);
$merged = array_merge($valueOne, $valueTwo);
return trim(implode(' ', $merged));
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.