-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Incorrect type in SelectStatement::$expr when query has CASE-clause in selected fields #552
Comments
Hello |
This is on the latest release of sql-parser, 5.9.0, with PHP 8.2. |
@MauricioFauth could you please have a look? |
This was added #88 I noticed this issue before but I have no idea how to fix this. CaseExpression cannot inherit from Expression, but all of the code is written around the value being only Expression. |
#583 Defines now that function acceptExpression(CaseExpression|Expression $e): void {} As @kamil-tekiela said, |
The public field
SelectStatement::$expr
is defined in a PHP docblock as anExpression[]
. When parsing a query with aCASE
statement, aCaseExpression
object is present in this list, despiteCaseExpression
not extendingExpression
. This causes issues when explicitly requiring theExpression
type as should be returned bySelectStatement::$expr
.Reproduction case
Expected behavior
I would expect this script to not error out as the
$stmt->expr
returnsExpression[]
according to its PHP docblock. Each element should therefore be compatible withExpression
in myacceptExpression
function.Real behavior
The text was updated successfully, but these errors were encountered: