for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/
declare(strict_types=1);
namespace Spiral\Tests\Boot;
use PHPUnit\Framework\TestCase;
use Spiral\Boot\MemoryInterface;
use Spiral\Boot\NullMemory;
class NullMemoryTest extends TestCase
{
public function testLoadData(): void
$memory = new NullMemory();
$this->assertInstanceOf(MemoryInterface::class, $memory);
$this->assertNull($memory->loadData('test'));
$memory->loadData('test')
Spiral\Boot\NullMemory::loadData()
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.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
}
public function testSaveData(): void
$memory->saveData('test', null);
This check looks for function or method calls that always return null and whose return value is used.
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.