How to make phpDoc comments visible in Eclipse - php

I wonder how I can make PHPDoc-comments visible in Eclipse on a project-wide basis. For the moment, it only works in the current, open file.
It would be super to be able to check out all the #params and descriptions that I have put in before each function, outside the function's own file.
Thanks a lot!

If you have already documented your code elements via docblocks, then when you use those elements in your code, the hover popups feature of Eclipse will indeed show you what's in their docblocks. This doesn't require you to have the other file open, e.g. writing code in test.php that uses class Foo from foo.php... you're not required to have foo.php open in the editor in order for your Foo object in test.php to have hover popup docblock info visible.
If such hover popups are not showing docblock info to you, then you might need to revisit your buildpath/includepath settings in your PHP project, particularly if the elements you're trying to use are actually defined in another project than the one you're working in.

Related

VS Code suggestions for PHP show everything, instead of class functions only

I tried setting up VS Code for a legacy PHP project, to evaluate it against other IDEs.
My problem is with the suggestions I get, when I press <an object>->Ctrl+Space.
For example I want to get all suggestions (properties and functions) of a certain class. I am in the class and I type:
$this->(Ctrl+Space)
I get a large list of functions and constants, which are things I can use in PHP in general and not the functions and properties of the class I am in. After I installed the PHP Intelephense extension, I get the class methods that I need in my suggestions, but still they are mixed with everything else and hard to find, unless I start typing the first letters of the function I need to access. To show you what I mean, this is what I get, when I type the following within a function of my class:
I don't think this is a matter of extension, because even if I disable all my extensions I still get the whole bunch of suggestions. How can I remove all unnecessary suggestions, or at least give priority to the class specific suggestions and see them on top of the list?
You must disable the vscode built-in PHP Language Features.
Click extensions.
In the search bar type #builtin php.
Click cog icon of PHP Language Features.
Click Disable.
I've been struggling with this for while too ...
You can just disable the basic PHP suggestions by setting php.suggest.basic to false in your settings.json file or use the settings UI at PHP > Suggest: Basic
With Intelephense installed everything works as expected now !
source : https://code.visualstudio.com/docs/languages/php#_disable-builtin-php-support

Vim function to show documentation (e.g. phpdoc) for a tag somewhere like in a preview window

I haven't been able to find a plugin or script that to display the documentation for the function for a given tag.
Say I have the cursor over a function foo. The source code for foo is in another file that's not currently open, but has been scanned into the project's tags file. I would like to be able to call a function that would display the documentation for that function, which would be above the function declaration in phpdoc format.
Does something like that exist?
I'm not sure it provides the feature you are looking for but there is a very exhaustive set of plugins for PHP called VIP.
I have changed the phpcomplete.vim plugin so it parses the phpdoc. This means while your in autocomplete, the associated phpdoc will be shown with the function name and args on the top screen. This is not exactly what you would want since you need to type something to get the info and not just going over the methods name with cursor but you may find it helpful anyways.
Unfortunately, its only for methods for now. You will also need vim-python and exuberant tags (to generate class tags)

Can Dreamweaver show a list of variables, functions, class?

Is there a window in Dreamweaver that shows all variables and functions defined in the current document?
When you right click on the current document, you will see Functions context menu which contains the methods used.
Another trick is to edit the toolbars xml file and uncomment the code nav button.
This gives you a toolbar button you can click to list the methods, rather than right clicking and selecting functions from the context menu.
Still not as good as a permanently visible pane, but one less click than the right click > functions context menu.
Open this file:
C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5\configuration\Toolbars\toolbars.xml
Uncomment this block:
<menubutton id="DW_CodeNav"
image="Toolbars/images/MM/codenav.png"
MMString:tooltip="DW_CodeNav/menubutton/tooltip"
enabled="dw.getFocus() == 'textView' || dw.getFocus() == 'html'"
menuID="DWCodeNavPopup"
update="onViewChange"/>
Restart Dreamweaver for the changes to be applied.
Code Nav icon "{}" appears at the end of the Document toolbar. The toolbar with (code|split|design).
No, Dreamweaver, at least through CS5, does not have a window that lists variables and functions in the document. The CS5 code hinting engine is pretty good, so it should at least allow you to quickly type your code, but if you need a list outside of the document itself, there is no such thing.
There used to be an extension that would list functions defined in the page in a floating panel, Interakt's MX Code Pack, but it is no longer available as Interakt was acquired by Adobe, and their products subsequently "retired":
MX Coder Pack
This is an old topic but I thought I would update it since I submitted a feature request to Adobe to implement an "outline view" which would address OP's original question. The feature would list functions inside of a page similar to how other IDE tools like Eclipse do it. Dreamweaver currently does this for JavaScript functions only but this feature request would enable it for other types of pages as well (cfml, php, asp) and also let you see the DOM outline for any page.
Feel free to submit your request to Adobe here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform&loc=en
Be sure to reference enhancement request #3812052. If enough people ask for this feature, perhaps Adobe will listen.
I have no sulution for the variables, but for functions I use a little trick:
I do a search (ctrl+f) for the string "function " and the press "find all" this'll show the result window with all lines with "function "in it. Double clicking a line in the result window will take your to the appropriate function.
You can make something with regular expression where you search for function ({some chars}){ to be absolutely certain to only get function declarations.
You can then save this query and load it as needed.
Indeed code hinting is the only way I've been able to view a functions list in CS5. The HOTKEY for code hinting is ctrl+spacebar.

NetBeans PHP Code Completion for Standard Functions

I have started to use NetBeans 6.9.1 for developing PHP projects. Although it does provide code completion to certain extent, but it's by no means complete. For example, commonly used functions such as implode,explode are not in the list for code completion. Also, it would have been convenient to have code completion for objects made from built in classes, such as HttpRequest.
Is there anyway to obtain code completion for the items mentioned above.
Try this...
Tools->Options
Selct "Editor"
Select "Code completion"
In language drop down select "PHP"
You will see a list of code completion options for PHP project ONLY
If you have global variables/objects set "Code Completion for Variables" is set to "All Variables"
If you are using methods without static in front of them as static make sure under "Code Completing for Class Methods" you have "Also Non-Static Methods after ::"
If you are not using namespaces PHP 5.3, make sure you project is type is test to PHP 5.2/5.1. To check it, right click your project->Properties->Sources->PHP Version.
I checked the above thread and my project settings are correct, as are the PHP settings and plugins are enabled. Each PHP editor window shows and editable form, but there is no hints,completion or anything else that is helpful whilst writing code.
I figured it out in the end:
each PHP section started and ended as below:
<? ?>
should have been:
<?php ?>
tags are deprecated (since php 7.0+), but you can enable it in NetBeans if You're working with legacy code at:
Project Properties -> Sources
mark Option: Allow short tags, it is also possible to allows ASP tags <% %> there.

Jump to function declaration in php

I have the following ide's for php
Dreamweaver
php-Eclipse
Textpad
I wish to jump to a function's definition which is located in another file which is not yet open. How could I do that. I am studying a websites code and have the entire directory structure in my local root folder. I come across certain functions and I don't know in which file their definition is. Please suggest something.
In eclipse PDT IDE put mouse over class name, property, method or function name (must be in opened eclipse project) and press CTRL + clic.
It work with almost all declarations, even constants and class constants. In most case it will work, but it can have trouble with some dynamic property assignement like magic methods or certain injected dependency.
The file will be opened, and if target is in same file code view will scroll to the declaration
Press F3 in eclipse and you will find the declaration.
To jump to function definition for Dreamweaver just add this extension:
http://code.google.com/p/dwoop/.
Also you can add Autocomplete feature to Dreamweaver by going to Site --> Site Specific code hints --> select a folder which you want to scan for autocomplete --> save it with any custom name you want.
This works with any type of project (wordpress, codeigniter...)
I wish to jump to a function's
definition which is located in another
file which is not yet open.
I can suggest you about dreamweaver, the one i use. Point the cursor at the file that is included via php's include, require, etc or within link's href and src attribute and press Cntr+D and that file should open.
For functions, just right click anywhere on the document, in the context menu you should see the Functions link about all functions defined in the document.
phpDesigner can do that
In an opposite direction, and perhaps out of question's field, but if your code if OOP and you want to study it you can try automated tools to get UML view of its architecture , but these softwares are generally not free.
I found a way of going to the function definition. Using help in dreamweaver and selecting the option of searching wihtin a folder type 'function function_name()' and unselect all the checkboxes below.
if you press find it will start opening pages which containg the expression or find all will not open any pages but show the list of all the pages in the bottom panel.
Well, I'm currently working with Dreamweaver CC. If you want to jump to Function Definition from code, just select the desired function and then right click -> then select "Find Selection" option or you can use "Shift+F3", and you will be redirected to the code where the function is defined. enter image description here

Categories