Better support for namespaces

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Better support for namespaces

Postby josh » March 3rd, 2015, 3:16 pm

It would be great if there were better support for namespaces throughout a PHP project.

In Project Properties: Allow entering of a root namespace (eg: myOrg\MyProject)

In PHP templates: add support for $rootnamespace$ placeholder. It should account for adding to the project defined rootnamespace by including the name of the current folder. So for something in the /src/Models folder, $rootnamespace$ would translate to myOrg\MyProject\Models/

It would also be extremely helpful to have some 'use' statement helpers, where for example, something like
Code: Select all
$foo = new /myOrg/MyProject/Model/Foo;
would give an option to add a
Code: Select all
use /myOrg/MyProject/Model/Foo;
after any namespace declaration in the current PHP script.

Would it be possible to add support for namespaces in project item templates
josh
 
Posts: 7
Joined: February 27th, 2015, 7:43 pm

Re: Better support for namespaces

Postby davidbcn » March 5th, 2015, 7:03 pm

Yes this is a much needed feature!

For example, when developing on AS3 (where namespaces work quite like PHP) you get:

- Warnings for declared "use" full qualified class names that are actually not being used in the code.
- When locally typing a namespace, instead of adding the complete namespace it will automatically add a "use" for that class full qualified name and use only the class name.
davidbcn
 
Posts: 87
Joined: September 10th, 2014, 3:07 am

Re: Better support for namespaces

Postby josh » March 26th, 2015, 4:07 pm

Any update on this?
josh
 
Posts: 7
Joined: February 27th, 2015, 7:43 pm

Re: Better support for namespaces

Postby Jakub Misek » March 26th, 2015, 4:20 pm

These are great suggestions! We'll introduce it in future updates for sure.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Better support for namespaces

Postby josh » March 26th, 2015, 6:55 pm

Just a thought, it would be great if these were actually pulled from composer.json, since it already tells you most of what you need in the the `autoload` sections
josh
 
Posts: 7
Joined: February 27th, 2015, 7:43 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 33 guests

User Control Panel

Login

Who is online

In total there are 33 users online :: 0 registered, 0 hidden and 33 guests (based on users active over the past 5 minutes)
Most users ever online was 297 on March 29th, 2024, 7:06 am

Users browsing this forum: No registered users and 33 guests