Skip to content

Commit 4b3718e

Browse files
committed
2.15 - clean ups
1 parent d51dd1e commit 4b3718e

File tree

84 files changed

+442
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+442
-145
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ Choose from the list of available rules:
709709
Configuration options:
710710

711711
- ``functions`` (a subset of ``['get_called_class', 'get_class',
712-
'php_sapi_name', 'phpversion', 'pi', 'get_class_this']``): list of
712+
'get_class_this', 'php_sapi_name', 'phpversion', 'pi']``): list of
713713
function names to fix; defaults to ``['get_class', 'php_sapi_name',
714714
'phpversion', 'pi']``
715715

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"symfony/yaml": "^3.0 || ^4.0 || ^5.0"
4747
},
4848
"suggest": {
49+
"ext-dom": "For handling output formats in XML",
4950
"ext-mbstring": "For handling non-UTF8 characters in cache signature.",
5051
"php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.",
5152
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.",

php-cs-fixer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ foreach (['json', 'tokenizer'] as $extension) {
4646
}
4747
unset($extension);
4848

49-
set_error_handler(function ($severity, $message, $file, $line) {
49+
set_error_handler(static function ($severity, $message, $file, $line) {
5050
if ($severity & error_reporting()) {
5151
throw new ErrorException($message, 0, $severity, $file, $line);
5252
}

src/Console/Command/DescribeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private function describeRule(OutputInterface $output, $name)
197197
}
198198
} else {
199199
$allowed = array_map(
200-
function ($type) {
200+
static function ($type) {
201201
return '<comment>'.$type.'</comment>';
202202
},
203203
$option->getAllowedTypes()

src/Console/Command/HelpCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ static function (FixerOptionInterface $optionA, FixerOptionInterface $optionB) {
534534
}
535535
} else {
536536
$allowed = array_map(
537-
function ($type) {
537+
static function ($type) {
538538
return '<comment>'.$type.'</comment>';
539539
},
540540
$option->getAllowedTypes()

src/Differ/DiffConsoleFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static function ($line) use ($isDecorated, $lineTemplate) {
7171
'/^(\-.*)/',
7272
'/^(@.*)/',
7373
],
74-
function ($matches) {
74+
static function ($matches) {
7575
if ('+' === $matches[0][0]) {
7676
$colour = 'green';
7777
} elseif ('-' === $matches[0][0]) {

src/DocBlock/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private function getTypesContent()
286286
}
287287

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

src/DocBlock/DocBlock.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ public function getLines()
7878
*/
7979
public function getLine($pos)
8080
{
81-
if (isset($this->lines[$pos])) {
82-
return $this->lines[$pos];
83-
}
81+
return isset($this->lines[$pos]) ? $this->lines[$pos] : null;
8482
}
8583

8684
/**
@@ -121,9 +119,7 @@ public function getAnnotation($pos)
121119
{
122120
$annotations = $this->getAnnotations();
123121

124-
if (isset($annotations[$pos])) {
125-
return $annotations[$pos];
126-
}
122+
return isset($annotations[$pos]) ? $annotations[$pos] : null;
127123
}
128124

129125
/**

src/DocBlock/Line.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function remove()
133133
*/
134134
public function addBlank()
135135
{
136-
$matched = Preg::match('/^([ \t]*\*)[^\r\n]*(\r?\n)$/', $this->content, $matches);
136+
$matched = Preg::match('/^(\h*\*)[^\r\n]*(\r?\n)$/', $this->content, $matches);
137137

138138
if (1 !== $matched) {
139139
return;

src/DocBlock/ShortDescription.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,7 @@ public function getEnd()
5959
$reachedContent = true;
6060
}
6161
}
62+
63+
return null;
6264
}
6365
}

0 commit comments

Comments
 (0)