Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Inconsistent primitive typehint tokenization #387

@bakerkretzmar

Description

@bakerkretzmar

Prerequisites

Description

Function and method parameters receive the scope meta.function.parameters.php, unless the typehint is array or callable, in which case they additionally receive the scope meta.function.parameter.array.php.

It should be possible to scope typehints differently depending on whether they're classes/interfaces or primitive types (string, int, array, bool, etc.), like some other editors/grammars do. Sublime, for example:

Screen Shot 2020-04-11 at 9 06 20 PM

However right now, in Atom (and VS Code because they use your grammars), this is only possible for array and callable.

Steps to Reproduce

public function index(Request $request, string $string, array $array)
{
    // ...
}

Expected behavior:

Function parameters that are class names should have different scopes than those that are PHP primitive types.

Actual behavior:

Only array and callable are treated differently, Request, Repository, FooInterface, etc. all receive identical scopes to string, bool, int, etc.

Reproduces how often:

Always.

Versions

The most recent one.

Additional Information

VS Code issue opened here: microsoft/vscode#95029

I will work on a PR for this but welcome suggestions or comments if I'm missing something!

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