Browse Source

minor #4839 2.15 - clean ups (SpacePossum)

This PR was merged into the 2.15 branch.

Discussion
----------

2.15 - clean ups

Just some stuff I found over the last weeks when trying to wrap up for the new releases.

Commits
-------

4b3718e6 2.15 - clean ups
SpacePossum 5 years ago
parent
commit
cd1a868582

+ 1 - 1
README.rst

@@ -709,7 +709,7 @@ Choose from the list of available rules:
   Configuration options:
 
   - ``functions`` (a subset of ``['get_called_class', 'get_class',
-    'php_sapi_name', 'phpversion', 'pi', 'get_class_this']``): list of
+    'get_class_this', 'php_sapi_name', 'phpversion', 'pi']``): list of
     function names to fix; defaults to ``['get_class', 'php_sapi_name',
     'phpversion', 'pi']``
 

+ 1 - 0
composer.json

@@ -46,6 +46,7 @@
         "symfony/yaml": "^3.0 || ^4.0 || ^5.0"
     },
     "suggest": {
+        "ext-dom": "For handling output formats in XML",
         "ext-mbstring": "For handling non-UTF8 characters in cache signature.",
         "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.",
         "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.",

+ 1 - 1
php-cs-fixer

@@ -46,7 +46,7 @@ foreach (['json', 'tokenizer'] as $extension) {
 }
 unset($extension);
 
-set_error_handler(function ($severity, $message, $file, $line) {
+set_error_handler(static function ($severity, $message, $file, $line) {
     if ($severity & error_reporting()) {
         throw new ErrorException($message, 0, $severity, $file, $line);
     }

+ 1 - 1
src/Console/Command/DescribeCommand.php

@@ -197,7 +197,7 @@ final class DescribeCommand extends Command
                     }
                 } else {
                     $allowed = array_map(
-                        function ($type) {
+                        static function ($type) {
                             return '<comment>'.$type.'</comment>';
                         },
                         $option->getAllowedTypes()

+ 1 - 1
src/Console/Command/HelpCommand.php

@@ -534,7 +534,7 @@ EOF
                             }
                         } else {
                             $allowed = array_map(
-                                function ($type) {
+                                static function ($type) {
                                     return '<comment>'.$type.'</comment>';
                                 },
                                 $option->getAllowedTypes()

+ 1 - 1
src/Differ/DiffConsoleFormatter.php

@@ -71,7 +71,7 @@ final class DiffConsoleFormatter
                                     '/^(\-.*)/',
                                     '/^(@.*)/',
                                 ],
-                                function ($matches) {
+                                static function ($matches) {
                                     if ('+' === $matches[0][0]) {
                                         $colour = 'green';
                                     } elseif ('-' === $matches[0][0]) {

+ 1 - 1
src/DocBlock/Annotation.php

@@ -286,7 +286,7 @@ class Annotation
             }
 
             $matchingResult = Preg::match(
-                '{^(?:\s*\*|/\*\*)\s*@'.$name.'\s+'.self::REGEX_TYPES.'(?:[ \t].*)?$}sx',
+                '{^(?:\s*\*|/\*\*)\s*@'.$name.'\s+'.self::REGEX_TYPES.'(?:\h.*)?$}sx',
                 $this->lines[0]->getContent(),
                 $matches
             );

+ 2 - 6
src/DocBlock/DocBlock.php

@@ -78,9 +78,7 @@ class DocBlock
      */
     public function getLine($pos)
     {
-        if (isset($this->lines[$pos])) {
-            return $this->lines[$pos];
-        }
+        return isset($this->lines[$pos]) ? $this->lines[$pos] : null;
     }
 
     /**
@@ -121,9 +119,7 @@ class DocBlock
     {
         $annotations = $this->getAnnotations();
 
-        if (isset($annotations[$pos])) {
-            return $annotations[$pos];
-        }
+        return isset($annotations[$pos]) ? $annotations[$pos] : null;
     }
 
     /**

+ 1 - 1
src/DocBlock/Line.php

@@ -133,7 +133,7 @@ class Line
      */
     public function addBlank()
     {
-        $matched = Preg::match('/^([ \t]*\*)[^\r\n]*(\r?\n)$/', $this->content, $matches);
+        $matched = Preg::match('/^(\h*\*)[^\r\n]*(\r?\n)$/', $this->content, $matches);
 
         if (1 !== $matched) {
             return;

+ 2 - 0
src/DocBlock/ShortDescription.php

@@ -59,5 +59,7 @@ final class ShortDescription
                 $reachedContent = true;
             }
         }
+
+        return null;
     }
 }

Some files were not shown because too many files changed in this diff