Skip to content

feat: add the EnvironmentDetector utility class and envdetector service#10130

Open
paulbalandan wants to merge 6 commits intocodeigniter4:4.8from
paulbalandan:environment-detector
Open

feat: add the EnvironmentDetector utility class and envdetector service#10130
paulbalandan wants to merge 6 commits intocodeigniter4:4.8from
paulbalandan:environment-detector

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

Description
This PR adds the EnvironmentDetector utility class as a simple mockable wrapper to accessing the ENVIRONMENT constant, allowing us to test previously unreachable code branches dependent on the current environment.

Checklist:

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

@github-actions github-actions Bot added the 4.8 PRs that target the `4.8` branch. label Apr 23, 2026
Copy link
Copy Markdown
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

I think it's a good change.

I added some suggestions to the phpdocs / user guide.

Comment thread system/Config/Services.php
Comment thread system/EnvironmentDetector.php
Comment thread user_guide_src/source/general/environments.rst
@paulbalandan paulbalandan force-pushed the environment-detector branch from 7231481 to 86fe9de Compare April 23, 2026 15:27
Comment thread system/EnvironmentDetector.php
Comment thread user_guide_src/source/general/environments.rst Outdated
Comment thread system/Config/Services.php Outdated
@paulbalandan paulbalandan force-pushed the environment-detector branch from 86fe9de to 0549469 Compare April 23, 2026 19:33
@paulbalandan paulbalandan changed the title feat: add the EnvironmentDetector utility class and environmentdetector service feat: add the EnvironmentDetector utility class and envdetector service Apr 23, 2026
Copy link
Copy Markdown
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

4.8 PRs that target the `4.8` branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants