![]() ![]() 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 |