带有PHPStorm 10的PHP7
作者:互联网
在使用PHPStorm 10测试新的PHP 7时遇到了一些问题.这是一个错误吗?
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());
在浏览器中,一切正常,但PHPStorm给我错误(在picture中可见).
我认为这是一个错误.有什么办法解决这个问题?我尝试从此Site使用EAP,但是它没有解决问题.
解决方法:
要在PHP Storm中启用PHP 7,请转到
设置>语言和框架>的PHP
在开发环境部分中,将PHP语言级别更改为“ 7”.
标签:php-7,phpstorm,php 来源: https://codeday.me/bug/20191119/2034836.html