Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP7 with PHPStorm 10

I met some problems while testing new PHP 7 with PHPStorm 10. Is it a bug?

File1.php

    namespace Game\Fields;


abstract class Field
{
    protected $resources = [];

    protected $requirements = [];

    protected $destruction;

    public function __construct (array $resources, array $requirements, int $destruction)
    {
        $this->resources = $resources;
        $this->requirements = $requirements;
        $this->destruction = $destruction;
    }

    public function getResources (): array
    {
        return $this->resources;
    }

    public function getRequirements (): int
    {
        return $this->requirements;
    }

    public function getDestruction (): int
    {
        return $this->destruction;
    }
}

class DeepDeath extends Field {}

class MysteryDark extends Field {}

class SunEnd extends Field {}

File2.php

declare(strict_types=1);

require_once __DIR__ . '/Fields/Fields.php';

$level = new \Game\Fields\DeepDeath([], [], 30);

echo($level->getDestruction());

In browser everything is OK but PHPStorm give me errors (visible in the picture).

enter image description here

I think that it is a bug. Is there any way to solve this problem? I tried to use EAP from this Site but it didn't solve problem.

like image 979
Mati Avatar asked Sep 18 '26 18:09

Mati


1 Answers

To enable PHP 7 in PHP Storm, go to

Settings > Languages & Frameworks > PHP

And change the PHP language level to "7" in the development environment section.

like image 165
jiboulex Avatar answered Sep 20 '26 08:09

jiboulex