Help with ParseError syntax error, unexpected ‘static’ (T_STATIC)

silviustan
Member | 22
+
0
-

Hi,

Does anyone know how to fix this error?

See below the settings I use:

https://i.snipboard.io/Y51PQU.jpg

https://i.snipboard.io/fWknDR.jpg

Thank you in advance!

mystik
Member | 312
+
+2
-

Static return type is PHP 8 feature but you are on PHP 7.4.

Marek Bartoš
Nette Blogger | 1275
+
+2
-

Set PHP version you expect to use in production in composer.json. It will ensure Composer will install libraries accordingly to that PHP version instead of your current PHP version

{
	"config": {
		"platform": {
			"php": "7.4.29"
		}
	}
}
silviustan
Member | 22
+
0
-

Thank you guys, config.platform.php in composer solved my problem. I didn't know is that important :)