Skip to content

Notices when analyzing some PDO-related code #4836

@morozov

Description

@morozov

The issue can be observed on doctrine/dbal#4465 and is reproducible on any Psalm version from 4.1.1 to 4.3.1. Running psalm --debug-by-line yields the following:

Notice: Undefined offset: 0 in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1264
Notice: Trying to get property 'default' of non-object in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1328
Notice: Undefined offset: 1 in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1264
Notice: Trying to get property 'default' of non-object in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1328
Notice: Undefined offset: 2 in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1264
Notice: Trying to get property 'default' of non-object in /Users/smorozov/Projects/dbal/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php on line 1328
/Users/smorozov/Projects/dbal/lib/Doctrine/DBAL/Driver/PDOQueryImplementation.php:36

Where the code in question looks like this:

    /**
     * @internal
     */
    trait PDOQueryImplementation
    {
        /**
         * @return PDOStatement
         */
        public function query()
        {
            return $this->doQuery(...func_get_args());
        }
    }

This looks related to JetBrains/phpstorm-stubs#950 which introduces two methods with the same name and different signatures for different PHP versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions