GithubHelp home page GithubHelp logo

Comments (8)

m3co-code avatar m3co-code commented on July 17, 2024

+1

from assert.

frankdejonge avatar frankdejonge commented on July 17, 2024

This is not going to work without a class alias or a globally set assertion class. Both are not really ideal. These function are namespace bound and internal code relying on either one of the solutions leads to code smell. I'd say, want to use the functions? Either use the default implementation or cop the functions into the namespace that your own implementation resides in. Some things would have to be altered, like the hardcoded FQCN in AssertionChain in order for that to work.

Another option would be to replace the functions with public static methods, these are basically fancy alternative constructors and don't create state, which doesn't introduce anything into the global scope.

from assert.

sagikazarmark avatar sagikazarmark commented on July 17, 2024

I can imagine a solution like this:

\Assert\withCustom('CustomAssertionClass')
    ->that(null)
    ->notNull();

from assert.

bicpi avatar bicpi commented on July 17, 2024

+1 I'd also like to use my own exception class in a clean way when switching to the fluent interface.

from assert.

Solinx avatar Solinx commented on July 17, 2024

+1

from assert.

gries avatar gries commented on July 17, 2024

👍

from assert.

acgrid avatar acgrid commented on July 17, 2024

It headaches me too.
I forked it with my implementation here https://github.com/acgrid/assert which everything can be inherited and work with each other.
The significant issue to me is helper functions, I added two getter/setter functions to provide an interface to access which class to be used.
To make it production usable, I made the fork namespaced (avoid possible collusion with another composer component) and tagged version x.1.
Since the change would be BC-breaking, so I am not confident to PR.

from assert.

tacovandenbroek avatar tacovandenbroek commented on July 17, 2024

This issue should be solved as of release 2.6.7

from assert.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.