NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] PHP5 and code completion
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Hi.

I am using the latest PDO and SPL extensions with PHPed.

I now tried to use the DirectoryIterator class in PHP 5 like this.

foreach(new DirectoryIterator('c:/Export/data') as $currentFile)
{
if ($currentFile->)
}

And when I press ctrl + space I get the error

Code completion is not available due to the following errors
Failed to identify the type of $currentFile global variable

It feals like every time I try to use a PHP5 feature, then I have problems with code completion, because I do not have a extension file that defines the PHP5 feature.

But this time the DirectoryIterator is part of PHP 5 SPL, and it is defined in the SPL file, so why can't PHPed see that $currentFile is an instance of the DirectoryIterator class ?
View user's profileFind all posts by hgrSend private message
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
Another example of code complete that does not work. (see image)



The use of SPL or PDO files does not work well in PHPed.

Please make PHPed support true PHP5 code completion.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Code completion just can not work for the sample you provided. It's more of PHP dynamic nature.
Indeed, from code insight perspectives, the structure of the object being iterated with foreach() is not known or well-defined. I'd recommend you to add type hint.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Veteran

Joined: 30 Nov 2006
Posts: 186
Reply with quote
But Dimitri, in the last example shown in the image, two lines above the code completion worked. It worked in the if statement, but two lines below within the same scope it stopped working?

That is kind of frustrating.

I have even seen wrong code completion on the DirectoryIterator object, it acted as if were the PDO object, until I discovered that I have forgotten a ;

Can't really see how this has something to do with PHP, Why is these PHP 5 SPL and PDO libs not part of the standard PHPed code completion package?

I mean for every PHP4 statement code completion works like a charm, but when it comes to PHP 5, and these extension files, it is so buggy.
View user's profileFind all posts by hgrSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Code:
But Dimitri, in the last example shown in the image, two lines above the code completion worked. It worked in the if statement, but two lines below within the same scope it stopped working?

and what makes you thinking it stopped working? It just can't resolve one variable as it's know known to the IDE what instance/type is in $currentFile variable. It can not be resolved on any lines in your code. It does not mean that code completion won't work for the other variables.

Quote:
when it comes to PHP 5, and these extension files, it is so buggy.

You are not right. There are no bugs at all. At least no bugs reported.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
[resolved] PHP5 and code completion
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic