{"id":320041,"date":"2021-03-22T15:00:45","date_gmt":"2021-03-22T15:00:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320041"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320041","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0434\u0430 \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0414\u0430\u043d\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 code style \u0432 \u0432\u0430\u0448\u0435\u043c php \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0428\u0430\u0433 1 \u2014 \u0414\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e composer (\u0443 \u043a\u043e\u0433\u043e \u043e\u043d \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c)<\/h3>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u043e\u0440\u043d\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d composer, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/getcomposer.org\" rel=\"nofollow noopener noreferrer\">getcomposer.org<\/a><\/p>\n<pre><code class=\"bash\">composer init <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0428\u0430\u0433 2 \u2014 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c .gitignore<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">###&gt; phpstorm ### .idea ###&lt; phpstorm ###  \/vendor\/  ###&gt; friendsofphp\/php-cs-fixer ### \/.php_cs \/.php_cs.cache ###&lt; friendsofphp\/php-cs-fixer ### <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0428\u0430\u0433 3 \u2014 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"bash\">composer require --dev friendsofphp\/php-cs-fixer symfony\/process symfony\/console  squizlabs\/php_codesniffer <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0428\u0430\u0433 4 \u2014 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0445\u0443\u043a\u0430<\/h3>\n<p>  \u0421\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0447\u0435\u043c \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e php \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043d\u0435\u043c. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u0438\u043a \u0432 \u043f\u0430\u043f\u043e\u0447\u043a\u0435 hooks\/pre-commit.php<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">#!\/usr\/bin\/php  &lt;?php define('VENDOR_DIR', __DIR__.'\/..\/..\/vendor'); require VENDOR_DIR.'\/autoload.php';  use Symfony\\Component\\Console\\Input\\InputInterface; use Symfony\\Component\\Console\\Output\\OutputInterface; use Symfony\\Component\\Console\\Application; use Symfony\\Component\\Process\\Process;  class CodeQualityTool extends Application {     \/**      * @var OutputInterface      *\/     private $output;     \/**      * @var InputInterface      *\/     private $input;      const PHP_FILES_IN_SRC = '\/^src\\\/(.*)(\\.php)$\/';      public function __construct()     {         parent::__construct('Ecombo Quality Tool', '1.0.0');     }      \/**      * @param InputInterface $input      * @param OutputInterface $output      *      * @return void      * @throws \\Exception      *\/     public function doRun(InputInterface $input, OutputInterface $output)     {         $this-&gt;input = $input;         $this-&gt;output = $output;         $output-&gt;writeln('&lt;fg=white;options=bold;bg=red&gt;Code Quality Tool&lt;\/fg=white;options=bold;bg=red&gt;');         $output-&gt;writeln('&lt;info&gt;Fetching files&lt;\/info&gt;');         $files = $this-&gt;extractCommitedFiles();         $output-&gt;writeln('&lt;info&gt;Running PHPLint&lt;\/info&gt;');          if (! $this-&gt;phpLint($files)) {             throw new \\Exception('There are some PHP syntax errors!');         }          $output-&gt;writeln('&lt;info&gt;Checking code style with PHPCS&lt;\/info&gt;');          if (! $this-&gt;codeStylePsr($files)) {             throw new \\Exception(sprintf('There are PHPCS coding standards violations!'));         }          $output-&gt;writeln('&lt;info&gt;Well done!&lt;\/info&gt;');     }      \/**      * @return array      *\/     private function extractCommitedFiles()     {         $output = array();         $against = 'HEAD';         exec(&quot;git diff-index --cached --name-status $against | egrep '^(A|M)' | awk '{print $2;}'&quot;, $output);          return $output;     }      \/**      * @param array $files      *      * @return bool      *      * @throws \\Exception      *\/     private function phpLint($files)     {         $needle = '\/(\\.php)|(\\.inc)$\/';         $succeed = true;          foreach ($files as $file) {             if (! preg_match($needle, $file)) {                 continue;             }              $process = new Process(['php', '-l', $file]);             $process-&gt;run();              if (! $process-&gt;isSuccessful()) {                 $this-&gt;output-&gt;writeln($file);                 $this-&gt;output-&gt;writeln(sprintf('&lt;error&gt;%s&lt;\/error&gt;', trim($process-&gt;getErrorOutput())));                  if ($succeed) {                     $succeed = false;                 }             }         }          return $succeed;     }      \/**      * @param array $files      *      * @return bool      *\/     private function codeStylePsr(array $files)     {         $succeed = true;         $needle = self::PHP_FILES_IN_SRC;         $standard = 'PSR2';          foreach ($files as $file) {             if (! preg_match($needle, $file)) {                 continue;             }              $phpCsFixer = new Process([                 'php',                 VENDOR_DIR.'\/bin\/phpcs',                 '-n',                 '--standard='.$standard,                 $file,             ]);              $phpCsFixer-&gt;setWorkingDirectory(__DIR__.'\/..\/..\/');             $phpCsFixer-&gt;run();              if (! $phpCsFixer-&gt;isSuccessful()) {                 $this-&gt;output-&gt;writeln(sprintf('&lt;error&gt;%s&lt;\/error&gt;', trim($phpCsFixer-&gt;getOutput())));                  if ($succeed) {                     $succeed = false;                 }             }         }          return $succeed;     } }  $console = new CodeQualityTool(); $console-&gt;run(); <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c 3 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<br \/>   \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438<br \/>   \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 PSR2 \u0447\u0435\u0440\u0435\u0437 code sniffer<\/p>\n<p>  PSR2 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 code sniffer. \u0421\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0432\u0435\u0434\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <\/p>\n<pre><code class=\"bash\"> vendor\/bin\/phpcs -i <\/code><\/pre>\n<h3>\u0428\u0430\u0433 5 \u2014 \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c composer \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 pre-commit<\/h3>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043d\u0430 pre commit \u0445\u0443\u043a \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u0438\u043a \u0441 \u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432 3 \u043f\u0443\u043d\u043a\u0442\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 .git\/hooks\/pre-commit. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043d\u043e \u043a\u0443\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b\u0438\u043a \u0438 \u043f\u043e\u0432\u0435\u0448\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 composer install. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.  <\/p>\n<h3>5.1 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u0438\u043a pre-commit.php \u0432 \u043f\u0430\u043f\u043a\u0443 \u0445\u0443\u043a\u043e\u0432 \u0433\u0438\u0442\u0430<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u0438\u043a src\/Composer\/ScriptHandler.php<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  namespace App\\Composer;  use Composer\\Script\\Event;  class ScriptHandler {     \/**      * @param Event $event      *      * @return bool      *\/     public static function preHooks(Event $event)     {         $io = $event-&gt;getIO();         $gitHook = '.git\/hooks\/pre-commit';          if (file_exists($gitHook)) {             unlink($gitHook);             $io-&gt;write('&lt;info&gt;Pre-commit hook removed!&lt;\/info&gt;');         }          return true;     }      \/**      * @param Event $event      *      * @return bool      *      * @throws \\Exception      *\/     public static function postHooks(Event $event)     {         \/** @var array $extras *\/         $extras = $event-&gt;getComposer()-&gt;getPackage()-&gt;getExtra();          if (! array_key_exists('hooks', $extras)) {             throw new \\InvalidArgumentException('The parameter handler needs to be configured through the extra.hooks setting.');         }         $configs = $extras['hooks'];         if (! array_key_exists('pre-commit', $configs)) {             throw new \\InvalidArgumentException('The parameter handler needs to be configured through the extra.hooks.pre-commit setting.');         }          if (file_exists('.git\/hooks')) {             \/** @var \\Composer\\IO\\IOInterface $io *\/             $io = $event-&gt;getIO();             $gitHook = '.git\/hooks\/pre-commit';             $docHook = $configs['pre-commit'];             copy($docHook, $gitHook);             chmod($gitHook, 0777);             $io-&gt;write('&lt;info&gt;Pre-commit hook created!&lt;\/info&gt;');         }          return true;     } } <\/code><\/pre>\n<p>  5.2 \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c composer \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<br \/>  \u0432 composer.json \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0435\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"json\">    &quot;scripts&quot;: {         &quot;post-install-cmd&quot;: [             &quot;App\\\\Composer\\\\ScriptHandler::postHooks&quot;         ],         &quot;post-update-cmd&quot;: [             &quot;App\\\\Composer\\\\ScriptHandler::postHooks&quot;         ],         &quot;pre-update-cmd&quot;: &quot;App\\\\Composer\\\\ScriptHandler::preHooks&quot;,         &quot;pre-install-cmd&quot;: &quot;App\\\\Composer\\\\ScriptHandler::preHooks&quot;     },     &quot;extra&quot;: {         &quot;hooks&quot;: {             &quot;pre-commit&quot;: &quot;hooks\/pre-commit.php&quot;         }     } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  <code>pre-update-cmd, pre-install-cmd<\/code> \u2014 \u043f\u0435\u0440\u0435\u0434 install \u0438 update \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/p>\n<p>  <code>post-install-cmd, post-update-cmd<\/code> \u2014 \u043f\u043e\u0441\u043b\u0435 install \u0438 update \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 pre commit<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0444\u0430\u0439\u043b\u043a\u0438\u043a composer.json \u043f\u0440\u0438\u043c\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">composer.json<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"json\">{     &quot;name&quot;: &quot;admin\/test&quot;,     &quot;authors&quot;: [         {             &quot;name&quot;: &quot;vitaly.gorbunov&quot;,             &quot;email&quot;: &quot;cezar62882@gmail.com&quot;         }     ],     &quot;minimum-stability&quot;: &quot;stable&quot;,     &quot;require&quot;: {},     &quot;autoload&quot;: {         &quot;psr-4&quot;: {             &quot;App\\\\&quot;: &quot;src\/&quot;         }     },     &quot;scripts&quot;: {         &quot;post-install-cmd&quot;: [             &quot;App\\\\Composer\\\\ScriptHandler::postHooks&quot;         ],         &quot;post-update-cmd&quot;: [             &quot;App\\\\Composer\\\\ScriptHandler::postHooks&quot;         ],         &quot;pre-update-cmd&quot;: &quot;App\\\\Composer\\\\ScriptHandler::preHooks&quot;,         &quot;pre-install-cmd&quot;: &quot;App\\\\Composer\\\\ScriptHandler::preHooks&quot;     },     &quot;require-dev&quot;: {         &quot;friendsofphp\/php-cs-fixer&quot;: &quot;^2.16&quot;,         &quot;symfony\/process&quot;: &quot;^5.0&quot;,         &quot;symfony\/console&quot;: &quot;^5.0&quot;,         &quot;squizlabs\/php_codesniffer&quot;: &quot;^3.5&quot;     },     &quot;extra&quot;: {         &quot;hooks&quot;: {             &quot;pre-commit&quot;: &quot;hooks\/pre-commit.php&quot;         }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 composer install \u0447\u0442\u043e\u0431\u044b \u0444\u0430\u0439\u043b\u0438\u043a \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043a\u0443\u0434\u0430 \u043d\u0430\u0434\u043e.<\/p>\n<p>  \u0412\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u0437\u0430\u043a\u043e\u043c\u0438\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0441 \u043a\u0440\u0438\u0432\u044b\u043c code style \u0442\u043e git console \u0432\u0430\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u043a\u0430\u0436\u0435\u0442.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 src \u0444\u0430\u0439\u043b\u0438\u043a MyClass.php \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App;  class MyClass {      private $var1; private $var2;      public function __construct() {     }      public function test() {      } } <\/code><\/pre>\n<p>  \u041f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u043a\u043e\u043c\u0438\u0442\u0438\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"bash\">MBP-Admin:test admin$ git commit -am 'test'  Code Quality Tool Fetching files Running PHPLint Checking code style with PHPCS FILE: \/Users\/admin\/projects\/test\/src\/MyClass.php ---------------------------------------------------------------------- FOUND 5 ERRORS AFFECTING 5 LINES ----------------------------------------------------------------------   8 | ERROR | [x] Each PHP statement must be on a line by itself  10 | ERROR | [x] Opening brace should be on a new line  13 | ERROR | [x] Opening brace should be on a new line  15 | ERROR | [x] Function closing brace must go on the next line     |       |     following the body; found 1 blank lines before     |       |     brace  16 | ERROR | [x] Expected 1 newline at end of file; 0 found ---------------------------------------------------------------------- PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------  Time: 49ms; Memory: 6MB  In pre-commit line 53:                                                    There are PHPCS coding standards violations!                       <\/code><\/pre>\n<p>  \u0423\u0440\u0430, \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/548336\/\"> https:\/\/habr.com\/ru\/post\/548336\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0414\u0430\u043d\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 code style \u0432 \u0432\u0430\u0448\u0435\u043c php \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320041","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320041"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320041\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}