Problem/Motivation

Hi we are tightening core's \Drupal\Core\Database\Database PHPStan compliance in #3532930: Make Drupal\Core\Database\Database type strict and PHPStan L10 compliant and there's a question from core committer on whether that could be confirmed by contrib.

Mind chiming in?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

mondrake created an issue. See original summary.

code poet’s picture

My thoughts on the impact of this core change for this module;

1. Scope is the @final Database static registry only. #3532930 adds declare(strict_types=1), native type hints, and @phpstan-type ConnectionInfo to Drupal\Core\Database\Database. That class is @final — the module doesn't (and can't) extend it. It only calls its static methods, so there are no override/signature obligations. The classes the module actually extends (Connection, Schema, Select, Insert, Update, Upsert) are untouched by this issue.

2. The tightened $key/$target params only deprecate integers. They become string|int, with a deprecation (11.5.0, removal in 13) when an int is passed. I checked all ~45 call sites in the module — every one passes a string target/key ('default', 'second', 'third', 'check', or the defaults). Zero integer usage. So phpstan's deprecation rules won't fire anything new, now or when the 11.x backport lands.

3. The array-shape/strict-types additions are internal to Database; they impose nothing on callers beyond "pass strings," which the module already does.

4. Config-wise: the module has no local phpstan.neon (it uses the gitlab_templates default), .gitlab-ci.yml just includes those templates, and nothing in phpstan-baseline.neon relates to Database typing. Nothing needs to change for this core issue.

Hope this helps clarify?

code poet’s picture

Status: Active » Closed (works as designed)

Not sure what actual status to apply to this issue - but closing with works as designed is close enough :)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.