Skip to content

Replace static Type::* calls with instance-based TypeRegistry lookups#12421

Open
GromNaN wants to merge 2 commits into
doctrine:3.7.xfrom
GromNaN:type-registry-instance
Open

Replace static Type::* calls with instance-based TypeRegistry lookups#12421
GromNaN wants to merge 2 commits into
doctrine:3.7.xfrom
GromNaN:type-registry-instance

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Mar 31, 2026

Related to doctrine/dbal#7342

All internal callers now resolve types through
Configuration::getTypeRegistry() rather than the global static Type::getType() / Type::hasType() / Type::getTypeRegistry() methods.

Remaining static calls are justified fallbacks:

  • Configuration::getTypeRegistry() falls back to Type::getTypeRegistry() for DBAL v3 and 4.0 compatibility (no Configuration::getTypeRegistry() there)
  • LengthFunction and CountFunction: getReturnType() has no EM access, accessing built-in INTEGER type only
  • DatabaseDriver: deprecated class, no EM access available

All internal callers now resolve types through
Configuration::getTypeRegistry() rather than the global static
Type::getType() / Type::hasType() / Type::getTypeRegistry() methods.

Remaining static calls are justified fallbacks:
- Configuration::getTypeRegistry() falls back to Type::getTypeRegistry()
  for DBAL v3 compatibility (no Configuration::getTypeRegistry() there)
- LengthFunction and CountFunction: getReturnType() has no EM access,
  accessing built-in INTEGER type only
- DatabaseDriver: deprecated class, no EM access available
@GromNaN GromNaN changed the title Replace static Type::* calls with instance-based TypeRegistry lookups Replace static Type::* calls with instance-based TypeRegistry lookups Mar 31, 2026
… methods

Replace getType()/hasType() helpers with a $typeRegistry property initialized
in the constructor, avoiding repeated getConfiguration()->getTypeRegistry() chain calls.
@stof
Copy link
Copy Markdown
Member

stof commented Apr 3, 2026

  • LengthFunction and CountFunction: getReturnType() has no EM access, accessing built-in INTEGER type only

This indicates a flaw in the architecture IMO. If Function::getReturnType is meant to return a Type instance (rather than the identifier in the type registry), custom functions might need to return one of the custom types.

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.

2 participants