From 42385c358bdcf54cb489fd91ed578e7836639fa7 Mon Sep 17 00:00:00 2001
From: Lucas Michot <lucas@semalead.com>
Date: Mon, 7 Aug 2017 19:58:22 +0200
Subject: [PATCH 1/2] Move engine to Contracts.

---
 .../EngineInterface.php => Contracts/View/Engine.php}  |  4 ++--
 src/Illuminate/View/Engines/EngineResolver.php         |  2 +-
 src/Illuminate/View/Engines/FileEngine.php             |  4 +++-
 src/Illuminate/View/Engines/PhpEngine.php              |  3 ++-
 src/Illuminate/View/Factory.php                        |  2 +-
 src/Illuminate/View/View.php                           | 10 +++++-----
 tests/View/ViewFactoryTest.php                         |  8 ++++----
 tests/View/ViewTest.php                                |  4 ++--
 8 files changed, 20 insertions(+), 17 deletions(-)
 rename src/Illuminate/{View/Engines/EngineInterface.php => Contracts/View/Engine.php} (77%)

diff --git a/src/Illuminate/View/Engines/EngineInterface.php b/src/Illuminate/Contracts/View/Engine.php
similarity index 77%
rename from src/Illuminate/View/Engines/EngineInterface.php
rename to src/Illuminate/Contracts/View/Engine.php
index a6f71d2af78f..4d0b268c1df9 100755
--- a/src/Illuminate/View/Engines/EngineInterface.php
+++ b/src/Illuminate/Contracts/View/Engine.php
@@ -1,8 +1,8 @@
 <?php
 
-namespace Illuminate\View\Engines;
+namespace Illuminate\Contracts\View;
 
-interface EngineInterface
+interface Engine
 {
     /**
      * Get the evaluated contents of the view.
diff --git a/src/Illuminate/View/Engines/EngineResolver.php b/src/Illuminate/View/Engines/EngineResolver.php
index 3a9f2e19460b..66b6e64a2b64 100755
--- a/src/Illuminate/View/Engines/EngineResolver.php
+++ b/src/Illuminate/View/Engines/EngineResolver.php
@@ -41,7 +41,7 @@ public function register($engine, Closure $resolver)
      * Resolver an engine instance by name.
      *
      * @param  string  $engine
-     * @return \Illuminate\View\Engines\EngineInterface
+     * @return \Illuminate\Contracts\View\Engine
      * @throws \InvalidArgumentException
      */
     public function resolve($engine)
diff --git a/src/Illuminate/View/Engines/FileEngine.php b/src/Illuminate/View/Engines/FileEngine.php
index e9ec85d8feaa..360b54381a8f 100644
--- a/src/Illuminate/View/Engines/FileEngine.php
+++ b/src/Illuminate/View/Engines/FileEngine.php
@@ -2,7 +2,9 @@
 
 namespace Illuminate\View\Engines;
 
-class FileEngine implements EngineInterface
+use Illuminate\Contracts\View\Engine;
+
+class FileEngine implements Engine
 {
     /**
      * Get the evaluated contents of the view.
diff --git a/src/Illuminate/View/Engines/PhpEngine.php b/src/Illuminate/View/Engines/PhpEngine.php
index 1b2a3837c3b9..4209e58bdd85 100755
--- a/src/Illuminate/View/Engines/PhpEngine.php
+++ b/src/Illuminate/View/Engines/PhpEngine.php
@@ -4,9 +4,10 @@
 
 use Exception;
 use Throwable;
+use Illuminate\Contracts\View\Engine;
 use Symfony\Component\Debug\Exception\FatalThrowableError;
 
-class PhpEngine implements EngineInterface
+class PhpEngine implements Engine
 {
     /**
      * Get the evaluated contents of the view.
diff --git a/src/Illuminate/View/Factory.php b/src/Illuminate/View/Factory.php
index 238e0c679f9a..6418a653f453 100755
--- a/src/Illuminate/View/Factory.php
+++ b/src/Illuminate/View/Factory.php
@@ -248,7 +248,7 @@ public function exists($view)
      * Get the appropriate view engine for the given path.
      *
      * @param  string  $path
-     * @return \Illuminate\View\Engines\EngineInterface
+     * @return \Illuminate\Contracts\View\Engine
      *
      * @throws \InvalidArgumentException
      */
diff --git a/src/Illuminate/View/View.php b/src/Illuminate/View/View.php
index 592f4292f657..bfa7604fa4c4 100755
--- a/src/Illuminate/View/View.php
+++ b/src/Illuminate/View/View.php
@@ -10,7 +10,7 @@
 use Illuminate\Support\MessageBag;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
-use Illuminate\View\Engines\EngineInterface;
+use Illuminate\Contracts\View\Engine;
 use Illuminate\Contracts\Support\MessageProvider;
 use Illuminate\Contracts\View\View as ViewContract;
 
@@ -26,7 +26,7 @@ class View implements ArrayAccess, ViewContract
     /**
      * The engine implementation.
      *
-     * @var \Illuminate\View\Engines\EngineInterface
+     * @var \Illuminate\Contracts\View\Engine
      */
     protected $engine;
 
@@ -55,13 +55,13 @@ class View implements ArrayAccess, ViewContract
      * Create a new view instance.
      *
      * @param  \Illuminate\View\Factory  $factory
-     * @param  \Illuminate\View\Engines\EngineInterface  $engine
+     * @param  \Illuminate\Contracts\View\Engine  $engine
      * @param  string  $view
      * @param  string  $path
      * @param  mixed  $data
      * @return void
      */
-    public function __construct(Factory $factory, EngineInterface $engine, $view, $path, $data = [])
+    public function __construct(Factory $factory, Engine $engine, $view, $path, $data = [])
     {
         $this->view = $view;
         $this->path = $path;
@@ -287,7 +287,7 @@ public function getFactory()
     /**
      * Get the view's rendering engine.
      *
-     * @return \Illuminate\View\Engines\EngineInterface
+     * @return \Illuminate\Contracts\View\Engine
      */
     public function getEngine()
     {
diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php
index 71246203e31a..b7bb7992d233 100755
--- a/tests/View/ViewFactoryTest.php
+++ b/tests/View/ViewFactoryTest.php
@@ -20,7 +20,7 @@ public function testMakeCreatesNewViewInstanceWithProperPathAndEngine()
 
         $factory = $this->getFactory();
         $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('path.php');
-        $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('php')->andReturn($engine = m::mock('Illuminate\View\Engines\EngineInterface'));
+        $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('php')->andReturn($engine = m::mock(\Illuminate\Contracts\View\Engine::class));
         $factory->getFinder()->shouldReceive('addExtension')->once()->with('php');
         $factory->setDispatcher(new \Illuminate\Events\Dispatcher);
         $factory->creator('view', function ($view) {
@@ -83,7 +83,7 @@ public function testEnvironmentAddsExtensionWithCustomResolver()
         $factory->getFinder()->shouldReceive('addExtension')->once()->with('foo');
         $factory->getEngineResolver()->shouldReceive('register')->once()->with('bar', $resolver);
         $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('path.foo');
-        $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('bar')->andReturn($engine = m::mock(\Illuminate\View\Engines\EngineInterface::class));
+        $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('bar')->andReturn($engine = m::mock(\Illuminate\Contracts\View\Engine::class));
         $factory->getDispatcher()->shouldReceive('dispatch');
 
         $factory->addExtension('foo', 'bar', $resolver);
@@ -409,7 +409,7 @@ public function testMakeWithSlashAndDot()
     {
         $factory = $this->getFactory();
         $factory->getFinder()->shouldReceive('find')->twice()->with('foo.bar')->andReturn('path.php');
-        $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(\Illuminate\View\Engines\EngineInterface::class));
+        $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(\Illuminate\Contracts\View\Engine::class));
         $factory->getDispatcher()->shouldReceive('dispatch');
         $factory->make('foo/bar');
         $factory->make('foo.bar');
@@ -419,7 +419,7 @@ public function testNamespacedViewNamesAreNormalizedProperly()
     {
         $factory = $this->getFactory();
         $factory->getFinder()->shouldReceive('find')->twice()->with('vendor/package::foo.bar')->andReturn('path.php');
-        $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(\Illuminate\View\Engines\EngineInterface::class));
+        $factory->getEngineResolver()->shouldReceive('resolve')->twice()->with('php')->andReturn(m::mock(\Illuminate\Contracts\View\Engine::class));
         $factory->getDispatcher()->shouldReceive('dispatch');
         $factory->make('vendor/package::foo/bar');
         $factory->make('vendor/package::foo.bar');
diff --git a/tests/View/ViewTest.php b/tests/View/ViewTest.php
index 6117191d241f..fd203d713baa 100755
--- a/tests/View/ViewTest.php
+++ b/tests/View/ViewTest.php
@@ -70,7 +70,7 @@ public function testRenderSectionsReturnsEnvironmentSections()
     {
         $view = m::mock('Illuminate\View\View[render]', [
             m::mock('Illuminate\View\Factory'),
-            m::mock('Illuminate\View\Engines\EngineInterface'),
+            m::mock(\Illuminate\Contracts\View\Engine::class),
             'view',
             'path',
             [],
@@ -224,7 +224,7 @@ protected function getView($data = [])
     {
         return new View(
             m::mock('Illuminate\View\Factory'),
-            m::mock('Illuminate\View\Engines\EngineInterface'),
+            m::mock(\Illuminate\Contracts\View\Engine::class),
             'view',
             'path',
             $data

From cd536966a7b4ea59fb795a2a31e25d6dff105b3b Mon Sep 17 00:00:00 2001
From: Lucas Michot <lucas@semalead.com>
Date: Mon, 7 Aug 2017 20:00:27 +0200
Subject: [PATCH 2/2] Fix Style.

---
 src/Illuminate/View/View.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Illuminate/View/View.php b/src/Illuminate/View/View.php
index bfa7604fa4c4..496eb6cbd198 100755
--- a/src/Illuminate/View/View.php
+++ b/src/Illuminate/View/View.php
@@ -8,9 +8,9 @@
 use BadMethodCallException;
 use Illuminate\Support\Str;
 use Illuminate\Support\MessageBag;
+use Illuminate\Contracts\View\Engine;
 use Illuminate\Contracts\Support\Arrayable;
 use Illuminate\Contracts\Support\Renderable;
-use Illuminate\Contracts\View\Engine;
 use Illuminate\Contracts\Support\MessageProvider;
 use Illuminate\Contracts\View\View as ViewContract;