Add advanced edge case tests: final+nested-brackets and multiple attributes

Co-authored-by: barryvdh <[email protected]>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-04 10:33:07 +00:00
co-authored by barryvdh
parent ee7b0cf6bd
commit 0fa3161af3
3 changed files with 74 additions and 0 deletions
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesBeforeClass\Models;
use Illuminate\Database\Eloquent\Model;
// Tests: final class + attribute with nested array argument (e.g. ObservedBy([...]))
#[ObservedByStub([StubObserver::class])]
final class FinalWithNested extends Model
{
protected $table = 'simples';
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesBeforeClass\Models;
use Illuminate\Database\Eloquent\Model;
// Tests: multiple consecutive PHP 8 attributes before the class declaration
#[\AllowDynamicProperties]
#[SecondAttribute]
class MultipleAttributes extends Model
{
protected $table = 'simples';
}
@@ -6,6 +6,51 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesBef
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
// Tests: final class + attribute with nested array argument (e.g. ObservedBy([...]))
/**
* @property int $id
* @method static \Illuminate\Database\Eloquent\Builder<static>|FinalWithNested newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|FinalWithNested newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|FinalWithNested query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|FinalWithNested whereId($value)
* @mixin \Eloquent
*/
#[ObservedByStub([StubObserver::class])]
final class FinalWithNested extends Model
{
protected $table = 'simples';
}
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesBeforeClass\Models;
use Illuminate\Database\Eloquent\Model;
// Tests: multiple consecutive PHP 8 attributes before the class declaration
/**
* @property int $id
* @method static \Illuminate\Database\Eloquent\Builder<static>|MultipleAttributes newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|MultipleAttributes newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|MultipleAttributes query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|MultipleAttributes whereId($value)
* @mixin \Eloquent
*/
#[\AllowDynamicProperties]
#[SecondAttribute]
class MultipleAttributes extends Model
{
protected $table = 'simples';
}
<?php
declare(strict_types=1);
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PhpAttributesBeforeClass\Models;
use Illuminate\Database\Eloquent\Model;
/** /**
* @property int $id * @property int $id
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()