Feat 4387 add code analyzer to ‘utopia-php/cli'
This PR aims to close https://github.com/appwrite/appwrite/issues/4387.
- Added analysis script
- Removed errors
@stnguyen90 @Meldiron I have made all the changes. I'm just now sure about 1 error, given below:
I cannot figure out the perfect declaration for the resourceCallbacks variable. I will be trying though any help is appreciated :)
Hey @stnguyen90, could you please review my PR?
I cannot figure out the perfect declaration for the resourceCallbacks variable. I will be trying though any help is appreciated :)
@ItsAdityaKSingh, try array<callable>.
Yeah @stnguyen90. I tried that with array<callable>, but it started showing multiple other errors.

I tried defining the variable with all the other types and a combination of them, but still am getting an error :( Should I ask the check to ignore this variable, or defining its type is what I should try for?
Yeah @stnguyen90. I tried that with
array<callable>, but it started showing multiple other errors.
Oops, I guess that's the wrong type. You'll need to define the type to match what it is:
https://github.com/utopia-php/cli/blob/e2c6c85ed4db9907269846b57ab9f58faedd1770/src/CLI/CLI.php#L212
See:
- https://phpstan.org/writing-php-code/phpdoc-types#general-arrays
- https://phpstan.org/writing-php-code/phpdoc-types#array-shapes
Thank you so much for the PR 🤩. We're adding the hacktoberfest-accepted label to ensure this PR counts towards your Hacktoberfest contributions count. With that said, please stay active on this PR to address any comments once you receive a review. Happy Hacktoberfest! 🎃
@ItsAdityaKSingh thanks a lot for your contributions during Hacktoberfest 2022! I'll be closing this PR since there has not been any activity here for a while. If you'd like to work on it again, please feel free to open a new PR
Please reach out to me on our Discord server if you would like to claim your Appwrite swags! As a way of saying thank you, we would also love to invite you to join the Appwrite organization on GitHub. Please share your GitHub username with us on Discord.