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

@GromNaN GromNaN commented Mar 31, 2026

Copy link
Copy Markdown
Member

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

stof commented Apr 3, 2026

Copy link
Copy Markdown
Member
  • 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.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions Bot added the Stale label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants