Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: "Checkout"
Expand Down
6 changes: 3 additions & 3 deletions src/Readability.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Readability implements LoggerAwareInterface
'enclose-text' => true,
'merge-divs' => true,
// 'merge-spans' => true,
'input-encoding' => '????',
'input-encoding' => 'utf8',
'output-encoding' => 'utf8',
'hide-comments' => true,
];
Expand Down Expand Up @@ -1118,7 +1118,7 @@ protected function grabArticle(?\DOMElement $page = null)

$topCandidates = array_filter(
$topCandidates,
fn ($v, $idx) => 0 === $idx || null !== $v,
static fn ($v, $idx) => 0 === $idx || null !== $v,
\ARRAY_FILTER_USE_BOTH
);
$topCandidate = $topCandidates[0];
Expand Down Expand Up @@ -1481,7 +1481,7 @@ private function isPhrasingContent($node): bool
private function hasSingleTagInsideElement(\DOMElement $node, string $tag): bool
{
$childNodes = iterator_to_array($node->childNodes);
$children = array_filter($childNodes, fn ($childNode) => $childNode instanceof \DOMElement);
$children = array_filter($childNodes, static fn ($childNode) => $childNode instanceof \DOMElement);

// There should be exactly 1 element child with given tag
if (1 !== \count($children) || $children[0]->nodeName !== $tag) {
Expand Down
3 changes: 2 additions & 1 deletion tests/ReadabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase
public function testConstructDefault(): void
{
$readability = $this->getReadability('');
$this->assertSame('utf8', $readability->tidy_config['input-encoding']);
$readability->init();

$this->assertNull($readability->url);
Expand Down Expand Up @@ -323,7 +324,7 @@ public function testAutoClosingIframeNotThrowingException(): void
$oldErrorReporting = error_reporting(\E_ALL);
$oldDisplayErrors = ini_set('display_errors', '1');
// dummy function to be used to the next test
set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline) {
throw new \Exception($errstr, $errno);
});

Expand Down
Loading