Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized imports #2124

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

edwinvdpol
Copy link
Contributor

Hi there 👋

This PR includes:

  • Use imports where possible (not all)
  • Remove unused imports
  • Format imports

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.47%. Comparing base (91d183e) to head (6419913).
Report is 3 commits behind head on development.

Additional details and impacted files
@@              Coverage Diff               @@
##             development    #2124   +/-   ##
==============================================
  Coverage          90.47%   90.47%           
  Complexity          1945     1945           
==============================================
  Files                189      189           
  Lines               4388     4388           
==============================================
  Hits                3970     3970           
  Misses               418      418           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lrljoe
Copy link
Collaborator

lrljoe commented Dec 10, 2024

Wow, swathe of updates there, but all make sense.

Once the next release is done, then I'll look at merging this into the development branch and releasing, as there's already a lot in the next release

@lrljoe
Copy link
Collaborator

lrljoe commented Dec 10, 2024

I've started reviewing this properly. It's well worth noting, it has no impact on performance if you have imports that aren't used. Modern PHP "use" isn't the same as old-school "require/include".

Removing currently unused namespace declarations may not add a lot, as a lot of the code is in flux to extent.

I think a three-stage PR would be best, as it reduces the potential for impact on odd implementations. Something we have to keep in mind with the sheer number of sites using the package.

My steer would be three separate PRs:
Stage 1) Add any missing namespaces

Once merged in:
Stage 2) Look to remove any superfluous namespace declarations (that are outside of the package)

Once merged in:
Stage 3) Look to remove any superfluous namespace declarations (that are within the context of the package).

Welcome comments on that though!

@edwinvdpol
Copy link
Contributor Author

edwinvdpol commented Dec 10, 2024

Do you use an IDE like PHPStorm, if you don't mind me asking? It shows me ... kinda much stuff on things that could be improved. As I use this package for the company I work for, I would like to optimize the code further.
Like this PR, it can touch a lot of files, but the changes generally don't have significant impact as such.

What exactly do you mean by superfluous code?
What are the absolute minimum / oldest versions for like example PHP / Laravel you want to support?

@lrljoe
Copy link
Collaborator

lrljoe commented Dec 10, 2024

So we support Laravel 10 + 11 in v3, with the various iterations of PHP that are supported by those.

I'm keen to merge this in, but in multiple stages, as I run some separate tests to the main tests.

None of the changes should break anything, but sometimes some of the sites using the package have some oddities in their config, so it can be smoother to merge changes of this size in stages.

By superfluous, I mean unused, e.g. where you've removed some of the classes that aren't used in a specific file.

As for IDE etc, quite often there are PRs from various contributors, and we've set the styling fixes to be more forgiving than amending, which is why there are anomalies with spacing in namespace declarations

@lrljoe lrljoe merged commit 0dffa95 into rappasoft:development Dec 11, 2024
11 checks passed
@lrljoe
Copy link
Collaborator

lrljoe commented Dec 11, 2024

I've merged this into development for testing purposes

@lrljoe lrljoe mentioned this pull request Dec 11, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants