Fixed Collection::offsetGet() signature for PHP 8.1#291
Open
davidbyoung wants to merge 1 commit intopaquettg:masterfrom
Open
Fixed Collection::offsetGet() signature for PHP 8.1#291davidbyoung wants to merge 1 commit intopaquettg:masterfrom
davidbyoung wants to merge 1 commit intopaquettg:masterfrom
Conversation
|
Merge would be appreciated |
|
merged : Since the original creator seemed to have abandoned this project and I can not install it on my project, so I created a fork and published it as a new package to allow me to install it on my project. hope help other too thanks. |
Open
|
You can also patch it with composer-patches composer plugin. Patch file (e.g. diff --git a/src/PHPHtmlParser/Dom/Node/Collection.php b/src/PHPHtmlParser/Dom/Node/Collection.php
index ff44725..6125b19 100644
--- a/src/PHPHtmlParser/Dom/Node/Collection.php
+++ b/src/PHPHtmlParser/Dom/Node/Collection.php
@@ -130,6 +130,7 @@ class Collection implements IteratorAggregate, ArrayAccess, Countable
*
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->collection[$offset] ?? null;
List it in {
"extra": {
"patches": {
"paquettg/php-html-parser": {
"Fix deprecation notices for offsetGet() return type": "patches/paquettg_phphtmlparser_fix_offsetget_deprecation.patch"
},
}
}⚠ Note that you have to have aforementioned composer-patches composer plugin installed first. |
mr-chetan
added a commit
to devanoxltd/php-html-parser
that referenced
this pull request
Aug 24, 2025
Added the #[ReturnTypeWillChange] attribute to the offsetGet method in Collection to ensure compatibility with future PHP versions and suppress deprecation warnings. https: //github.com/paquettg/pull/291 https: //github.com/paquettg/issues/290 Co-Authored-By: David Young <6652430+davidbyoung@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #290