Issues (138)

tests/DataSet/SingleValueDataSetTest.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\DataSet;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Validator\DataSet\SingleValueDataSet;
9
10
final class SingleValueDataSetTest extends TestCase
11
{
12
    public function testBase(): void
13
    {
14
        $data = new SingleValueDataSet(['test' => 'hello']);
15
16
        $this->assertNull($data->getData());
0 ignored issues
show
Are you sure the usage of $data->getData() targeting Yiisoft\Validator\DataSe...ValueDataSet::getData() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

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

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

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

Loading history...
17
        $this->assertSame(['test' => 'hello'], $data->getSource());
18
        $this->assertFalse($data->hasAttribute('test'));
19
        $this->assertNull($data->getAttributeValue('test'));
20
    }
21
}
22