Skip to content

[5.x] Remove the API deprecated since 1.x and 2.x - #414

Open
Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-remove-deprecated-api
Open

Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-remove-deprecated-api

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Removes API that was deprecated in 1.x/2.x and announced for removal (several messages still said "3.0"):

Removed Use instead
DatabaseDriver::getInstance() and static $instances DatabaseFactory::getDriver()
$db->name via DatabaseDriver::__get() getName()
$offset/$limit arguments of setQuery() (driver and DatabaseInterface) QueryInterface::setLimit()
$new argument of getQuery() (driver and DatabaseInterface) createQuery()
DatabaseQuery::dump() cast the query to a string

PHP silently accepts extra arguments, so a forgotten setQuery($query, 0, 1) would return every row and getQuery(true) would return the current query. To avoid that, setQuery() throws an InvalidArgumentException when more than one argument is passed, and getQuery() throws for a truthy argument (getQuery(false) keeps working).

The 4.x side (#407) corrects the deprecation messages to say 5.0. When 4.x-dev is merged up, the removed blocks here win over the message changes there.

Testing Instructions

  • The tests for the old syntax are replaced: testGetQueryWithArgumentThrows and testSetQueryWithOffsetAndLimitThrows in Tests/AbstractDatabaseDriverTestCase.php.
  • The union test now uses setLimit().
  • vendor/bin/phpunit and -c phpunit.sqlite.xml.dist pass, as do phpcs and PHPStan. The other driver suites run in CI.

Documentation Changes Required

Entry "Removed deprecated API" in docs/v4-to-v5-update.md.

Depends on #410 (creates docs/v4-to-v5-update.md; this branch is based on it) and relates to #407. Expect a small conflict in docs/v4-to-v5-update.md with #411/#412, which also append to it.

🤖 Generated with Claude Code

Hackwar and others added 2 commits November 12, 2026 23:48
Several 5.0 changes need an entry in the update guide; adding the empty
guide first keeps their pull requests from conflicting over its creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getInstance() and the static $instances storage, the name magic property,
the $offset/$limit arguments of setQuery(), the $new argument of getQuery()
and DatabaseQuery::dump() were announced for removal long ago. Passing the
removed arguments now throws instead of being silently ignored, so a
forgotten getQuery(true) or setQuery($q, 0, 1) cannot return the wrong query
or all rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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