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

Bump PHPStan level to 2 #721

Merged
merged 1 commit into from
Sep 8, 2021
Merged

Bump PHPStan level to 2 #721

merged 1 commit into from
Sep 8, 2021

Conversation

phansys
Copy link
Member

@phansys phansys commented Sep 7, 2021

Subject

Bump PHPStan level to 2.

I am targeting this branch, because these changes respect BC.

Changelog

### Added
- Missing methods in interfaces (through the `@method` annotation).

### Fixed
- Calls to several undefined methods.

To do

  • Validate the changes related to the ODM manager (/cc @franmomu);

@@ -24,7 +24,7 @@ public function getPager(array $criteria, $page, $limit = 10, array $sort = [])
{
$parameters = [];

$query = $this->getRepository()
$query = $this->getDocumentManager()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be something like:

$query = $this->getDocumentManager()->createQueryBuilder();
$query->field('enabled')->equals($criteria['enabled'] ?? true);

$pager = new Pager();
$pager->setMaxPerPage($limit);
$pager->setQuery(new ProxyQuery($query));
// ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a new commit @franmomu: 9b188f5.
Could you please check and confirm if this seems fine to you?
Is there any way this ever worked the way it was written before?
If no, I think we must provide a separate PR for these changes.
Thank you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this looks fine and I would say it has never worked before, those methods did not exist in the odm 😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #724.
Thank you so much.

VincentLanglet
VincentLanglet previously approved these changes Sep 8, 2021
@phansys phansys marked this pull request as ready for review September 8, 2021 13:23
@phansys phansys requested review from franmomu, VincentLanglet and a team September 8, 2021 13:23
@phansys phansys added the minor label Sep 8, 2021
@phansys phansys requested review from a team and jordisala1991 September 8, 2021 14:20
@franmomu franmomu merged commit 2ea96ad into sonata-project:3.x Sep 8, 2021
@franmomu
Copy link
Member

franmomu commented Sep 8, 2021

Thanks @phansys !

@phansys phansys deleted the phpstan branch September 8, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants