Skip to content

Psalm acts differently depending on what version of PHP it is executed on. #6305

@greg0ire

Description

@greg0ire

Context: I'm trying to fix an error that does not happen in the CI of doctrine/orm, but does happen on my machine where I use PHP 7.4.

I tried fixing it with an assert, but now I get the opposite situation: doctrine/orm#8917

I cannot reproduce the issue on psalm.dev, that presumably does not run PHP 8

https://psalm.dev/r/a8f882ff61

On a machine with PHP 8, as well as on the CI, I know get this:

ERROR: RedundantConditionGivenDocblockType - lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php:912:13 - Docblock-defined type SimpleXMLElement for $action is never null (see https://psalm.dev/156)
            assert($action !== null);


ERROR: RedundantConditionGivenDocblockType - lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php:912:20 - Docblock-defined type SimpleXMLElement ca never contain null (see https://psalm.dev/156)
            assert($action !== null);

Either way, there is a difference in results depending on the version of PHP, and hardcoding phpVersion to 7.1 in psalm.xml does not help. I'm not sure what to try next.

See also: https://symfony-devs.slack.com/archives/C8SFXTD2M/p1628964600095200

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions