Robin S

Declare ProcessWire namespace but keep v2 compatability

3 posts in this topic

Without declaring the ProcessWire namespace at the top of a module file I don't get the benefit of code completion and warnings in my IDE (or rather I get a bunch of false-positive warnings without a namespace declared). So I'd like to declare it, but if I understand right this will make the module incompatible with PW 2.x. It would be great to be able to conditionally declare the namespace according to the PW version but that's not possible unfortunately.

I suppose I could declare the namespace and comment it out just before pushing to GitHub, but it would be easy to forget.

Any tips? Does anyone know if there's a way to indicate the namespace in a DocBlock comment so PhpStorm picks it up but it isn't an actual namespace declaration?

Share this post


Link to post
Share on other sites

If you want to stay compatible with the 2.x branch I'd simply develop on a 2.8 or even 2.7 installation. 

2 people like this

Share this post


Link to post
Share on other sites
21 minutes ago, LostKobrakai said:

If you want to stay compatible with the 2.x branch I'd simply develop on a 2.8 or even 2.7 installation.

Good idea, thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.