cli icon indicating copy to clipboard operation
cli copied to clipboard

Feat 4387 add code analyzer to ‘utopia-php/cli'

Open ItsAdityaKSingh opened this issue 3 years ago • 6 comments

This PR aims to close https://github.com/appwrite/appwrite/issues/4387.

  • Added analysis script
  • Removed errors

ItsAdityaKSingh avatar Oct 27 '22 15:10 ItsAdityaKSingh

@stnguyen90 @Meldiron I have made all the changes. I'm just now sure about 1 error, given below:

Screenshot 2022-10-27 at 8 57 05 PM

I cannot figure out the perfect declaration for the resourceCallbacks variable. I will be trying though any help is appreciated :)

ItsAdityaKSingh avatar Oct 27 '22 15:10 ItsAdityaKSingh

Hey @stnguyen90, could you please review my PR?

ItsAdityaKSingh avatar Oct 30 '22 06:10 ItsAdityaKSingh

I cannot figure out the perfect declaration for the resourceCallbacks variable. I will be trying though any help is appreciated :)

@ItsAdityaKSingh, try array<callable>.

stnguyen90 avatar Oct 30 '22 15:10 stnguyen90

Yeah @stnguyen90. I tried that with array<callable>, but it started showing multiple other errors. Screenshot 2022-10-30 at 10 50 27 PM

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?

ItsAdityaKSingh avatar Oct 30 '22 17:10 ItsAdityaKSingh

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

stnguyen90 avatar Oct 30 '22 18:10 stnguyen90

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! 🎃

PineappleIOnic avatar Oct 31 '22 16:10 PineappleIOnic

@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. 

christyjacob4 avatar Apr 05 '23 21:04 christyjacob4