{"id":8743,"date":"2013-03-08T06:42:44","date_gmt":"2013-03-08T06:42:44","guid":{"rendered":"https:\/\/blog.jetbrains.com\/webide\/?p=5660"},"modified":"2013-03-08T06:42:44","modified_gmt":"2013-03-08T06:42:44","slug":"arrange-your-code-automatically-with-phpstorm-rearranger","status":"publish","type":"webide","link":"https:\/\/blog.jetbrains.com\/fr\/webide\/2013\/03\/arrange-your-code-automatically-with-phpstorm-rearranger","title":{"rendered":"Arrange your code automatically with PhpStorm (re)arranger"},"content":{"rendered":"<p style=\"text-align: center\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-5661 aligncenter\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-10.png\" alt=\"\" width=\"559\" height=\"181\" \/><\/p>\n<p>The easiest way to enhance code readability is to standardize its organization. For example, you can specify methods to be ordered after fields or keep dependent methods together.<\/p>\n<p>The good news is that starting with version 6, you can have your code rearranged automatically! All code generated by PhpStorm will follow these rules, so you don&#8217;t have to worry about it at every turn.<\/p>\n<p><!--more--><\/p>\n<p>Use this feature in one of these two ways:<\/p>\n<ol>\n<li>Invoke the <em>Rearrange Code<\/em> action explicitly (<em>Code | Rearrange Code<\/em> or with <em>Find action<\/em>&#8230;)<\/li>\n<p style=\"text-align: center\"><a href=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-rearranger_action.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-5668 aligncenter\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-16-300x87.png\" alt=\"\" width=\"300\" height=\"87\" \/><\/a><\/p>\n<li>Enable <em>Rearrange entries<\/em> in <em>Reformat Code<\/em> options.<\/li>\n<p style=\"text-align: center\"><a href=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-reformat_code.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-5665 aligncenter\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-71.png\" alt=\"\" width=\"608\" height=\"259\" \/><\/a><\/p>\n<\/ol>\n<p><strong>Settings<\/strong><\/p>\n<p>Arrangement settings are available at <em>Code Style | PHP | Arrangement<\/em>.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-rearranger_rules.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-5666 aligncenter\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-3.png\" alt=\"\" width=\"666\" height=\"778\" \/><\/a><\/p>\n<p><strong>Grouping rules:<\/strong><\/p>\n<ul>\n<li>Allows you to keep getters and setters together.<\/li>\n<li>Allows you to group overridden methods by class and interface. For instance, your class implements <em>ArrayAcces<\/em> and <em>Serializable<\/em> interfaces, so you want to keep your methods grouped by the interface where they are declared.<\/li>\n<li>Keeps dependent methods together. For instance, <em>service()<\/em> method calls <em>util()<\/em> method, and you want to keep <em>util()<\/em> after <em>service()<\/em>.<\/li>\n<\/ul>\n<p>To create a new rule, click the <em>Add rule<\/em> button in the upper right corner of the rules list. Configure it by type and modifier, add a name rule (like \u201cinit.*\u201d or \u201c*Test\u201d) and\/or set order type, if needed.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-rearranger_add_rule.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-5667 aligncenter\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2013\/02\/webide-122.png\" alt=\"\" width=\"587\" height=\"363\" \/><\/a><\/p>\n<p>Feel free to share your feedback and submit bug reports in our <a href=\"http:\/\/youtrack.jetbrains.com\/dashboard\/WI?\" target=\"_blank\" rel=\"noopener\">issue tracker<\/a>.<\/p>\n<p><em>Keep you code arranged with pleasure!<\/em><br \/>\n<em>&#8211; JetBrains Web IDE Team<\/em><\/p>\n","protected":false},"author":74,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","categories":[808],"tags":[228,45,1216],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/webide\/8743"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/webide"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/types\/webide"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/comments?post=8743"}],"version-history":[{"count":0,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/webide\/8743\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/media?parent=8743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/categories?post=8743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/tags?post=8743"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/cross-post-tag?post=8743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}