Phpinspectionsea: Inspection for parent::__construct() cannot be turned off

Created on 30 May 2019  路  5Comments  路  Source: kalessil/phpinspectionsea


| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Plugin | Php Inspections (EA Ultimate), v3.0.1 |
| Language level | PHP 7.2 |

Current behaviour

Shows error even with inspection disabled

image

Expected behaviour

It shouldn't, parent constructor will throw exception. I could go with abstract but then I can't typehint the parameter in child.

When I turn off this plugin, all works normal.

Environment details

PhpStorm 2019.1.1
Build #PS-191.6707.66, built on April 17, 2019
JRE: 1.8.0_202-release-1483-b44 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-47-generic

question

All 5 comments

I could not reproduces that. And too, I think that it is related to PHP plugin (from Jetbrains), not with this plugin.

Maybe you can check if the following code will broken for you and is related to this plugin?

<?php

class TestA
{
    public function __construct()
    {
    }
}

class TestB
    extends TestA
{
    public function __construct()
    {
    }
}

It also breaks:

image

Anyway, I think this issue can be closed. I am getting same error with phpstan, even if I put private function __construct; it shouldn't report this error, you can't call private methods from child class.

And it is not super important. Feel free to close.

What do you expects in this case? I mean, this inspection check if the parent::__construct() is called. In my example code, it does not, so is correct this warning.

So I think that you have two options:

  1. Disable this inspection;
  2. Suppress for statement;

I solved it by putting parent to private, now the issue is in phpstan.

When I created the ticket, I didn't think of suppressing the error. It is not a problem for EA so closing.

Was this page helpful?
0 / 5 - 0 ratings