Repository navigation
hive-41897 Add qxpath(), qxparent() and qxprev(); deprecate the old names (v0.4.0) - #10
Merged
Merged
Conversation
…ames (v0.4.0) QuipXmlElement::xpath() overrides SimpleXMLElement::xpath() with an iterator return that no type covariant with array|null|false can express, so PHP 9 will reject it. The behaviour moves to new q* names on both QuipXmlElement and QuipXmlElementIterator; xpath(), xparent() and xprev() delegate to them and are marked @deprecated for removal in 1.0.0. QuipXmlElement::xpath() carries #[\ReturnTypeWillChange] so PHP 8.1+ prints no deprecation on class load. Internal callers and tests use the new names. Drop-in replacement for v0.3.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Summary
QuipXmlElementandQuipXmlElementIteratorgainqxpath(),qxparent()andqxprev(), which carry the existing behaviour unchanged.xpath(),xparent()andxprev()on both classes now delegate to the new methods and are marked@deprecated in quipxml:0.4.0 and is removed from quipxml:1.0.0.QuipXmlElement::xpath()carries#[\ReturnTypeWillChange], taken over from the patch aapp-drupal applies today, so PHP 8.1+ prints no deprecation when the class loads.BasicTestandPerformanceTest) use the new names.grep -rnE "\->(xpath|xparent|xprev)\(" srcreturns nothing.composer.jsonand the test layout are unchanged, so this is a drop-in replacement for v0.3.5.Why
SimpleXMLElement::xpath()declares the tentative return typearray|null|false. An iterator return cannot be made covariant with it, so PHP 9 will reject the override. The behaviour moves to new names now, and v1.0.0 retires the old ones.Source
aapp-drupal
docs/recs/quipxml/delegable-quipxml-php9-xpath-retirement.md, Phase 1 (library). Hive 41897.Testing
BasicTestandCharacterEncodingTestwere run on PHP 8.4 against bothmasterand this branch. The results are identical: 7 pass and 4 fail on both. The failures aretestSimpleXmlLimitsHtml,testSimpleXmlLimitsTextandtestSetNewChild(adom_import_simplexml()TypeError), plustestSurviveEmpty, which is partly an artefact of the harness. Phase 2 (v1.0.0) covers the PHP 8 test modernisation.After merge
Tag
v0.4.0. aapp-drupal then moves to^0.4, drops its patch and switches its call sites.🤖 Generated with Claude Code