Skip to content

Commit f7e1526

Browse files
committed
Merge branch '2.x' into provides-inertia-props
2 parents 1994a15 + 091daa7 commit f7e1526

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/PropContext.php renamed to src/PropertyContext.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 PropContext
7+
class PropertyContext
88
{
99
public function __construct(
1010
public string $key,

src/ProvidesInertiaProp.php

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

src/ProvidesInertiaProperty.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 ProvidesInertiaProperty
6+
{
7+
public function toInertiaProperty(PropertyContext $prop): mixed;
8+
}

src/Response.php

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

300300
$currentKey = $parentKey ? $parentKey.'.'.$key : $key;
301301

302-
if ($value instanceof ProvidesInertiaProp) {
303-
$value = $value->toInertiaProp(new PropContext($currentKey, $props, $request));
302+
if ($value instanceof ProvidesInertiaProperty) {
303+
$value = $value->toInertiaProperty(new PropertyContext($currentKey, $props, $request));
304304
}
305305

306306
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\PropContext;
7-
use Inertia\ProvidesInertiaProp;
6+
use Inertia\PropertyContext;
7+
use Inertia\ProvidesInertiaProperty;
88

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

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

0 commit comments

Comments
 (0)