Skip to content

chore: accept pollora/query 2.0 alongside 1.x - #493

Open
ogorzalka wants to merge 2 commits into
release/v13.36.1from
feat/require-query-v2
Open

ogorzalka wants to merge 2 commits into
release/v13.36.1from
feat/require-query-v2

Conversation

@ogorzalka

@ogorzalka ogorzalka commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Lets the framework run with pollora/query 2.0 (released today), which covers every WordPress query class, while still accepting 1.x.

  • composer.json: pollora/query ^1.0 || ^2.0, up from ^1.0, the way attributes, discovery, wp-cli and wp-rest are required.
  • tests/Unit/Support/QueryFacadesTest.php: the four query bindings of QueryServiceProvider and the PostQuery, TaxQuery and MetaQuery facades. They hold with both versions; nothing tested the provider before.
  • CHANGELOG.md: a Changed entry.

The five query facades for the new classes (terms, users, comments, sites, networks) are not part of this PR any more: they need 2.0, so they are better in a minor release that requires it. The commit that had them is still in the history of this branch, with their tests.

What the constraint does, and does not do

^1.0 || ^2.0 makes both versions installable and tested. It does not keep a project on 1.x: composer update takes the highest version, 2.0.0, as it does for the packages above. A project that wants 1.x requires pollora/query ^1.0 itself. If a patch release must not move anyone to a major version, the way to do it is to leave ^1.0 as it is and require 2.0 in the next minor, together with the facades.

What 2.0 changes for an application that updates

A few fixes change the result of a query that used to run: where() then orWhere() groups the earlier clauses ((a AND b) OR c), DateQuery::inclusive() now takes effect, dates use a 24-hour clock, and an invalid fields(), userPermission() or orderBy() direction throws a QueryException. The public initQuery(), query() and genericQuery() methods are gone. The upgrading guide lists everything. Nothing in the framework or in the sibling packages uses what was removed, and the framework only builds PostQuery, TaxQuery, MetaQuery and DateQuery with no argument, which works the same.

Checked

  • The new test file and PHPStan pass with pollora/query 2.0.0 and with 1.0.3 forced.
  • Before this change was reduced, the whole suite ran as the CI does (containers with pcov, pdo_sqlite and pcntl, fresh composer install): 1652 passed on PHP 8.3 and 8.4 with 2.0.0, against 1635 on the release without any change. The 1.0.3 side is the release as it is.
  • Pint: clean.

Noticed, not changed

wp.query.post, wp.query.taxonomy, wp.query.meta and wp.query.date are registered as singletons of mutable builders, so a call such as TaxQuery::where(...) through its facade accumulates across calls. It predates this PR. There is no DateQuery facade although its binding exists.

@ogorzalka ogorzalka changed the title feat: require pollora/query 2.0 and add the term, user, comment, site and network query facades chore: accept pollora/query 2.0 alongside 1.x Oct 15, 2026
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