From 2fceccbe91011728d9166bba5f9d916e23c8d33d Mon Sep 17 00:00:00 2001 From: agis Date: Fri, 11 Sep 2026 09:06:20 +0700 Subject: [PATCH] feat(contracts): introduce Illuminate\Contracts namespace - Add 39 core Contracts interfaces matching L13 signatures - Old Support\Contracts\*Interface now extend new Contracts\Support\* (backward compatible: instanceof checks work both ways) - Migrate internal callsites: Response, View, and tests This unblocks SCC-1 cycle breaking by introducing the interface layer between Support and other core components. --- .../Contracts/Auth/Authenticatable.php | 14 ++++++++ src/Illuminate/Contracts/Auth/Guard.php | 14 ++++++++ .../Contracts/Auth/UserProvider.php | 13 +++++++ src/Illuminate/Contracts/Bus/Dispatcher.php | 16 +++++++++ .../Contracts/Bus/QueueingDispatcher.php | 10 ++++++ src/Illuminate/Contracts/Cache/Factory.php | 8 +++++ src/Illuminate/Contracts/Cache/Repository.php | 22 ++++++++++++ src/Illuminate/Contracts/Cache/Store.php | 18 ++++++++++ .../Contracts/Config/Repository.php | 13 +++++++ .../Container/BindingResolutionException.php | 11 ++++++ .../Container/CircularDependencyException.php | 11 ++++++ .../Contracts/Container/Container.php | 31 +++++++++++++++++ .../Container/ContextualBindingBuilder.php | 11 ++++++ src/Illuminate/Contracts/Cookie/Factory.php | 8 +++++ .../Contracts/Cookie/QueueingFactory.php | 10 ++++++ .../Contracts/Database/ModelIdentifier.php | 31 +++++++++++++++++ .../Contracts/Encryption/DecryptException.php | 10 ++++++ .../Contracts/Encryption/EncryptException.php | 10 ++++++ .../Contracts/Encryption/Encrypter.php | 12 +++++++ .../Contracts/Events/Dispatcher.php | 16 +++++++++ .../Filesystem/FileNotFoundException.php | 10 ++++++ .../Contracts/Filesystem/Filesystem.php | 33 ++++++++++++++++++ src/Illuminate/Contracts/Hashing/Hasher.php | 11 ++++++ src/Illuminate/Contracts/Http/Kernel.php | 11 ++++++ src/Illuminate/Contracts/Mail/MailQueue.php | 9 +++++ src/Illuminate/Contracts/Mail/Mailer.php | 13 +++++++ src/Illuminate/Contracts/Queue/Job.php | 30 ++++++++++++++++ src/Illuminate/Contracts/Queue/Queue.php | 21 ++++++++++++ .../Contracts/Queue/ShouldQueue.php | 8 +++++ src/Illuminate/Contracts/Redis/Factory.php | 8 +++++ .../Contracts/Routing/Registrar.php | 18 ++++++++++ .../Contracts/Routing/UrlGenerator.php | 19 +++++++++++ src/Illuminate/Contracts/Session/Session.php | 34 +++++++++++++++++++ .../Contracts/Support/Arrayable.php | 8 +++++ src/Illuminate/Contracts/Support/Jsonable.php | 8 +++++ .../Contracts/Support/MessageProvider.php | 8 +++++ .../Contracts/Support/Renderable.php | 8 +++++ src/Illuminate/Contracts/View/Factory.php | 15 ++++++++ src/Illuminate/Contracts/View/View.php | 12 +++++++ .../Foundation/Console/Optimize/config.php | 1 + src/Illuminate/Http/Response.php | 6 ++-- .../Support/Contracts/ArrayableInterface.php | 4 ++- .../Support/Contracts/JsonableInterface.php | 4 ++- .../Contracts/MessageProviderInterface.php | 4 ++- .../Support/Contracts/RenderableInterface.php | 4 ++- src/Illuminate/View/View.php | 8 +---- tests/Http/HttpResponseTest.php | 4 +-- tests/View/ViewTest.php | 4 +-- 48 files changed, 594 insertions(+), 18 deletions(-) create mode 100644 src/Illuminate/Contracts/Auth/Authenticatable.php create mode 100644 src/Illuminate/Contracts/Auth/Guard.php create mode 100644 src/Illuminate/Contracts/Auth/UserProvider.php create mode 100644 src/Illuminate/Contracts/Bus/Dispatcher.php create mode 100644 src/Illuminate/Contracts/Bus/QueueingDispatcher.php create mode 100644 src/Illuminate/Contracts/Cache/Factory.php create mode 100644 src/Illuminate/Contracts/Cache/Repository.php create mode 100644 src/Illuminate/Contracts/Cache/Store.php create mode 100644 src/Illuminate/Contracts/Config/Repository.php create mode 100644 src/Illuminate/Contracts/Container/BindingResolutionException.php create mode 100644 src/Illuminate/Contracts/Container/CircularDependencyException.php create mode 100644 src/Illuminate/Contracts/Container/Container.php create mode 100644 src/Illuminate/Contracts/Container/ContextualBindingBuilder.php create mode 100644 src/Illuminate/Contracts/Cookie/Factory.php create mode 100644 src/Illuminate/Contracts/Cookie/QueueingFactory.php create mode 100644 src/Illuminate/Contracts/Database/ModelIdentifier.php create mode 100644 src/Illuminate/Contracts/Encryption/DecryptException.php create mode 100644 src/Illuminate/Contracts/Encryption/EncryptException.php create mode 100644 src/Illuminate/Contracts/Encryption/Encrypter.php create mode 100644 src/Illuminate/Contracts/Events/Dispatcher.php create mode 100644 src/Illuminate/Contracts/Filesystem/FileNotFoundException.php create mode 100644 src/Illuminate/Contracts/Filesystem/Filesystem.php create mode 100644 src/Illuminate/Contracts/Hashing/Hasher.php create mode 100644 src/Illuminate/Contracts/Http/Kernel.php create mode 100644 src/Illuminate/Contracts/Mail/MailQueue.php create mode 100644 src/Illuminate/Contracts/Mail/Mailer.php create mode 100644 src/Illuminate/Contracts/Queue/Job.php create mode 100644 src/Illuminate/Contracts/Queue/Queue.php create mode 100644 src/Illuminate/Contracts/Queue/ShouldQueue.php create mode 100644 src/Illuminate/Contracts/Redis/Factory.php create mode 100644 src/Illuminate/Contracts/Routing/Registrar.php create mode 100644 src/Illuminate/Contracts/Routing/UrlGenerator.php create mode 100644 src/Illuminate/Contracts/Session/Session.php create mode 100644 src/Illuminate/Contracts/Support/Arrayable.php create mode 100644 src/Illuminate/Contracts/Support/Jsonable.php create mode 100644 src/Illuminate/Contracts/Support/MessageProvider.php create mode 100644 src/Illuminate/Contracts/Support/Renderable.php create mode 100644 src/Illuminate/Contracts/View/Factory.php create mode 100644 src/Illuminate/Contracts/View/View.php diff --git a/src/Illuminate/Contracts/Auth/Authenticatable.php b/src/Illuminate/Contracts/Auth/Authenticatable.php new file mode 100644 index 000000000..4e5a80061 --- /dev/null +++ b/src/Illuminate/Contracts/Auth/Authenticatable.php @@ -0,0 +1,14 @@ +class = $class; + $this->id = $id; + $this->relations = $relations; + $this->connection = $connection; + } + + public function useCollectionClass(?string $collectionClass) + { + $this->collectionClass = $collectionClass; + return $this; + } + + public function getClass(): ?string + { + return $this->class; + } +} diff --git a/src/Illuminate/Contracts/Encryption/DecryptException.php b/src/Illuminate/Contracts/Encryption/DecryptException.php new file mode 100644 index 000000000..7edebc9ca --- /dev/null +++ b/src/Illuminate/Contracts/Encryption/DecryptException.php @@ -0,0 +1,10 @@ +render(); } diff --git a/src/Illuminate/Support/Contracts/ArrayableInterface.php b/src/Illuminate/Support/Contracts/ArrayableInterface.php index 03834929e..55f136459 100755 --- a/src/Illuminate/Support/Contracts/ArrayableInterface.php +++ b/src/Illuminate/Support/Contracts/ArrayableInterface.php @@ -1,6 +1,8 @@ data = $data instanceof Arrayable ? $data->toArray() : (array) $data; } - /** - * Get the string contents of the view. - * - * @param \Closure $callback - * @return string - */ public function render(?Closure $callback = null) { try { diff --git a/tests/Http/HttpResponseTest.php b/tests/Http/HttpResponseTest.php index 735ec8bc3..d245e3118 100755 --- a/tests/Http/HttpResponseTest.php +++ b/tests/Http/HttpResponseTest.php @@ -3,7 +3,7 @@ use Illuminate\Http\Response; use Illuminate\Support\Contracts\ArrayableInterface; use Illuminate\Support\Contracts\JsonableInterface; -use Illuminate\Support\Contracts\RenderableInterface; +use Illuminate\Contracts\Support\Renderable; use L4\Tests\BackwardCompatibleTestCase; use Mockery as m; use Symfony\Component\HttpFoundation\Cookie; @@ -52,7 +52,7 @@ public function testJsonResponsesAreConvertedAndHeadersAreSet() public function testRenderablesAreRendered() { - $mock = m::mock(RenderableInterface::class); + $mock = m::mock(Renderable::class); $mock->shouldReceive('render')->once()->andReturn('foo'); $response = new Response($mock); $this->assertEquals('foo', $response->getContent()); diff --git a/tests/View/ViewTest.php b/tests/View/ViewTest.php index 4c11f479a..f6797238c 100755 --- a/tests/View/ViewTest.php +++ b/tests/View/ViewTest.php @@ -1,7 +1,7 @@ getFactory()->shouldReceive('decrementRender')->once()->ordered(); $view->getFactory()->shouldReceive('flushSectionsIfDoneRendering')->once(); - $view->renderable = m::mock(RenderableInterface::class); + $view->renderable = m::mock(Renderable::class); $view->renderable->shouldReceive('render')->once()->andReturn('text'); $this->assertEquals('contents', $view->render()); }