mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-19 10:33:11 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c9b88f4b0 | ||
|
|
7345b1bff4 | ||
|
|
0fa3161af3 | ||
|
|
ee7b0cf6bd | ||
|
|
7cd11e292c |
+1
-1
@@ -187,7 +187,7 @@ class Alias
|
|||||||
public function shouldExtendParentClass()
|
public function shouldExtendParentClass()
|
||||||
{
|
{
|
||||||
return $this->parentClass
|
return $this->parentClass
|
||||||
&& !is_subclass_of($this->extends, Facade::class);
|
&& $this->getExtendsNamespace() !== '\\Illuminate\\Support\\Facades';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -195,18 +195,6 @@ class MetaCommand extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't throw when class existence is being checked via class_exists(),
|
|
||||||
// interface_exists(), trait_exists(), or enum_exists(). These functions
|
|
||||||
// expect the autoloader to return gracefully when the class doesn't exist.
|
|
||||||
// Throwing here would break libraries that use class_exists() to check for
|
|
||||||
// optional dependencies (e.g. Doctrine ORM checking for removed classes).
|
|
||||||
$existsFunctions = ['class_exists', 'interface_exists', 'trait_exists', 'enum_exists'];
|
|
||||||
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3) as $frame) {
|
|
||||||
if (isset($frame['function']) && in_array($frame['function'], $existsFunctions, true)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \ReflectionException("Class '$class' not found.");
|
throw new \ReflectionException("Class '$class' not found.");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+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