Reputation: 781
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).
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.
Upvotes: 3
Views: 703
Reputation: 3031
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.
Upvotes: 3