Skip to content

Commit

Permalink
Revert "handle array callbacks"
Browse files Browse the repository at this point in the history
This reverts commit b80ddf4.
  • Loading branch information
driesvints committed Jun 16, 2020
1 parent a938e20 commit 4e3fedb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ protected function addInterfaceListeners($eventName, array $listeners = [])
*/
public function makeListener($listener, $wildcard = false)
{
if (is_string($listener) || is_array($listener)) {
if (is_string($listener)) {
return $this->createClassListener($listener, $wildcard);
}

Expand All @@ -381,7 +381,7 @@ public function makeListener($listener, $wildcard = false)
/**
* Create a class based listener using the IoC container.
*
* @param string|array $listener
* @param string $listener
* @param bool $wildcard
* @return \Closure
*/
Expand All @@ -401,12 +401,12 @@ public function createClassListener($listener, $wildcard = false)
/**
* Create the class based event callable.
*
* @param string|array $listener
* @param string $listener
* @return callable
*/
protected function createClassCallable($listener)
{
[$class, $method] = is_array($listener) ? $listener : $this->parseClassCallable($listener);
[$class, $method] = $this->parseClassCallable($listener);

if ($this->handlerShouldBeQueued($class)) {
return $this->createQueuedHandlerCallable($class, $method);
Expand Down
18 changes: 0 additions & 18 deletions tests/Events/EventsDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,6 @@ public function testClassesWork()
$this->assertSame('baz', $_SERVER['__event.test']);
}

public function testArrayCallbackListenersAreHandled()
{
unset($_SERVER['__event.ExampleListener']);
$d = new Dispatcher;
$d->listen(ExampleEvent::class, [ExampleListener::class, 'hear']);
$d->dispatch(new ExampleEvent);

$this->assertTrue($_SERVER['__event.ExampleListener']);
}

public function testEventClassesArePayload()
{
unset($_SERVER['__event.test']);
Expand Down Expand Up @@ -400,11 +390,3 @@ class AnotherEvent implements SomeEventInterface
{
//
}

class ExampleListener
{
public function hear()
{
$_SERVER['__event.ExampleListener'] = true;
}
}

0 comments on commit 4e3fedb

Please sign in to comment.