Using region (code folding) in PHPStorm


People who use VS to write C# are very fond of it.#regionImplementation of the code folding function. PHP itself does not have similar functions, but as a PHPer, it is certainly unwilling to show weakness in this regard. This article describes the use of the most powerful PHP IDE in history – PHPStorm to achieve code folding (note: not necessarily a function or a class).

As a matter of fact, there are only three lines in the text, with all the nonsense said before.

//region description

Someone wants to say you don’t have a picture. You say Smartisan. Okay, I’ll put up a picture.

  1. Expansion effect map:

Expansion diagram

  1. Folding effect map:

Folding diagram

Note: Only valid under PHPStorm. Of course, it supports not only PHP code, but also JS code.

Original address

Recommended Today

Implementation of PHP Facades

Example <?php class RealRoute{ public function get(){ Echo’Get me’; } } class Facade{ public static $resolvedInstance; public static $app; public static function __callStatic($method,$args){ $instance = static::getFacadeRoot(); if(!$instance){ throw new RuntimeException(‘A facade root has not been set.’); } return $instance->$method(…$args); } // Get the Facade root object public static function getFacadeRoot() { return static::resolveFacadeInstance(static::getFacadeAccessor()); } protected […]