8000 hive-41897 Add qxpath(), qxparent() and qxprev(); deprecate the old names (v0.4.0) by stackpr · Pull Request #10 · brainite/quipxml · GitHub
[go: up one dir, main page]

Skip to content

hive-41897 Add qxpath(), qxparent() and qxprev(); deprecate the old names (v0.4.0) - #10

Merged
stackpr merged 1 commit into
masterfrom
feat/hive-41897-qxpath
Oct 1, 2026
Merged

stackpr merged 1 commit into
masterfrom
feat/hive-41897-qxpath

Conversation

@stackpr
@stackpr stackpr commented Oct 1, 2026
Copy link
Copy Markdown
Collaborator

Summary

  • QuipXmlElement and QuipXmlElementIterator gain qxpath(), qxparent() and qxprev(), which carry the existing behaviour unchanged.
  • xpath(), xparent() and xprev() 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.
  • The library's own callers (the element and iterator internals, the ICS and JSON-feed calendar formatters, BasicTest and PerformanceTest) use the new names. grep -rnE "\->(xpath|xparent|xprev)\(" src returns nothing.
  • CI, composer.json and the test layout are unchanged, so this is a drop-in replacement for v0.3.5.

Why

SimpleXMLElement::xpath() declares the tentative return type array|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

  • BasicTest and CharacterEncodingTest were run on PHP 8.4 against both master and this branch. The results are identical: 7 pass and 4 fail on both. The failures are testSimpleXmlLimitsHtml, testSimpleXmlLimitsText and testSetNewChild (a dom_import_simplexml() TypeError), plus testSurviveEmpty, which is partly an artefact of the harness. Phase 2 (v1.0.0) covers the PHP 8 test modernisation.
  • PHP 7.4 / PHPUnit 5.7 coverage comes from the existing CI run on this PR.

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

…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>
@stackpr
stackpr merged commit dcaa5b9 into master Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0