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

doctrine/dbal v3 - Make sure that values passed to are not null #8889

Merged

Conversation

scyzoryck
Copy link
Contributor

Hello! My first PR here.
Partially fixes #8884 - 7 out of 117 issues.

Let's start from fixing 2 types of issues:

�[0;31mERROR�[0m: PossiblyNullArgument - lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php:765:66 - Argument 3 of Doctrine\DBAL\Platforms\AbstractPlatform::modifyLimitQuery cannot be null, possibly null value provided (see https://psalm.dev/078)
            return $this->platform->modifyLimitQuery('', $limit, �[97;41m$offset�[0m);

�[0;31mERROR�[0m: PossiblyNullArgument - lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php:335:62 - Argument 2 of Doctrine\DBAL\Platforms\AbstractPlatform::appendLockHint cannot be null, possibly null value provided (see https://psalm.dev/078)
        $lock       = $this->platform->appendLockHint($from, �[97;41m$lockMode�[0m);

The first issue is simpler - modifyLimitQuery has default $offset value set to 0 - so let's pass it instead of null.
For AbstractPlatform::appendLockHint there is no default value, so passing LockMode::NONE seems to be the best choice - it would not affect any known implementation.

…l to meet changes in doctrine/dbal v3.

Fix psalm issues with type: `PossiblyNullArgument`, found after updating doctrine/dbal to v3. Override `null` passed as offset with `0` in calls to `Doctrine\DBAL\Platforms\AbstractPlatform::modifyLimitQuery`. Override `null` passed as lockMode with `LockMode::NONE` in calls to `Doctrine\DBAL\Platforms\AbstractPlatform::appendLockHint`.
Partialy fixes doctrine#8884
@greg0ire greg0ire added this to the 2.10.0 milestone Aug 5, 2021
@greg0ire greg0ire merged commit c4456a2 into doctrine:2.10.x Aug 5, 2021
@greg0ire
Copy link
Member

greg0ire commented Aug 5, 2021

Thanks and congrats on your first PR!

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.

3 participants