Giter VIP home page Giter VIP logo

Comments (10)

samdark avatar samdark commented on June 28, 2024

Benchmark should be put together in order to check it.

from event-dispatcher.

SamMousa avatar SamMousa commented on June 28, 2024

Honestly, I would propose not supporting generic callables altogether.
Having support for invokable objects / closures should be more than enough?

Also: https://wiki.php.net/rfc/closurefromcallable

from event-dispatcher.

samdark avatar samdark commented on June 28, 2024

Maybe. A benchmark will definitely help to solve this dilemma.

from event-dispatcher.

SamMousa avatar SamMousa commented on June 28, 2024

https://gist.github.com/SamMousa/22dfaf40b89d21748afdd238de2fd8a8

from event-dispatcher.

KpuTuK avatar KpuTuK commented on June 28, 2024

What if we add another argument

public function attach(string $eventName, callable $listener): void
    {
        $this->listeners[$eventName][] = $listener;
    }
//use
$provider->attach(Event::class, $listener);

from event-dispatcher.

SamMousa avatar SamMousa commented on June 28, 2024

This provider / issue is about using reflection.
We can definitely add another function / create another provider, but it is not related to this issue.

from event-dispatcher.

samdark avatar samdark commented on June 28, 2024

@KpuTuK that was how it was done initially but since handler has to type-hint for event anyway, why not to re-use this information?

from event-dispatcher.

KpuTuK avatar KpuTuK commented on June 28, 2024

@SamMousa я не совсем понял. плохой английский.

from event-dispatcher.

SamMousa avatar SamMousa commented on June 28, 2024

Sorry @KpuTuK, my Russian is probably much worse than your English ;-)

from event-dispatcher.

samdark avatar samdark commented on June 28, 2024

@KpuTuK изначально так и было сделано. Но раз мы указываем интерфейс события в аргументе хендлера, то есть ли смысл делать это два раза?

// above is translation of my comment into Russian

from event-dispatcher.

Related Issues (16)

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.