| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Issue type | False-Positive |
| Plugin | Php Inspections (EA Ultimate), 2.0.9 |
| Language level | PHP 7.2 |
Here is some example code:
<?php
declare(strict_types=1);
class A
{
/** @var string */
private $foo;
public function __construct(string $foo)
{
$this->foo = $foo;
}
}
class B extends A
{
/** @var string */
private $bar;
public function __construct(string $foo, string $bar)
{
parent::__construct($foo);
$this->bar = $bar;
}
}
class C extends B
{
/** @var string */
private $fooBar;
public function __construct(string $foo, string $bar, string $fooBar)
{
parent::__construct($foo, $bar);
$this->fooBar = $fooBar;
}
}
I get a warning "Function result is not used" in class C in the line parent::__construct($foo, $bar); now. The weird thing is, if class C extends from class A directly instead of class B, this false-positive does not happen.
Do not report this. The constructor can't return anything.
Fixed!
Thank you a lot, that bug was really annoying. :+1:
@kalessil was it released for EA Ultimate?
The reported one yes. I had reworked the settings though, so in the next update inspection will be more usable.
False positive is still there for me in the current version. It's reporting that constructor return result isn't used.
Most helpful comment
Fixed!