-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to generate larastan-friendly doc blocks for models
- Loading branch information
1 parent
7f28242
commit bb1f243
Showing
9 changed files
with
225 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Soyhuce\NextIdeHelper\Tests\Fixtures\Blog; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
use Illuminate\Support\Str; | ||
use Soyhuce\NextIdeHelper\Tests\Fixtures\User; | ||
|
||
/** | ||
* @property int $id | ||
* @property string $title | ||
* @property string|null $subtitle | ||
* @property string $content | ||
* @property int $user_id | ||
* @property \Illuminate\Support\Carbon $created_at | ||
* @property \Illuminate\Support\Carbon $updated_at | ||
* @property-read string $slug | ||
* @property-read \Soyhuce\NextIdeHelper\Tests\Fixtures\User $user | ||
* @method static \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection all(array|mixed $columns = ['*']) | ||
* @method static \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery query() | ||
* @mixin \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery<\Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post> | ||
*/ | ||
class Post extends Model | ||
{ | ||
public function newEloquentBuilder($query) | ||
{ | ||
return new PostQuery($query); | ||
} | ||
|
||
public function newCollection(array $models = []) | ||
{ | ||
return new PostCollection($models); | ||
} | ||
|
||
public function user(): BelongsTo | ||
{ | ||
return $this->belongsTo(User::class); | ||
} | ||
|
||
public function getSlugAttribute(): string | ||
{ | ||
return Str::slug($this->title); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Soyhuce\NextIdeHelper\Tests\Fixtures\Blog; | ||
|
||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
/** | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereId(int|string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereTitle(string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereSubtitle(string|null $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereContent(string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereUserId(int|string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereCreatedAt(\Illuminate\Support\Carbon|string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery whereUpdatedAt(\Illuminate\Support\Carbon|string $value) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post create(array $attributes = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection|\Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post|null find($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection findMany($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection|\Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post findOrFail($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post findOrNew($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post|null first(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post firstOrCreate(array $attributes, array $values = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post firstOrFail(array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post firstOrNew(array $attributes = [], array $values = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post forceCreate(array $attributes = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection get(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post getModel() | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostCollection getModels(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post newModelInstance(array $attributes = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post updateOrCreate(array $attributes, array $values = []) | ||
* @template TModelClass of \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post | ||
* @extends \Illuminate\Database\Eloquent\Builder<TModelClass> | ||
*/ | ||
class PostQuery extends Builder | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures | ||
{ | ||
/** | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereId(int|string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereEmail(string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery wherePassword(string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereAddress(\Soyhuce\NextIdeHelper\Tests\Fixtures\Address|string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereRememberToken(string|null $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereCreatedAt(\Illuminate\Support\Carbon|string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereUpdatedAt(\Illuminate\Support\Carbon|string $value) | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery whereEmailDomain(string $domain, ?string $area = null) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User create(array $attributes = []) | ||
* @method \Illuminate\Database\Eloquent\Collection|\Soyhuce\NextIdeHelper\Tests\Fixtures\User|null find($id, array $columns = ['*']) | ||
* @method \Illuminate\Database\Eloquent\Collection findMany($id, array $columns = ['*']) | ||
* @method \Illuminate\Database\Eloquent\Collection|\Soyhuce\NextIdeHelper\Tests\Fixtures\User findOrFail($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User findOrNew($id, array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User|null first(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User firstOrCreate(array $attributes, array $values = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User firstOrFail(array $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User firstOrNew(array $attributes = [], array $values = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User forceCreate(array $attributes = []) | ||
* @method \Illuminate\Database\Eloquent\Collection get(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User getModel() | ||
* @method \Illuminate\Database\Eloquent\Collection getModels(array|string $columns = ['*']) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User newModelInstance(array $attributes = []) | ||
* @method \Soyhuce\NextIdeHelper\Tests\Fixtures\User updateOrCreate(array $attributes, array $values = []) | ||
* @template TModelClass of \Soyhuce\NextIdeHelper\Tests\Fixtures\User | ||
* @extends \Illuminate\Database\Eloquent\Builder<TModelClass> | ||
*/ | ||
class UserQuery extends \Illuminate\Database\Eloquent\Builder | ||
{ | ||
} | ||
} | ||
|
||
namespace IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post | ||
{ | ||
/** | ||
* @mixin \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery | ||
*/ | ||
class User extends \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
{ | ||
} | ||
} | ||
|
||
namespace IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\User | ||
{ | ||
/** | ||
* @mixin \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery | ||
*/ | ||
class LaravelPosts extends \Illuminate\Database\Eloquent\Relations\HasMany | ||
{ | ||
} | ||
|
||
/** | ||
* @mixin \Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\PostQuery | ||
*/ | ||
class Posts extends \Illuminate\Database\Eloquent\Relations\HasMany | ||
{ | ||
} | ||
} | ||
|
||
namespace Soyhuce\NextIdeHelper\Tests\Fixtures | ||
{ | ||
/** | ||
* @method static \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery query() | ||
* @mixin \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\UserQuery | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\User\Posts posts() | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\User\LaravelPosts laravelPosts() | ||
*/ | ||
class User | ||
{ | ||
} | ||
} | ||
|
||
namespace Soyhuce\NextIdeHelper\Tests\Fixtures\Blog | ||
{ | ||
/** | ||
* @method \IdeHelper\Soyhuce\NextIdeHelper\Tests\Fixtures\Blog\Post\User user() | ||
*/ | ||
class Post | ||
{ | ||
} | ||
} |