Reputation: 249
I'm using PHP 7.2 and trying to type hint this variable:
class TestClass
{
public static ?string $test = null;
But PHP gives me the following error:
syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
And I'm absolutely clueless why! Am I doing something wrong?
Upvotes: 0
Views: 787