repman-io / repman

Repman - PHP Repository Manager: packagist proxy and host for private packages
https://repman.io
MIT License
515 stars 107 forks source link

Add Rector - Automatic upgrades and code refactoring #579

Closed xvilo closed 1 year ago

xvilo commented 2 years ago

This PR aims to add Rector to this project. Rector instantly upgrades and refactors the PHP code of your application. It can help you in 2 major areas:

This PR adds some default rules for just PHP Level with LevelSetList::UP_TO_PHP_74. It also automatically imports namespace classes and will remove unused imports too.

The amount of rules/changes could be discussed, but this is the default set delivered by Rector. My intention is to create a PR that updates the project to PHP 8.0, this is includes the upgrades of packages (already available locally) and update to rector so the code will use the latest language features and automatically remove/fix deprecations and such.

codecov[bot] commented 2 years ago

Codecov Report

Merging #579 (800eaeb) into master (c0f2e0d) will increase coverage by 0.00%. The diff coverage is 98.96%.

:exclamation: Current head 800eaeb differs from pull request most recent head 68ef302. Consider uploading reports for the commit 68ef302 to get more accurate results

@@            Coverage Diff            @@
##             master     #579   +/-   ##
=========================================
  Coverage     99.18%   99.19%           
- Complexity     1903     1904    +1     
=========================================
  Files           301      301           
  Lines          6041     5976   -65     
=========================================
- Hits           5992     5928   -64     
+ Misses           49       48    -1     
Impacted Files Coverage Δ
src/Controller/Admin/OrganizationController.php 100.00% <ø> (ø)
src/Entity/Organization/Package/Download.php 100.00% <ø> (ø)
src/Query/Api/Model/Error.php 100.00% <ø> (ø)
src/Query/Api/Model/Errors.php 100.00% <ø> (ø)
src/Query/Api/Model/Links.php 100.00% <ø> (ø)
src/Query/Api/Model/Organization.php 100.00% <ø> (ø)
src/Query/Api/Model/Paginated.php 100.00% <ø> (ø)
src/Service/Config.php 100.00% <ø> (ø)
.../Service/Integration/BitbucketApi/Repositories.php 91.66% <0.00%> (ø)
src/Service/Telemetry/Entry.php 100.00% <ø> (ø)
... and 101 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c0f2e0d...68ef302. Read the comment docs.

xvilo commented 2 years ago

@akondas Can you take some time to get this reviewed?

xvilo commented 2 years ago

Thanks, @marmichalski for your suggestions and comments, I've implemented these as best as I could. Can you do another review of this PR?