-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comments like table columns. (#1168)
* add comment with @method & @property-read & property-write in models * add readme comment * add readme comment * add comment tag unit-test * add comment tag unit-test * both a getter and a setter has a @comment test * Update README.md improve README Co-authored-by: Markus Podar <[email protected]> * Update CHANGELOG.md Co-authored-by: Markus Podar <[email protected]>
- Loading branch information
1 parent
c5e18be
commit c5c9b2b
Showing
6 changed files
with
393 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Comment\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
use Illuminate\Database\Eloquent\Relations\HasOne; | ||
use Illuminate\Database\Eloquent\Relations\MorphTo; | ||
|
||
class Simple extends Model | ||
{ | ||
/** | ||
* There is not comment. | ||
* | ||
* @return string | ||
*/ | ||
public function getNotCommentAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* comment There is not format comment, invalid. | ||
* | ||
* @return string | ||
*/ | ||
public function getFakerCommentAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* @comment There is format comment, success. | ||
* | ||
* @return string | ||
*/ | ||
public function getFormatCommentAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* @comment There is format comment, success. | ||
* This is second line, success too. | ||
* | ||
* @return string | ||
*/ | ||
public function getFormatCommentLineTwoAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* @comment There is format comment, success. | ||
* @comment This is others format comment, invalid. | ||
* | ||
* @return string | ||
*/ | ||
public function getManyFormatCommentAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* @comment Set the user's first name. | ||
* @param $value | ||
*/ | ||
public function setFirstNameAttribute($value) | ||
{ | ||
} | ||
|
||
/** | ||
* @comment Scope a query to only include active users. | ||
* | ||
* @param $query | ||
* @return mixed | ||
*/ | ||
public function scopeActive($query) | ||
{ | ||
return $query; | ||
} | ||
|
||
/** | ||
* @comment HasMany relations. | ||
* | ||
* @return HasMany | ||
*/ | ||
public function relationHasMany(): HasMany | ||
{ | ||
return $this->hasMany(Simple::class); | ||
} | ||
|
||
/** | ||
* @comment MorphTo relations. | ||
* @return MorphTo | ||
*/ | ||
public function relationMorphTo(): MorphTo | ||
{ | ||
return $this->morphTo(); | ||
} | ||
|
||
/** | ||
* @comment Others relations. | ||
* @return HasOne | ||
*/ | ||
public function relationHasOne(): HasOne | ||
{ | ||
return $this->hasOne(Simple::class); | ||
} | ||
|
||
/** | ||
* @comment I'm a setter | ||
*/ | ||
public function setBothSameNameAttribute(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @comment I'm a getter | ||
* @return string | ||
*/ | ||
public function getBothSameNameAttribute(): string | ||
{ | ||
} | ||
|
||
/** | ||
* @comment I'm a setter | ||
*/ | ||
public function setBothWithoutGetterCommentAttribute(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getBothWithoutGetterCommentAttribute(): string | ||
{ | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Comment; | ||
|
||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; | ||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; | ||
|
||
class Test extends AbstractModelsCommand | ||
{ | ||
public function test(): void | ||
{ | ||
$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(); | ||
} | ||
} |
Oops, something went wrong.