Skip to content

Consider adding namespaced standalone functions #80

@kostislav

Description

@kostislav

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions