mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-26 22:16:12 +00:00
Rectorize to PHP 7.4
Switches to short anonymous function syntax.
This commit is contained in:
committed by
Jérémy Benoist
parent
e792644fe8
commit
89d3b74259
+2
-2
@@ -23,9 +23,9 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
// Define what rule sets will be applied
|
// Define what rule sets will be applied
|
||||||
$rectorConfig->sets([
|
$rectorConfig->sets([
|
||||||
LevelSetList::UP_TO_PHP_72,
|
LevelSetList::UP_TO_PHP_74,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// is your PHP version different from the one your refactor to?
|
// is your PHP version different from the one your refactor to?
|
||||||
$rectorConfig->phpVersion(PhpVersion::PHP_72);
|
$rectorConfig->phpVersion(PhpVersion::PHP_74);
|
||||||
};
|
};
|
||||||
|
|||||||
+3
-9
@@ -1120,9 +1120,7 @@ class Readability implements LoggerAwareInterface
|
|||||||
|
|
||||||
$topCandidates = array_filter(
|
$topCandidates = array_filter(
|
||||||
$topCandidates,
|
$topCandidates,
|
||||||
function ($v, $idx) {
|
fn ($v, $idx) => 0 === $idx || null !== $v,
|
||||||
return 0 === $idx || null !== $v;
|
|
||||||
},
|
|
||||||
\ARRAY_FILTER_USE_BOTH
|
\ARRAY_FILTER_USE_BOTH
|
||||||
);
|
);
|
||||||
$topCandidate = $topCandidates[0];
|
$topCandidate = $topCandidates[0];
|
||||||
@@ -1471,9 +1469,7 @@ class Readability implements LoggerAwareInterface
|
|||||||
&& !\in_array(
|
&& !\in_array(
|
||||||
false,
|
false,
|
||||||
array_map(
|
array_map(
|
||||||
function ($c) {
|
fn ($c) => $this->isPhrasingContent($c),
|
||||||
return $this->isPhrasingContent($c);
|
|
||||||
},
|
|
||||||
iterator_to_array($node->childNodes)
|
iterator_to_array($node->childNodes)
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
@@ -1489,9 +1485,7 @@ class Readability implements LoggerAwareInterface
|
|||||||
|
|
||||||
$a = array_filter(
|
$a = array_filter(
|
||||||
iterator_to_array($node->childNodes),
|
iterator_to_array($node->childNodes),
|
||||||
function ($childNode) {
|
fn ($childNode) => $childNode instanceof \DOMText && preg_match($this->regexps['hasContent'], $this->getInnerText($childNode))
|
||||||
return $childNode instanceof \DOMText && preg_match($this->regexps['hasContent'], $this->getInnerText($childNode));
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return 0 === \count($a);
|
return 0 === \count($a);
|
||||||
|
|||||||
Reference in New Issue
Block a user