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

Consider adding namespaced standalone functions #80

Open
kostislav opened this issue Feb 12, 2023 · 0 comments
Open

Consider adding namespaced standalone functions #80

kostislav opened this issue Feb 12, 2023 · 0 comments

Comments

@kostislav
Copy link

The recommended way to use the assertion functions is by calling the static methods of Hamcrest_MatcherAssert and Hamcrest_Matchers. For people that would like to use "standalone" functions, there is the option to call Util::registerGlobalFunctions and let it create functions in the global namespace.

But since PHP 5.6 it is possible to import functions from namespaces using use function. Would it make sense to define the functions in a namespace and make them accessible by default? They should not conflict with any existing functions and can be used exactly like the global functions just by adding a use statement at the top of the file.

The global ones would probably have to be kept as well so as to not break backwards compatibility.

I can try to do a PR if there is a chance of this being accepted.

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

1 participant