Phpinspectionsea: Couldn't detect NPE when calling static method

Created on 14 Dec 2017  路  11Comments  路  Source: kalessil/phpinspectionsea

default

expected warning about NPE when calling convertDateTimeToDateKey

enhancement fixed

Most helpful comment

Implemented, the comparison list to be published in early January.

All 11 comments

Okay, I could reproduce it.

<?php

declare(strict_types = 1);

class Example
{
    public function checkIssue(): void
    {
        // Don't warn. Fail. Both should be warned.
        $this->expectDateTime($this->returnNullable());
        $this->expectDateTime(null);

        // Warn okay (EA inspection).
        $dateTime = $this->returnNullable();
        $this->expectDateTime($dateTime);

        // Warn okay (PS inspection).
        $this->expectDateTime(new stdClass);
    }

    public function expectDateTime(DateTime $dateTime): void
    {
    }

    public function returnNullable(): ?DateTime
    {
        return new DateTime;
    }
}

@rentalhost I think this can go to the Ultimate ;)

@Koc : any chance that you would like to migrate onto https://plugins.jetbrains.com/plugin/10215-php-inspections-ea-ultimate- (commercial and enhanced version of the plugin) ? I'm asking as I need to make a decision which of plugins getting this enhancement.

not now, but you can move to commercical version, no problem

Will it be fair in your opinion?

100%. A agree that this plugin prevents errors in some cases and make my work much productive. Just for now I have some financing problems and maybe will buy plugin next year.

Thank you!

@kalessil can you create comparation table for free/paid version and include link on it in plugin pages?

Will do (next days if not get ill completely)

Implemented, the comparison list to be published in early January.

@Koc : here we go with Ultimate-plugin details https://kalessil.github.io/page-blog-post-about-ea-ultimate.html

Was this page helpful?
0 / 5 - 0 ratings