[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.tools.pdt] Re: Nested Class/Function and Code Completion
|
Andrew Thompson wrote:
> Sorry I should have noticed your using require_once anyway. That
> should be enough to make sure file1.php is not included more than
> once, so you don't need the constant check.
>
No problem.
I should also point out this is a regression test issue also. Previous
versions of PDT handled this behaviour as expected.
> Andrew Thompson wrote:
> > Why would you use constants here to check if the file is defined?
> > Looks like you are trying to do something similar to C/C++ header
> > file inclusion.
> >
> > You can use require_once/include_once to include the file instead.
> >
> > I'd expect conditional declaration is bad practice anyway. If there
> > were any need to do it, it could surely be done another way, e.g.
> > subclassing Fish for different implementations.
> >
> >
> > Andy
> >
> > Ben Clifton wrote:
> >> Code Completion breaks when a class or function definition is
> nested >> inside an if statement.
> > >
> >> Case:
> > >
> >> file1.php
> > >
> >> if( !defined( 'FILE1' ) {
> >> define( 'FILE1', true );
> > >
> >> class Fish { public $dead; }
> > >
> >> }
> > >
> > >
> >> file2.php
> > >
> >> require_once( 'file1.php' );
> > >
> >> $fish = new Fish(); // Code Completion fails to find class Fish
> >> $fish->dead = true; // Code Completion finds dead varibale in ...
> >> // instance of class Fish
> > >
--