-
Notifications
You must be signed in to change notification settings - Fork 124
Inconsistent primitive typehint tokenization #387
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- N/A
Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode - Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- N/A
Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
- N/A
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:
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!