PHP 8.6 arrives on November 19. DressCode already rewrites code for it. 16 days Upgrading to a newer PHP →

Upgrading Dibi and Texy

Since version 4.1 of the Dibi database layer and version 3.0 of Texy, both libraries have renamed classes, constants and parameters, and dropped part of their API without a replacement. The package dresscode/upgrade-deegee holds these changes: with it, DressCode rewrites insertId() to getInsertId(), Type::DATETIME to Type::DateTime, and calls to Texy helper methods that moved to Texy\Helpers; for the API that is gone, it says what to do next.

Installation

composer require --dev dresscode/upgrade-deegee phpstan/phpstan
vendor/bin/dresscode upgrade today

The second line already rewrites the code: upgrade today finds the data of the package on its own, needs no configuration, and leaves the style of the code as it is. Upgrading Code describes the procedure and what to do with what is left.

The everyday check watches for the old API too, once the configuration adds the types and the set deprecations; see How Upgrading Libraries Works:

typeAnalysis: phpstan

use:
	- perCs           # your standard
	- deprecations

What Gets Fixed

Here is a repository class written for Dibi 4 and Texy 3.1, in a project on the current versions:

public function insert(array $data): int
{
	$this->db->query('INSERT INTO articles', $data);
	return $this->db->insertId();  // Method `Dibi\Connection::insertId()` is replaced by `Connection::getInsertId()`.
}


public function render(string $text): string
{
	$html = $this->texy->process($text);
	return $this->texy->unProtect($html);  // Method `Texy\Texy::unProtect()` is replaced by `Texy::unprotect()`.
}


public function getColumnType(): string
{
	return Type::DATETIME;  // Constant `Dibi\Type::DATETIME` is replaced by `Type::DateTime`.
}

After dresscode upgrade today:

public function insert(array $data): int
{
	$this->db->query('INSERT INTO articles', $data);
	return $this->db->getInsertId();
}


public function render(string $text): string
{
	$html = $this->texy->process($text);
	return $this->texy->unprotect($html);
}


public function getColumnType(): string
{
	return Type::DateTime;
}

From Dibi, DressCode fixes the constants of Dibi\Type, Fluent and the drivers that used to be in uppercase, the constants of the static facade dibi (dibi::AFFECTED_ROWS to Dibi\Fluent::AffectedRows), affectedRows() and insertId() to getAffectedRows() and getInsertId(), also on the facade, Dibi\DateTime::modifyClone($modify) to modify($modify), DibiExtension22 to DibiExtension3, and the constructors of FileLogger and Panel with the filter null. From Texy: classes with the prefix Texy to the namespace Texy\, helper methods of Texy and Utf moved to Texy\Helpers, escapeHtml() to htmlspecialchars(), unescapeHtml() to Texy\Helpers::unescapeHtml() (and, in a project on Texy 3.0 to 3.1.0, to html_entity_decode()), the property $cleaner to $htmlOutputModule, the constants of HtmlElement, and the renamed parameters of Modifier.

What Is Left to You

Where there is no replacement, DressCode reports the place and says what to do next. This covers, for example, the method translateArgs(), which Dibi 4.2 removed, or output modes Texy no longer has:

Method `Dibi\Connection::translateArgs()` is forbidden: there is no replacement; the hook is gone; the SQL is generated by `translate()`, which is final and takes the arguments as variadic parameters.
Method `Texy\Texy::setOutputMode()` is forbidden: there is no replacement; the output is always HTML5.

From Dibi, DressCode also reports the extension methods extensionMethod(), the trait Dibi\Strict, modifyClone() without an argument, and __sleep() and __wakeup() of a child of Connection, which should be replaced by __serialize() and __unserialize(). From Texy: the HTML4 and XHTML output modes, including setOutputMode(), getOutputMode() and $xhtml, encodings other than UTF-8 ($encoding, Utf::toUtf(), utfTo() and utf2html()), methods of modules that became private in version 3.2, TexyMacro for Latte 2, $removeOptional, Modifier::$cite and the trait Texy\Strict.

What a library only quietly marks as deprecated is not in the data. With the types, DressCode reports it anyway, and where the annotation names the replacement, it rewrites the code through upgrading.declarations.deprecatedMember. The data does not capture changes in behavior at all.

What the Package Covers

library versions
dibi/dibi 4.1 to 5.1
texy/texy 3.0 to 3.2

Upgrading Code describes how to proceed one major version at a time.

Show on GitHub · Report a problem with this page on GitHub · Nov 2, 2026