Skip to content
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

Improve compatibility with Doctrine DBAL 4 #9266

Merged
merged 3 commits into from
Dec 19, 2021
Merged

Improve compatibility with Doctrine DBAL 4 #9266

merged 3 commits into from
Dec 19, 2021

Conversation

morozov
Copy link
Member

@morozov morozov commented Dec 18, 2021

The following issues have been identified by running Psalm with the DBAL 4.0.x-dev:

  1. See Modified AbstractPlatform::getLocateExpression() and ::getSubstringExpression() signatures dbal#3494:
    ERROR: PossiblyFalseArgument - lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php:38:14 - Argument 3 of Doctrine\DBAL\Platforms\AbstractPlatform::getLocateExpression cannot be false, possibly null|string value expected (see https://psalm.dev/104)
                ($this->simpleArithmeticExpression
                    ? $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression)
                    : false
    
  2. See Changed the type of $char in AbstractPlatform::getTrimExpression()from string|false to ?string dbal#3491:
     ERROR: InvalidArgument - lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php:46:50 - Argument 1 of Doctrine\DBAL\Connection::quote expects string, true provided (see https://psalm.dev/004)
                 ? $sqlWalker->getConnection()->quote($this->trimChar)
     
     
     ERROR: PossiblyFalseArgument - lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php:49:72 - Argument 3 of Doctrine\DBAL\Platforms\AbstractPlatform::getTrimExpression cannot be false, possibly null|string value expected (see https://psalm.dev/104)
             return $platform->getTrimExpression($stringPrimary, $trimMode, $trimChar);
    
  3. See Connection::quote() can only quote strings dbal#3488:
    ERROR: InvalidArgument - lib/Doctrine/ORM/Query/SqlWalker.php:2197:71 - Argument 1 of Doctrine\DBAL\Connection::quote expects string, Doctrine\ORM\Query\AST\Node provided (see https://psalm.dev/004)
                : (is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr));
    
    ERROR: InvalidArgument - lib/Doctrine/ORM/Query/SqlWalker.php:2203:73 - Argument 1 of Doctrine\DBAL\Connection::quote expects string, Doctrine\ORM\Query\AST\Node provided (see https://psalm.dev/004)
                : (is_numeric($rightExpr) ? $rightExpr : $this->conn->quote($rightExpr));
    

@morozov morozov requested review from greg0ire and derrabus December 19, 2021 05:12
@morozov morozov marked this pull request as ready for review December 19, 2021 05:15
@morozov morozov added this to the 2.11.0 milestone Dec 19, 2021
@derrabus derrabus merged commit 8cb62a6 into doctrine:2.11.x Dec 19, 2021
@morozov morozov deleted the dbal-4-compatibility branch December 19, 2021 16:01
derrabus added a commit to derrabus/orm that referenced this pull request Dec 26, 2021
* 2.11.x:
  Enable UnusedUse sniff again (doctrine#9267)
  Whitelist composer plugins used by this repository (doctrine#9286)
  Fix XML export for `change-tracking-policy` (doctrine#9285)
  Allow symfony/cache 6 (doctrine#9283)
  Put actual value instead of index inside $originalEntityData. (doctrine#9244)
  Fix return types of cache interfaces (doctrine#9271)
  Better explain limitations of DQL "DELETE" (doctrine#9281)
  Fix docblocks on nullable EM properties (doctrine#9273)
  Docs: use canonical order for phpdoc tags, add missed semicolon (doctrine#9190)
  Make PrimaryReadReplicaConnection enforcement explicit (doctrine#9239)
  Regenerate Psalm baseline (doctrine#9272)
  Improve compatibility with Doctrine DBAL 4 (doctrine#9266)
  [docs] Fix wording for attributes=>parameters. (doctrine#9265)
  Support for nesting attributes with PHP 8.1 (doctrine#9241)
  Revert "Fix SchemaValidator with abstract child class in discriminator map (doctrine#9096)" (doctrine#9262)
  Docs: consistency for FQCN, spacing, etc (doctrine#9232)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants