From c5407ec07c9ee5fbc062cf07434e34285096f6e6 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 02:54:25 +0200 Subject: [PATCH 1/8] composer: Add scripts for development --- composer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composer.json b/composer.json index c96ead8..f3d38e1 100644 --- a/composer.json +++ b/composer.json @@ -45,5 +45,11 @@ }, "autoload-dev": { "psr-4": { "Tests\\Readability\\": "tests/" } + }, + "scripts": { + "fix": "php-cs-fixer fix --verbose --diff", + "phpstan": "phpstan analyze --memory-limit 512M", + "rector": "rector process", + "test": "simple-phpunit -v" } } From 2c6c6d59874c16e199a4b810060e7cabaf5371c3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 02:54:59 +0200 Subject: [PATCH 2/8] PHPStan: Use stable PHPUnit path phpunit-bridge will create a symlink. --- phpstan.neon | 2 +- rector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 4f4a583..895d58d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,7 +6,7 @@ parameters: # https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288 bootstrapFiles: - - vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php + - vendor/bin/.phpunit/phpunit/vendor/autoload.php checkMissingIterableValueType: false diff --git a/rector.php b/rector.php index 47e4da8..d3eb4f6 100644 --- a/rector.php +++ b/rector.php @@ -20,7 +20,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon'); $parameters->set(Option::BOOTSTRAP_FILES, [ - __DIR__ . '/vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php', + __DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php', __DIR__ . '/vendor/autoload.php', ]); From 9ed89bde92764babdde6d10b16fffcb225944bcc Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 02:59:44 +0200 Subject: [PATCH 3/8] Fix PHP-Cs-Fixer changes 1) src/Readability.php (braces, no_unneeded_control_parentheses, single_line_comment_spacing, global_namespace_import, no_unused_imports, phpdoc_align) 2) src/JSLikeHTMLElement.php (phpdoc_separation) Switch code blocks to Markdown syntax to work around `phpdoc_separation`, ApiGen uses Markdown these days anyway. --- src/JSLikeHTMLElement.php | 8 ++--- src/Readability.php | 71 +++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/JSLikeHTMLElement.php b/src/JSLikeHTMLElement.php index 3f382e1..2ec11a0 100644 --- a/src/JSLikeHTMLElement.php +++ b/src/JSLikeHTMLElement.php @@ -39,9 +39,9 @@ class JSLikeHTMLElement extends \DOMElement /** * Used for setting innerHTML like it's done in JavaScript:. * - * @code + * ```php * $div->innerHTML = '

Chapter 2

The story begins...

'; - * @endcode + * ``` */ public function __set($name, $value) { @@ -105,9 +105,9 @@ class JSLikeHTMLElement extends \DOMElement /** * Used for getting innerHTML like it's done in JavaScript:. * - * @code + * ```php * $string = $div->innerHTML; - * @endcode + * ``` */ public function __get($name) { diff --git a/src/Readability.php b/src/Readability.php index 4336bca..df55a8a 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -2,7 +2,6 @@ namespace Readability; -use DOMElement; use Masterminds\HTML5; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; @@ -115,7 +114,7 @@ class Readability implements LoggerAwareInterface // HACK: replace linebreaks plus br's with p's '!(]*>[ \r\n\s]*){2,}!i' => '

', // replace noscripts - //'!!is' => '', + // '!!is' => '', // replace fonts to spans '!<(/?)font[^>]*>!is' => '<\\1span>', ]; @@ -126,8 +125,8 @@ class Readability implements LoggerAwareInterface // replace empty tags that break layouts '!<(?:a|div|p|figure)[^>]+/>!is' => '', // remove all attributes on text tags - //'!<(\s*/?\s*(?:blockquote|br|hr|code|div|article|span|footer|aside|p|pre|dl|li|ul|ol)) [^>]+>!is' => "<\\1>", - //single newlines cleanup + // '!<(\s*/?\s*(?:blockquote|br|hr|code|div|article|span|footer|aside|p|pre|dl|li|ul|ol)) [^>]+>!is' => "<\\1>", + // single newlines cleanup "/\n+/" => "\n", // modern web... '!]*>\s* 'convertLinksToFootnotes && !preg_match('/\bwiki/', $this->url)) { $this->addFootnotes($articleContent); @@ -292,7 +291,7 @@ class Readability implements LoggerAwareInterface * * @see http://www.roughtype.com/archives/2010/05/experiments_in.php */ - public function addFootnotes(DOMElement $articleContent): void + public function addFootnotes(\DOMElement $articleContent): void { $footnotesWrapper = $this->dom->createElement('footer'); $footnotesWrapper->setAttribute('class', 'readability-footnotes'); @@ -335,7 +334,7 @@ class Readability implements LoggerAwareInterface $articleLink->setAttribute('style', 'color: inherit; text-decoration: none;'); $articleLink->setAttribute('name', 'readabilityLink-' . $linkCount); $footnote->setInnerHtml('^ '); - $footnoteLink->setInnerHtml(('' !== $footnoteLink->getAttribute('title') ? $footnoteLink->getAttribute('title') : $linkText)); + $footnoteLink->setInnerHtml('' !== $footnoteLink->getAttribute('title') ? $footnoteLink->getAttribute('title') : $linkText); $footnoteLink->setAttribute('name', 'readabilityFootnoteLink-' . $linkCount); $footnote->appendChild($footnoteLink); @@ -356,7 +355,7 @@ class Readability implements LoggerAwareInterface */ public function prepArticle(\DOMNode $articleContent): void { - if (!$articleContent instanceof DOMElement) { + if (!$articleContent instanceof \DOMElement) { return; } @@ -456,9 +455,9 @@ class Readability implements LoggerAwareInterface * Get the inner text of a node. * This also strips out any excess whitespace to be found. * - * @param DOMElement $e - * @param bool $normalizeSpaces (default: true) - * @param bool $flattenLines (default: false) + * @param \DOMElement $e + * @param bool $normalizeSpaces (default: true) + * @param bool $flattenLines (default: false) */ public function getInnerText($e, bool $normalizeSpaces = true, bool $flattenLines = false): string { @@ -482,7 +481,7 @@ class Readability implements LoggerAwareInterface /** * Remove the style attribute on every $e and under. */ - public function cleanStyles(DOMElement $e): void + public function cleanStyles(\DOMElement $e): void { if (\is_object($e)) { $elems = $e->getElementsByTagName('*'); @@ -515,7 +514,7 @@ class Readability implements LoggerAwareInterface * This is the amount of text that is inside a link divided by the total text in the node. * Can exclude external references to differentiate between simple text and menus/infoblocks. */ - public function getLinkDensity(DOMElement $e, bool $excludeExternal = false): float + public function getLinkDensity(\DOMElement $e, bool $excludeExternal = false): float { $links = $e->getElementsByTagName('a'); $textLength = mb_strlen($this->getInnerText($e, true, true)); @@ -538,7 +537,7 @@ class Readability implements LoggerAwareInterface /** * Get an element relative weight. */ - public function getWeight(DOMElement $e): int + public function getWeight(\DOMElement $e): int { if (!$this->flagIsActive(self::FLAG_WEIGHT_ATTRIBUTES)) { return 0; @@ -556,7 +555,7 @@ class Readability implements LoggerAwareInterface /** * Remove extraneous break tags from a node. */ - public function killBreaks(DOMElement $node): void + public function killBreaks(\DOMElement $node): void { $html = $node->getInnerHTML(); $html = preg_replace($this->regexps['killBreaks'], '
', $html); @@ -569,7 +568,7 @@ class Readability implements LoggerAwareInterface * * Updated 2012-09-18 to preserve youtube/vimeo iframes */ - public function clean(DOMElement $e, string $tag): void + public function clean(\DOMElement $e, string $tag): void { $targetList = $e->getElementsByTagName($tag); $isEmbed = ('audio' === $tag || 'video' === $tag || 'iframe' === $tag || 'object' === $tag || 'embed' === $tag); @@ -601,7 +600,7 @@ class Readability implements LoggerAwareInterface * "Fishy" is an algorithm based on content length, classnames, * link density, number of images & embeds, etc. */ - public function cleanConditionally(DOMElement $e, string $tag): void + public function cleanConditionally(\DOMElement $e, string $tag): void { if (!$this->flagIsActive(self::FLAG_CLEAN_CONDITIONALLY)) { return; @@ -714,7 +713,7 @@ class Readability implements LoggerAwareInterface /** * Clean out spurious headers from an Element. Checks things like classnames and link density. */ - public function cleanHeaders(DOMElement $e): void + public function cleanHeaders(\DOMElement $e): void { for ($headerIndex = 1; $headerIndex < 3; ++$headerIndex) { $headers = $e->getElementsByTagName('h' . $headerIndex); @@ -754,7 +753,7 @@ class Readability implements LoggerAwareInterface /** * Get the article title as an H1. * - * @return DOMElement + * @return \DOMElement */ protected function getArticleTitle() { @@ -826,7 +825,7 @@ class Readability implements LoggerAwareInterface * Initialize a node with the readability object. Also checks the * className/id for special names to add to its score. */ - protected function initializeNode(DOMElement $node): void + protected function initializeNode(\DOMElement $node): void { if (!isset($node->tagName)) { return; @@ -894,11 +893,11 @@ class Readability implements LoggerAwareInterface * Using a variety of metrics (content score, classname, element types), find the content that is * most likely to be the stuff a user wants to read. Then return it wrapped up in a div. * - * @param DOMElement $page + * @param \DOMElement $page * - * @return DOMElement|false + * @return \DOMElement|false */ - protected function grabArticle(DOMElement $page = null) + protected function grabArticle(\DOMElement $page = null) { if (!$page) { $page = $this->dom; @@ -1040,7 +1039,7 @@ class Readability implements LoggerAwareInterface // For every SCORE_CHARS_IN_PARAGRAPH (default:100) characters in this paragraph, add another point. Up to 3 points. $contentScore += min(floor(mb_strlen($innerText) / self::SCORE_CHARS_IN_PARAGRAPH), 3); // For every SCORE_WORDS_IN_PARAGRAPH (default:20) words in this paragraph, add another point. Up to 3 points. - //$contentScore += min(floor($this->getWordCount($innerText) / self::SCORE_WORDS_IN_PARAGRAPH), 3); + // $contentScore += min(floor($this->getWordCount($innerText) / self::SCORE_WORDS_IN_PARAGRAPH), 3); foreach ($ancestors as $level => $ancestor) { if (!$ancestor->nodeName || !$ancestor->parentNode) { @@ -1211,7 +1210,7 @@ class Readability implements LoggerAwareInterface if (0 === strcasecmp($tagName, 'td') || 0 === strcasecmp($tagName, 'tr')) { $up = $topCandidate; - if ($up->parentNode instanceof DOMElement) { + if ($up->parentNode instanceof \DOMElement) { $up = $up->parentNode; if (0 === strcasecmp($up->tagName, 'table')) { @@ -1292,8 +1291,8 @@ class Readability implements LoggerAwareInterface // To ensure a node does not interfere with readability styles, remove its classnames & ids. // Now done via RegExp post_filter. - //$nodeToAppend->removeAttribute('class'); - //$nodeToAppend->removeAttribute('id'); + // $nodeToAppend->removeAttribute('class'); + // $nodeToAppend->removeAttribute('id'); // Append sibling and subtract from our list as appending removes a node. $articleContent->appendChild($nodeToAppend); } @@ -1340,7 +1339,7 @@ class Readability implements LoggerAwareInterface * Get an element weight by attribute. * Uses regular expressions to tell if this element looks good or bad. */ - protected function weightAttribute(DOMElement $element, string $attribute): int + protected function weightAttribute(\DOMElement $element, string $attribute): int { if (!$element->hasAttribute($attribute)) { return 0; @@ -1443,14 +1442,14 @@ class Readability implements LoggerAwareInterface libxml_use_internal_errors(false); } - $this->dom->registerNodeClass(DOMElement::class, \Readability\JSLikeHTMLElement::class); + $this->dom->registerNodeClass(\DOMElement::class, \Readability\JSLikeHTMLElement::class); } - private function getAncestors(DOMElement $node, int $maxDepth = 0): array + private function getAncestors(\DOMElement $node, int $maxDepth = 0): array { $ancestors = []; $i = 0; - while ($node->parentNode instanceof DOMElement) { + while ($node->parentNode instanceof \DOMElement) { $ancestors[] = $node->parentNode; if (++$i === $maxDepth) { break; @@ -1470,7 +1469,7 @@ class Readability implements LoggerAwareInterface }, iterator_to_array($node->childNodes)), true)); } - private function hasSingleTagInsideElement(DOMElement $node, string $tag): bool + private function hasSingleTagInsideElement(\DOMElement $node, string $tag): bool { if (1 !== $node->childNodes->length || $node->childNodes->item(0)->nodeName !== $tag) { return false; @@ -1490,11 +1489,11 @@ class Readability implements LoggerAwareInterface * Tidy must be configured to not clean the input for this function to * work as expected, see $this->tidy_config['clean'] */ - private function isNodeVisible(DOMElement $node): bool + private function isNodeVisible(\DOMElement $node): bool { return !($node->hasAttribute('style') && preg_match($this->regexps['isNotVisible'], $node->getAttribute('style')) - ) + ) && !$node->hasAttribute('hidden'); } } From 0975574bdb74f71ad235390c106d70cab4971939 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 03:12:21 +0200 Subject: [PATCH 4/8] Rector: Upgrade configuration --- rector.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/rector.php b/rector.php index d3eb4f6..379e368 100644 --- a/rector.php +++ b/rector.php @@ -2,31 +2,30 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; +use Rector\Config\RectorConfig; use Rector\Core\ValueObject\PhpVersion; use Rector\Set\ValueObject\LevelSetList; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; - -return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); +return static function (RectorConfig $rectorConfig): void { // paths to refactor; solid alternative to CLI arguments - $parameters->set(Option::PATHS, [ + $rectorConfig->paths([ __DIR__ . '/src', __DIR__ . '/tests', ]); // Path to phpstan with extensions, that PHPSTan in Rector uses to determine types - $parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon'); + $rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon'); - $parameters->set(Option::BOOTSTRAP_FILES, [ + $rectorConfig->bootstrapFiles([ __DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php', __DIR__ . '/vendor/autoload.php', ]); // Define what rule sets will be applied - $containerConfigurator->import(LevelSetList::UP_TO_PHP_72); + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_72, + ]); // is your PHP version different from the one your refactor to? - $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_72); + $rectorConfig->phpVersion(PhpVersion::PHP_72); }; From 2a571245283846d21297cf9bbc38869c47b87bd3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 03:13:03 +0200 Subject: [PATCH 5/8] composer: upgrade rector --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f3d38e1..254c04d 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "symfony/phpunit-bridge": "^4.4|^5.3|^6.0", "phpstan/phpstan": "^1.3", "phpstan/phpstan-phpunit": "^1.0", - "rector/rector": "^0.12.15" + "rector/rector": "^0.15.0" }, "suggest": { "ext-tidy": "Used to clean up given HTML and to avoid problems with bad HTML structure." From 23f824a1cea9500fe367c9dc1868c0245d00dc98 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 03:19:14 +0200 Subject: [PATCH 6/8] =?UTF-8?q?tests:=20Fix=20=E2=80=9CTHE=20ERROR=20HANDL?= =?UTF-8?q?ER=20HAS=20CHANGED!=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/ReadabilityTest.php | 78 +++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/tests/ReadabilityTest.php b/tests/ReadabilityTest.php index b975817..1c3d5c2 100644 --- a/tests/ReadabilityTest.php +++ b/tests/ReadabilityTest.php @@ -335,48 +335,56 @@ class ReadabilityTest extends \PHPUnit\Framework\TestCase public function testAutoClosingIframeNotThrowingException(): void { - error_reporting(\E_ALL | \E_STRICT); - ini_set('display_errors', '1'); + $oldErrorReporting = error_reporting(\E_ALL | \E_STRICT); + $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, array $errcontext) { throw new \Exception($errstr, $errno); }, \E_ALL | \E_STRICT); - $data = ' - - - - - - - - -

-
-
-

3D Touch — будущее мобильных игр

- -
-

Компания Apple представила новую технологию 3D Touch, которая является прямым потомком более ранней версии Force Touch — последняя, напомним, используется сейчас в трекпадах Macbook Pro и Macbook 2015. Теперь управлять устройством стало в разы проще, и Force Touch открывает перед пользователями новые возможности, но при этом 3D Touch — это про другое. Дело в том, что теперь и на мобильных устройствах интерфейс будет постепенно меняться, кардинальные перемены ждут мобильный гейминг, потому что здесь разработчики действительно могут разгуляться.

-

-

Итак, просто представьте себе, что iPhone 6S — это, по большому счету, отличная игровая приставка, которую вы носите с собой, а еще она может выдавать невероятной красоты картинку. Но проблема заключается, пожалуй, в том, что управлять персонажем в играх довольно трудно — он неповоротлив, обладает заторможенной реакцией, а игровой клиент зачастую требует перегруза интерфейса для того, чтобы обеспечить максимально большое количество возможностей. Благодаря трехуровневому нажатию можно избавиться от лишних кнопок и обеспечить более качественный обзор местности, и при этом пользователь будет закрывать пальцами минимальное пространство.

+ try { + $data = ' + + + + + + + + +
+
+
+

3D Touch — будущее мобильных игр

+ +
+

Компания Apple представила новую технологию 3D Touch, которая является прямым потомком более ранней версии Force Touch — последняя, напомним, используется сейчас в трекпадах Macbook Pro и Macbook 2015. Теперь управлять устройством стало в разы проще, и Force Touch открывает перед пользователями новые возможности, но при этом 3D Touch — это про другое. Дело в том, что теперь и на мобильных устройствах интерфейс будет постепенно меняться, кардинальные перемены ждут мобильный гейминг, потому что здесь разработчики действительно могут разгуляться.

+

+

Итак, просто представьте себе, что iPhone 6S — это, по большому счету, отличная игровая приставка, которую вы носите с собой, а еще она может выдавать невероятной красоты картинку. Но проблема заключается, пожалуй, в том, что управлять персонажем в играх довольно трудно — он неповоротлив, обладает заторможенной реакцией, а игровой клиент зачастую требует перегруза интерфейса для того, чтобы обеспечить максимально большое количество возможностей. Благодаря трехуровневому нажатию можно избавиться от лишних кнопок и обеспечить более качественный обзор местности, и при этом пользователь будет закрывать пальцами минимальное пространство.

+
+
-
-
- - '; - - $readability = $this->getReadability($data, 'http://iosgames.ru/?p=22030'); - $readability->debug = true; - - $res = $readability->init(); - - $this->assertTrue($res); - $this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent()); - $this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle()); - $this->assertStringContainsString('', $readability->getContent()->getInnerHtml()); - $this->assertStringContainsString('3D Touch', $readability->getTitle()->getInnerHtml()); + + '; + + $readability = $this->getReadability($data, 'http://iosgames.ru/?p=22030'); + $readability->debug = true; + + $res = $readability->init(); + + $this->assertTrue($res); + $this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getContent()); + $this->assertInstanceOf(JSLikeHTMLElement::class, $readability->getTitle()); + $this->assertStringContainsString('', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('3D Touch', $readability->getTitle()->getInnerHtml()); + } finally { + restore_error_handler(); + if (false !== $oldDisplayErrors) { + ini_set('display_errors', $oldDisplayErrors); + } + error_reporting($oldErrorReporting); + } } /** From f14428e4c0fa34b28f6b8a7696e62790bcde363e Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 05:25:40 +0200 Subject: [PATCH 7/8] Do not use `mb_convert_encoding` with `HTML-ENTITIES` as target encoding This is deprecated since PHP 8.2: Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead It was used because `DOMDocument`, which uses libxml2 internally, will parse the HTML as ISO-8859-1, unless the document contains an XML encoding declaration or HTML meta tag setting character set. Since first such element wins, putting the `meta[charset]` up front will ensure the parser uses the correct encoding, even if the document contains incorrect meta tag (e.g. when the document is converted to UTF-8 without also updating the metadata by the software passing it to Readability). https://stackoverflow.com/a/39148511/160386 --- src/JSLikeHTMLElement.php | 3 +-- src/Readability.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/JSLikeHTMLElement.php b/src/JSLikeHTMLElement.php index 2ec11a0..18116a6 100644 --- a/src/JSLikeHTMLElement.php +++ b/src/JSLikeHTMLElement.php @@ -79,14 +79,13 @@ class JSLikeHTMLElement extends \DOMElement } else { // $value is probably ill-formed $f = new \DOMDocument(); - $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); // Using will generate a warning, but so will bad HTML // (and by this point, bad HTML is what we've got). // We use it (and suppress the warning) because an HTML fragment will // be wrapped around tags which we don't really want to keep. // Note: despite the warning, if loadHTML succeeds it will return true. - $result = $f->loadHTML('' . $value . ''); + $result = $f->loadHTML('' . $value . ''); if ($result) { $import = $f->getElementsByTagName('htmlfragment')->item(0); diff --git a/src/Readability.php b/src/Readability.php index df55a8a..f41d6c0 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -1426,7 +1426,7 @@ class Readability implements LoggerAwareInterface unset($tidy); } - $this->html = mb_convert_encoding((string) $this->html, 'HTML-ENTITIES', 'UTF-8'); + $this->html = '' . (string) $this->html; if ('html5lib' === $this->parser || 'html5' === $this->parser) { $this->dom = (new HTML5())->loadHTML($this->html); From 9bdd3b6b2eca914aec4a57f7c070e4bea3e428e8 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 31 Mar 2023 03:57:24 +0200 Subject: [PATCH 8/8] ci: Add PHP 8.2 and 8.3 --- .github/workflows/continuous-integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3e34f07..1522e2c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -24,6 +24,8 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" + - "8.3" steps: - name: "Checkout"