Skip to content

Commit 89d3b74

Browse files
jtojnarj0k3r
authored andcommitted
Rectorize to PHP 7.4
Switches to short anonymous function syntax.
1 parent e792644 commit 89d3b74

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323

2424
// Define what rule sets will be applied
2525
$rectorConfig->sets([
26-
LevelSetList::UP_TO_PHP_72,
26+
LevelSetList::UP_TO_PHP_74,
2727
]);
2828

2929
// is your PHP version different from the one your refactor to?
30-
$rectorConfig->phpVersion(PhpVersion::PHP_72);
30+
$rectorConfig->phpVersion(PhpVersion::PHP_74);
3131
};

src/Readability.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,7 @@ protected function grabArticle(?\DOMElement $page = null)
11201120

11211121
$topCandidates = array_filter(
11221122
$topCandidates,
1123-
function ($v, $idx) {
1124-
return 0 === $idx || null !== $v;
1125-
},
1123+
fn ($v, $idx) => 0 === $idx || null !== $v,
11261124
\ARRAY_FILTER_USE_BOTH
11271125
);
11281126
$topCandidate = $topCandidates[0];
@@ -1471,9 +1469,7 @@ private function isPhrasingContent($node): bool
14711469
&& !\in_array(
14721470
false,
14731471
array_map(
1474-
function ($c) {
1475-
return $this->isPhrasingContent($c);
1476-
},
1472+
fn ($c) => $this->isPhrasingContent($c),
14771473
iterator_to_array($node->childNodes)
14781474
),
14791475
true
@@ -1489,9 +1485,7 @@ private function hasSingleTagInsideElement(\DOMElement $node, string $tag): bool
14891485

14901486
$a = array_filter(
14911487
iterator_to_array($node->childNodes),
1492-
function ($childNode) {
1493-
return $childNode instanceof \DOMText && preg_match($this->regexps['hasContent'], $this->getInnerText($childNode));
1494-
}
1488+
fn ($childNode) => $childNode instanceof \DOMText && preg_match($this->regexps['hasContent'], $this->getInnerText($childNode))
14951489
);
14961490

14971491
return 0 === \count($a);

0 commit comments

Comments
 (0)