Mongodb-odm: [2.0] Add PHPStan

Created on 21 Dec 2017  路  10Comments  路  Source: doctrine/mongodb-odm

From the documentation:

PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code.

Has PR Task

Most helpful comment

Problem with increasing levels is typehinting Common's metadata (as per interface) and expecting our own implementation. I'm :-1: for adding ifs but maybe assert would be the way to go?

All 10 comments

I was lately playing with PHPStan and running it against ODM was also on my list :+1:

@alcaeus Can I PR it? :innocent:

@carusogabriel feel free, I'm in the middle of setting up new computer (and seeing if I can run MongoDB on that funky linux in Windows 10 :P )

As I'm new to PHPStan, just a question: by [2.0] Add PHPStan means require it in dev-dependencies and work on phpstan.neon?

My roadmap was:

  1. Add it to require-dev and configure if needed (can take a look at ORM)
  2. Get to a decent (5?) level without errors (at least 1 commit per level to ease review)
  3. Take a page from ORM's playbook and add PHPStan to travis

Level 1 and parts of level 2 added in #1714.

@alcaeus @malarzm May we add https://github.com/phpstan/phpstan-strict-rules or better to increase PHPStan level first?

Problem with increasing levels is typehinting Common's metadata (as per interface) and expecting our own implementation. I'm :-1: for adding ifs but maybe assert would be the way to go?

Gonna try tonight to increase one more level :smile:

Closing, we're on level 7 for now :)

Was this page helpful?
0 / 5 - 0 ratings