Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

knubbe's avatar
Level 36

PHP storm don't recognize php8.1 features

I have a problem with using some of the php8.1 features like this one:

public function __construct(
    private readonly TestClass $test,
    private readonly AnotherClass $anotherClass
 ) {
 }

In composer.json php version is set to be 8.1

0 likes
7 replies
Tray2's avatar

Have you changed the projects settings in PHPStorm and made the 8.1 the interpreter?

1 like
knubbe's avatar
Level 36

I don't have 8.1 in the interpreter Only 8.0

Tray2's avatar

@knubbe Then you will get issues with php 8.1 syntax.

Try updating to php 8.1

knubbe's avatar
Level 36

@Tray2 It's not related with cli interpreter because it's work without setting that up

click's avatar

You will have to inform PHP storm which PHP version you are using.

Open Settings > PHP and make sure PHP Language Level and CLI Interpreter are both set to PHP 8.1.

1 like
knubbe's avatar
knubbe
OP
Best Answer
Level 36

I fixed it. It's related to .idea folder ;)

Please or to participate in this conversation.