Skip to content

Commit 96f9766

Browse files
committed
Renamed implementation
1 parent eafbf74 commit 96f9766

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/InertiaResponsable.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Prop.php renamed to src/PropContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Illuminate\Http\Request;
66

7-
class Prop
7+
class PropContext
88
{
99
public function __construct(
1010
public string $key,

src/ProvidesInertiaProp.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Inertia;
4+
5+
interface ProvidesInertiaProp
6+
{
7+
public function toInertiaProp(PropContext $prop): mixed;
8+
}

src/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ public function resolvePropertyInstances(array $props, Request $request, ?string
263263

264264
$currentKey = $parentKey ? $parentKey.'.'.$key : $key;
265265

266-
if ($value instanceof InertiaResponsable) {
267-
$value = $value->toInertiaResponse(new Prop($currentKey, $props, $request));
266+
if ($value instanceof ProvidesInertiaProp) {
267+
$value = $value->toInertiaProp(new PropContext($currentKey, $props, $request));
268268
}
269269

270270
if ($value instanceof Arrayable) {

tests/Stubs/MergeWithSharedProp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Inertia\Tests\Stubs;
44

55
use Inertia\Inertia;
6-
use Inertia\InertiaResponsable;
7-
use Inertia\Prop;
6+
use Inertia\PropContext;
7+
use Inertia\ProvidesInertiaProp;
88

9-
class MergeWithSharedProp implements InertiaResponsable
9+
class MergeWithSharedProp implements ProvidesInertiaProp
1010
{
1111
public function __construct(protected array $items = []) {}
1212

13-
public function toInertiaResponse(Prop $prop): mixed
13+
public function toInertiaProp(PropContext $prop): mixed
1414
{
1515
return array_merge(Inertia::getShared($prop->key, []), $this->items);
1616
}

0 commit comments

Comments
 (0)