-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom DQL functions: TypedExpression returning StringType does not cast to string #11537
Comments
Related issues:
|
|
I understand that, but since you are using |
given that the ORM currently does not allow registering custom boolean functions for instance (see the list of |
Partially related to doctrine#11537
I understand that.
I dont understand how that is related. I can easily register e.g. custom NOT function. I actually dont understand what is the
Feels like it actually does nothing. |
Partially related to doctrine#11537 Co-authored-by: Claudio Zizza <859964+SenseException@users.noreply.github.com>
While implementing better expression type inference in phpstan-doctrine, I added support even for
TypedExpression
as those are the only way how to have type inference with custom functions.But the problem is that it is designed to use
Type::convertToPHPValue
which is no-op forStringType
(it keeps whatever the value is, no casting performed). This means that all TypedExpressions returning StringType are actually not typed at all.I kept this exception in phpstan-doctrine, but this feels like a design flaw and can definitelly cause some WTF moments.
Obviously, anybody can solve it by custom Type that do cast to string, but that requires deeper knowledge of how things work.
I dont really have any proposal of how to make this better. Maybe just document it?
The text was updated successfully, but these errors were encountered: