From 7345b1bff401219dfeb095e7c1bd0f67e6d8c898 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:43:33 +0000 Subject: [PATCH] Add PHP 8.5 test for closures inside attribute arguments Co-authored-by: barryvdh <973269+barryvdh@users.noreply.github.com> --- .../Models/ClosureInAttribute.php | 14 ++++++++++ .../PhpAttributesClosureInAttribute/Test.php | 27 +++++++++++++++++++ .../__snapshots__/Test__test__1.php | 22 +++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Models/ClosureInAttribute.php create mode 100644 tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Test.php create mode 100644 tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/__snapshots__/Test__test__1.php diff --git a/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Models/ClosureInAttribute.php b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Models/ClosureInAttribute.php new file mode 100644 index 0000000..99fa888 --- /dev/null +++ b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Models/ClosureInAttribute.php @@ -0,0 +1,14 @@ + true)] +class ClosureInAttribute extends Model +{ + protected $table = 'simples'; +} diff --git a/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Test.php b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Test.php new file mode 100644 index 0000000..1208731 --- /dev/null +++ b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/Test.php @@ -0,0 +1,27 @@ +app->make(ModelsCommand::class); + + $tester = $this->runCommand($command, [ + '--write' => true, + ]); + + $this->assertSame(0, $tester->getStatusCode()); + $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); + $this->assertMatchesMockedSnapshot(); + } +} diff --git a/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..77e0f03 --- /dev/null +++ b/tests/Console/ModelsCommand/PhpAttributesClosureInAttribute/__snapshots__/Test__test__1.php @@ -0,0 +1,22 @@ +|ClosureInAttribute newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|ClosureInAttribute newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|ClosureInAttribute query() + * @method static \Illuminate\Database\Eloquent\Builder|ClosureInAttribute whereId($value) + * @mixin \Eloquent + */ +#[SomeClosureAttr(fn() => true)] +class ClosureInAttribute extends Model +{ + protected $table = 'simples'; +}