Skip to content

Commit 57578a9

Browse files
committed
Add PHP 8.5 Guidelines
Signed-off-by: Pushpak Chhajed <[email protected]>
1 parent 9be69f1 commit 57578a9

19 files changed

+87
-53
lines changed

.ai/php/8.5/core.blade.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## PHP 8.5
2+
3+
- PHP 8.5 introduces new array functions for cleaner code:
4+
- `array_first(array $array): mixed` - Get first value (or `null` if empty)
5+
- `array_last(array $array): mixed` - Get last value (or `null` if empty)
6+
7+
- The `#[\NoDiscard]` attribute warns when a function's return value is ignored. Use `(void)` cast to suppress intentionally.
8+
9+
### Pipe Operator
10+
- The pipe operator (`|>`) chains function calls left-to-right, replacing nested calls:
11+
<code-snippet name="Pipe Operator Example" lang="php">
12+
// Before PHP 8.5
13+
$slug = strtolower(str_replace(' ', '-', trim($title)));
14+
15+
// After PHP 8.5
16+
$slug = $title |> trim(...) |> (fn($s) => str_replace(' ', '-', $s)) |> strtolower(...);
17+
</code-snippet>
18+
19+
### Clone With
20+
- Properties can be modified during cloning using `clone($object, ['property' => $value])`:
21+
<code-snippet name="Clone With Example" lang="php">
22+
// Before PHP 8.5 (readonly classes required manual reconstruction)
23+
$new = new User(...get_object_vars($user), role: 'admin');
24+
25+
// After PHP 8.5
26+
$new = clone($user, ['role' => 'admin']);
27+
</code-snippet>

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"illuminate/contracts": "^10.49.0|^11.45.3|^12.28.1",
2020
"illuminate/routing": "^10.49.0|^11.45.3|^12.28.1",
2121
"illuminate/support": "^10.49.0|^11.45.3|^12.28.1",
22-
"laravel/mcp": "^0.3.4",
22+
"laravel/mcp": "^0.4.0",
2323
"laravel/prompts": "0.1.25|^0.3.6",
2424
"laravel/roster": "^0.2.9"
2525
},
2626
"require-dev": {
27-
"laravel/pint": "1.20",
27+
"laravel/pint": "^v1.26.0",
2828
"mockery/mockery": "^1.6.12",
2929
"orchestra/testbench": "^8.36.0|^9.15.0|^10.6",
30-
"pestphp/pest": "^2.36.0|^3.8.4",
30+
"pestphp/pest": "^2.36.0|^3.8.4|^4.1.5",
3131
"phpstan/phpstan": "^2.1.27",
3232
"rector/rector": "^2.1"
3333
},

src/Mcp/Tools/BrowserLogs.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Laravel\Boost\Concerns\ReadsLogs;
910
use Laravel\Mcp\Request;
1011
use Laravel\Mcp\Response;
@@ -24,7 +25,7 @@ class BrowserLogs extends Tool
2425
/**
2526
* Get the tool's input schema.
2627
*
27-
* @return array<string, JsonSchema>
28+
* @return array<string, Type>
2829
*/
2930
public function schema(JsonSchema $schema): array
3031
{

src/Mcp/Tools/DatabaseQuery.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Illuminate\Support\Facades\DB;
910
use Laravel\Mcp\Request;
1011
use Laravel\Mcp\Response;
@@ -23,7 +24,7 @@ class DatabaseQuery extends Tool
2324
/**
2425
* Get the tool's input schema.
2526
*
26-
* @return array<string, JsonSchema>
27+
* @return array<string, Type>
2728
*/
2829
public function schema(JsonSchema $schema): array
2930
{

src/Mcp/Tools/DatabaseSchema.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
namespace Laravel\Boost\Mcp\Tools;
66

77
use Exception;
8-
use Illuminate\JsonSchema\JsonSchema;
8+
use Illuminate\Contracts\JsonSchema\JsonSchema;
9+
use Illuminate\JsonSchema\Types\Type;
910
use Illuminate\Support\Arr;
1011
use Illuminate\Support\Facades\Cache;
1112
use Illuminate\Support\Facades\DB;
@@ -28,7 +29,7 @@ class DatabaseSchema extends Tool
2829
/**
2930
* Get the tool's input schema.
3031
*
31-
* @return array<string, JsonSchema>
32+
* @return array<string, Type>
3233
*/
3334
public function schema(JsonSchema $schema): array
3435
{

src/Mcp/Tools/GetAbsoluteUrl.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Laravel\Mcp\Request;
910
use Laravel\Mcp\Response;
1011
use Laravel\Mcp\Server\Tool;
@@ -21,7 +22,7 @@ class GetAbsoluteUrl extends Tool
2122
/**
2223
* Get the tool's input schema.
2324
*
24-
* @return array<string, JsonSchema>
25+
* @return array<string, Type>
2526
*/
2627
public function schema(JsonSchema $schema): array
2728
{

src/Mcp/Tools/GetConfig.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Illuminate\Support\Facades\Config;
910
use Laravel\Mcp\Request;
1011
use Laravel\Mcp\Response;
@@ -19,7 +20,7 @@ class GetConfig extends Tool
1920
/**
2021
* Get the tool's input schema.
2122
*
22-
* @return array<string, JsonSchema>
23+
* @return array<string, Type>
2324
*/
2425
public function schema(JsonSchema $schema): array
2526
{

src/Mcp/Tools/ListAvailableEnvVars.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Laravel\Mcp\Request;
910
use Laravel\Mcp\Response;
1011
use Laravel\Mcp\Server\Tool;
@@ -21,7 +22,7 @@ class ListAvailableEnvVars extends Tool
2122
/**
2223
* Get the tool's input schema.
2324
*
24-
* @return array<string, JsonSchema>
25+
* @return array<string, Type>
2526
*/
2627
public function schema(JsonSchema $schema): array
2728
{

src/Mcp/Tools/ListRoutes.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Illuminate\Support\Facades\Artisan;
910
use Laravel\Mcp\Request;
1011
use Laravel\Mcp\Response;
@@ -24,7 +25,7 @@ class ListRoutes extends Tool
2425
/**
2526
* Get the tool's input schema.
2627
*
27-
* @return array<string, JsonSchema>
28+
* @return array<string, Type>
2829
*/
2930
public function schema(JsonSchema $schema): array
3031
{

src/Mcp/Tools/ReadLogEntries.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
namespace Laravel\Boost\Mcp\Tools;
66

7-
use Illuminate\JsonSchema\JsonSchema;
7+
use Illuminate\Contracts\JsonSchema\JsonSchema;
8+
use Illuminate\JsonSchema\Types\Type;
89
use Laravel\Boost\Concerns\ReadsLogs;
910
use Laravel\Mcp\Request;
1011
use Laravel\Mcp\Response;
@@ -24,7 +25,7 @@ class ReadLogEntries extends Tool
2425
/**
2526
* Get the tool's input schema.
2627
*
27-
* @return array<string, JsonSchema>
28+
* @return array<string, Type>
2829
*/
2930
public function schema(JsonSchema $schema): array
3031
{

0 commit comments

Comments
 (0)