Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class variable syntax inside string highlights the double-colon #11

Open
biinari opened this issue Jul 1, 2024 · 0 comments
Open

Class variable syntax inside string highlights the double-colon #11

biinari opened this issue Jul 1, 2024 · 0 comments

Comments

@biinari
Copy link
Owner

biinari commented Jul 1, 2024

In the following code, the double-colon has no immediate meaning for string interpolation, so should not be highlighted.

class Test {
    const FOO = 'foo';
}

$name = 'FOO';

echo constant("Test::$name"); // bad - highlights ::$name

echo constant("Test::{$name}"); // ok - highlights {$name}
echo constant("Test::${name}"); // ok - highlights ${name} (though this syntax is deprecated in PHP 8.2)

Related issue: "\$obj->name" should not highlight the ->name part.

Screenshot

php vim-string_class_const

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant