algolia / algoliasearch-client-php

⚡️ A fully-featured and blazing-fast PHP API client to interact with Algolia.
https://www.algolia.com/doc/api-client/php/getting-started/
MIT License
671 stars 116 forks source link

Consider adding static analysis #709

Closed BackEndTea closed 2 days ago

BackEndTea commented 2 years ago

Description

Consider using a static analysis tool (like PHPStan or Pslam), in order to catch basic errors, like the class not found issue introduced recently.

Currently there is no way to verify that code that is not covered by tests isn't broken. With static analysis all code would be automatically type checked, which should make it (nearly) impossible for these kind of errors to happen.

It shouldn't be too much work to set it up with real low strictness, which should catch any basic errors. At a later point it could be configured to be more strict, catching more specific errors.

If you need any help with setting this up, i'd be more than happy to help.

bodinsamuel commented 2 years ago

Hello, thanks for the report. It's unfortunate that those kind bug are appearing. However there is good news, we are in the process of releasing a new major that will have better testing overall ☺️

Code is there: https://github.com/algolia/algoliasearch-client-php/tree/next Source is there: https://github.com/algolia/api-clients-automation

BackEndTea commented 2 years ago

Hey, thats great to see!

But even in a new major static analysis would still be beneficial to the overall quality of the project. Plus it would also help better document types towards the user.

Especially since this is a new major, and adding/changing types could be a BC break, this seems like the perfect time to add those.