Skip to content

Commit 7783185

Browse files
authored
Fix final class keyword (#1517)
* Fix final class keyword * Add changelog
1 parent b47a118 commit 7783185

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ All notable changes to this project will be documented in this file.
1111

1212
### Added
1313

14-
2024-02-14, 2.15.0
14+
2024-02-15, 2.15.1
1515
------------------
1616

17+
### Fixed
18+
- Fix final class keyword in wrong position [#1517 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1517)
19+
20+
### Changed
21+
22+
### Added
23+
24+
2024-02-14, 2.15.0
25+
------------------
1726
### Fixed
1827
- Fix case issue in `ModelsCommand::unsetMethod()` [#1453 / leo108](https://github.com/barryvdh/laravel-ide-helper/pull/1453)
1928
- Fix non-facade classes will result in no autocomplete [#841 / netpok](https://github.com/barryvdh/laravel-ide-helper/pull/841)

src/Console/ModelsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ protected function createPhpDocs($class)
10831083
$classname = $this->write_mixin ? $mixinClassName : $classname;
10841084

10851085
$allowDynamicAttributes = $this->write_mixin ? "#[\AllowDynamicProperties]\n\t" : '';
1086-
$output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}{$allowDynamicAttributes}class {$classname} ";
1086+
$output = "namespace {$namespace}{\n{$docComment}\n\t{$allowDynamicAttributes}{$keyword}class {$classname} ";
10871087

10881088
if (!$this->write_mixin) {
10891089
$output .= "extends \Eloquent ";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models;
6+
7+
use Illuminate\Database\Eloquent\Model;
8+
9+
/**
10+
* @property $someProp
11+
* @method someMethod(string $method)
12+
* @mixin IdeHelperPost
13+
*/
14+
final class FinalPost extends Model
15+
{
16+
}

tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66

77
use Illuminate\Database\Eloquent\Model;
88

9+
/**
10+
* @property $someProp
11+
* @method someMethod(string $method)
12+
* @mixin IdeHelperFinalPost
13+
*/
14+
final class FinalPost extends Model
15+
{
16+
}
17+
<?php
18+
19+
declare(strict_types=1);
20+
21+
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models;
22+
23+
use Illuminate\Database\Eloquent\Model;
24+
925
/**
1026
* @property $someProp
1127
* @method someMethod(string $method)
@@ -27,6 +43,21 @@ class Post extends Model
2743
*/
2844

2945

46+
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
47+
/**
48+
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models\FinalPost
49+
*
50+
* @property $someProp
51+
* @method someMethod(string $method)
52+
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost newModelQuery()
53+
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost newQuery()
54+
* @method static \Illuminate\Database\Eloquent\Builder|FinalPost query()
55+
* @mixin \Eloquent
56+
*/
57+
#[\AllowDynamicProperties]
58+
final class IdeHelperFinalPost {}
59+
}
60+
3061
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
3162
/**
3263
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models\Post

0 commit comments

Comments
 (0)