Issues (1)

tests/examples/example_3.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace DanBettles\Gestalt\Tests;
4
5
use DanBettles\Gestalt\ArrayObject;
6
7
require_once __DIR__ . '/../../vendor/autoload.php';
8
9
$elements = [
10
    'foo' => 'bar',
11
    'baz' => 'qux',
12
    'quux' => 'quuz',
13
];
14
15
$output = [];
16
17
$arrayObject = (new ArrayObject($elements))->each(function ($key, $value) use (&$output) {
0 ignored issues
show
Are you sure the assignment to $arrayObject is correct as new DanBettles\Gestalt\A...ion(...) { /* ... */ }) targeting DanBettles\Gestalt\ArrayObject::each() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
18
    $output[$key] = $value;
19
});
20
21
\assert($output === $elements);
22