diff --git a/src/Illuminate/Contracts/View/Factory.php b/src/Illuminate/Contracts/View/Factory.php index 1bffd1aa27b9..dc9b19a2676c 100644 --- a/src/Illuminate/Contracts/View/Factory.php +++ b/src/Illuminate/Contracts/View/Factory.php @@ -46,10 +46,9 @@ public function share($key, $value = null); * * @param array|string $views * @param \Closure|string $callback - * @param int|null $priority * @return array */ - public function composer($views, $callback, $priority = null); + public function composer($views, $callback); /** * Register a view creator event. diff --git a/src/Illuminate/View/Concerns/ManagesEvents.php b/src/Illuminate/View/Concerns/ManagesEvents.php index 94512756d381..8f837ba0dd9a 100644 --- a/src/Illuminate/View/Concerns/ManagesEvents.php +++ b/src/Illuminate/View/Concerns/ManagesEvents.php @@ -50,15 +50,14 @@ public function composers(array $composers) * * @param array|string $views * @param \Closure|string $callback - * @param int|null $priority * @return array */ - public function composer($views, $callback, $priority = null) + public function composer($views, $callback) { $composers = []; foreach ((array) $views as $view) { - $composers[] = $this->addViewEvent($view, $callback, 'composing: ', $priority); + $composers[] = $this->addViewEvent($view, $callback, 'composing: '); } return $composers; @@ -70,19 +69,18 @@ public function composer($views, $callback, $priority = null) * @param string $view * @param \Closure|string $callback * @param string $prefix - * @param int|null $priority * @return \Closure|null */ - protected function addViewEvent($view, $callback, $prefix = 'composing: ', $priority = null) + protected function addViewEvent($view, $callback, $prefix = 'composing: ') { $view = $this->normalizeName($view); if ($callback instanceof Closure) { - $this->addEventListener($prefix.$view, $callback, $priority); + $this->addEventListener($prefix.$view, $callback); return $callback; } elseif (is_string($callback)) { - return $this->addClassEvent($view, $callback, $prefix, $priority); + return $this->addClassEvent($view, $callback, $prefix); } } @@ -92,10 +90,9 @@ protected function addViewEvent($view, $callback, $prefix = 'composing: ', $prio * @param string $view * @param string $class * @param string $prefix - * @param int|null $priority * @return \Closure */ - protected function addClassEvent($view, $class, $prefix, $priority = null) + protected function addClassEvent($view, $class, $prefix) { $name = $prefix.$view; @@ -106,7 +103,7 @@ protected function addClassEvent($view, $class, $prefix, $priority = null) $class, $prefix ); - $this->addEventListener($name, $callback, $priority); + $this->addEventListener($name, $callback); return $callback; } @@ -164,16 +161,11 @@ protected function classEventMethodForPrefix($prefix) * * @param string $name * @param \Closure $callback - * @param int|null $priority * @return void */ - protected function addEventListener($name, $callback, $priority = null) + protected function addEventListener($name, $callback) { - if (is_null($priority)) { - $this->events->listen($name, $callback); - } else { - $this->events->listen($name, $callback, $priority); - } + $this->events->listen($name, $callback); } /** diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php index 35ef0e03b879..05121c12f323 100755 --- a/tests/View/ViewFactoryTest.php +++ b/tests/View/ViewFactoryTest.php @@ -126,18 +126,6 @@ public function testComposersAreProperlyRegistered() $this->assertEquals('bar', $callback()); } - public function testComposersAreProperlyRegisteredWithPriority() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure'), 1); - $callback = $factory->composer('foo', function () { - return 'bar'; - }, 1); - $callback = $callback[0]; - - $this->assertEquals('bar', $callback()); - } - public function testComposersCanBeMassRegistered() { $factory = $this->getFactory();