Skip to content

Commit abec2fa

Browse files
[DomCrawler] Use the native HTM5 parser on PHP 8.4
1 parent 7f5f0fb commit abec2fa

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

AbstractBrowser.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ abstract class AbstractBrowser
4646
/** @psalm-var TResponse */
4747
protected object $response;
4848
protected Crawler $crawler;
49+
/** @deprecated since Symfony 7.4, to be removed in Symfony 8 */
4950
protected bool $useHtml5Parser = true;
5051
protected bool $insulated = false;
5152
protected ?string $redirect;
@@ -204,10 +205,16 @@ public function getCrawler(): Crawler
204205
/**
205206
* Sets whether parsing should be done using "masterminds/html5".
206207
*
208+
* @deprecated since Symfony 7.4, Symfony 8 will unconditionally use the native HTML5 parser
209+
*
207210
* @return $this
208211
*/
209212
public function useHtml5Parser(bool $useHtml5Parser): static
210213
{
214+
if (\PHP_VERSION_ID >= 80400) {
215+
trigger_deprecation('symfony/browser-kit', '7.4', 'Method "%s()" is deprecated. Symfony 8 will unconditionally use the native HTML5 parser.', __METHOD__);
216+
}
217+
211218
$this->useHtml5Parser = $useHtml5Parser;
212219

213220
return $this;

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Add `isFirstPage()` and `isLastPage()` methods to the History class for checking navigation boundaries
88
* Add PHPUnit constraints: `BrowserHistoryIsOnFirstPage` and `BrowserHistoryIsOnLastPage`
9+
* Deprecate `AbstractBrowser::useHtml5Parser()`; Symfony 8 will unconditionally use the native HTML5 parser
910

1011
6.4
1112
---

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=8.2",
20+
"symfony/deprecation-contracts": "^2.5|^3",
2021
"symfony/dom-crawler": "^6.4|^7.0|^8.0"
2122
},
2223
"require-dev": {

0 commit comments

Comments
 (0)