Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
in /core/tests/Drupal/Tests/Core/DependencyInjection/DependencySerializationTest.php , I think I see an unused variable.
The code block is
$string = serialize($dependencySerialization);
$object = unserialize($string);
$string = serialize($dependencySerialization);
/** @var \Drupal\Tests\Core\DependencyInjection\DependencySerializationTestDummy $object */
$dependencySerialization = unserialize($string);
$this->assertSame($service, $dependencySerialization->service);
$this->assertSame($container, $dependencySerialization->container);
$this->assertEmpty($dependencySerialization->getServiceIds());
Here you can see that $object is defined but never used. Futhermore the same operatation unserialize($string)
is stored into $dependencySerialization so it's also redundant. Which makes the typing above $dependencySerialization weird. Oh I just noticed that $string is reset too. So I guess this can be removed:
$string = serialize($dependencySerialization);
$object = unserialize($string);
and we should fix the object typing.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2602536_2.patch | 976 bytes | cosmicdreams |
|
Comments
Comment #2
cosmicdreams CreditAttribution: cosmicdreams as a volunteer commentedHere's a patch:
Comment #3
cosmicdreams CreditAttribution: cosmicdreams as a volunteer commentedComment #4
Wim LeersComment #6
Wim LeersWas a testbot fluke.
Comment #7
catchCommitted/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!