Skip to content

Commit 4e3fedb

Browse files
committed
Revert "handle array callbacks"
This reverts commit b80ddf4.
1 parent a938e20 commit 4e3fedb

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

src/Illuminate/Events/Dispatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ protected function addInterfaceListeners($eventName, array $listeners = [])
365365
*/
366366
public function makeListener($listener, $wildcard = false)
367367
{
368-
if (is_string($listener) || is_array($listener)) {
368+
if (is_string($listener)) {
369369
return $this->createClassListener($listener, $wildcard);
370370
}
371371

@@ -381,7 +381,7 @@ public function makeListener($listener, $wildcard = false)
381381
/**
382382
* Create a class based listener using the IoC container.
383383
*
384-
* @param string|array $listener
384+
* @param string $listener
385385
* @param bool $wildcard
386386
* @return \Closure
387387
*/
@@ -401,12 +401,12 @@ public function createClassListener($listener, $wildcard = false)
401401
/**
402402
* Create the class based event callable.
403403
*
404-
* @param string|array $listener
404+
* @param string $listener
405405
* @return callable
406406
*/
407407
protected function createClassCallable($listener)
408408
{
409-
[$class, $method] = is_array($listener) ? $listener : $this->parseClassCallable($listener);
409+
[$class, $method] = $this->parseClassCallable($listener);
410410

411411
if ($this->handlerShouldBeQueued($class)) {
412412
return $this->createQueuedHandlerCallable($class, $method);

tests/Events/EventsDispatcherTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,6 @@ public function testClassesWork()
327327
$this->assertSame('baz', $_SERVER['__event.test']);
328328
}
329329

330-
public function testArrayCallbackListenersAreHandled()
331-
{
332-
unset($_SERVER['__event.ExampleListener']);
333-
$d = new Dispatcher;
334-
$d->listen(ExampleEvent::class, [ExampleListener::class, 'hear']);
335-
$d->dispatch(new ExampleEvent);
336-
337-
$this->assertTrue($_SERVER['__event.ExampleListener']);
338-
}
339-
340330
public function testEventClassesArePayload()
341331
{
342332
unset($_SERVER['__event.test']);
@@ -400,11 +390,3 @@ class AnotherEvent implements SomeEventInterface
400390
{
401391
//
402392
}
403-
404-
class ExampleListener
405-
{
406-
public function hear()
407-
{
408-
$_SERVER['__event.ExampleListener'] = true;
409-
}
410-
}

0 commit comments

Comments
 (0)