blob: d712f97efc8bd8e6a08e31dadb47b10c58e6881f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>PHP - Editing and Refactoring</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<h1>Editing and Refactoring</h1>
<p> <img
src="../../images_www/v7/3/features/php/editor-top.png"
alt="PHP development in NetBeans IDE" class="box" border="none"
<br>
<p>
<p class="intro">
The language-aware NetBeans editor detects errors while
you type and assists you with documentation and smart code
completion&#8212;all with the speed and simplicity of your favorite lightweight text
editor.
</p>
<span id="im1" class="overview-right"><img src="/images_www/v7/3/features/php/php-54-traitcc_small.png"></span>
<h2>PHP 5.4 Support</h2>
<p>
The IDE's PHP code completion supports PHP 5.4 array styles such as
<a href="https://blogs.oracle.com/netbeansphp/entry/php_5_4_support_array">array dereferencing</a> and
<a href="https://blogs.oracle.com/netbeansphp/entry/php_5_4_support_short">short array syntax</a>. NetBeans IDE also recognizes
<a href="https://blogs.oracle.com/netbeansphp/entry/php_5_4_support_traits">Traits</a> and
<a href="https://blogs.oracle.com/netbeansphp/entry/php_5_4_support_anonymous">anonymous object variables</a> (
also called "fluent instantiation"). Finally, NetBeans IDE for PHP includes
<a href="https://blogs.oracle.com/netbeansphp/entry/php_5_4_support_minor">minor features</a> such as callable type hints,
binary notation for integers, and <code>Class::{expr}()</code> invocation.
</p>
<div class="line">&nbsp;</div>
<span class="overview-left" id="im2"><img src="/images_www/v7/3/features/php/php-code-completion_small.png"></span>
<h2>Code Completion</h2>
<p>
The editor provides automatic code completion (for most common PHPDoc annotations as well). While you type, it lists possible
completions: The most obvious and common options are listed at the top, but you can always choose from the full set of options
at the bottom. If one completes a method with parameters, IDE tries to compute and insert the most proper variable which is
declared right before the completed method.
</p>
<div class="line">&nbsp;</div>
<span class="overview-right" id="im6"><img src="/images_www/v7/3/features/php/php-code-navigation_small.png"></span>
<h2>Easy Code Navigation</h2>
<p>
Use the navigator window or the Go To Type, Go To File, Go To Symbol, Go To Declaration, Find Usages menu items for easy code
navigation in large projects. The editor warns about potential code problems by flagging them and giving an hint in a pop-up.
A tasks window lists all warnings in the project, making it easy to find and resolve problems.
</p>
<div class="line">&nbsp;</div>
<table>
<tr>
<td class="valign-top"><h2>Refactoring</h2></td>
<!--<td></td>-->
<td class="valign-top"><h2>Hints</h2></td>
<!--<td></td>-->
<td class="valign-top"><h2>Insert Code</h2></td>
<!--<td></td>-->
</tr>
<tr>
<td class="valign-top" style="width:33%;padding-right:10px;">
<p>
<span class="overview-centre" id="im24"><img src="/images_www/v7/3/features/php/php-refactoring_small.png"></span><br/>
The IDE provides some basic rename refactorings of elements (classes, interfaces, methods, fields, etc.). It's closely connected
with the Find Usages support which provides a way how to find a selected element through the whole project and display that usages
in a UI.
</p>
</td>
<!--<td>&nbsp;</td>-->
<td class="valign-top" style="width:33%;padding-right:10px;">
<p>
<span class="overview-centre" id="im25"><img src="/images_www/v7/3/features/php/php-hints_small.png"></span><br/>
The IDE provides a set of "Hints" which helps you to analyse your code and find some strange parts (unused variables, uninitialized
variables, etc.) and most of them suggest you some simple solution how to fix that found problem.
</p>
</td>
<!--<td>&nbsp;</td>-->
<td class="valign-top" style="width:33%;padding-right:10px;">
<p>
<span class="overview-centre" id="im26"><img src="/images_www/v7/3/features/php/php-insert-code_small.png"></span><br/>
The editor can generate common code snippets for you in PHP. A dialog is provided to give you complete control over which methods
are created and which class attributes they access. The IDE assists you when overriding methods and generating accessors.
</p>
</td>
</tr>
<tr>
<td class="valign-top"><h2>Fixing Use Statements</h2></td>
<!--<td></td>-->
<td class="valign-top"><h2>Type Hierarchy View</h2></td>
<!--<td></td>-->
<td class="valign-top"></td>
<!--<td></td>-->
</tr>
<tr>
<td class="valign-top" style="width:33%;padding-right:10px;">
<p>
<span class="overview-centre" id="im24"><img src="/images_www/v7/3/features/php/php-fix-uses.png"></span><br/>
One of the most powerful actions of the NetBeans IDE for PHP is "Fix Uses..." action. It analysis your code and tries to find
usages of types (classes, interfaces) which doesn't have its corresponding use statement (it analysis PHPDocs as well). If some
naming conflicts appear the dialog is displayed and user can solve
that problem.
</p>
</td>
<!--<td>&nbsp;</td>-->
<td class="valign-top" style="width:33%;padding-right:10px;">
<p>
<span class="overview-centre" id="im25"><img src="/images_www/v7/3/features/php/php-hierarchy-view_small.png" /></span><br/>
The IDE provides a way how to show to user a type hierarchy (supertypes and subtypes) of a required type. Its graphical representation
is displayed in a sepatate window next to a navigator window.
</p>
</td>
<!--<td>&nbsp;</td>-->
<td class="valign-top" style="width:33%;padding-right:10px;">
</td>
</tr>
</table>
<h2>See Also</h2>
<ul class="bigger">
<li><a href="/community/releases/81/index.html">NetBeans IDE 8.1 Release Page</a> for a list of specific features in the latest stable release.</li>
<li><a href="../../kb/trails/php.html">PHP and HTML5 Learning Trail</a> for tutorials that will help you get started.</li>
</ul>
</body>
</html>