PhpStorm 9.0 IDE无法识别包类 [英] PhpStorm 9.0 IDE doesn't recognize package classes

查看:132
本文介绍了PhpStorm 9.0 IDE无法识别包类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

\Braintree_Configuration::environment('sandbox');

这显示为未定义的类Braintree配置"

This is showing up as "Undefined class Braintree Configuration"

并且在程序包Braintree中,即使它们位于同一类中,它也无法识别方法.

And inside of the package Braintree it doesn't recognize methods even though they are there in the same class.

推荐答案

我最初在寻求解决composer/phpstorm/braintree问题时不知道Braintree类在哪里的问题.

I originally saw your question when looking to fix a problem with composer/phpstorm/braintree not knowing where the Braintree classes were.

如果您像我在

If you had given a little more context to your question like I did to mine over here then it would of been a little clear to understand what the problem was.

尽管您的问题出在PhpStorm上,但原因与作曲家和PhpStorm无关.但是,与Braintree并没有解释的是,他们在每个类的末尾都调用了class_alias函数,以便使文档一目了然地易于阅读/使用.

Although your problem lies with PhpStorm, the cause has nothing to do with composer nor PhpStorm. But rather with Braintree not explaining that they calling the class_alias function at the end of every class to make their documentation easier to read/use at a glance.

您可以在此处看到您提供的示例:

You can see this here with the example you gave:

https://github.com/braintree /braintree_php/blob/master/lib/Braintree/Configuration.php

class_alias('Braintree\Configuration', 'Braintree_Configuration');


修复

  1. 您可以轻松地解决此问题,即使用正确的名称空间/类替换所有别名.那将在您的文件中,用Braintree\Configuration替换Braintree_Configuration.
  2. 或者您可以等待,或者PhpStorm支持此功能(正如LazyOne在我的问题中解释的那样),它将在本月底(2016年11月)进入下一版PhpStorm.您可以在此处查看该错误跟踪器.
  3. 下载EAP(PhpStorm的抢先体验计划)版本以立即访问此修复程序.
  1. The fix that you can do easily is to replace all our alias' with the correct namespace/class. That would be in your file, replacing Braintree_Configuration with Braintree\Configuration.
  2. Or you can wait or PhpStorm to support this (which as LazyOne explained in my question), will be going into the next release of PhpStorm at the end of this month (November 2016). You can view the bug tracker for this bug here.
  3. Download an EAP (PhpStorm's Early Access Program) release to get access to this fix straight away.

无论哪种方式解决此问题,都可以解决您的问题.非常感谢LazyOne向我解释这个问题.

Either way you go about fixing this will resolve your issue. Big thanks to LazyOne to explaining this to me for my problem.

这篇关于PhpStorm 9.0 IDE无法识别包类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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