Please report any problems to our issue tracker, or add comments to this post. See all the PHP-related bug-fixes and improvements in our issue tracker or the full list of changes in the release notes. Fixed: Exception with copy & paste on debug watches window.Place the cursor on a class name when opening a file if the file contains only one class.Import reference on paste: ask to reuse existing alias.Ability to move multiple functions and constants at once.Note that it’s much better to perform this kind of refactoring with PhpStorm – instead of doing manually – because PhpStorm will track variables, names, and other things for you and thus ensure that the changes are done safely.ĭiscover other cool refactorings by pressing Ctrl+T (Shift+Ctrl+Alt+T) at any place in your code. If the selected piece of code contains variables of outer scope, these will be added as parameters of a new method. PhpStorm will suggest a name and ask you if you would like to change it. Next, you’ll see a popup with a preview and some options that will help you create a new method out of those lines. Select a few lines of code that implement some related logic and then click Cmd+Alt+M (Ctrl+Alt+M on Win/Linux). Let’s say you have a fat controller or service and you want to start refactoring it. It can be used to easily move some piece of code to a separate method. Usability Improvements for Extract MethodĪnother handy refactoring available in PhpStorm is Extract Method. Now you’ll be able to not only introduce a constant but also add it to another class which it matches better. Put the caret over the value, and press Cmd+Alt+C (Ctrl+Alt+C on Win/Linux). You can do that by running the corresponding refactoring called Extract Constant. This is a potential source of bugs in the application so you may want to quickly move values to constants. Sometimes you may find the usage of magic numbers or, broadly, any magic values in your code. Or add a tag if it’s not in the list yet.Īlso, now when you run the Add field intention, PhpStorm will generate a PHPDoc for it too: Select the field and move it up/down with arrow buttons to define the lineup. In PhpStorm 2019.1, you can configure the order of generated fields. For example, it’s very handy to add some aligning to improve the visual perception of a doc block: You may configure how you want the comments to look, by going to Preferences | Editor | Code Style | PHP and opening the PHPDoc tab. PhpStorm is able to automatically generate PHPDoc comments based on your code. What’s even cooler about Code Cleanup is that you may run it automatically before committing to VCS! This will run fixes on all files selected for commit. You may run all or selected cleanups at any time by calling Code->Code Cleanup… from the menu. You can now run any of those to fix code style automatically. This one includes support for two popular fixers for PHP_CodeSniffer rules: PHP CS Fixer and phpcbf. PhpStorm can replace them by either adding a corresponding ‘use’ statement or just removing the extra namespace part. Here we have two inspections that can fix a redundant usage of fully qualified class names. We’ve added following cleanups in this release: Starting from PhpStorm 2019.1, Code Cleanup comes with PHP-specific intentions. In PhpStorm 2018.3 and earlier, this tool included only JavaScript inspections inherited from WebStorm as all of its features are bundled in PhpStorm. In PhpStorm, Code Cleanup is a batch action that lets you run a number of safe transformations on the whole project or a part of it. Or, if you have the previous PhpStorm 2019.1 EAP build (191.4738.10) installed, you should soon get a notification in the IDE about a patch update. You can download it on the website or via JetBrains Toolbox App. This build delivers code cleanup for PHP, ability to define the order of tags in PHPDoc, improvements for Introduce Constant and Extract Method refactorings, and even more!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |