Sublime Forum

PHP 7.4 typed properties syntax highlighting

#1

Hello,

I would like to ask you whether it would be possible to fix PHP syntax highlighting for version 7.4.
New feature: Instead of

class AnotherFoo {}

class FooClass
{

	/**
	 * @var AnotherFoo
	 */
	private $anotherFoo;
}

there are now typed properties:

class AnotherFoo {}

class FooClass
{

	private AnotherFoo $anotherFoo;
}

Sadly, Sublime text is not able to mark “AnotherFoo” type as class/keyword.

Official PHP reference:

Thanks!

Pavel

0 Likes

#2

If you don’t mind an unofficial one, you can use mine. I have migrated to ST 4 so I am no longer maintaining syntax for ST 3. But this can be the same with the official one (I don’t think ST 3 syntaxes will receive updates).


This is the last version which supports ST 3 on my side. It should catch up everything in PHP 7.4 and some PHP 8 things (since PHP 8 is not feature freeze yet).

The official ST 4 should work with PHP 8 once this PR gets merged.


Some extra features about my version:

  • highlights multiline regex in strings like image
    I found it useful especially with the x modifier.
  • highlights Symfony’s annotation (and unknown @XXXXXXX) like image
    Annotations are different among frameworks so this just never fits everyone.
1 Like

#3

Wow, thanks a lot! Works perfect!!

0 Likes