diff --git a/.github/workflows/run-static-analysis.yml b/.github/workflows/run-static-analysis.yml
index 1085dfe..c8c29bb 100644
--- a/.github/workflows/run-static-analysis.yml
+++ b/.github/workflows/run-static-analysis.yml
@@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
- php-version: 8.0
+ php-version: 8.1
coverage: none
extensions: pdo_sqlite
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16fa904..d638d2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
### Changed
- Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504)
+
+### Added
+- Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464)
+
2024-02-05, 2.14.0
------------------
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index f6a5b14..84de223 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -16,4 +16,9 @@
\Storage
+
+
+ \UnitEnum
+
+
diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php
index c2ce4a6..13735c2 100644
--- a/src/Console/ModelsCommand.php
+++ b/src/Console/ModelsCommand.php
@@ -1099,6 +1099,8 @@ class ModelsCommand extends Command
$default = 'null';
} elseif (is_int($default)) {
//$default = $default;
+ } elseif ($default instanceof \UnitEnum) {
+ $default = '\\' . get_class($default) . '::' . $default->name;
} else {
$default = "'" . trim($default) . "'";
}
diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php
new file mode 100644
index 0000000..afe6b9b
--- /dev/null
+++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php
@@ -0,0 +1,12 @@
+=')) {
+ $this->markTestSkipped(
+ 'This test only works in PHP >= 8.1'
+ );
+ }
+
+ $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();
+ }
+}
diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php
new file mode 100644
index 0000000..b4229da
--- /dev/null
+++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php
@@ -0,0 +1,172 @@
+