php - PhpStorm does not recognise class aliases -


i've taken @ question, unfortuently there no answer.

i'm using phpstorm , building project composer project loaded. i'm trying make phpstorm recognises classes/functions when ctrl+click on them, specifically, projects installed via composer.

i have tried changing source folders in settings/directories still cannot work.

i using require __dir__ . '/vendor/autoload.php'; load composer dependancies.

what need phpstorm recognise declarations files loaded through composer?


to support question, here pictures:

my test.php file: (notice how can't recognise class): project/test.php enter image description here

a project added via composer , installed using autoloader: project/vendor/braintree/braintree_php/lib/braintree/subscription.php enter image description here

my composer.json file: project/composer.json enter image description here

well ... technically package has no braintree_subscription class defined (i mean -- "proper" definition). 2nd screenshot shows definition of subscription class \braintree namespace.

here file: https://github.com/braintree/braintree_php/blob/master/lib/braintree/subscription.php

notice last line -- "undefined" class mentioned there when calling class_alias() function:

class_alias('braintree\subscription', 'braintree_subscription'); 

it looks phpstorm not understand such class definition.


here ticket phpstorm's issue tracker: wi-11936 -- accordingly ticket has been fixed on 3rd of november 2016 (2 days ago, basically). fix (class alias support) available in next major version, 2016.3.

you may wait till officially released (approximately end of month) or try next eap or rc build (watch blog or twitter announcements).


right (for current , past stable versions: 2016.2 , older) solution use "real" class name (\braintree\subscription) instead of alias (braintree_subscription) in code.

but in case: using real class in own fresh code name correct way -- leave class aliases situation legacy/compatibility support required , other edge cases.


p.s. has nothing composer -- nothing @ all.

it's code examples -- whatever reason (possibly legacy/compatibility reasons .. or easier new php users, not know) using class aliases instead of real class names , phpstorm not understand such aliases.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -