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

Add sniff to enforce importing a namespace not a namespaced function/constant #215

Closed
jrfnl opened this issue Jun 17, 2020 · 1 comment
Closed
Milestone

Comments

@jrfnl
Copy link
Collaborator

jrfnl commented Jun 17, 2020

Discussed on Slack with @herregroen.

For namespaced functions and constants, disallow importing these via use func/ use const.
Instead, the namespace should be imported and the function name/constant name should be qualified with the namespace name.

Enforce:

use Package\Level;

Level\function_name();

Disallow:

use func Package\Level\function_name;

function_name();
@jrfnl
Copy link
Collaborator Author

jrfnl commented Dec 14, 2023

I'm going to close this issue as "fixed".

Importing functions/constants is now disallowed. While it is not enforced that the namespace is imported, that is realistically, the only other alternative.

@jrfnl jrfnl closed this as completed Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant