Skip to content

Conversation

@aaheli8
Copy link
Contributor

@aaheli8 aaheli8 commented Oct 26, 2022

What does this PR do?
Implements code analyzer.

Link your issue: #4379
Have you read the Contributing Guidelines on issues?
Yes! 👏

@stnguyen90 stnguyen90 self-requested a review October 26, 2022 21:09
@stnguyen90 stnguyen90 linked an issue Oct 26, 2022 that may be closed by this pull request
5 tasks
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I ran phpstan, I got 11 errors. Please make sure they're addressed:

$ docker run --rm -v $PWD:/app composer sh -c "composer install --profile --ignore-platform-reqs && ./vendor/bin/phpstan analyse --level max src tests"
[12.8MiB/0.27s] Installing dependencies from lock file (including require-dev)
[12.9MiB/0.27s] Verifying lock file contents can be installed on current platform.
[14.2MiB/0.28s] Nothing to install, update or remove
[14.0MiB/0.29s] Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
[14.0MiB/0.29s] Generating autoload files
[14.4MiB/0.44s] 43 packages you are using are looking for funding.
[14.4MiB/0.44s] Use the `composer fund` command to find out more!
[14.4MiB/0.44s] Memory usage: 14.42MiB (peak: 15.89MiB), time: 0.44s
 7/7 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ----------------------------------------------------------------------- 
  Line   src/WebSocket/Adapter/Workerman.php                                    
 ------ ----------------------------------------------------------------------- 
  32     Parameter #1 $callback of function call_user_func expects callable():  
         mixed, mixed given.                                                    
  69     Cannot access property $onWebSocketConnect on mixed.                   
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/WebSocket/Server.php                                               
 ------ ----------------------------------------------------------------------- 
  17     Property Utopia\WebSocket\Server::$errorCallbacks type has no value    
         type specified in iterable type array.                                 
         💡 See:                                                                
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
 ------ ----------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   tests/servers/Swoole/server.php                                      
 ------ --------------------------------------------------------------------- 
  28     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
  31     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
  34     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array given.                                  
  37     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
 ------ --------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------- 
  Line   tests/servers/Workerman/server.php                                   
 ------ --------------------------------------------------------------------- 
  27     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
  30     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
  33     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array given.                                  
  36     Parameter #1 $connections of method Utopia\WebSocket\Server::send()  
         expects array<string>, array<int, int> given.                        
 ------ --------------------------------------------------------------------- 

 [ERROR] Found 11 errors  

@aaheli8
Copy link
Contributor Author

aaheli8 commented Oct 29, 2022

I have resolved the errors as mentioned but I am unable to resolve one particular error and need help regarding it.

image

Please provide some help to solve it. Thank you.

@gewenyu99
Copy link

@stnguyen90 Teehee Please look at this again.

@aaheli8
Copy link
Contributor Author

aaheli8 commented Oct 29, 2022

Resolved all the errors. Thank you @stnguyen90 for helping to resolve the last error.
image

@PineappleIOnic
Copy link

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

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋 awesome work on your PR! We've approved your work and it'll be merged soon!

I know there's a build error, but it looks like that was already on the repo. We'll try to fix it in another PR.

@christyjacob4 christyjacob4 merged commit f0a59bf into utopia-php:main Dec 20, 2022
@christyjacob4
Copy link
Contributor

THANK YOU! All changes merged 🥳

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.  

You can accept the invite by visiting https://github.com/orgs/appwrite/invitation. By joining our team, you will officially be an Appwrite maintainer on GitHub.

You can change your membership visibility settings, so your new Appwrite team membership badge will show up on your personal GitHub profile.

Please feel free to look for more PRs you might be interested in helping with on our long list of Hacktoberfest friendly issues and help make Appwrite better :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

5 participants