PhpStorm显示PHP方法的代码错误 [英] PhpStorm showing code error for PHP method

查看:117
本文介绍了PhpStorm显示PHP方法的代码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇为什么PhpStorm编辑器拒绝以下语法:

I am curious as to why the following syntax is rejected by my PhpStorm editor:

PhpStorm版本:2016.1.2

PhpStorm version: 2016.1.2

推荐答案

  1. 可空参数/返回类型(在您的示例中为?User)是 /strong>(比您的2016.1.x更新)
  1. Nullable parameters/return types (?User from your example) is a PHP 7.1 feature.
  2. PHP Language Level must be set to 7.1 in PhpStorm settings for this project (although right now it does not produce an error if language is set below 7.1 -- see WI-32136 ticket).
  3. Support for nullable types was added in PhpStorm 2016.2.2 (which is newer than your 2016.1.x)

结论:将您的PhpStorm升级到最新版本(目前为2017.2.1).至少您需要具有PhpStorm 2016.2.2才能支持此特定语法9(不显示错误).

Conclusion: upgrade your PhpStorm to the latest version (which is 2017.2.1 at this moment). At very least you need to have PhpStorm 2016.2.2 for this particular syntax to be supported 9not showing an error).

这篇关于PhpStorm显示PHP方法的代码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆