X

An Oracle blog about NetBeans for PHP

Recent Posts

Features

PHP 7 Support (Part 2)

Hi all, today we will show you our support for PHP 7 which will be part of NetBeans 8.2.(This is the second part; for the first part, please follow this link.) First, please let me thank our NetBeans user Junichi Yamamoto who is helping a lot with developing of new features as well as fixing of existing issues. Thanks a lot, Junichi! Please note that PHP 7 is a huge update of NetBeans PHP support so your help with testing and reporting issues is more than welcome (and really appreciated!), thank you. Instructions can be found at the end of this blog post. As the first step, you should set PHP 7.0 as the PHP version of  your PHP project: One of the biggest features of PHP 7 is group use declarations. Now, all the use statements from some common namespace can be combined in one group use statement. How this can look like can be found on the next image: Of course, all the features you would expect work - e.g. code completion: Or hints:  Not only classes/interfaces/traits can be used in group uses but also constants as well as functions:  So if you prefer group uses, simply select the relevant property in IDE Options: Another big feature of PHP 7 is ability to use anonymous classes. These classes are basically created on-the-fly and immediately used: Great news is that code completion works as expected in this case as well: Anonymous classes can be also a bit more complicated - they can extend some other class, implement some interfaces and even use some traits, just like any other classes. They can also take any constructor parameters:  Not only code completion works but also all other features like e.g. find usages: That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans Bugzilla (component php, subcomponent Editor). You can also leave a comment here (please notice that the comments are moderated so they will not appear here immediately) but reporting issues is strongly preferred (no issues described here in comments will be fixed, sorry; only Bugzilla counts).

Hi all, today we will show you our support for PHP 7 which will be part of NetBeans 8.2. (This is the second part; for the first part, please follow this link.) First, please let me thank our...

Features

PHP 7 Support (Part 1)

Hi all, today we will show you our support for PHP 7 which will be part of NetBeans 8.2. First, please let me thank our NetBeans user Junichi Yamamoto who is helping a lot with developing of new features as well as fixing of existing issues. Thanks a lot, Junichi! Please note that PHP 7 is a huge update of NetBeans PHP support so your help with testing and reporting issues is more than welcome (and really appreciated!), thank you. Instructions can be found at the end of this blog post. As the first step, you should set PHP 7.0 as the PHP version of  your PHP project: One of the new features of PHP 7 is return type declarations; it means that now, PHP functions and methods can declare what type the given function/method returns: As you would expect, NetBeans provides code completion here, of course: Another nice improvement is that in PHP 7, also scalar types can be used for declaration. An example can be found below together with activated code completion that provides these new types as well. NetBeans also support new operators that come with PHP 7, these are combined comparison (spaceship) and null coalesce operators: As the last feature today, we will show you support for generator delegation: We will continue with the rest of the new features available in PHP 7 next time (soon so stay tuned! :) That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans Bugzilla (component php, subcomponent Editor). You can also leave a comment here (please notice that the comments are moderated so they will not appear here immediately) but reporting issues is strongly preferred (no issues described here in comments will be fixed, sorry; only Bugzilla counts).

Hi all, today we will show you our support for PHP 7 which will be part of NetBeans 8.2. First, please let me thank our NetBeans user Junichi Yamamoto who is helping a lot with developing of new...

Features

Spellchecker for PHPDoc comments

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who is helping a lot with implementing enhancements and fixing issues in all the areas of NetBeans PHP support. He has also contributed a few plugins, e.g. support for CakePHP framework. He would like to tell you a few words about one new PHP feature in NetBeans. Thanks a lot, Junichi! Hi all. Today we will show you the Spellchecker for PHPDoc comments which will be available in the next NetBeans version. This feature spell checks your words in PHPDoc comments(/** */) (NOTE: Not /* */, # and //). If there are some spelling mistakes, they will be marked with wavy underlines. Configuration At first, let's check the configuration. It is enabled by default. If you don't want to use this feature, please unckeck the Tools > Options > Editor > Spellchecker > PHPDoc comments. Please note that only english dictionary is bundled with NetBeans so only "en_US" locale works out-of-the-box. Ignored words Variable: e.g. $foo Annotation: e.g. @param Type of Annotation: e.g. @param type (only the tags recognized by NetBeans) Camel Case Word: e.g. MyClass That's all for today. As always, please test it. It's available in the development version. If you find some issues or enhancements, please report them to NetBeans Bugzilla (component php, subcomponent Editor). Thanks.

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who is helping a lot with implementing enhancements and fixing issues in all the areas of NetBeans PHP support. He has...

Features

{@inheritdoc} tag support added

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who is helping a lot with implementing enhancements and fixing issues in all the areas of NetBeans PHP support. He has also contributed a few plugins, e.g. support for CakePHP framework. He would like to tell you a few words about one new PHP feature in NetBeans. Thanks a lot, Junichi! Hi all. Today we will show you the {@inheritdoc} tag support for PHPDoc comments which will be available in the next NetBeans version. You can use this support when you extend a class or override a method. Simply add only {@inheritdoc} to a PHPDoc comment of a child class if you want to use the same one as the parent. And you can see the description of the parent class in the PHP document window using the code completion. Let's see an example:  <?php/** * The summary of BaseClass. * * The description of BaseClass. * @author junichi11 */class BaseClass{ /** * test method of BaseClass. * * @param string $param1 * @param int $param2 */ public function test($param1, $param2) { }}/** * {@inheritdoc} */class ChildClass extends BaseClass{ /** * {@inheritdoc} */ public function test($param1, $param2) { }} Which in the IDE in the case of the class results in: And in the case of the method: That's all for today. As always, please test it. It's available in the development version. If you find some issues or enhancements, please report them to NetBeans Bugzilla(component php, subcomponent Editor). Thanks.

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who is helping a lot with implementing enhancements and fixing issues in all the areas of NetBeans PHP support. He has...

Features

Codeception support added

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who has created support for Codeception in NetBeans 8.1. He would like to tell you a few words about this new PHP unit testing framework and its support in NetBeans. Thanks, a lot Junichi! Hi all, today we will show you Codeception support which has been added in NetBeans 8.1 as another PHP testing framework. If you have used PHPUnit, atoum or Nette Tester in NetBeans IDE, you can use this support the same way as them. Requirements Codeception 2.1 or newer. Configurations At first, let's set the Options for Codeception. Next, to enable the Codeception, please select it and your test directories in your project properties. You can also set some configurations per project. Run tests Your tests are run from a context menu of your project and you can review the results using in the Test Results window: Code Coverage To enable code coverage, you have to add a bit configurations to your configuration file (e.g. codeception.yml, unit.suite.yml). Please refer to the Codeception's web site for details. Enable code coverage for project. Show report for code coverage. Right-click the project node and select Code Coverage > Show Report... See tested lines in files. Debugging Before start with it, you should check the following: How to configure XDebug. If you are ready, please put breakpoint(s) to your code.Then, open the context menu in the editor for a test file and select Debug file. Create Tests Create a test using a generate command (e.g. generate:test). Open your PHP file in the editor and select Tools > Create/Update Tests. Then, select a command (e.g. test) and a suite (e.g. unit) in the Create Test dialog. Run Commands Run a few commands for Codeception. Supported commands are bootstrap, build and clean. NOTE: The other commands are currently not supported. These commands will be available in the project context menu if you enable Codeception in your project. Additional Parameters You can use this option if you want to specify the group(s) and the env(s) when you run tests. Issues The support is already available in NetBeans development version. Please test it. If you find some issues or enhancements, please report them to NetBeans Bugzilla (component php, subcomponent Codeception). Finally, thanks a lot, Tomas! He helped me and gave me some advices when we had some issues.

This blog post has been contributed by our NetBeans PHP user Junichi Yamamoto who has created support for Codeception in NetBeans 8.1. He would like to tell you a few words about this new PHP unit...

Features

Phing support added

Hi all, today we will show you our support for PHP project build system or build tool which has been added in NetBeans 8.1. This time, we will talk about Phing. This support works exactly the same way as the existing support for JavaScript build tool, Grunt (please note that for NetBeans 8.1, we have added another popular JavaScript build tool, Gulp). This starts with configuration of Phing executable, of course: Now, we can create a new Phing build file if it does not exist in the PHP project yet:  Phing build file appears among Important Files of the project: Phing targets can be assigned to common IDE actions in the Project Properties dialog so then, if one e.g. Runs Project, the relevant Phing target is automatically executed as well. Any Phing target defined in project's build.xml can be run via project's context menu. One can even specify an advanced task: Advanced task can be configured with custom options and parameters. Moreover, more Phing targets can be run at once and every advanced task can be optionally stored in VCS so every team member can use it easily: NetBeans remembers a few of the latest advanced tasks and allows to rerun them easily. Ordinary Phing targets can be run directly as well, of course: Output of every Phing target run can be easily found (and reviewed if needed) in the Output window:  That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans Bugzilla (component php, subcomponent Phing). You can also leave a comment here (please notice that the comments are moderated so they will not appear here immediately) but reporting issues is strongly preferred.

Hi all, today we will show you our support for PHP project build system or build tool which has been added in NetBeans 8.1. This time, we will talk about Phing. This support works exactly the same way...

Features

Netbeans + atoum = love <3

This blog post has been contributed by our NetBeans PHP user Julien Bianchi who has helped a lot with integrating atoum into NetBeans PHP support in NetBeans 7.4. He would like to tell you a few words about this new PHP unit testing framework and its support in NetBeans. Thanks, a lot Julien! Hi all! If you are here today, it's because you know and probably use Netbeans. But you probably don't know atoum yet. Too bad, you missed one of the most powerfull and pleasant to use unit testing framework for PHP. Today, atoum is directly integrated in Netbeans and I'm here to introduce this new feature. We, the atoum team, have one main goal: to provide users a modern, simple and intuitive tool to write unit tests. Integrating atoum in an IDE is a step farther to ease the use of such a tool. In this blog post, I'll try to cover the main functionalities: we will bootstrap a new project using atoum, configure it to be able to trigger our tests and then, we'll see how to debug them. Do not worry, thanks to Tomas and all the Netbeans' team work, this will be easy and will only happen through the Netbeans' user interface. Bootstrapping Once you have created your new Netbeans project, you will have to build a basic directory structure. Let's use something like this: .├── src│ └── netbeans│ └── sample└── tests └── units └── netbeans └── sample What does this tell us ? We prepared our project to host a netbeans\sample namespace where we will put our sources and a directory to host our tests. The last thing to do before writing the first line of code is to include atoum. atoum is available as a PHAR archive, a composer package, or on Github. In the example I'll use composer with the following content in the composer.json file: { "name": "netbeans/sample", "description": "Netbeans + atoum = love <3", "require-dev": { "atoum/atoum": "dev-master" }, "autoload": { "psr-0": { "netbeans\\sample": "src" } }} This could be automatically generated with Netbeans but I won't cover this step in detail here as it's the matter of one click: right click on your project name and choose Composer and then Install. As soon as you have your dependencies installed, you will be ready to continue. Configuring This is where we will start using Netbeans features. Let's start by opening the project properties window (right-click on the project name and select "Properties" then go to the "Testing" item in the left tree): Now, we have to tell Netbeans which directory will hold our tests (still in project's properties, go to the "Sources" item in the left tree): Use the "Browse" button next to the "Test folder" field and choose the tests directory. You can now save the settings and see that Neatbeans marks the tests as a special folder: "Test Files". This will let it automatically find your test files based on your source filenames. For now, that's all you need to do to make Netbeans use atoum to run your tests. I told you atoum was a really simple tool: it's a self-contained tool and can run your test without any configuration! Netbeans takes full advantage of this and only asks you to choose your favorite tool by checking a single option! Of course, when you'll be more familiar with the tool, you'll be able to customize it more precisely. For basic use cases, this should be sufficient and we can go to the next step: writing our first unit test because TDD is a good practice and atoum is oriented on this way of working (but you can also use it other way). Writing unit tests Before we start writing tests, let me explain some points I skipped until now: when we prepared our workspace, we created a deep tree in the tests directory. This is something that is required by atoum: you have to use namespace to structure your sources and tests and the tests should live in a namespace matching tests\units and your source namespace. In our example, our tests will live in the tests\units\netbeans\sample namespace as our sources are in netbeans\sample. We also follow the PSR-0 convention so our directories match the namespaces to ease autoloading. So let's go! We want to write a Calculator class which will provide some basic operations: add, multiply and divide. Let's create the file tests/units/netbeans/sample/Calculator.php: <?phpnamespace tests\units\netbeans\sample;use atoum;require __DIR__ . '/../../../../vendor/autoload.php';class Calculator extends atoum { public function testAdd() { $this ->if($object = new \netbeans\sample\Calculator()) ->then ->integer($object->add(1, 2))->isEqualTo(3) ; }} We now have our first unit test, so just launch it: click on its filename in the left tree and, as you prefer, use the CMD+F6 shortcut on Mac OS X or use the right-click menu and select "Run". Netbeans should display the result of the test run, saying that a test failed. Exactly what we expect: we tested a method which we don't have yet implemented (TDD FTW!): What we have to do now is create our tested class and write the add method to make our test pass. Ass I told you, atoum and Netbeans expect your project to be PSR-0 compliant so our class will lay in the src/netbeans/sample directory: <?phpnamespace netbeans\sample;class Calculator { public function add($a, $b) { return $a + $b; }} Using you prefered trigger, you can now rerun the unit test and see that everything is now green! This is how netbeans will report the tests results : a shiny progress bar and a list of ran test cases. If you are curious, you will also be able to see the command used to run tests and the raw output produced by atoum which is provided in the TAP format (I bet you won't want to read this but it's still interesting to know how everything works under the hood): I won't cover the other test methods and let you discover them here. Using TDD, you will now be able to quickly write a test, run it, see it's failing, switch to your source file (ALT+CMD+T on Mac OS X), write some code to make the test pass, run it, see it's passing, switch to the test (again with ALT+CMD+T), write a failing test, … This is how we do! We will now switch to a new example to discover another feature: using XDebug to debug our code. Debugging Netbeans and atoum allow you to easily debug your code using XDebug. This is really handy when dealing with complex classes and tests. To show you how everything works, I'll use a Sorter class which has one method to do a bubble sorting on an array. But before we can use XDebug with atoum, we'll have to do a bit of configuration. Here is the configuration used for the example: zend_extension=xdebug.soxdebug.idekey="netbeans-xdebug"xdebug.remote_enable=1xdebug.remote_autostart=0 What we do here is tell XDebug which IDE key will be used during debug session and enable remote debugging. remote_autostart will prevent atoum's child processes to automatically trigger a new session (yes, atoum runs every test in a single isolated PHP process!). If you want to know more about how to configure XDebug for a Netbeans usage, check out this documentation. We are now ready to debug! To start your test in debug mode, you can chose between a keyboard shortcut (CMD+Shift+F5 on Mac OS X) or by right-clicking on the test file and choosing "Debug". But before triggering tests, you will have to put some breakpoint in your code so you can control the execution flow using debugger tools (Step over, step into, …). Being able to run s step-by-step debugger in unit tests context will help you debug your code as you can make a specific behavior happen and track the execution in detail using the call stack and variables inspectors. Nothing really new compared to a conventional debugger session but still useful. I hope the blog post made a good introduction to atoum in Netbeans, and perhaps made you want to test it. Of course, you will find all the code related to this post on Github. Feel free to check it out, try it and enjoy using atoum in Netbeans! I wanted to thank everyone who worked on these awesome features, Tomáš Myšík for his work on Netbeans but also the entire Netbeans team and all the contributors who helped us make this happen. Finally, if you want to know more about atoum or need help, feel free to join us on IRC or have a look at the documentation.

This blog post has been contributed by our NetBeans PHP user Julien Bianchi who has helped a lot with integrating atoum into NetBeans PHP support in NetBeans 7.4. He would like to tell you a few...

Features

Improve Your Code With New Hints

Hi all! After few weeks of inactivity we are here again and we want to show you some new hints which will try to improve your code in NetBeans 7.4 (at least we hope so ;-). So here they are: Too Many Lines So what do you think that it does? Yes, exactly :-) It checks the number of lines of class, interface, trait and method (function) declarations. If the number is exceeded, than IDE warns you. So your elements will be more readable and pretty thin :-) Do you think that the default value is too strict? Don't worry, you can simply adjust it ;-) Superglobals Everyone knows superglobals, but not everyone knows that superglobal arrays shouldn't be accessed directly. Never ever trust to user inputs. Every user input should be somehow filtered/validated. And that's why this hint was created :-) Braces As you certainly know, one can use conditional statements and control structures without curly braces (if block doesn't contain more than one statement). But it makes code less readable, so we suggest you to use braces everytime. This hint works for Do-While, While, For and Foreach loops and for If-Else-ElseIf statements. Empty Statement Empty statement is just an empty statement so why to pollute your code by stuff which does nothing? Error Control Operator Misused Error control operator is pure evil (we talk about an "at" sign). It hides much more errors than you think. So don't use it. But we allow to use it in some special cases like fopen() and such. Nested Blocks in Functions Just another hint which tries to make your code more readable. Too many nested blocks make your code ugly and it also tends to violate single responsibility principle. So it tries to check the depth of your blocks and warns you if it seems suspicious. And you can set your custom depth number of course ;-) Parent Constructor Call Constructor of parent class should be called if exists. It ensures the right initialization of instantiated object. So if you override parent constructor we try to check whether you should call parent constructor or not. Unnecessary Closing Delimiter Using PHP closing delimiter at the end of file is unnecessary when there is no text after it. It is just a cause of Headers already sent error and such. So if it finds such an unnecessary delimiter, IDE will warn you. Unreachable Statement What are unreachable statements? E.g. statements after return statement. Just snippets which will never be executed. They just pollute your code. Hint tries to detect them and warn you. Please, don't forget, that all hints are just our suggestions. If you don't want, you don't have to use them. You can simply disable every hint which you don't like in: Tools -> Options -> Editor -> Hints -> PHP. Just uncheck it in the list. And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Editor). Thanks.

Hi all! After few weeks of inactivity we are here again and we want to show you some new hints which will try to improve your code in NetBeans 7.4 (at least we hope so ;-). So here they are: Too Many...

Features

Static code analysis

Hi all, today we will show you how you can check quality of your PHP code in NetBeans 7.4. For this task, we use standard PHP tools PHP_CodeSniffer and PHP Mess Detector. As always if NetBeans uses any external tool, verify IDE Options that everything is set correctly: If it is, you are ready to inspect your code (one can select a PHP project or a PHP file): Inspect dialog will appear. Here, we can e.g. select only one inspection tool or create custom configuration: If we are ready and run the inspection (please notice that it can take a long time for big projects), analysis results are shown: As you can see, the results are categorized by files and folders so we can easily recognize which area of our project needs our attention first. If we double click any of these results, the given warning(s) is shown to us on the proper line: If anything goes wrong (e.g. inspection is running too long), one can easily verify what each tool does exactly in the Output window: If anyone of you has a tip for another PHP code analysis tool, let us know via NetBeans Bugzilla or leave a comment here (please notice that the comments are moderated so they will not appear here immediately). That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans Bugzilla (component php, subcomponent Code).

Hi all, today we will show you how you can check quality of your PHP code in NetBeans 7.4. For this task, we use standard PHP tools PHP_CodeSniffer and PHP Mess Detector. As always if NetBeans uses any...

Features

Nette Framework with Latte Templates (and one more thing)

Hi all! After few weeks we would like to introduce you some new features which will be available in NetBeans 7.4. And what is it about? It's about new framework support! For NetBeans 7.4 we added a support for Nette Framework with Latte Templates. Not sure if all of you know it, so here is an official introduction: "A popular tool for PHP web development. It is designed to be the most usable as possible and is definitely one of the safest one. It speaks your language and helps you to easily build better websites." If you remember, we wrote about Nette Framework few months ago when we added a support for the Neon file type, which is a configuration file type for most of Nette Framework applications, and then once again when we introduced new ApiGen suppport, which is an API generation tool based on Nette Framework. Nette Framework also has a great and active community, so if you have a problem, don't hesitate to ask on an offical Nette Framework forum! You will receive an answer in minutes ;) Ok, so let's look at some features :) Nette Framework Let's start with support of the framework part. As usual, Nette Framework has it's own Options tab. You can select a directory with Nette Framework sources and a directory with Nette Framework sandbox. These both information are useful when you try to create a new project and in a framework selection step select a Nette2 Framework. Then you can decide to copy Nette Framework sources into your project and if you properly set a path to the Nette Framework sandbox directory, then it's automatically created in your new project. We try to automatically detect whether the Nette Framework is used in your project to provide some framework specific features (such as custom @persistent annotation, code generator for action and render methods, or Go to View action), but when the detection fails (e.g. due to non-standard directory structure), you can enable whole support manually in Project Properties. Latte Templates At first, what is Latte Template? If you know Smarty or Twig, then you will exactly know what it is. It's just a HTML file, with a custom extension (.latte), which contains some embedded parts which are "somehow processed by Latte Templating engine". You can read much more in an official documentation of Latte Templates. And what we support? For example coloring (of embedded Latte parts, comments and such). But our coloring is a bit clever ;) In Latte Templates, you can switch to another Latte delimiters in one file (or in HTML element) without any problem. Just use {syntax ...} macro or n:syntax="..." tag in a HTML element. NetBeans catches that and colors following source properly :) And another great thing is code completion. It work for macros, helpers and keywords. And it works for n:tags too ;) One more thing Now all of you know, that Neon file type is a common configuration file for Nette Framework applications. It has some special sections like services: and such. And in these sections you will sometimes need to write some PHP types with fully qualified name (to specify factory classes and such). So it would be helpful to have some code completion in there, right? Ok, so it's there! ;) It's simple, it just lists all of PHP types from your project, but it's better then nothing, isn't it? :) And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Nette / Latte / Neon). Thanks a lot!

Hi all! After few weeks we would like to introduce you some new features which will be available in NetBeans 7.4. And what is it about? It's about new framework support! For NetBeans 7.4 we added...

Features

Another Twig Improvements

Hi all! We are here again to intorduce you some of our new NetBeans 7.3 features. Today we'll show you some another Twig improvements. So let's start! Code Templates First feature is about Code Templates. We added some basic templates to improve your Editor experience. You will be really fast with it! If someone don't know what Code Templates are, they are piece of code (snippet) which is inserted into editor after typing its abbreviation and pressing Tab key (or another one which you define in Tools -> Options -> Editor -> Code Templates -> Expand Template on) to epxand it. All default Twig Code Templates can be found in Tools -> Options -> Editor -> Code Templates -> Twig Markup. You can add your custom templates there as well. Note: Twig Markup code templates have to be expanded inside Twig delimiters (i.e. { and }). If you try to expand them outside of delimiters, it will not work, because then you are in HTML context. If you want to add a template which will contain Twig delimiter too, you have to add it directly into Tools -> Options -> Editor -> Code Templates -> HTML/XHTML. Don't add them into Twig File, it will not work. Interpolation Coloring The second, minor, feature is, that we know how to colorize Twig Interpolation. It's a small feature, but usefull :-) And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Twig). Thanks a lot!

Hi all! We are here again to intorduce you some of our new NetBeans 7.3 features. Today we'll show you some another Twig improvements. So let's start! Code Templates First feature is about Code...

Features

NetBeans PHP Community Council

Hi all, today we would like to inform all of you that now you have a chance to improve NetBeans via NetBeans PHP Community Council. The author of this activity is Timur Poperecinii and he would like to tell you a few words about it. Hello passionate technical people, First of all let me introduce myself: my name is Timur, I’m a developer from Moldova (that little country between Romania and Ukraine), I develop mostly in .NET and JQuery, but I love to learn more, not being an expert I am familiar with Java (Struts2, Play), PHP (Symfony2), Ruby (Rails), Sencha Touch 2 and other technologies. I was “introduced” in PHP recently by a client of mine who requested to make the work specifically in PHP. Let me tell you a little story about my experience with open source and IDEs: when I was studying in university in 2007 I think, I did a simple little application in PHP and thought “Damn, if only there was a good IDE for PHP so I could relax and no having to remember all the function names”, then when I searched on internet pretty much everyone was using Vim or Emacs on Linux, but it had no autocomplete anyway, just syntax highlighting. I remember using some tool like Notepad++ I think. Nowadays everything changed, we have highlighting and autocomplete for about all standard things in PHP in many IDEs. I use NetBeans for PHP, and I really am happy with the experience I have there with standard PHP code, but for frameworks I still think there is lots of room for improvements. For example we have some Symfony 2 and Twig support. But I’d love to see more of that coming, for example I’m a big fan of file templates, where the main goal is to not waste time on writing over and over again something that can be generated, and it counts even more when you don’t have a lot of autocomplete. So what I thought, “Hey I know Java a little, and NetBeans has plugins, so may be it worth trying to do a file templates plugin”, and so I did, you can find details about my Unified Udevi Symfony2 Plugin for NetBeans 7.2 on my blog. It wasn’t hard, and it even was fun! Give back to open source Now think a little, NetBeans is an open source project and PHP support is just a part of it, so the resources are pretty limited in this area. But we as a community that uses this product, want to have the best possible experience with PHP and frameworks(!!!). So why don’t we GIVE BACK TO OPENSOURCE ? Imagine an IDE that can do all the things you wanted + it is free. Now how far is NetBeans from that point? I guess not so far – you might miss a little niche thing that you use on a daily basis, but then the question appears why don’t you make it happen on your own? NetBeans PHP Community Council What I proposed is to create a NetBeans PHP Community Council that will be formed of people willing to change something, willing to create plugins for their own needs and for the needs of the community, test the plugins created by them too, and basically evolve NetBeans in direction they want to reach. I already talked with the NetBeans PHP team. They are only happy to help this Council, with technical advises, opening some APIs we might need to have access to, and other things. One important thing to mention is that this Council is a Community project, so though we’ll have direct discussions with NetBeans PHP Dev team, NetBeans is not the leading force here, it is the community. You can see more details about the goals and structure I proposed at NetBeans PHP Community Council wiki page. We use this mail list: dev@php.netbeans.org for discussions and topics related to the Council. How can I join To join the NetBeans PHP Community Council please send an email to dev@php.netbeans.org with the subject of the mail starting with [Council New Member]. You can subscribe to this mail list here:http://netbeans.org/projects/php/lists. in your mail please indicate your location, age and experience both in Java and PHP. I need these data to assign you to a team. A response will be send to you with your next assignment and some people to contact. I really hope that you’ll make a step forward and try to make your everyday use of NetBeans even more fun.

Hi all, today we would like to inform all of you that now you have a chance to improve NetBeans via NetBeans PHP Community Council. The author of this activity is Timur Poperecinii and he would like...

Features

Smarty: Configurable Comments and Code Templates

Hello, today we would like to show you few improvements we have prepared in PHP Smarty Framework for NetBeans 7.3. So let's talk about adjustable toggle comment action and code templates. Configurable Comments As some of you requested we implemented toggle comment action with adjustable behavior. In NetBeans 7.3 you can choose in Options between commenting as a "Smarty comments everywhere" or "Language sensitive comments" in Smarty Templates. Toggle comment language sensitive: Toggle comment as Smarty comment everywhere: Code Templates In NetBeans 7.3 we will provide by default many code templates inside Smarty templates or directly inside Smarty tags. Available should be code templates for all built-in or custom functions and modifiers of Smarty 3.x. Besides that you should be able to define additional custom templates easily in Options -> Editor -> Code Templates for "Smarty Templates" or directly for "Smarty Markup" (which means code templates inside Smarty tag). You can also take advantage of selection's template which are able to wrap your code with chosen Smarty tag. That's all for today. As always, please test it and report all the issues or enhancements you find in NetBeans BugZilla (component php, subcomponent Smarty).

Hello, today we would like to show you few improvements we have prepared in PHP Smarty Framework for NetBeans 7.3. So let's talk about adjustable toggle comment action and code templates. Configurable...

Features

How To Fix Your Use Statements?

Hi all! Today we would like to introduce you our new feature for NetBeans 7.2 which is called Fix Uses.... Have you ever used Java support in NetBeans and its Fix Imports... action? What does it do. It simply goes through your code and tries to resolve missing import statements. And as you know, Java imports are "something like" PHP use statements. So what that our new Fix Uses... action do? Exactly what you mean. It goes through your code and tries to resolve missing use statements. Note: We need to say, that this implemetation is really first and it doesn't cover all your use cases. But it does its work (which will be described later) and, hopefully, does it correctly. So lets describe the work, what this new action does: How to invoke Fix Uses... action? It's quite simple. Just click inside a namespace, where you want to resolve missing use statements and press Ctrl + Shift + I, go to Source -> Fix Uses..., or right click in a namespace and select Fix Uses.... Note: If you use namespace declarations without brackets, don't invoke Fix Uses... action at the end of a file on a whitespace! It will not work properly, because these whitespaces doesn't belong to a proper namespace. It's a lexer/parser bug. So when you use this action, invoke it somewhere inside a namespace. How to select proper types? When you successfully invoke Fix Uses... action, two things may happen. Resolving window occurs, or nothing - no resolving window occurs. When resolving window occurs, than you can see all possible classes (types in general) which you can resolve somehow. It means that you can select a proper type from a combo box which will be used for a new use statement. When nothing happens, then NetBeans thinks that all types are used properly and nothing has to be done. There is just one think in a resolving window. There is a check box which allows you to remove all unused statements which occur after confirming a resolving window. If we find some type, which can't be resolved (no type for this unqualified name exists, or you have some typo in PHPDoc), then it's mentioned in resolving window. What happens after confirmation of a resolving window? After confirmation, all resolved (selected) types are inserted into a use statement declaration area which is located right after the namespace declaration and all uses of these types in a code are replaced by their unqualified types. If you wanted to Remove Unused Uses, than they are removed. What happens when a conflict of type names occurs? When a conflict occurs, we try to create a use statement with an alias for every conflicting type (except the first one). No other possibilities are available in this first implementation, but we would like to implement some into the next version (e.g. to prefer unqualified names instead of aliases, etc.). Are there any possibilities, how to customize the default behavior? Yes. Not too much, but there are three of them. You can find them in Tools -> Options -> Editor -> Formatting -> PHP: Uses Prefer Fully Qualified Names over Use of Unqualified Names - if it's checked, then it means, that if you have a fully-qualified name used somewhere in a code, it will not be resolved by default (i.e. combo box in a resolving window will have a default value set to "Don't use type"). Prefer Multiple Use Statements Combined - if it's checked, it means, that all resolved types will be inserted as a one use statement with a combined types. Start Use Statements with a Namespace Separator - if it's checked, then all your resolved types will be prepended by a namespace separator. And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Editor). Thanks.

Hi all! Today we would like to introduce you our new feature for NetBeans 7.2 which is called Fix Uses.... Have you ever used Java support in NetBeans and its Fix Imports... action? What does it do. It...

Features

Several New Hints

Hi all! Today we would like to introduce you some of our new experimental hints for NetBeans 7.2. They are called: Unused Use Statement and Immutable Variables. Unused Use Statement This hint is quite simple. It highlights (underlines) your use statements, which are not used. Typical use case is after some refactoring, when you forgot to remove some obsolete use statements. This hint warns you on them and allows you to remove them easily. Just click on the hint bulb in the gutter and select Remove Unused Use Statement. And of course, it works in multiple use statements combined too. Immutable Variables The next one is the hint which checks too many assignments into a variable. And why? That's simple. Mostly you should use just one assignment into one variable. But sometimes you are lazy and you do something like: But it's quite wrong, because what you really do is: And that's exactly the case, when our new hint warns you, that Too many assignments (2) into variable $foo occured. Nothing more. Yes, we know that there are some cases, where could be more assignments and no warning should occur, e.g.: Because maybe one likes longer increment syntax more than the short one. So we tried to handle these cases to don't bother you if it's not a need. Note: We are almost sure that this hint doesn't cover all your use cases, because there are a lot of them. So if you find something strange, write it into our bugzilla so we can handle it better for you. Thanks for your patience! And the last thing is, that you can set the number of allowed assignments in Tools -> Options -> Editor -> Hints -> PHP: Immutable Variables. Note: This hint works just for a common variables, not for fields. We have an enhancement request for that and it should be implemented in next version of NetBeans (probably 7.3).And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Editor). Thanks.

Hi all! Today we would like to introduce you some of our new experimental hints for NetBeans 7.2. They are called: Unused Use Statement and Immutable Variables. Unused Use Statement This hint is quite...

Features

JavaScript: Code Folding

Today I would like to mentioned code folding in the new JavaScript editor support, which is available in the continual builds from our server. It's a basic feature, but was mentioned in a comment under the mentioned post. So you can fold comments and every code block between { and }. The current support allows only methods to be folded. The difference is shown below. In the picture on the left side is the current folding and on the right side the new one.   The code folding can be switched off in the Editor Options (Tools main menu -> Options -> Editor category -> General Tab). In this dialog you can also define which folds should be collapsed by default when you open a file. These options more closely fit Java editor needs, but you can see in the next picture how the options are mapped for JavaScript code.  The Method option folds all functions in the code. Other code blogs are fold through the option Tags and Other Code Blogs.  The documentation comments (starts with /**) are fold through Javadoc Comments and when you check Initial Comment, then all comments that start with /* are folded by default.  The new JavaScript editor also supports custom folds. To add your custom fold, type in two special comments as shown in this example: // <editor-fold> Your code goes here... // </editor-fold>You can define the default description of a collapsed fold by adding a "desc" attribute: // <editor-fold desc="This is my super secret genius code."> Your code goes here... // </editor-fold>You can set a fold to be collapsed by default by adding a "defaultstate" attribute: // <editor-fold defaultstate="collapsed"> Your code goes here... // </editor-fold> There is a code template that helps with writing custom fold comments. The abbreviation for the template is fcom. As I wrote the new JS support is available in the continual builds. Go here for more info.

Today I would like to mentioned code folding in the new JavaScript editor support, which is available in the continual builds from our server. It's a basic feature, but was mentioned in a...

Features

Brand New Annotations Support

Hi all! Today we would like to introduce you our brand new annotation support for NetBeans 7.2. The first thing which is different is the look of annotations in code completion. As you can see, there is a new annotation icon and an annotation type. Because we have a lot of modules with their own annotations, we differ them in code completion window by their type. We support annotations for: ApiGen (legacy PHPDoc annotations), PHPUnit, Doctrine 2 (ORM and ODM) and Symfony 2. Every annotation can be associated with some context. We recognize four of them: function, class/interface (type), method and field. It means that you will get just proper annotations for your class field as well as your global function. Do you have your own annotations? Or do you simply miss some? There is nothing hard to add it in there. We have a simple UI for adding your custom annotations! It's in Tools -> Options -> PHP -> Annotations. Here you can simply add, edit or delete your annotations. When you try to create new one, all fields are prefilled by some default values. So you really don't have to remember "how to use that crazy freemarker syntax". If you are satisfied with your new annotation, you can see it in a code completion window among other annotations. As you can see it has its own "Custom" type. That's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (component php, subcomponent Editor). Thanks.

Hi all! Today we would like to introduce you our brand new annotation support for NetBeans 7.2. The first thing which is different is the look of annotations in code completion. As you can see, there...

Features

Remote synchronization

Hi all, today we would like to show you another improvement we have prepared for NetBeans 7.2. Today, let's talk a little bit about remote synchronization. If you already use our simple (S)FTP client, this enhancement could be useful for you. Simply right click on Source Files and select Synchronize. Please notice that the remote synchronization works better only on the whole project (it means that the Source Files must be selected). The Synchronize action is also available on individual files (more files can be selected at once) but the suggested operation (download, upload etc.) does not work so precisely. Also please notice that the suggested operations are not 100% reliable since the timestamps provided by FTP servers are not exact. Once the remote files (their names and paths only, of course) are fetched, the main dialog appears: As you can see, NetBeans tries to suggest you operations (upload, download etc.) which should be done for each individual file of your project. If you are interested only in some particular changes, you can simply filter the list: Since we have a file conflict, we need to resolve it first. Fortunately this is very easy because we just select the desired file and click the Diff button . The remote version of our file is downloaded and compared with the local version. The resut is displayed in the dialog where you can easily apply and/or refuse the remote changes or even simply type manually to the local version of the selected file: Once we are done with our changes, the operation for the selected file changes to Upload and the file is marked with * (since we made some changes). Please notice that if you now click the Cancel button, in fact no changes are done in our local file. As you can see, if we have one or more files selected, we can change their operation to: no operation (file won't be synchronized) download upload delete (both local and remote file) reset (the operation is resetted to the original one suggested by NetBeans and also all changes done via Diff action are discarded) Now we are ready to synchronize our project. NetBeans will show us the synchronization summary (this dialog can be omitted, see the Show Summary checkbox on the previous image). The synchronization itself starts and we can see its progress and of course its result. As always, all the operations can be reviewed in the Output window. That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans BugZilla (component php, subcomponent FTP support).

Hi all, today we would like to show you another improvement we have prepared for NetBeans 7.2. Today, let's talk a little bit about remote synchronization. If you already use our simple (S)FTP client,...

Features

New JavaScript Editor

I did not write a blog post here for a few weeks. I think the last my post was  about releasing NetBeans 7.1 in the beginning of January. The reason is not that I would change the job:), but that I have concentrated on new JavaScript support/editor. The new JavaScript editor is written basically from scratch. The answer for the question "Why from beginning again, why do you just improve the old one?" is not easy and the decision has more aspects. One of the main reasons is that the old support was written 4 years ago and the architecture is limited. Also during the time, the APIs were changed and it was very hard to keep the editor up to date. Also there is a license issue etc. In short, it is time to rewrite the old JS editor.  We build up strong community about the PHP support in NetBeans and because many PHP developers also write JavaScript code I would like to ask you for a help. There is a continual PHP build with the new JavaScript support. You can download the result of the builds here. It's a zip file. You can unzip the file anywhere, where you want. I recommend to run the build with the new userdir, to avoid damaging your current userdir. It shouldn't happened, but just to be sure:). You can achieve this through the switch --userdir. So start the unzipped file from command line from the folder, where you unzipped it, can be done with this command on unix: bin/netbeans.sh --userdir /path/to/new/userdir and on windows: bin\netbeans.exe --userdir D:\path\to\new\userdir For the developers who use continual php build already, it's well known. There is also full IDE build with the new JavaScript support for people, who need more than only PHP support.  Because the builds with the new JavaScript editor is created from a branch, there are not nightly builds available. They will be, when we merge the branch to the trunk, but so far we have to work only with the mentioned continual build. We will merge our branch after branching NetBeans 7.2 from trunk. This is also answer for the question, what release of NetBeans will contain the new JS support. It should be the release after NetBeans 7.2. I'm asking you whether you could play with the builds or better, could work in the builds with new JavaScript support and tell us every issue that you run in. It can be everything what doesn't fit you, something doesn't work as you expected, something is slow, you want change the behaviour of a feature etc. Your input / comments are very important for us and it will help us to achieve the new JavaScript support that you need.  The best way how to communicate issues is through our Bugzilla, because it is simple to track them. Sure you can write comment here:), but still I prefer Bugzilla for any issue. You can click here (you should be already log in Bugzilla), a form for the new JavaScript issue is opened, with pre-filled component Editor and NO72 keyword. I will write about the single features later, but now I will mentioned a few features that should work in better way than in the old support.  Syntactic and semantic colouring Navigator Mark Occurrences and GoTo Declaration  Code CompletionCode Completion is invoked through keyboard shortcut CTRL+SPACE. The first invocation offers items that are found through a source model. Almost all editor features are based on the model, that is build from source code. There is a lot of work on the model yet, but it should offer better results. When the pop up window with code completion items is open and you press CTRL+SPACE again, then the code completion offers all elements that are in the project. In the pictures all elements that starts with letter 't'. Formatter with many options and more :) A few features are not still implemented that are supported in the old JavaScript support (for example jQuery support), but we are adding this features ASAP.

I did not write a blog post here for a few weeks. I think the last my post was  about releasing NetBeans 7.1 in the beginning of January. The reason is not that I would change the job:), but that I...

Features

Continuous Integration support

Hi all, today we would like to show you another great feature we have prepared for NetBeans 7.2. It is Continuous Integration support for PHP projects. Everyone who has plenty of tests for his/her PHP projects and needs to be sure that all the tests pass all the time, NetBeans 7.2 will try to help as much as possible. What exactly needs to be done? NetBeans uses Template for Jenkins Jobs for PHP Projects (created by Sebastian Bergmann, the author of PHPUnit - thanks for it, Sebastian!) so please ensure that all the necessary plugins and tools are installed both on your server as well as on your local computer - detailed instactions can be found on the project website. If you are done, register your Hudson or Jenkins instance in the NetBeans: Now, verify that everything is configured properly (in Tools > Options > PHP > Hudson): Now it is time to create a new build job for your project (the project must be versioned) right from your NetBeans: You can specify areas you are interested in: If everything goes well, the job is created on your CI server so you can run it: After the job finishes, NetBeans will show you the status of the job (success in our case). Also, you can easily open the job web page in your browser: The job web page can look similarly to this one: That's all for today, as always, please test it and report all the issues or enhancements you find in NetBeans BugZilla (component connecteddeveloper, subcomponent Hudson).

Hi all, today we would like to show you another great feature we have prepared for NetBeans 7.2. It is Continuous Integration support for PHP projects. Everyone who has plenty of tests for his/her PHP...

Features

New Old Hints

Hi all! It's several weeks when we last introduced you some pure PHP improvements, isn't it? But now, it's here again :-) Today we would like to write something about old well-known PHP hints, their new implementation and new improvements. Here they are: Order of Arguments, Uninitialized Variables and Accidental Assignments.Order of ArgumentsThis hint was renamed. Its old name was Argument with a default value should not be preceded by argument without a default value. It's really strange (and long :-) name, isn't it? So we renamed it to simpler version - Order of Arguments. It checks the order of arguments in your function/method declaration.Optional arguments should be on the right side and mandatory arguments on the left. This works equally as its previous version, but it has a new feature now - you can apply hint fix on arguments and reorder them automatically! Just press alt + enter on the line with declaration and select the right hint fix.When you apply the hint fix, everything will be ok :-)Uninitialized VariablesThe next one is a hint which checks an initialization of your variables, because it's a good practise to initialize every variable before its first use. This hint has been renamed too. Its old name was Variable might have not been initialized. Now it's called simply - Uninitialized Variables.Fixing this state is really simple, just add an initialization of that variable before its use and the hint warning will disappear.Accidental AssignmentsThe last one is Accidental Assignments hint. It was also renamed, its old name was Possible accidental assignment, assignments in conditions should be avoided. It checks assignments in conditional statements such as if, while, etc. Mostly you don't want to use assignments there, but comparisons (equal ==, or identical ===).If assignment is detected in a conditional statement, you can apply hint fix to repair it! It's another difference between old version and the new one. And you can choose equal fix (==), or identical fix (===), of course.And when you apply it, it will be fixed :-)There is just one UI connected with this hint, you can apply some settings on it.You can enable/disable checking assignments in sub-statements (e.g. if ($a === ($b = 25)) {}) and you can enable/disable checking assignments in while statements, because there are some use cases when assignment in a while statement makes sense.Do you miss some useful hints? Please, describe them and write it to us! Here as a comment, or into our bugzilla as a new enhancement for Editor component!And that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Editor). Thanks.

Hi all! It's several weeks when we last introduced you some pure PHP improvements, isn't it? But now, it's here again :-) Today we would like to write something about old well-known PHP hints,...

Features

Smart Method Parameters Pre-Filling

Hi all, today we would like to introduce you a new feature which will be, we hope, very helpful for you! It makes pre-filling of method/function parameters really smart.Let's start with an old behaviour. If you had a method with parameters described in PHPDoc, code completion of this function didn't care about that. It suggested you just the names of it's parameters, even though you had your own variables of a valid type declared right before code completion invocation.It was really annoying. But now, code completion suggests you your valid variables (of desired type), so you don't have to rewrite method calls everytime you use code completion. Isn't that great? I think it is! So now that suggestion looks like this: And the last thing. If you have your variables named exactly as parameters of suggested function and they are of desired types, you don't have to care about positions of these variables in invocation scope. They are used always, even though some other variables of desired types exist closer your completion invocation.And, of course, it works for PHP built-in functions as well.So that's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (product php, component Editor). Thanks.

Hi all, today we would like to introduce you a new feature which will be, we hope, very helpful for you! It makes pre-filling of method/function parameters really smart. Let's start with an old...

Features

New Features in PHP Debugger

Hi all, we are very happy today, because we can introduce you new features which were implemented into the PHP Debugger module. From now a debugging of PHP projects with NetBeans is much more comfortable. So enough words and let us introduce them!The first:Debugging has it's own tab in Tools -> Options -> PHP. So everything what was somehow connected with a debugging and was in a General tab is here now. The second:In the Debugging tab, there are two new text inputs which allow you to directly set XDebug settings. Now you can set: Maximum Depth of Structures - which sets a visibility of nested structures (like nested arrays, objects in objects, etc.) andMaximum Number of Children - which sets a visibility of e.g. array items during Watch evaluating (if you set it to 1 you will see only the first array item even though it has more then one item).The third:There is just another option which you can enable or disable in the new Debugging window. It's called Show Requested URLs. When it's enabled new Output Window occurs during debugging and currently processed URLs are showed there. They are clickable so after clicking on it a browser window is opened with the clicked URL. The fourth:And the last new option in the Debugging tab allows you to show or hide a new Output Window called PHP Debugger Console. If you want to see an output of your debugged scripts, just enable this option and you will see it in this new Output Window. But don't forget to set output_buffering = Off in your php.ini file to see it immediately. The fifth:It's the icing on the cake:) When you have an array in the Variables window (as a simple variable or a watch) you can see the number of array items and you don't have to expand a whole array. And that's all for today. There are many other smaller improvements and fixes so please test it and if you find something strange or you have an idea for a great new enhancement, please report it into our BugZilla (component php, subcomponent Debugger). Thanks.

Hi all, we are very happy today, because we can introduce you new features which were implemented into the PHP Debugger module. From now a debugging of PHP projects with NetBeans is much more...

Features

Instant Rename and Rename Refactoring

During the last weeks I have got  a few questions about rename refactoring and some users also complain to me that the refactoring in NetBeans 6.x was much faster. So I would like to explain the situation. For some people, who don't know, Instant Rename action and Rename Refactoring  can look like one action. But it's not true, even if  both actions use the same shortcut (CTRL + R). NetBeans 6.x contained only Instant Rename action (speaking about PHP support), which we can mark as very simple rename refactoring through one file. From NetBeans 7.0 the Instant Rename action works only in "non public" context. It means that this action is used for fast renaming variables that has local context like inside a method, or for renaming private methods and fields that can not be used outside of the scope, where they are declared. From user point of view these two action can be simply recognized. When is after CTRL+R called Instant Rename action, then the identifier is surrounded with rectangle and you can rename it directly in the file. It's fast and simple, also the usages of this identifier are renamed in the same time as you write. The picture below shows Instant Rename action for $message identifier, that is visible only in the print_test method and due this after CTRL+R is called Instant Rename. In NetBeans 7.0, there was added Rename Refactoring that is called for public identifiers. It means for identifiers that could be used in other files. If you press CTRL+R shortcut when the caret is inside $hello identifier from the picture above, NetBeans recognizes that $hello is declared / used in a global context and calls the Rename Refactoring that brings a dialog to change the name of the identifier. From this dialog you have to preview suggested changes, through pressing Preview button and then execute the refactoring through Do Refactoring button. Yes, it's more complicated from user point of view than Instant Rename, but in Rename Refactoring NetBeans can change more files at once. It should be  the developer responsibility to decide whether the suggested changes are right and the refactoring can be executed or in some files original name should be kept. Someone can argue that he doesn't use $hello variable in any other file so Instant Rename could be used in such case. Yes it's true, but in such case NetBeans has to know all usages of all identifiers and keep this informations up to date during editing a file. I'm sure that this is not possible due to the performance problems, mainly for big projects. So the usages are computed after pressing the Preview button. And why is the Refactor button always disabled in the Rename dialog and user has to always go through the preview phase? NetBeans has API and SPI for implementing refactoring actions and this dialog is a part of this infrastructure. If you rename an identifier for example in Java, the Refactor buttons is enabled, but Java is strongly type language and you can be almost in 99% sure that the IDE will suggest the right results. In PHP as a dynamic language, we can not be sure, what NetBeans finds is only a "guess". This is why NetBeans pushes developers to preview the changes for PHP rename. I hope that I have explain it clearly. I'm open to any discussion. What I have described above is situation in NetBeans 7.0, 7.0.1 and probably it will be also in NetBeans 7.1, because there is no plan to change it. Please write your opinion here.

During the last weeks I have got  a few questions about rename refactoring and some users also complain to me that the refactoring in NetBeans 6.x was much faster. So I would like to explain the...

Tips & Tricks

Adding a ShortCut for Generation PHP Documentation

This is a tip how to add a shortcut for generating PHP Doc for  a class or method / function. Probably every body who uses PHP editor in NetBeans knows that if you write start of PHP Documentation /** just before a class or method/function and hit ENTER, then NetBeans tries to finished the PHP Documentation and adds PHP Doc tag, if there are needed. This feature is not implemented as an action, it's based on the code that checks what is written on the line after pressing ENTER key. And because it's not an action, it's not possible to assign shortcut for it. If you want to use a shortcut, you can use editor macros. An editor macro is sequence of pressed keys and actions in the source editor and you can assign a shortcut to the macro. By default the editor toolbar contains buttons for recording macros. Start the recording of new macro through pressing Start Macro Recording button. Press type in editor /**, press ENTER key and then stop the recording through Stop Macro Recording button. In the New Macro Dialog place name of the macro. I have called it PHP Doc. Through the Set Shortcut ... button assign a short cut. In my case I have used ALT+D combination. You don't have to write it in the Shortcut text field, it's enough to press the combination of keys. Close the dialog and you are done. Now if you have cursor just before a class or method or function and press ALT+D shortcut the PHP Doc is generated. Like in the picture below. If you want to change the shortcut, edit or delete a macro, you have to go to the Tools->Options dialog, Editor category and choose Macros tab. The macros are more powerful, but this is a small example how can use it. Hope that it will be helpful for someone.

This is a tip how to add a shortcut for generating PHP Doc for  a class or method / function. Probably every body who uses PHP editor in NetBeans knows that if you write start of PHP Documentation /**...

Oracle

Integrated Cloud Applications & Platform Services