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

Fix some phpdoc #2313

Merged
merged 4 commits into from
May 25, 2021
Merged

Fix some phpdoc #2313

merged 4 commits into from
May 25, 2021

Conversation

franmomu
Copy link
Contributor

Q A
Type improvement
BC Break no
Fixed issues

Summary

Raising psalm level locally and analyzing tests directory made some issues appear:

ReplaceRoot allowing Expr:

->replaceRoot(
$builder->expr()
->field('isToday')
->eq('$createdAt', $dateTime)
);

Bucket::groupBy allowing string:

$bucketStage = new Bucket($this->getTestAggregationBuilder(), $this->dm, new ClassMetadata(User::class));
$bucketStage
->groupBy('$someField')

With ClassMetadata I was getting:

ERROR: InvalidArgument - tests/Doctrine/ODM/MongoDB/Tests/QueryTest.php:418:30 - Argument 2 of Doctrine\ODM\MongoDB\Query\Query::__construct expects Doctrine\ODM\MongoDB\Mapping\ClassMetadata<object>, Doctrine\ODM\MongoDB\Mapping\ClassMetadata<Documents\User> provided (see https://psalm.dev/004)
        new Query($this->dm, new ClassMetadata(User::class), $this->getMockCollection(), ['type' => -1], []);

Making it covariant I think it makes sense as it is in doctrine/persistence.

@malarzm malarzm added this to the 2.3.0 milestone May 25, 2021
@malarzm
Copy link
Member

malarzm commented May 25, 2021

Thanks @franmomu!

@malarzm malarzm merged commit 6db1288 into doctrine:2.3.x May 25, 2021
@franmomu franmomu deleted the fix_phpdoc branch May 26, 2021 00:07
@alcaeus alcaeus modified the milestones: 2.3.0-alpha1, 2.3.0 Sep 9, 2021
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