mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Add PHP 8.5 test for closures inside attribute arguments
Co-authored-by: barryvdh <[email protected]>
This commit is contained in:
co-authored by
barryvdh
parent
0fa3161af3
commit
7345b1bff4
+14
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesClosureInAttribute\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// Tests: closure expression inside an attribute argument (PHP 8.5+)
|
||||||
|
#[SomeClosureAttr(fn() => true)]
|
||||||
|
class ClosureInAttribute extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'simples';
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesClosureInAttribute;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
|
||||||
|
class Test extends AbstractModelsCommand
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @requires PHP 8.5
|
||||||
|
*/
|
||||||
|
public function test(): void
|
||||||
|
{
|
||||||
|
$command = $this->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesClosureInAttribute\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// Tests: closure expression inside an attribute argument (PHP 8.5+)
|
||||||
|
/**
|
||||||
|
* @property int $id
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|ClosureInAttribute newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|ClosureInAttribute newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|ClosureInAttribute query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|ClosureInAttribute whereId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
#[SomeClosureAttr(fn() => true)]
|
||||||
|
class ClosureInAttribute extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'simples';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user