From 77831852bb7bc54f287246d32eb91274eaf87f8b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 15 Feb 2024 15:23:20 +0100 Subject: [PATCH] Fix final class keyword (#1517) * Fix final class keyword * Add changelog --- CHANGELOG.md | 11 ++++++- src/Console/ModelsCommand.php | 2 +- .../Models/FinalPost.php | 16 ++++++++++ .../__snapshots__/Test__test__1.php | 31 +++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/FinalPost.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca111e..0af1aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,18 @@ All notable changes to this project will be documented in this file. ### Added -2024-02-14, 2.15.0 +2024-02-15, 2.15.1 ------------------ +### Fixed +- Fix final class keyword in wrong position [#1517 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1517) + +### Changed + +### Added + +2024-02-14, 2.15.0 +------------------ ### Fixed - Fix case issue in `ModelsCommand::unsetMethod()` [#1453 / leo108](https://github.com/barryvdh/laravel-ide-helper/pull/1453) - Fix non-facade classes will result in no autocomplete [#841 / netpok](https://github.com/barryvdh/laravel-ide-helper/pull/841) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index a31cce5..299469d 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1083,7 +1083,7 @@ class ModelsCommand extends Command $classname = $this->write_mixin ? $mixinClassName : $classname; $allowDynamicAttributes = $this->write_mixin ? "#[\AllowDynamicProperties]\n\t" : ''; - $output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}{$allowDynamicAttributes}class {$classname} "; + $output = "namespace {$namespace}{\n{$docComment}\n\t{$allowDynamicAttributes}{$keyword}class {$classname} "; if (!$this->write_mixin) { $output .= "extends \Eloquent "; diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/FinalPost.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/FinalPost.php new file mode 100644 index 0000000..79cdff9 --- /dev/null +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/Models/FinalPost.php @@ -0,0 +1,16 @@ +