Add AllowDynamicProperties Attribute to cooperate with php8.2 deprecation

This commit is contained in:
GeoSot
2023-03-09 16:45:39 +02:00
parent 4dc20b028a
commit 19b6ebd58f
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -1055,9 +1055,11 @@ class ModelsCommand extends Command
}
$classname = $this->write_mixin ? $mixinClassName : $classname;
$output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}class {$classname} ";
if (!$this->write_mixin) {
$allowDynamicAttributes = $this->write_mixin ? "#[\AllowDynamicProperties]\n\t" : '';
$output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}{$allowDynamicAttributes}class {$classname} ";
if (! $this->write_mixin) {
$output .= "extends \Eloquent ";
if ($interfaceNames) {
@@ -183,6 +183,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value)
* @mixin \Eloquent
*/
class IdeHelperPost {}
#[\AllowDynamicProperties]
class IdeHelperPost {}
}