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

refactor: replace global $app with Services #6524

Merged
merged 3 commits into from
Sep 12, 2022

Conversation

ping-yee
Copy link
Contributor

@ping-yee ping-yee commented Sep 9, 2022

Description
Modified #6523.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ping-yee ping-yee changed the title modify: variable changed. modify: variable global $app changed. Sep 9, 2022
@kenjis kenjis added the refactor Pull requests that refactor code label Sep 9, 2022
@kenjis kenjis changed the title modify: variable global $app changed. refactor: variable global $app changed. Sep 9, 2022
@kenjis kenjis changed the title refactor: variable global $app changed. refactor: replace global $app with Services Sep 9, 2022
@iRedds
Copy link
Collaborator

iRedds commented Sep 10, 2022

I understand the reason for this PR, but I don't think it's the right solution.

To begin with, the Services::codeigniter() service was actually introduced at the suggestion of a developer who wanted to change the request handler.
The reason for this was the unsuccessful design of the framework and the rejection of autowiring.
Therefore, I do not consider it necessary to implement this service, which is a crutch.

I also think that the design of the toolbar filter is bad. Instead of simply injecting a toolbar header or script into the response, data collection is additionally triggered.

I think the way the toolbar works should be changed instead of using Services::codeigniter().

Codeigniter::class

  • Initialization
    • filter toolbar::after( Turn on the toolbar. Inject a header or script into the response. )
    • sending the response
  • if the toolbar is enabled, we collect data, including timer data.

@ping-yee
Copy link
Contributor Author

ping-yee commented Sep 10, 2022

@iRedds Thanks for your advices, I understand what you mean and feel grateful.
Is there any alternative change can use?
If there isn't, I will close this PR.

@kenjis
Copy link
Member

kenjis commented Sep 10, 2022

@iRedds It seems true what you say, but this PR fixes the bug in Long-living PHP like RoadRunner.
I think even if a PR is not perfect, if it improves CI4, it is better to merge.

@iRedds
Copy link
Collaborator

iRedds commented Sep 11, 2022

I just expressed my opinion.
So which way to choose is up to you, gentlemen.

@kenjis
Copy link
Member

kenjis commented Sep 11, 2022

@ping-yee Can you remove this?

* @global \CodeIgniter\CodeIgniter $app

@kenjis
Copy link
Member

kenjis commented Sep 11, 2022

@iRedds Thank you for your opinion. You can send a PR to fix the bad design of the debugbar later.

@ping-yee
Copy link
Contributor Author

ping-yee commented Sep 12, 2022

@kenjis I have been taken out the comment out, appreciated that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants