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

Bug: Namespacing of app/Config folder vs. app/Controller #2826

Closed
samfullman opened this issue Apr 15, 2020 · 6 comments
Closed

Bug: Namespacing of app/Config folder vs. app/Controller #2826

samfullman opened this issue Apr 15, 2020 · 6 comments

Comments

@samfullman
Copy link

I've noticed what appears to be an inconsistency in CodeIgniter4 namespacing and wanted to enquire about the logic of it.

In CI4 namespacing, the system folder is CodeIgniter (which makes sense), and class files in all folders and subfolders in system reliably have the namespace
CodeIgniter\Folder[\Subfolder].

However in the app folder, which has a paucity of class files starting out, it's not so uniform: the namespace for files in the Config folder is simply Config, but the namespace for class files in Controller is App\Controller.

Is there an intentional reason for this? It seems inconsistent to me. It stands to reason that the app/Config folder files should also have the namespace App\Config

@lonnieezell
Copy link
Member

This is because the APP_NAMESPACE can be changed. We ran into issues early on where if App namespace was changed the system could not load up the config files and died. I don't recall any additional specifics around it as that was a couple of years ago. But it's a safety feature for the framework so it can always find it's config files. Probably less crucial now that the config() helper exists and can search through all namespaces, but we can't change it now without it being a BC break and it's way too early for a v5 release. :)

Something we can definitely take a look at down the road, though, to see if it makes sense now.

@samfullman
Copy link
Author

samfullman commented Apr 15, 2020 via email

@lonnieezell
Copy link
Member

Hey Sam - I look forward to the seeing your contributions!

@samfullman
Copy link
Author

samfullman commented Nov 26, 2020 via email

@lonnieezell
Copy link
Member

Master branch is pushed to when a new release happens (4.0.4, etc). To stay up to date with the latest changes (but take on the risk of in-development and potentially unstable code) use the develop branch.

@samfullman
Copy link
Author

samfullman commented Nov 28, 2020 via email

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

No branches or pull requests

2 participants