mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d1998428e | ||
|
|
ef890b87ce | ||
|
|
232d7acf6f |
+3
-1
@@ -6,7 +6,9 @@
|
||||
/.gitattributes export-ignore
|
||||
/.github export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.php-cs-fixer* export-ignore
|
||||
/.php-cs-fixer.cache export-ignore
|
||||
/.php-cs-fixer.php export-ignore
|
||||
/.php-cs-fixer.tests.cache export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/psalm-baseline.xml export-ignore
|
||||
/psalm.xml export-ignore
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate Composer configuration
|
||||
run: composer validate --strict
|
||||
@@ -23,6 +23,6 @@ jobs:
|
||||
composer global require ergebnis/composer-normalize
|
||||
composer normalize
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v7
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: normalize composer.json
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- run: composer fix-style
|
||||
continue-on-error: true
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v7
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: composer fix-style
|
||||
commit_author: laravel-ide-helper <[email protected]>
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
name: P${{ matrix.php }} - Laravel${{ matrix.laravel }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: src
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php: [8.5, 8.4, 8.3, 8.2]
|
||||
php: [8.4, 8.3, 8.2]
|
||||
laravel: [~11.15, 12.x]
|
||||
stability: [prefer-lowest, prefer-stable]
|
||||
include:
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
git config --global core.eol lf
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.target_commitish }}
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
release-notes: ${{ github.event.release.body }}
|
||||
|
||||
- name: Commit updated CHANGELOG
|
||||
uses: stefanzweifel/git-auto-commit-action@v7
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
branch: ${{ github.event.release.target_commitish }}
|
||||
commit_message: Update CHANGELOG
|
||||
|
||||
@@ -1,37 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## v3.6.0 - 2025-07-18
|
||||
|
||||
### What's Changed
|
||||
|
||||
* fix: Change AsArrayObject cast to be Laravel's ArrayObject by @wsamoht in https://github.com/barryvdh/laravel-ide-helper/pull/1675
|
||||
* Add extends declaration for Macroable classes to fix missing inherited methods by @KentarouTakeda in https://github.com/barryvdh/laravel-ide-helper/pull/1674
|
||||
* fix(meta): ignore aliases in the autoloader (Fixes #1671) by @pataar in https://github.com/barryvdh/laravel-ide-helper/pull/1686
|
||||
* feat(ModelsCommand): add support for the new Scope attribute by @pataar in https://github.com/barryvdh/laravel-ide-helper/pull/1694
|
||||
* fix type change for scope default float parameter by @nivseb in https://github.com/barryvdh/laravel-ide-helper/pull/1697
|
||||
* Revert #1629 - *Allow adding custom Macroable classes* by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1707
|
||||
* Configurable macro return type defaults by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1711
|
||||
* docs(readme): add Laravel 12 support information by @SantosVilanculos in https://github.com/barryvdh/laravel-ide-helper/pull/1717
|
||||
* Add multi-level directory support for translation files by @RosiersRobin in https://github.com/barryvdh/laravel-ide-helper/pull/1718
|
||||
* Support `AsCollection::of($map)`, `AsCollection::using($class, $map)` by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1714
|
||||
* fix: Fixed wrong doc for SoftDeletes `withTrashed` method by @eldair in https://github.com/barryvdh/laravel-ide-helper/pull/1688
|
||||
* Support other OS on tests by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1715
|
||||
* Fix tests on windows by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1720
|
||||
* Bump stefanzweifel/git-auto-commit-action from 5 to 6 in the deps group by @dependabot[bot] in https://github.com/barryvdh/laravel-ide-helper/pull/1719
|
||||
* Update .gitattributes - avoid all `.php-cs-fixer` files on vendor by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1708
|
||||
* fix(ModelsCommand): use 'string' as realType for 'encrypted' casts by @pataar in https://github.com/barryvdh/laravel-ide-helper/pull/1698
|
||||
* Trim strings and bump reflection docblock by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1721
|
||||
* Add magic *_exists properties by @erikn69 in https://github.com/barryvdh/laravel-ide-helper/pull/1712
|
||||
|
||||
### New Contributors
|
||||
|
||||
* @wsamoht made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1675
|
||||
* @nivseb made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1697
|
||||
* @SantosVilanculos made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1717
|
||||
* @RosiersRobin made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1718
|
||||
|
||||
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.5.5...v3.6.0
|
||||
|
||||
## v3.5.5 - 2025-02-21
|
||||
|
||||
### What's Changed
|
||||
|
||||
@@ -51,7 +51,7 @@ php artisan ide-helper:models -RW
|
||||
|
||||
If you don't want the full _ide_helper.php file, you can run add `--write-eloquent-helper` to the model command to generate small version, which is required for the `@mixin \Eloquent` to be able to add the QueryBuilder methods.
|
||||
|
||||
If you don't want to add all the phpdocs to your Models directly, you can use `--nowrite` to create a separate file. The `--write-mixin` option can be used to only add a `@mixin` to your models, but add the generated phpdocs in a separate file. This avoids having the results marked as duplicate.
|
||||
If you don't want to add all the phpdocs to your Models directly, you can use `--nowrite` to create a seperate file. The `--write-mixin` option can be used to only add a `@mixin` to your models, but add the generated phpdocs in a seperate file. This avoids having the results marked as duplicate.
|
||||
|
||||
|
||||
_Check out [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_
|
||||
@@ -210,11 +210,11 @@ Eloquent allows calling `where<Attribute>` on your models, e.g. `Post::whereTitl
|
||||
|
||||
If for some reason it's undesired to have them generated (one for each column), you can disable this via config `write_model_magic_where` and setting it to `false`.
|
||||
|
||||
#### Magic `*_count` and `*_exists` properties
|
||||
#### Magic `*_count` properties
|
||||
|
||||
You may use the [`::withCount`](https://laravel.com/docs/master/eloquent-relationships#counting-related-models) and [`::withExists`](https://laravel.com/docs/master/eloquent-relationships#other-aggregate-functions) methods to count the number results from a relationship without actually loading them. Those results are then placed in attributes following the `<columnname>_count` and `<columnname>_exists` convention.
|
||||
You may use the [`::withCount`](https://laravel.com/docs/master/eloquent-relationships#counting-related-models) method to count the number results from a relationship without actually loading them. Those results are then placed in attributes following the `<columname>_count` convention.
|
||||
|
||||
By default, these attributes are generated in the phpdoc. You can turn them off by setting the config `write_model_relation_count_properties` and `write_model_relation_exists_properties` to `false`.
|
||||
By default, these attributes are generated in the phpdoc. You can turn them off by setting the config `write_model_relation_count_properties` to `false`.
|
||||
|
||||
#### Generics annotations
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"ext-json": "*",
|
||||
"barryvdh/reflection-docblock": "^2.4",
|
||||
"barryvdh/reflection-docblock": "^2.3",
|
||||
"composer/class-map-generator": "^1.0",
|
||||
"illuminate/console": "^11.15 || ^12",
|
||||
"illuminate/database": "^11.15 || ^12",
|
||||
|
||||
@@ -85,16 +85,14 @@ return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Write model relation count and exists properties
|
||||
| Write model relation count properties
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to false to disable writing of relation count and exists properties
|
||||
| to model DocBlocks.
|
||||
| Set to false to disable writing of relation count properties to model DocBlocks.
|
||||
|
|
||||
*/
|
||||
|
||||
'write_model_relation_count_properties' => true,
|
||||
'write_model_relation_exists_properties' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -124,6 +124,7 @@ $reflection = new ReflectionClass($loader);
|
||||
$property = $reflection->hasProperty('paths')
|
||||
? $reflection->getProperty('paths')
|
||||
: $reflection->getProperty('path');
|
||||
$property->setAccessible(true);
|
||||
|
||||
$paths = Illuminate\Support\Arr::wrap($property->getValue($loader));
|
||||
|
||||
|
||||
@@ -256,8 +256,6 @@ class Alias
|
||||
if ($fake !== $real) {
|
||||
$this->addClass(get_class($fake));
|
||||
}
|
||||
} catch (Throwable $throwable) {
|
||||
// Ignore error
|
||||
} finally {
|
||||
$facade::swap($real);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,6 @@ class ModelsCommand extends Command
|
||||
|
||||
protected $write_model_magic_where;
|
||||
protected $write_model_relation_count_properties;
|
||||
protected $write_model_relation_exists_properties;
|
||||
protected $properties = [];
|
||||
protected $methods = [];
|
||||
protected $write = false;
|
||||
@@ -174,8 +173,6 @@ class ModelsCommand extends Command
|
||||
$this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true);
|
||||
$this->write_model_relation_count_properties =
|
||||
$this->laravel['config']->get('ide-helper.write_model_relation_count_properties', true);
|
||||
$this->write_model_relation_exists_properties =
|
||||
$this->laravel['config']->get('ide-helper.write_model_relation_exists_properties', false);
|
||||
|
||||
$this->write = $this->write_mixin ? true : $this->write;
|
||||
//If filename is default and Write is not specified, ask what to do
|
||||
@@ -413,6 +410,9 @@ class ModelsCommand extends Command
|
||||
$params = [];
|
||||
|
||||
switch ($type) {
|
||||
case 'encrypted':
|
||||
$realType = 'mixed';
|
||||
break;
|
||||
case 'boolean':
|
||||
case 'bool':
|
||||
$realType = 'bool';
|
||||
@@ -420,7 +420,6 @@ class ModelsCommand extends Command
|
||||
case 'decimal':
|
||||
$realType = 'numeric';
|
||||
break;
|
||||
case 'encrypted':
|
||||
case 'string':
|
||||
case 'hashed':
|
||||
$realType = 'string';
|
||||
@@ -584,8 +583,6 @@ class ModelsCommand extends Command
|
||||
'float', 'real', 'float4',
|
||||
'double', 'float8' => 'float',
|
||||
|
||||
'decimal', 'numeric' => 'numeric',
|
||||
|
||||
default => 'string',
|
||||
};
|
||||
}
|
||||
@@ -825,15 +822,6 @@ class ModelsCommand extends Command
|
||||
// What kind of comments should be added to the relation count here?
|
||||
);
|
||||
}
|
||||
if ($this->write_model_relation_exists_properties) {
|
||||
$this->setProperty(
|
||||
Str::snake($method) . '_exists',
|
||||
'bool|null',
|
||||
true,
|
||||
false
|
||||
// What kind of comments should be added to the relation count here?
|
||||
);
|
||||
}
|
||||
} elseif (
|
||||
$relationReturnType === 'morphTo' ||
|
||||
(
|
||||
@@ -889,6 +877,7 @@ class ModelsCommand extends Command
|
||||
|
||||
if (in_array($relation, ['hasOne', 'hasOneThrough', 'morphOne'], true)) {
|
||||
$defaultProp = $reflectionObj->getProperty('withDefault');
|
||||
$defaultProp->setAccessible(true);
|
||||
|
||||
return !$defaultProp->getValue($relationObj);
|
||||
}
|
||||
@@ -898,6 +887,7 @@ class ModelsCommand extends Command
|
||||
}
|
||||
|
||||
$fkProp = $reflectionObj->getProperty('foreignKey');
|
||||
$fkProp->setAccessible(true);
|
||||
|
||||
$enforceNullableRelation = $this->laravel['config']->get('ide-helper.enforce_nullable_relationships', true);
|
||||
|
||||
@@ -930,6 +920,7 @@ class ModelsCommand extends Command
|
||||
}
|
||||
|
||||
$fkProp = $reflectionObj->getProperty('foreignKey');
|
||||
$fkProp->setAccessible(true);
|
||||
|
||||
foreach (Arr::wrap($fkProp->getValue($relationObj)) as $foreignKey) {
|
||||
if (isset($this->nullableColumns[$foreignKey])) {
|
||||
@@ -1282,6 +1273,9 @@ class ModelsCommand extends Command
|
||||
*/
|
||||
protected function getAttributeTypes(Model $model, \ReflectionMethod $reflectionMethod): Collection
|
||||
{
|
||||
// Private/protected ReflectionMethods require setAccessible prior to PHP 8.1
|
||||
$reflectionMethod->setAccessible(true);
|
||||
|
||||
/** @var Attribute $attribute */
|
||||
$attribute = $reflectionMethod->invoke($model);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ class Factories
|
||||
$factory = app(Factory::class);
|
||||
|
||||
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
||||
$definitions->setAccessible(true);
|
||||
|
||||
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
||||
try {
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ class Method
|
||||
/**
|
||||
* Get the parameters for this method
|
||||
*
|
||||
* @param bool $implode Whether to implode the array or not
|
||||
* @param bool $implode Wether to implode the array or not
|
||||
* @return string
|
||||
*/
|
||||
public function getParams($implode = true)
|
||||
@@ -208,7 +208,7 @@ class Method
|
||||
/**
|
||||
* Get the parameters for this method including default values
|
||||
*
|
||||
* @param bool $implode Whether to implode the array or not
|
||||
* @param bool $implode Wether to implode the array or not
|
||||
* @return string
|
||||
*/
|
||||
public function getParamsWithDefault($implode = true)
|
||||
|
||||
@@ -9,7 +9,6 @@ use Barryvdh\LaravelIdeHelper\Macro;
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -67,22 +66,6 @@ class AliasTest extends TestCase
|
||||
$this->assertNotNull($this->getAliasMacro($alias, EloquentBuilder::class, $macro));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::detectFake
|
||||
*/
|
||||
public function testNoExceptionOnRequiredFakeParameters(): void
|
||||
{
|
||||
// Mock
|
||||
$alias = new AliasMock();
|
||||
|
||||
// Prepare
|
||||
$alias->setFacade(MockFacade::class);
|
||||
$this->expectNotToPerformAssertions();
|
||||
|
||||
// Test
|
||||
$alias->detectFake();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::detectTemplateNames
|
||||
*/
|
||||
@@ -135,26 +118,4 @@ class AliasMock extends Alias
|
||||
{
|
||||
parent::detectMethods();
|
||||
}
|
||||
|
||||
public function detectFake()
|
||||
{
|
||||
parent::detectFake();
|
||||
}
|
||||
|
||||
public function setFacade(string $facade)
|
||||
{
|
||||
$this->facade = $facade;
|
||||
}
|
||||
}
|
||||
|
||||
class MockFacade extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function fake(string $test1, $test2 = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\GeneratorCommand;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\SnapshotPhpDriver;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\TestCase;
|
||||
|
||||
abstract class AbstractGeneratorCommand extends TestCase
|
||||
@@ -26,4 +27,9 @@ abstract class AbstractGeneratorCommand extends TestCase
|
||||
{
|
||||
return [IdeHelperServiceProvider::class];
|
||||
}
|
||||
|
||||
protected function assertMatchesMockedSnapshot()
|
||||
{
|
||||
$this->assertMatchesSnapshot($this->mockFilesystemOutput, new SnapshotPhpDriver());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\SnapshotPhpDriver;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\TestCase;
|
||||
|
||||
abstract class AbstractModelsCommand extends TestCase
|
||||
@@ -50,7 +51,10 @@ abstract class AbstractModelsCommand extends TestCase
|
||||
|
||||
// Don't override integer -> int for tests
|
||||
$config->set('ide-helper.type_overrides', []);
|
||||
}
|
||||
|
||||
$config->set('ide-helper.write_model_relation_exists_properties', true);
|
||||
protected function assertMatchesMockedSnapshot()
|
||||
{
|
||||
$this->assertMatchesSnapshot($this->mockFilesystemOutput, new SnapshotPhpDriver());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ use Illuminate\Database\Eloquent\Casts\AsEnumCollection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property \Illuminate\Support\Carbon $cast_to_date_serialization
|
||||
* @property \Illuminate\Support\Carbon $cast_to_datetime_serialization
|
||||
* @property \Illuminate\Support\Carbon $cast_to_custom_datetime
|
||||
@@ -20,7 +22,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime
|
||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_datetime
|
||||
* @property int $cast_to_timestamp
|
||||
* @property string $cast_to_encrypted
|
||||
* @property mixed $cast_to_encrypted
|
||||
* @property array<array-key, mixed> $cast_to_encrypted_array
|
||||
* @property \Illuminate\Support\Collection<array-key, mixed> $cast_to_encrypted_collection
|
||||
* @property array<array-key, mixed> $cast_to_encrypted_json
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirecto
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -42,8 +44,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ArrayCastsWithCo
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property array<int, string>|null $cast_to_array -- These three should not be duplicated
|
||||
* @property array<int, string> $cast_to_json some-description
|
||||
* @property \Illuminate\Support\Collection<int, string> $cast_to_collection some-description
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $name
|
||||
* @property string|null $name_read
|
||||
@@ -83,6 +85,8 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $diverging_type_hinted_get_and_set
|
||||
* @property string|null $name
|
||||
|
||||
@@ -10,6 +10,8 @@ use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $both_same_name I'm a getter
|
||||
* @property string $both_without_getter_comment
|
||||
@@ -21,7 +23,6 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
* @property-read string $not_comment
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationHasMany HasMany relations.
|
||||
* @property-read int|null $relation_has_many_count
|
||||
* @property-read bool|null $relation_has_many_exists
|
||||
* @property-read Simple|null $relationHasOne Others relations.
|
||||
* @property-read Model|\Eloquent $relationMorphTo MorphTo relations.
|
||||
* @property-write mixed $first_name Set the user's first name.
|
||||
|
||||
@@ -9,10 +9,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read SimpleCollection<int, Simple> $relationHasMany
|
||||
* @property-read int|null $relation_has_many_count
|
||||
* @property-read bool|null $relation_has_many_exists
|
||||
* @method static SimpleCollection<int, static> all($columns = ['*'])
|
||||
* @method static SimpleCollection<int, static> get($columns = ['*'])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Model
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property \Carbon\CarbonImmutable|null $created_at
|
||||
* @property \Carbon\CarbonImmutable|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|CustomDate newModelQuery()
|
||||
|
||||
+4
-2
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -48,8 +50,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -10,9 +10,10 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Dynamic> $regularHasMany
|
||||
* @property-read int|null $regular_has_many_count
|
||||
* @property-read bool|null $regular_has_many_exists
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dynamic newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dynamic newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dynamic query()
|
||||
|
||||
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\CustomSpace\ModelWithCustomNamespaceFactory factory($count = null, $state = [])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithCustomNamespace newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithCustomNamespace newQuery()
|
||||
@@ -39,6 +41,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithFactoryFactory factory($count = null, $state = [])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithFactory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithFactory newQuery()
|
||||
@@ -56,6 +60,8 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithNestedFactoryFactory factory($count = null, $state = [])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithNestedFactory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithNestedFactory newQuery()
|
||||
@@ -75,6 +81,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithoutFactory newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithoutFactory newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithoutFactory query()
|
||||
|
||||
+4
-2
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -44,8 +46,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -42,8 +44,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
+4
-2
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $charNullable
|
||||
* @property string $charNotNullable
|
||||
@@ -42,8 +44,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $floatNotNullable
|
||||
* @property float|null $doubleNullable
|
||||
* @property float $doubleNotNullable
|
||||
* @property numeric|null $decimalNullable
|
||||
* @property numeric $decimalNotNullable
|
||||
* @property string|null $decimalNullable
|
||||
* @property string $decimalNotNullable
|
||||
* @property int|null $booleanNullable
|
||||
* @property int $booleanNotNullable
|
||||
* @property string|null $enumNullable
|
||||
|
||||
+4
-2
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -42,8 +44,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -67,6 +67,8 @@ class WithCollection extends Model
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property-read \Illuminate\Support\Collection<int, string> $collection
|
||||
* @property-read \Illuminate\Support\Collection<\Illuminate\Support\Collection, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\NonModels\CollectionModel<\Illuminate\Support\Collection, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\NonModels\CollectionModel<int, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\NonModels\NonModel>>> $collection_with_nested_template
|
||||
* @property-read \Illuminate\Support\Collection<int, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\NonModels\NonModel> $collection_with_non_model_template
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static Builder<static>|Comment newModelQuery()
|
||||
* @method static Builder<static>|Comment newQuery()
|
||||
* @method static Builder<static>|Comment query()
|
||||
|
||||
+4
-2
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -48,8 +50,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
+4
-2
@@ -8,6 +8,8 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExte
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -43,8 +45,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
+4
-3
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -44,8 +46,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
@@ -82,7 +84,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post> $posts
|
||||
* @property-read int|null $posts_count
|
||||
* @property-read bool|null $posts_exists
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam)
|
||||
|
||||
@@ -15,6 +15,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property CastType $char_not_nullable
|
||||
@@ -50,8 +52,8 @@ use Illuminate\Support\Carbon;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
@@ -88,7 +90,6 @@ use Illuminate\Support\Carbon;
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection<int, Post> $posts
|
||||
* @property-read int|null $posts_count
|
||||
* @property-read bool|null $posts_exists
|
||||
* @method static EloquentBuilder<static>|Post newModelQuery()
|
||||
* @method static EloquentBuilder<static>|Post newQuery()
|
||||
* @method static EloquentBuilder<static>|Post null(string $unusedParam)
|
||||
|
||||
+4
-2
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -48,8 +50,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -45,6 +45,8 @@ class Post extends Model
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property $someProp
|
||||
* @method someMethod(string $method)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|FinalPost newModelQuery()
|
||||
@@ -58,6 +60,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property $someProp
|
||||
* @method someMethod(string $method)
|
||||
* @property int $id
|
||||
@@ -95,8 +99,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -9,13 +9,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularBelongsToMany
|
||||
* @property-read int|null $regular_belongs_to_many_count
|
||||
* @property-read bool|null $regular_belongs_to_many_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularHasMany
|
||||
* @property-read int|null $regular_has_many_count
|
||||
* @property-read bool|null $regular_has_many_exists
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple query()
|
||||
|
||||
@@ -8,6 +8,8 @@ use DateTime;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read int|null $attribute_return_type_int_or_null
|
||||
* @property-read array $attribute_returns_array
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|NotIgnored newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|NotIgnored newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|NotIgnored query()
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|User newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|User newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|User query()
|
||||
|
||||
@@ -24,6 +24,8 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Cas
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_type
|
||||
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock
|
||||
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_return_docblock_fqn
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere\Model
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -42,8 +44,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
@@ -9,6 +9,8 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\CustomMethod;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\CustomProperty;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\UnsetMethod;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Mockery;
|
||||
|
||||
class Test extends AbstractModelsCommand
|
||||
{
|
||||
@@ -32,6 +34,24 @@ class Test extends AbstractModelsCommand
|
||||
|
||||
public function test(): void
|
||||
{
|
||||
$actualContent = null;
|
||||
|
||||
$mockFilesystem = Mockery::mock(Filesystem::class)->makePartial();
|
||||
$mockFilesystem
|
||||
->shouldReceive('get')
|
||||
->andReturn(file_get_contents(__DIR__ . '/Models/Simple.php'))
|
||||
->once();
|
||||
$mockFilesystem
|
||||
->shouldReceive('put')
|
||||
->with(
|
||||
Mockery::any(),
|
||||
Mockery::capture($actualContent)
|
||||
)
|
||||
->andReturn(1) // Simulate we wrote _something_ to the file
|
||||
->once();
|
||||
|
||||
$this->instance(Filesystem::class, $mockFilesystem);
|
||||
|
||||
$command = $this->app->make(ModelsCommand::class);
|
||||
|
||||
$tester = $this->runCommand($command, [
|
||||
@@ -40,6 +60,33 @@ class Test extends AbstractModelsCommand
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode());
|
||||
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
||||
$this->assertMatchesMockedSnapshot();
|
||||
|
||||
$expectedContent = <<<'PHP'
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read string $custom
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple custom($custom)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple whereId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Simple extends Model
|
||||
{
|
||||
}
|
||||
|
||||
PHP;
|
||||
|
||||
$this->assertSame($expectedContent, $actualContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property-read string $custom
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple custom($custom)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple whereId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Simple extends Model
|
||||
{
|
||||
}
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property string $relation_morph_to_type
|
||||
* @property int $relation_morph_to_id
|
||||
* @property string|null $nullable_relation_morph_to_type
|
||||
|
||||
+2
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
|
||||
+2
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
|
||||
@@ -9,24 +9,21 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\Di
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property-read DifferentCustomPivot|CustomPivot|null $pivot
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessor
|
||||
* @property-read int|null $relation_custom_pivot_using_same_accessor_count
|
||||
* @property-read bool|null $relation_custom_pivot_using_same_accessor_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessorAndClass
|
||||
* @property-read int|null $relation_custom_pivot_using_same_accessor_and_class_count
|
||||
* @property-read bool|null $relation_custom_pivot_using_same_accessor_and_class_exists
|
||||
* @property-read CustomPivot|null $customAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
|
||||
* @property-read int|null $relation_with_custom_pivot_count
|
||||
* @property-read bool|null $relation_with_custom_pivot_exists
|
||||
* @property-read DifferentCustomPivot|null $differentCustomAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithDifferentCustomPivot
|
||||
* @property-read int|null $relation_with_different_custom_pivot_count
|
||||
* @property-read bool|null $relation_with_different_custom_pivot_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithDifferentCustomPivotUsingSameAccessor
|
||||
* @property-read int|null $relation_with_different_custom_pivot_using_same_accessor_count
|
||||
* @property-read bool|null $relation_with_different_custom_pivot_using_same_accessor_exists
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot query()
|
||||
@@ -78,6 +75,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Piv
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|CustomPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|CustomPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|CustomPivot query()
|
||||
@@ -95,6 +94,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Piv
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot query()
|
||||
|
||||
@@ -9,6 +9,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static Builder<static>|Comment local() Scope using the 'Scope' attribute
|
||||
* @method static Builder<static>|Comment newModelQuery()
|
||||
* @method static Builder<static>|Comment newQuery()
|
||||
@@ -46,6 +48,8 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Models;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -81,8 +85,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Mode
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
@@ -211,6 +215,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\QueryScopes\Mode
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|PostParent active()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|PostParent newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|PostParent newQuery()
|
||||
|
||||
@@ -14,7 +14,6 @@ class Test extends AbstractModelsCommand
|
||||
parent::getEnvironmentSetUp($app);
|
||||
|
||||
$app['config']->set('ide-helper.write_model_relation_count_properties', false);
|
||||
$app['config']->set('ide-helper.write_model_relation_exists_properties', false);
|
||||
}
|
||||
|
||||
public function test(): void
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $char_nullable
|
||||
* @property string $char_not_nullable
|
||||
@@ -43,8 +45,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
* @property float $float_not_nullable
|
||||
* @property float|null $double_nullable
|
||||
* @property float $double_not_nullable
|
||||
* @property numeric|null $decimal_nullable
|
||||
* @property numeric $decimal_not_nullable
|
||||
* @property string|null $decimal_nullable
|
||||
* @property string $decimal_not_nullable
|
||||
* @property int|null $boolean_nullable
|
||||
* @property int $boolean_not_nullable
|
||||
* @property string|null $enum_nullable
|
||||
|
||||
+6
-8
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $not_null_column_with_foreign_key_constraint
|
||||
* @property int $not_null_column_with_no_foreign_key_constraint
|
||||
@@ -59,6 +61,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $not_null_column_with_foreign_key_constraint
|
||||
* @property int $not_null_column_with_no_foreign_key_constraint
|
||||
@@ -128,39 +132,33 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read Simple $relationBelongsTo
|
||||
* @property-read AnotherModel $relationBelongsToInAnotherNamespace
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToMany
|
||||
* @property-read int|null $relation_belongs_to_many_count
|
||||
* @property-read bool|null $relation_belongs_to_many_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToManyWithSub
|
||||
* @property-read int|null $relation_belongs_to_many_with_sub_count
|
||||
* @property-read bool|null $relation_belongs_to_many_with_sub_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToManyWithSubAnother
|
||||
* @property-read int|null $relation_belongs_to_many_with_sub_another_count
|
||||
* @property-read bool|null $relation_belongs_to_many_with_sub_another_exists
|
||||
* @property-read AnotherModel $relationBelongsToSameNameAsColumn
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationHasMany
|
||||
* @property-read int|null $relation_has_many_count
|
||||
* @property-read bool|null $relation_has_many_exists
|
||||
* @property-read Simple|null $relationHasOne
|
||||
* @property-read Simple $relationHasOneWithDefault
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationMorphMany
|
||||
* @property-read int|null $relation_morph_many_count
|
||||
* @property-read bool|null $relation_morph_many_exists
|
||||
* @property-read Simple|null $relationMorphOne
|
||||
* @property-read Model|\Eloquent $relationMorphTo
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationMorphedByMany
|
||||
* @property-read int|null $relation_morphed_by_many_count
|
||||
* @property-read bool|null $relation_morphed_by_many_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationSampleRelationType
|
||||
* @property-read int|null $relation_sample_relation_type_count
|
||||
* @property-read bool|null $relation_sample_relation_type_exists
|
||||
* @property-read Model|\Eloquent $relationSampleToAnyMorphedRelationType
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationSampleToAnyRelationType
|
||||
* @property-read int|null $relation_sample_to_any_relation_type_count
|
||||
* @property-read bool|null $relation_sample_to_any_relation_type_exists
|
||||
* @property-read Simple $relationSampleToBadlyNamedNotManyRelation
|
||||
* @property-read Simple $relationSampleToManyRelationType
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $not_null_column_with_foreign_key_constraint
|
||||
* @property int $not_null_column_with_no_foreign_key_constraint
|
||||
@@ -59,6 +61,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $not_null_column_with_foreign_key_constraint
|
||||
* @property int $not_null_column_with_no_foreign_key_constraint
|
||||
@@ -128,39 +132,33 @@ use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property-read Simple|null $relationBelongsTo
|
||||
* @property-read AnotherModel|null $relationBelongsToInAnotherNamespace
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToMany
|
||||
* @property-read int|null $relation_belongs_to_many_count
|
||||
* @property-read bool|null $relation_belongs_to_many_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToManyWithSub
|
||||
* @property-read int|null $relation_belongs_to_many_with_sub_count
|
||||
* @property-read bool|null $relation_belongs_to_many_with_sub_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationBelongsToManyWithSubAnother
|
||||
* @property-read int|null $relation_belongs_to_many_with_sub_another_count
|
||||
* @property-read bool|null $relation_belongs_to_many_with_sub_another_exists
|
||||
* @property-read AnotherModel|null $relationBelongsToSameNameAsColumn
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationHasMany
|
||||
* @property-read int|null $relation_has_many_count
|
||||
* @property-read bool|null $relation_has_many_exists
|
||||
* @property-read Simple|null $relationHasOne
|
||||
* @property-read Simple $relationHasOneWithDefault
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationMorphMany
|
||||
* @property-read int|null $relation_morph_many_count
|
||||
* @property-read bool|null $relation_morph_many_exists
|
||||
* @property-read Simple|null $relationMorphOne
|
||||
* @property-read Model|\Eloquent $relationMorphTo
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationMorphedByMany
|
||||
* @property-read int|null $relation_morphed_by_many_count
|
||||
* @property-read bool|null $relation_morphed_by_many_exists
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationSampleRelationType
|
||||
* @property-read int|null $relation_sample_relation_type_count
|
||||
* @property-read bool|null $relation_sample_relation_type_exists
|
||||
* @property-read Model|\Eloquent $relationSampleToAnyMorphedRelationType
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, Simple> $relationSampleToAnyRelationType
|
||||
* @property-read int|null $relation_sample_to_any_relation_type_count
|
||||
* @property-read bool|null $relation_sample_to_any_relation_type_exists
|
||||
* @property-read Simple $relationSampleToBadlyNamedNotManyRelation
|
||||
* @property-read Simple $relationSampleToManyRelationType
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SimpleCasts\Mode
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $cast_to_int
|
||||
* @property int $cast_to_integer
|
||||
* @property float $cast_to_real
|
||||
@@ -31,7 +33,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_datetime
|
||||
* @property \Carbon\CarbonImmutable $cast_to_immutable_datetime_serialization
|
||||
* @property int $cast_to_timestamp
|
||||
* @property string $cast_to_encrypted
|
||||
* @property mixed $cast_to_encrypted
|
||||
* @property array<array-key, mixed> $cast_to_encrypted_array
|
||||
* @property \Illuminate\Support\Collection<array-key, mixed> $cast_to_encrypted_collection
|
||||
* @property array<array-key, mixed> $cast_to_encrypted_json
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
|
||||
@@ -9,10 +9,11 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property-read string|int|null $foo
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, UnionTypeModel> $withUnionTypeReturn
|
||||
* @property-read int|null $with_union_type_return_count
|
||||
* @property-read bool|null $with_union_type_return_exists
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|UnionTypeModel newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|UnionTypeModel newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|UnionTypeModel query()
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @method static Builder<static>|Simple newModelQuery()
|
||||
* @method static Builder<static>|Simple newQuery()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
* @mixin \Illuminate\Database\Eloquent\Builder
|
||||
* @mixin \Illuminate\Database\Query\Builder
|
||||
|
||||
+4
-2
@@ -242,11 +242,13 @@ class MacroTest extends TestCase
|
||||
$macro = new Macro($reflectionMethod, 'URL', new ReflectionClass(UrlGenerator::class), 'macroName');
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $foo
|
||||
* @param int $bar
|
||||
* @return string
|
||||
* @return string
|
||||
* @see \Barryvdh\LaravelIdeHelper\Tests\UrlGeneratorMacroClass::__invoke()
|
||||
* @static
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
$this->assertSame($output, $macro->getDocComment(''));
|
||||
|
||||
+15
-11
@@ -36,10 +36,12 @@ class MethodTest extends TestCase
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $last
|
||||
* @param string $first
|
||||
* @param string $middle
|
||||
* @static
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
$this->assertSame($output, $method->getDocComment(''));
|
||||
@@ -69,8 +71,8 @@ DOC;
|
||||
* @param array $values
|
||||
* @param array|string $uniqueBy
|
||||
* @param array|null $update
|
||||
* @return int
|
||||
* @static
|
||||
* @return int
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
$this->assertSame($output, $method->getDocComment(''));
|
||||
@@ -102,8 +104,8 @@ DOC;
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @param string $boolean
|
||||
* @return \Illuminate\Database\Eloquent\Builder<static>
|
||||
* @static
|
||||
* @return \Illuminate\Database\Eloquent\Builder<static>
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
$this->assertSame($output, $method->getDocComment(''));
|
||||
@@ -132,8 +134,8 @@ DOC;
|
||||
* @param string|array|\Illuminate\Contracts\Database\Query\Expression $columns
|
||||
* @param string $boolean
|
||||
* @param bool $not
|
||||
* @return \Illuminate\Database\Eloquent\Builder<static>
|
||||
* @static
|
||||
* @return \Illuminate\Database\Eloquent\Builder<static>
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
|
||||
@@ -175,8 +177,10 @@ DOC;
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
* @return \Illuminate\Foundation\Application
|
||||
* @static
|
||||
*
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
|
||||
@@ -204,8 +208,8 @@ DOC;
|
||||
* @template TValue
|
||||
* @param (\Closure(): TValue)|list<string> $columns
|
||||
* @param (\Closure(): TValue)|null $callback
|
||||
* @return TModel|TValue
|
||||
* @static
|
||||
* @return TModel|TValue
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
$this->assertSame($output, $method->getDocComment(''));
|
||||
|
||||
@@ -11,7 +11,7 @@ class SnapshotPhpDriver implements Driver
|
||||
{
|
||||
public function serialize($data): string
|
||||
{
|
||||
return str_replace(["\r\n", "\r"], "\n", (string) $data);
|
||||
return (string) $data;
|
||||
}
|
||||
|
||||
public function extension(): string
|
||||
@@ -21,6 +21,6 @@ class SnapshotPhpDriver implements Driver
|
||||
|
||||
public function match($expected, $actual)
|
||||
{
|
||||
Assert::assertSame(str_replace(["\r\n", "\r"], "\n", $expected), $this->serialize($actual));
|
||||
Assert::assertSame($expected, $this->serialize($actual));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class SnapshotTxtDriver implements Driver
|
||||
{
|
||||
public function serialize($data): string
|
||||
{
|
||||
return str_replace(["\r\n", "\r"], "\n", (string) $data);
|
||||
return (string) $data;
|
||||
}
|
||||
|
||||
public function extension(): string
|
||||
@@ -21,6 +21,6 @@ class SnapshotTxtDriver implements Driver
|
||||
|
||||
public function match($expected, $actual)
|
||||
{
|
||||
Assert::assertSame(str_replace(["\r\n", "\r"], "\n", $expected), $this->serialize($actual));
|
||||
Assert::assertSame($expected, $this->serialize($actual));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,6 @@ abstract class TestCase extends BaseTestCase
|
||||
$this->assertMatchesSnapshot($actualContent, new SnapshotTxtDriver());
|
||||
}
|
||||
|
||||
protected function assertMatchesMockedSnapshot()
|
||||
{
|
||||
$this->assertMatchesSnapshot($this->mockFilesystemOutput, new SnapshotPhpDriver());
|
||||
}
|
||||
|
||||
protected function mockFilesystem()
|
||||
{
|
||||
$mockFilesystem = Mockery::mock(Filesystem::class)->makePartial();
|
||||
@@ -71,7 +66,6 @@ abstract class TestCase extends BaseTestCase
|
||||
Mockery::any()
|
||||
)
|
||||
->andReturnUsing(function ($path, $contents) {
|
||||
$contents = str_replace(["\r\n", "\r"], "\n", $contents);
|
||||
$this->mockFilesystemOutput .= $contents;
|
||||
|
||||
return strlen($contents);
|
||||
|
||||
Reference in New Issue
Block a user