netbeans - php code completion not working anymore [duplicate] - php

Recently I started using NetBeans 6.7 beta for PHP development instead of Textmate and MacGDBp. I am rather amazed with it's feature set and most everything worked out of the box, or was easily configured to my liking.
I am having an issue with the code completion features though; they work for built-in functions, SPL and some of my code, but not all of my code, specifically, it never works for any methods in my classes, regardless of PHPDoc comments.
I can't seem to find any decent questions, let alone answers about this specific subject anywhere. It looks like everybody else who has problems with the code completion just hasn't enabled the auto-popup feature.
So the big question is:
Is there any way to influence the code completion cache, or something I have to add to my code to make it work? I'd really like to have code completion for the methods I write.
PS: I have tried several older versions of netbeans, they all exhibit the same problem.
edit: I've put a .zip up of my current test project. get it here. It's a very young project, think a day and a half.
edit2: Below is a screenshot of what i'm looking at. As you can see, it fails to complete pretty much anything, nor does it see the PHPDoc documentation.

I've tried opening your project, and the completion seems to be working just fine for me.
The only thing I can think of is to try to delete your entire NB cache, which should be located in $HOME/.netbeans/$VERSION/var/cache/. This is a wild guess
Create a backup first, I didn't try this!
If that fails, maybe you should try creating a new project, maybe that will kick NB in the butt.
Note that in NB 7.2 beta, the cache has moved to $HOME/.cache/netbeans/$VERSION.

What worked for me was deleting the old nbproject folder (that was created in windows) and recreating the PHP project from existing sources. This is on NB 7.0.1 Mac OS X. Clearing the cache did not work for me.

Be aware of #property something syntax. If object something does not exists in your code anymore, NetBeans might have problems with proper code completion. Consider example:
/** in main file: **/
use ABC as _ ;
/** in file ABC: **/
/**
* #property \Something $something
*/
If you do not use $something anymore, NetBeans will most likely generate an exception, thus failing to complete the code.

What worked for me was clearing the cache, then explicitly including some key subdirectories in the Global include path. Appears that for some reason NB 6.7 wasn't recursing the directories.
Including at project level also worked
Project->Properties->Include Path
Netbeans 7.01 + Windows 7

If, for instance, you open a php file with netbeans without being part of a project, code completion doesn't work at all. What you need to do is to create a project having that file in it.
Tested this on NetBeans 7.0.1

Related

PhpStorm does not recognize PHP

I saw many different questions here, but nothing was helpful to me.
I have no trouble with an interpreter, I tried to reset PhpStorm's cache.
It looks like file functions.php isn't accessible.
I really don't want to make a total reset. Maybe somebody has an idea how to solve it?
I'm not sure what I actually did and how to reproduce this issue again, but now it works well. I took previous version of PHPstorm. When I installed new one, the previous one was simply renamed to sth like 'phpstorm2'.
Here are my thoughts what actually happened:
As I understand for highlighting is responsible that part of application which is managed under Languages & Frameworks / PHP / PHP Runtime.
To reproduce this issue you may try to disable there "Core / Core" and try to write down in any place of your phpfile following:
\Exception::class();
And in your case this class will not be highlighted, as it presents in Core_c.php. In my case it is placed in
/opt/phpstorm/plugins/php/lib/php.jar!/stubs/Core/Core_c.php
I'm 100% sure that these libs were always enabled, but why I didn't saw this - that is the question.
So if I face this issue again my steps would be:
Try to verify Languages & Frameworks / PHP / PHP Runtime. The better way would be to enable ALL libs.
Check External Libraries in the project tree. Check read privileges for /opt/phpstorm/plugins/php/lib/php.jar and probably reinstall this plugin.
Try to find out function which I don't actually see in External Libraries.

PhpStorm code completion doesn't show core classes/extensions

I'm having trouble with PHPStorm. I just started new project created a couple of my own classes, in one of them I created PDO object.
$this->cnn = new PDO("sqlite:db/base.db");
Now when I want to see what kind of methods this object has via crtl + whitespace, I get no suggestions. Then I tried to see the list of classes available to me with.
$newClass = new
And when I pressed ctrl + whitespace it only showed me the classes I created.
So the question is, what do i need to do, to make PhpStorm see all the classes that are available (not just the ones i created).
P.S. when i ctrl + click on PDO (which is underlined) it says that class is undefined
P.P.S. in project settings i have selected php 5.4 language language and selected interpreter (php 5.4.7, using xampp)
I've solved the issue. File > Invalidate Caches did the trick!
I had a problem with PHPStorm Code Analysis hanging up (never finishing) on certain files using certain classes. No errors were reported, but all code completion was not working in these problem files.
The solution was the same, File > Invalidate Caches.

Can't configure ZEND to work

I tried both ZF 1.12.0 and 2.0.3, then ran this code:
On my computer it didn't work and seemed to stuck in this line:
$videoEntry = $yt->newVideoEntry();
I know that because when I put two echos around that line, only the first got displayed.
The weird thing is that there is no such method called newVideoEntry() anywhere, at all.
And the most annoying thing is that it works completely fine on phpcloud, which turn out to be using ZF 1.11.11, an old version that I can't find anywhere on the internet.
I'm really lost. Any idea? Which version I should use, since they are so much different and incompatible. Any solution for that code ?
Method newVideoEntry() does not exist because it is a magical method. Zend_Gdata_App::__call takes care of that. It creates Zend_Gdata_YouTube_VideoEntry and things go on.
if you want to use the same library as phpcloud all you have to do is to pull the content of the zf library that is hosted on the php cloud server. dont remember where it is exactly but should be in a zend folder on the phpcloud server.
As for the error you get , without the exact error message it is hard to tell what's wrong.

"Add as link" in Netbeans?

How can I (in the Netbeans IDE) add files as links, or point to existing files, kind of like a shortcut?
Visual Studio 2012 can do this, as shown in the following screenshot (found on Google Images - not mine).
I miss this feature in Netbeans. Copying my files over all the time is not an option, since I constantly improve my PHP library files, that are used across all other projects.
I am using the full version of Netbeans, and in this case, I am doing PHP development.
I am not sure that PHP is supposed to work like that, since its code is not compiled.
I could be completely wrong, and if I am, I'm sure someone else will educate us both.
What I've usually done is put the library in some directory and then add that directory to PHP's include path by adding this to php.ini:
include_path = "dir to your library"
And then I'd make sure that whatever class autoloader I was using was looking through the include path.
That said, I've more recently moved away from this, because a global library that changes often has caused me problems (a change would break something and similar issues).

Using aptana to debug with easyphp +cakephp

I'm starting a new project, for this project, I need a great IDE, which allows me to debug. I thought to aptana after some search.
But this project is a little specific, it has to work with a specific version of php and has not common extension(e.g. php_ingres), so I think I cannot use the internal server of aptana, otherwise it will not find every ingres function.
I've an EasyPhp environnement installed and working.
I've created a new "Simple server" and a new web browser configuration using this webserver(and chrome). But now when I try to debug it, I cannot see my browser configuration, it looks like it display only internal servers here. So is this possible to use aptana with easyphp? If yes, how?
If not, which IDE provide some auto-completion, debugging and allows me to use my own server?
Thank you very much
I think Netbeans can do your job, check this guide :
http://wiki.netbeans.org/HowToConfigureXDebug
Netbeans is great and is free too. But it maybe hard to figure your way around in that for a 1st time user. If money ain't a problem i'd suggest using phpDesigner 7 - http://www.mpsoftware.dk/phpdesigner.php. Easy and simple, with word completion, debugging features and also allows you to setup up an FTP connection to your servers so you can edit your files on the fly.(This method of editing files on the fly however may not be ideal if its mission critical data. I'd suggest using version control platforms like git, read more here - http://progit.org/book/ch1-1.html )
I finally used code lobster, which is not the best editor but can use easyPhp and actually debug into it.

Categories