plugin-php
plugin-php copied to clipboard
Class Name From Class Variable Throws Exception
There seems to be a PHP Prettier parse exception when ::class is called on a class property. This is a contrived example, but the following is a minimal reproducible example that throws an exception when checked:
class Test
{
public $exception;
public function test()
{
$this->exception = new \Exception("test");
return $this->exception::class; // Throws "SyntaxError: Parse Error : syntax error, unexpected 'class' (T_CLASS)"
}
}
Happens on the PHP Prettier playground and my local with:
- Node
18.20.5 - Prettier
3.4.2 - PHP Prettier
0.22.2