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.

CommentFileSizeAuthor
#2 2602536_2.patch976 bytescosmicdreams
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cosmicdreams created an issue. See original summary.

cosmicdreams’s picture

Here's a patch:

cosmicdreams’s picture

Status: Active » Needs review
Wim Leers’s picture

Priority: Normal » Minor
Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2602536_2.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

Was a testbot fluke.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and cherry-picked to 8.0.x. Thanks!

  • catch committed dcc5bed on
    Issue #2602536 by cosmicdreams: Unused local variable in...

  • catch committed 45fbe45 on
    Issue #2602536 by cosmicdreams: Unused local variable in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.