subjective-php /
psr-cache-helper
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SubjectivePHPTest\Psr\SimpleCache\Serializer; |
||
| 4 | |||
| 5 | use SubjectivePHP\Psr\SimpleCache\Serializer\NullSerializer; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @coversDefaultClass \SubjectivePHP\Psr\SimpleCache\Serializer\NullSerializer |
||
| 9 | * @covers ::<private> |
||
| 10 | */ |
||
| 11 | final class NullSerializerTest extends \PHPUnit\Framework\TestCase |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var NullSerializer |
||
| 15 | */ |
||
| 16 | private $serializer; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Prepare each test |
||
| 20 | * |
||
| 21 | * @return void |
||
| 22 | */ |
||
| 23 | public function setUp() |
||
| 24 | { |
||
| 25 | $this->serializer = new NullSerializer(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @test |
||
| 30 | * @covers ::unserialize |
||
| 31 | * |
||
| 32 | * @return void |
||
| 33 | */ |
||
| 34 | public function unserialize() |
||
| 35 | { |
||
| 36 | $data = ['foo' => 'abc', 'bar' => 123]; |
||
| 37 | $this->assertSame($data, $this->serializer->unserialize($data)); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @test |
||
| 42 | * @covers ::serialize |
||
| 43 | * |
||
| 44 | * @return void |
||
| 45 | */ |
||
| 46 | public function serialize() |
||
| 47 | { |
||
| 48 | $data = ['foo' => 'abc', 'bar' => 123]; |
||
| 49 | $serializer = new NullSerializer(); |
||
|
0 ignored issues
–
show
|
|||
| 50 | $this->assertSame($data, $this->serializer->serialize($data)); |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.