appwrite icon indicating copy to clipboard operation
appwrite copied to clipboard

🔎 Add Code Analyzer To ‘utopia-php/websocket’

Open christyjacob4 opened this issue 3 years ago • 8 comments

💭 Introduction

Code analyzer is one of the most valuable tools in the open source world. It not only ensures every high quality of the code but also allows CI/CD to ensure this. A code analyzer can find a potential bug, unexpected null value, or type mismatch. Having a code analyzer set up should be a high priority for every project as it makes the project more stable and bug-proof.

Your task is to update our library utopia-php/websocket and implement a code analyzer. We would like to use PHPStan as our analyzer.

To make this task easy, we created a sample pull request showing what exactly needs to be done to implement the analyzer into the Utopia PHP library: https://github.com/utopia-php/ab/pull/8

🎯 Requirements

  • Experience with GitHub Actions.
  • Experience with Composer.
  • Experience with PHP.

✅ Task Summary

Please configure PHPStan to max level (9). If that gives you too many problems that you cannot solve, please drop to level 8. If you have trouble with level 8 as well, let us know, and we can consider a lower level on some repositories.

If you have questions, need any help, or just want to hang out, make sure to join us on our Discord server.

Happy Appwriting!

christyjacob4 avatar Oct 10 '22 09:10 christyjacob4

Can I be assigned this issue

aaheli8 avatar Oct 11 '22 02:10 aaheli8

@aaheli8 , thanks for your interest! 🙏 Happy hacking! 🎃

Meldiron avatar Oct 11 '22 07:10 Meldiron

@Meldiron Thank You very much

aaheli8 avatar Oct 11 '22 09:10 aaheli8

Working on it

aaheli8 avatar Oct 13 '22 08:10 aaheli8

Hello, I am using PHPStan level 9 to analyze the code and got 13 errors. The most common error is "No value type specified in iterable type" and I would like to fix it, could you please provide any help or documentation on how to fix it?

aaheli8 avatar Oct 19 '22 08:10 aaheli8

@aaheli8 I faced this issue as well, more info here: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type

It means there is type array specified, but that is too generic. We need to be specific and say it's for example array of strings array<string> or array where key is string and value is integer array<string,int>.

Meldiron avatar Oct 20 '22 07:10 Meldiron

@Meldiron Thank you, I am looking into it.

aaheli8 avatar Oct 20 '22 14:10 aaheli8

I have created the PR, please review it.

aaheli8 avatar Oct 26 '22 13:10 aaheli8