Skip to content

FInd where a type requirement originated #2871

@alecwcp

Description

@alecwcp

Given a variable $query that is of type \Cake\Database\Query (from https://github.com/cakephp/database), when passing an array with 2 elements into the select or order functions, I get the error below

ERROR: UndefinedClass - /path/To/File.php:65:23 - Class or interface ASC does not exist
$query->order([
    'instance_date' => 'ASC',
    'start_time' => 'ASC',
]);

However, stepping into the class in use there, I'm unable to find anywhere that would cause (either through usage or annotations) that would indicate that the first value in that array should be a class/interface.

Is there any way to get out more info about where that expectation has come from? I've tried --debug and --debug-by-line but those didn't give me any more info and I don't see any other options that would do that when looking at the output of --help.

I've attempted to reproduce this with the online demo at https://psalm.dev/ but have been unsuccessful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions