From 1754dbb267de63ca0d7ce7535576b7087adf61c9 Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:48:01 +0100 Subject: [PATCH 01/57] Update CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70ed218..9bc1759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,17 @@ All notable changes to this project will be documented in this file. ### Added - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) +2024-01-04, v2.14.0 +------------------ + +### Fixes + +- Add AllowDynamicProperties when creating mixin: credit to GeoSot - https://github.com/GeoSot/laravel-ide-helper +- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. + +### Extra +This release contains all commits from the main laravel-ide-helper repo up to 04-01-2024. + 2023-02-04, 2.13.0 ------------------ From 456919de94ca8e12af0a60e6f2c527676d3af5c7 Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:49:07 +0100 Subject: [PATCH 02/57] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc1759..301458a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ All notable changes to this project will be documented in this file. ### Fixes - Add AllowDynamicProperties when creating mixin: credit to GeoSot - https://github.com/GeoSot/laravel-ide-helper -- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. +- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. https://github.com/scrumble-nl/laravel-ide-helper/pull/1 ### Extra This release contains all commits from the main laravel-ide-helper repo up to 04-01-2024. From 944fb325f47783a5b5da30a3eb62072afb261bfe Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:50:25 +0100 Subject: [PATCH 03/57] Update CHANGELOG.md --- CHANGELOG.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 301458a..3983a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,6 @@ All notable changes to this project will be documented in this file. -[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.13.0...master) --------------- - -### Changed -- Official support for Lumen has been dropped [#1425 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1425) -- Refactor resolving of null information for custom casted attribute types [#1330 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1330) - -### Fixed -- Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) - -### Added -- Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) - 2024-01-04, v2.14.0 ------------------ From 7b65bdbc87533dd191d56924dee12562d46162ff Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:51:10 +0100 Subject: [PATCH 04/57] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2eecae2..bdea7a4 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "barryvdh/laravel-ide-helper", + "name": "scrumble-nl/laravel-ide-helper", "description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.", "license": "MIT", "keywords": [ From 726e5955786969b7c650d989657b55c12d4521e1 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Sun, 28 Jan 2024 19:33:31 +0100 Subject: [PATCH 05/57] Add support for nikic/php-parser:^5 and (hopefully) doctrine/dbal:^4 (#1502) * Add support for nikic/php-parser:^5 - `createForHostVersion` has been added to php-parse 4.18 so code can run with both versions [1] - therefore also bumped the minimum required version to it Note: The dev dependency vimeo/psalm is **not** compatible with php-parser:^5 currently. This does not impact usages of this library, but sometimes cause friction when working on this library. For our CI this isn't a problem, because we already remove that dependency before running the test suite. [1] https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#changes-to-the-parser-factory * gha: prevent cancelling of all jobs if one fails * Update CHANGELOG.md * gha: remove unsupported Laravel / PHP combinations According to https://laravel.com/docs/10.x/releases * Add dbal:^4 too --- .github/workflows/run-integration-tests.yml | 9 +++++++-- CHANGELOG.md | 1 + composer.json | 4 ++-- src/UsesResolver.php | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 96173bf..31bc718 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -17,6 +17,7 @@ jobs: env: COMPOSER_NO_INTERACTION: 1 strategy: + fail-fast: false matrix: php: [8.3, 8.2, 8.1, 8.0, 7.4, 7.3] laravel: [10.*, 9.*, 8.*] @@ -25,14 +26,18 @@ jobs: laravel: 10.* - php: 7.4 laravel: 10.* - - php: 7.4 - laravel: 10.* - php: 7.3 laravel: 10.* + - php: 8.3 + laravel: 9.* - php: 7.4 laravel: 9.* - php: 7.3 laravel: 9.* + - php: 8.3 + laravel: 8.* + - php: 8.2 + laravel: 8.* name: P${{ matrix.php }} - Laravel${{ matrix.laravel }} steps: - name: Checkout code diff --git a/CHANGELOG.md b/CHANGELOG.md index 70ed218..fdab75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) ### Added +- Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) 2023-02-04, 2.13.0 diff --git a/composer.json b/composer.json index 2eecae2..22d94d8 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,11 @@ "ext-json": "*", "barryvdh/reflection-docblock": "^2.0.6", "composer/class-map-generator": "^1.0", - "doctrine/dbal": "^2.6 || ^3", + "doctrine/dbal": "^2.6 || ^3 || ^4", "illuminate/console": "^8 || ^9 || ^10", "illuminate/filesystem": "^8 || ^9 || ^10", "illuminate/support": "^8 || ^9 || ^10", - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5", "phpdocumentor/type-resolver": "^1.1.0" }, "require-dev": { diff --git a/src/UsesResolver.php b/src/UsesResolver.php index 205da9c..4900a12 100644 --- a/src/UsesResolver.php +++ b/src/UsesResolver.php @@ -64,7 +64,7 @@ class UsesResolver '\\' ); - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + $parser = (new ParserFactory())->createForHostVersion(); $namespaceData = null; foreach ($parser->parse($code) as $node) { From 850fc5fe7fb96bb1235e23c3adc87a2903af3dcc Mon Sep 17 00:00:00 2001 From: Oleksandr Oliinyk Date: Fri, 2 Feb 2024 18:37:44 +0200 Subject: [PATCH 06/57] test: case for the issue #1505; duplication of properties that have generic types specified and descriptions; --- .../Models/ArrayCastsWithComment.php | 43 +++++++++ .../ArrayCastsWithComment/Test.php | 24 +++++ .../__snapshots__/Test__test__1.php | 94 +++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 tests/Console/ModelsCommand/ArrayCastsWithComment/Models/ArrayCastsWithComment.php create mode 100644 tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php create mode 100644 tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/Models/ArrayCastsWithComment.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/Models/ArrayCastsWithComment.php new file mode 100644 index 0000000..b6bb6ed --- /dev/null +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/Models/ArrayCastsWithComment.php @@ -0,0 +1,43 @@ +|null $cast_to_array -- These three should not be duplicated + * @property array $cast_to_json some-description + * @property \Illuminate\Support\Collection $cast_to_collection some-description + * + * @property array|null $cast_to_encrypted_array -- These three are OK (no types) + * @property array $cast_to_encrypted_json some-description + * @property \Illuminate\Support\Collection $cast_to_encrypted_collection some-description + * + * @property string $cast_to_string -- The next three are OK (no description), this not included + * + * @property array|null $cast_to_immutable_date + * @property array $cast_to_immutable_date_serialization + * @property \Illuminate\Support\Collection $cast_to_immutable_custom_datetime + */ +class ArrayCastsWithComment extends Model +{ + protected $table = 'simple_casts'; + + protected $casts = [ + 'cast_to_array' => 'array', + 'cast_to_json' => 'json', + 'cast_to_collection' => 'collection', + + 'cast_to_encrypted_array' => 'array', + 'cast_to_encrypted_json' => 'json', + 'cast_to_encrypted_collection' => 'collection', + + 'cast_to_string' => 'string', + + 'cast_to_immutable_date' => 'array', + 'cast_to_immutable_date_serialization' => 'json', + 'cast_to_immutable_custom_datetime' => 'collection', + ]; +} diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php new file mode 100644 index 0000000..3833a55 --- /dev/null +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php @@ -0,0 +1,24 @@ +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(); + } +} diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..0236723 --- /dev/null +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php @@ -0,0 +1,94 @@ +|null $cast_to_array -- These three should not be duplicated + * @property array $cast_to_json some-description + * @property \Illuminate\Support\Collection $cast_to_collection some-description + * @property array|null $cast_to_encrypted_array -- These three are OK (no types) + * @property array $cast_to_encrypted_json some-description + * @property \Illuminate\Support\Collection $cast_to_encrypted_collection some-description + * @property string $cast_to_string -- The next three are OK (no description), this not included + * @property array|null $cast_to_immutable_date + * @property array $cast_to_immutable_date_serialization + * @property \Illuminate\Support\Collection $cast_to_immutable_custom_datetime + * @property string $cast_to_int + * @property string $cast_to_integer + * @property string $cast_to_real + * @property string $cast_to_float + * @property string $cast_to_double + * @property string $cast_to_decimal + * @property string $cast_to_bool + * @property string $cast_to_boolean + * @property string $cast_to_object + * @property string $cast_to_date + * @property string $cast_to_datetime + * @property string $cast_to_date_serialization + * @property string $cast_to_datetime_serialization + * @property string $cast_to_custom_datetime + * @property string $cast_to_immutable_datetime + * @property string $cast_to_immutable_datetime_serialization + * @property string $cast_to_timestamp + * @property string $cast_to_encrypted + * @property string $cast_to_encrypted_object + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment query() + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToArray($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToBool($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToBoolean($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToCollection($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToCustomDatetime($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDateSerialization($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDatetime($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDatetimeSerialization($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDecimal($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToDouble($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToEncrypted($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToEncryptedArray($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToEncryptedCollection($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToEncryptedJson($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToEncryptedObject($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToFloat($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToImmutableCustomDatetime($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToImmutableDate($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToImmutableDateSerialization($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToImmutableDatetime($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToImmutableDatetimeSerialization($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToInt($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToInteger($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToJson($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToObject($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToReal($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToString($value) + * @method static \Illuminate\Database\Eloquent\Builder|ArrayCastsWithComment whereCastToTimestamp($value) + * @mixin \Eloquent + */ +class ArrayCastsWithComment extends Model +{ + protected $table = 'simple_casts'; + + protected $casts = [ + 'cast_to_array' => 'array', + 'cast_to_json' => 'json', + 'cast_to_collection' => 'collection', + + 'cast_to_encrypted_array' => 'array', + 'cast_to_encrypted_json' => 'json', + 'cast_to_encrypted_collection' => 'collection', + + 'cast_to_string' => 'string', + + 'cast_to_immutable_date' => 'array', + 'cast_to_immutable_date_serialization' => 'json', + 'cast_to_immutable_custom_datetime' => 'collection', + ]; +} From 937495240214688e4d83e446cc2b5c6c8f15105a Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Sat, 3 Feb 2024 20:54:09 +0100 Subject: [PATCH 07/57] Adapt snapshot testcase --- tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php | 4 ++++ .../ArrayCastsWithComment/__snapshots__/Test__test__1.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php index 3833a55..a0be02e 100644 --- a/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/Test.php @@ -9,6 +9,10 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; class Test extends AbstractModelsCommand { + /** + * The generated snapshot is wrong until + * https://github.com/barryvdh/laravel-ide-helper/issues/1505 is fixed + */ public function test(): void { $command = $this->app->make(ModelsCommand::class); diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php index 0236723..9dfa034 100644 --- a/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php @@ -28,6 +28,9 @@ use Illuminate\Database\Eloquent\Model; * @property string $cast_to_bool * @property string $cast_to_boolean * @property string $cast_to_object + * @property array $cast_to_array + * @property array $cast_to_json + * @property \Illuminate\Support\Collection $cast_to_collection * @property string $cast_to_date * @property string $cast_to_datetime * @property string $cast_to_date_serialization From e65d30b27adcc44ae557c4dc106ace3f82a280df Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 5 Feb 2024 06:54:43 +0100 Subject: [PATCH 08/57] Remove doctrine/dbal:^4 support (#1507) * Remove doctrine/dbal:^4 support Tests fail with: `PHP Fatal error: Declaration of Illuminate\Database\PDO\Concerns\ConnectsToDatabase::connect(array $params, $username = null, $password = null, array $driverOptions = []) must be compatible with Doctrine\DBAL\Driver::connect(array $params): Doctrine\DBAL\Driver\Connection in /home/runner/work/laravel-ide-helper/laravel-ide-helper/vendor/laravel/framework/src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php on line 22` * gha: install with downgrading all dependencies * Add note to readme --- .github/workflows/run-integration-tests.yml | 2 +- README.md | 4 ++++ composer.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 31bc718..84345c5 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -62,7 +62,7 @@ jobs: run: | cd sample sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../src" } ],|' -i composer.json - composer require --dev "barryvdh/laravel-ide-helper:*" + composer require --dev "barryvdh/laravel-ide-helper:*" --with-all-dependencies - name: Execute generate run run: | diff --git a/README.md b/README.md index 92f04fa..7050d13 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ Require this package with composer using the following command: composer require --dev barryvdh/laravel-ide-helper ``` +> [!NOTE] +> If you encounter version conflicts with doctrine/dbal, please try: +> `composer require --dev barryvdh/laravel-ide-helper --with-all-dependencies` + This package makes use of [Laravels package auto-discovery mechanism](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518), which means if you don't install dev dependencies in production, it also won't be loaded. If for some reason you want manually control this: diff --git a/composer.json b/composer.json index 22d94d8..ef72894 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "ext-json": "*", "barryvdh/reflection-docblock": "^2.0.6", "composer/class-map-generator": "^1.0", - "doctrine/dbal": "^2.6 || ^3 || ^4", + "doctrine/dbal": "^2.6 || ^3", "illuminate/console": "^8 || ^9 || ^10", "illuminate/filesystem": "^8 || ^9 || ^10", "illuminate/support": "^8 || ^9 || ^10", From cf4687f98ccfc4042dc25aed0c3d38819a69602e Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 5 Feb 2024 09:13:57 +0100 Subject: [PATCH 09/57] Prepare 2.14.0 release (#1503) --- CHANGELOG.md | 6 +++++- composer.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdab75d..91a19be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,19 @@ All notable changes to this project will be documented in this file. -[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.13.0...master) +[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.14.0...master) -------------- +2023-01-28, 2.14.0 +------------------ + ### Changed - Official support for Lumen has been dropped [#1425 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1425) - Refactor resolving of null information for custom casted attribute types [#1330 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1330) ### Fixed - Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) +- Catch exceptions when loading aliases [#1465 / dongm2ez](https://github.com/barryvdh/laravel-ide-helper/pull/1465) ### Added - Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) diff --git a/composer.json b/composer.json index ef72894..8d7163d 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.13-dev" + "dev-master": "2.14-dev" }, "laravel": { "providers": [ From 485c756f6cff408d6b273274c5e86112c3973d98 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 5 Feb 2024 09:16:36 +0100 Subject: [PATCH 10/57] Prepare 2.14.0 release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91a19be..15556fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.14.0...master) -------------- -2023-01-28, 2.14.0 +2024-02-05, 2.14.0 ------------------ ### Changed From a8b34ad228f3471d25a9789f4de62817a646af10 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 5 Feb 2024 13:25:08 +0100 Subject: [PATCH 11/57] Removed support for Laravel 8 and therefore for PHP < 8.0 (#1504) * Removed support for Laravel 8 and therefore for PHP < 8.0 * Update php-cs-fixer to v3 * composer fix-style --- .github/workflows/run-integration-tests.yml | 16 +--- .github/workflows/run-tests.yml | 16 +--- .gitignore | 6 +- ..._cs.common.php => .php-cs-fixer.common.php | 3 +- .php_cs.dist => .php-cs-fixer.dist.php | 6 +- .php_cs.tests.php => .php-cs-fixer.tests.php | 6 +- CHANGELOG.md | 3 + README.md | 2 +- composer.json | 18 ++-- src/Alias.php | 4 +- src/Console/GeneratorCommand.php | 4 +- src/Console/ModelsCommand.php | 28 +++--- src/Generator.php | 4 +- src/Listeners/GenerateModelHelper.php | 8 +- src/Method.php | 2 +- .../Attributes/Models/Simple.php | 2 +- .../Console/ModelsCommand/Attributes/Test.php | 9 -- .../__snapshots__/Test__test__1.php | 2 +- .../ModelsCommand/DynamicRelations/Test.php | 18 +--- .../Console/ModelsCommand/Factories/Test.php | 31 +----- ...test_9__1.php => Test__testFactory__1.php} | 0 .../__snapshots__/Test__test_8__1.php | 94 ------------------- .../Casts/CastableReturnsAnonymousCaster.php | 2 +- .../Casts/CastableWithoutReturnType.php | 2 +- .../CustomCasterWithDocblockReturnFqn.php | 2 +- .../Console/ModelsCommand/UnionTypes/Test.php | 9 -- tests/MacroTest.php | 8 +- 27 files changed, 63 insertions(+), 242 deletions(-) rename .php_cs.common.php => .php-cs-fixer.common.php (94%) rename .php_cs.dist => .php-cs-fixer.dist.php (59%) rename .php_cs.tests.php => .php-cs-fixer.tests.php (69%) rename tests/Console/ModelsCommand/Factories/__snapshots__/{Test__test_9__1.php => Test__testFactory__1.php} (100%) delete mode 100644 tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_8__1.php diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 84345c5..6edd281 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -19,25 +19,13 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3, 8.2, 8.1, 8.0, 7.4, 7.3] - laravel: [10.*, 9.*, 8.*] + php: [8.3, 8.2, 8.1, 8.0] + laravel: [10.*, 9.*] exclude: - php: 8.0 laravel: 10.* - - php: 7.4 - laravel: 10.* - - php: 7.3 - laravel: 10.* - php: 8.3 laravel: 9.* - - php: 7.4 - laravel: 9.* - - php: 7.3 - laravel: 9.* - - php: 8.3 - laravel: 8.* - - php: 8.2 - laravel: 8.* name: P${{ matrix.php }} - Laravel${{ matrix.laravel }} steps: - name: Checkout code diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 55b79cd..b94dc0d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -20,26 +20,14 @@ jobs: strategy: matrix: os: [ubuntu-20.04, windows-2019] - php: [8.3, 8.2, 8.1, 8.0, 7.4, 7.3] - laravel: [8.*, 9.*, 10.*] + php: [8.3, 8.2, 8.1, 8.0] + laravel: [9.*, 10.*] dependency-version: [prefer-lowest, prefer-stable] exclude: - php: 8.0 laravel: 10.* - - php: 7.4 - laravel: 10.* - - php: 7.3 - laravel: 10.* - php: 8.0 dependency-version: prefer-lowest - - php: 7.4 - laravel: 9.* - - php: 7.3 - laravel: 9.* - - os: windows-2019 - php: 7.4 - - os: windows-2019 - php: 7.3 steps: - name: Set git to use LF if: ${{ matrix.os == 'windows-2019' }} diff --git a/.gitignore b/.gitignore index 1192196..c92a701 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ .phpunit.result.cache /.idea -/.php_cs -/.php_cs.cache -/.php_cs.tests.cache +/.php-cs-fixer.cache +/.php-cs-fixer.php +/.php-cs-fixer.tests.cache /composer.lock /vendor diff --git a/.php_cs.common.php b/.php-cs-fixer.common.php similarity index 94% rename from .php_cs.common.php rename to .php-cs-fixer.common.php index aebd544..31f433b 100644 --- a/.php_cs.common.php +++ b/.php-cs-fixer.common.php @@ -30,7 +30,6 @@ return [ ], 'return_type_declaration' => true, 'short_scalar_cast' => true, - 'single_blank_line_before_namespace' => true, 'single_trait_insert_per_statement' => true, 'ternary_operator_spaces' => true, 'visibility_required' => [ @@ -56,7 +55,7 @@ return [ 'no_unused_imports' => true, 'single_quote' => true, 'space_after_semicolon' => true, - 'trailing_comma_in_multiline_array' => true, + 'trailing_comma_in_multiline' => true, 'trim_array_spaces' => true, 'unary_operator_spaces' => true, 'whitespace_after_comma_in_array' => true, diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 59% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index 2083345..41c5d21 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -5,10 +5,10 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__) ->exclude('tests'); -$config = require __DIR__ . '/.php_cs.common.php'; +$config = require __DIR__ . '/.php-cs-fixer.common.php'; -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setFinder($finder) ->setRules($config) ->setRiskyAllowed(true) - ->setCacheFile(__DIR__ . '/.php_cs.cache'); + ->setCacheFile(__DIR__ . '/.php-cs-fixer.cache'); diff --git a/.php_cs.tests.php b/.php-cs-fixer.tests.php similarity index 69% rename from .php_cs.tests.php rename to .php-cs-fixer.tests.php index 24c484d..652efcd 100644 --- a/.php_cs.tests.php +++ b/.php-cs-fixer.tests.php @@ -5,7 +5,7 @@ $finder = PhpCsFixer\Finder::create() ->in(__DIR__ . '/tests') ->exclude('__snapshots__'); -$config = require __DIR__ . '/.php_cs.common.php'; +$config = require __DIR__ . '/.php-cs-fixer.common.php'; // Additional rules for tests $config = array_merge( @@ -15,8 +15,8 @@ $config = array_merge( ] ); -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setFinder($finder) ->setRules($config) ->setRiskyAllowed(true) - ->setCacheFile(__DIR__ . '/.php_cs.tests.cache'); + ->setCacheFile(__DIR__ . '/.php-cs-fixer.tests.cache'); diff --git a/CHANGELOG.md b/CHANGELOG.md index 15556fa..16fa904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.14.0...master) -------------- +### Changed +- Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) + 2024-02-05, 2.14.0 ------------------ diff --git a/README.md b/README.md index 7050d13..e354271 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package generates helper files that enable your IDE to provide accurate autocompletion. Generation is done based on the files in your project, so they are always up-to-date. -It supports Laravel 8+ and PHP 7.3+ +It supports Laravel 9+ and PHP 8.0+ - [Installation](#installation) - [Usage](#usage) diff --git a/composer.json b/composer.json index 8d7163d..07d7a02 100644 --- a/composer.json +++ b/composer.json @@ -20,24 +20,24 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^8.0", "ext-json": "*", "barryvdh/reflection-docblock": "^2.0.6", "composer/class-map-generator": "^1.0", "doctrine/dbal": "^2.6 || ^3", - "illuminate/console": "^8 || ^9 || ^10", - "illuminate/filesystem": "^8 || ^9 || ^10", - "illuminate/support": "^8 || ^9 || ^10", + "illuminate/console": "^9 || ^10", + "illuminate/filesystem": "^9 || ^10", + "illuminate/support": "^9 || ^10", "nikic/php-parser": "^4.18 || ^5", "phpdocumentor/type-resolver": "^1.1.0" }, "require-dev": { "ext-pdo_sqlite": "*", - "friendsofphp/php-cs-fixer": "^2", - "illuminate/config": "^8 || ^9 || ^10", - "illuminate/view": "^8 || ^9 || ^10", + "friendsofphp/php-cs-fixer": "^3", + "illuminate/config": "^9 || ^10", + "illuminate/view": "^9 || ^10", "mockery/mockery": "^1.4", - "orchestra/testbench": "^6 || ^7 || ^8", + "orchestra/testbench": "^7 || ^8", "phpunit/phpunit": "^8.5 || ^9", "spatie/phpunit-snapshot-assertions": "^3 || ^4", "vimeo/psalm": "^5.4" @@ -81,7 +81,7 @@ ], "fix-style": [ "php-cs-fixer fix", - "php-cs-fixer fix --config=.php_cs.tests.php" + "php-cs-fixer fix --config=.php-cs-fixer.tests.php" ], "psalm-set-baseline": "psalm --set-baseline=psalm-baseline.xml", "test": "phpunit", diff --git a/src/Alias.php b/src/Alias.php index ff4ae67..046fffe 100644 --- a/src/Alias.php +++ b/src/Alias.php @@ -329,7 +329,7 @@ class Alias continue; } $method = new \ReflectionMethod($className, $name); - $class = new \ReflectionClass($className); + $class = new ReflectionClass($className); if (!in_array($magic, $this->usedMethods)) { if ($class !== $this->root) { @@ -348,7 +348,7 @@ class Alias protected function detectMethods() { foreach ($this->classes as $class) { - $reflection = new \ReflectionClass($class); + $reflection = new ReflectionClass($class); $methods = $reflection->getMethods(\ReflectionMethod::IS_PUBLIC); if ($methods) { diff --git a/src/Console/GeneratorCommand.php b/src/Console/GeneratorCommand.php index 40758ec..0004e8f 100644 --- a/src/Console/GeneratorCommand.php +++ b/src/Console/GeneratorCommand.php @@ -42,7 +42,7 @@ class GeneratorCommand extends Command /** @var \Illuminate\Config\Repository */ protected $config; - /** @var \Illuminate\Filesystem\Filesystem */ + /** @var Filesystem */ protected $files; /** @var \Illuminate\View\Factory */ @@ -54,7 +54,7 @@ class GeneratorCommand extends Command /** * * @param \Illuminate\Config\Repository $config - * @param \Illuminate\Filesystem\Filesystem $files + * @param Filesystem $files * @param \Illuminate\View\Factory $view */ public function __construct( diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index ec39dee..c2ce4a6 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -354,7 +354,7 @@ class ModelsCommand extends Command /** * cast the properties's type from $casts. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ public function castPropertiesType($model) { @@ -498,7 +498,7 @@ class ModelsCommand extends Command /** * Load the properties from the database table. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model * * @throws DBALException If custom field failed to register */ @@ -602,7 +602,7 @@ class ModelsCommand extends Command } /** - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ public function getPropertiesFromMethods($model) { @@ -777,7 +777,7 @@ class ModelsCommand extends Command 'int|null', true, false - // What kind of comments should be added to the relation count here? + // What kind of comments should be added to the relation count here? ); } } elseif ( @@ -1126,7 +1126,7 @@ class ModelsCommand extends Command return '\Illuminate\Database\Eloquent\Collection'; } - /** @var \Illuminate\Database\Eloquent\Model $model */ + /** @var Model $model */ $model = new $className(); return '\\' . get_class($model->newCollection()); } @@ -1285,7 +1285,7 @@ class ModelsCommand extends Command /** * Generates methods provided by the SoftDeletes trait - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ protected function getSoftDeleteMethods($model) { @@ -1302,7 +1302,7 @@ class ModelsCommand extends Command /** * Generate factory method from "HasFactory" trait. * - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ protected function getFactoryMethods($model) { @@ -1330,16 +1330,12 @@ class ModelsCommand extends Command return; } - if (version_compare($this->laravel->version(), '9', '>=')) { - $this->setMethod('factory', $factory, ['$count = null, $state = []']); - } else { - $this->setMethod('factory', $factory, ['...$parameters']); - } + $this->setMethod('factory', $factory, ['$count = null, $state = []']); } /** * Generates methods that return collections - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model */ protected function getCollectionMethods($model) { @@ -1382,7 +1378,7 @@ class ModelsCommand extends Command return $type; } - $reflection = new \ReflectionClass($type); + $reflection = new ReflectionClass($type); if (!$reflection->implementsInterface(Castable::class)) { return $type; @@ -1414,7 +1410,7 @@ class ModelsCommand extends Command return $type; } - $reflection = new \ReflectionClass($type); + $reflection = new ReflectionClass($type); if (!$reflection->implementsInterface(CastsAttributes::class)) { return $type; @@ -1620,7 +1616,7 @@ class ModelsCommand extends Command } /** - * @param \Illuminate\Database\Eloquent\Model $model + * @param Model $model * @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \RuntimeException */ diff --git a/src/Generator.php b/src/Generator.php index 61417e2..abad534 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -26,7 +26,7 @@ class Generator /** @var \Illuminate\View\Factory */ protected $view; - /** @var \Symfony\Component\Console\Output\OutputInterface */ + /** @var OutputInterface */ protected $output; protected $extra = []; @@ -37,7 +37,7 @@ class Generator /** * @param \Illuminate\Config\Repository $config * @param \Illuminate\View\Factory $view - * @param \Symfony\Component\Console\Output\OutputInterface $output + * @param OutputInterface $output * @param string $helpers */ public function __construct( diff --git a/src/Listeners/GenerateModelHelper.php b/src/Listeners/GenerateModelHelper.php index 86e2bd4..c448aef 100644 --- a/src/Listeners/GenerateModelHelper.php +++ b/src/Listeners/GenerateModelHelper.php @@ -16,15 +16,15 @@ class GenerateModelHelper */ public static $shouldRun = false; - /** @var \Illuminate\Contracts\Console\Kernel */ + /** @var Artisan */ protected $artisan; - /** @var \Illuminate\Contracts\Config\Repository */ + /** @var Config */ protected $config; /** - * @param \Illuminate\Contracts\Console\Kernel $artisan - * @param \Illuminate\Contracts\Config\Repository $config + * @param Artisan $artisan + * @param Config $config */ public function __construct(Artisan $artisan, Config $config) { diff --git a/src/Method.php b/src/Method.php index f7f7ffa..a46e3f2 100644 --- a/src/Method.php +++ b/src/Method.php @@ -22,7 +22,7 @@ use Illuminate\Support\Str; class Method { - /** @var \Barryvdh\Reflection\DocBlock */ + /** @var DocBlock */ protected $phpdoc; /** @var \ReflectionMethod */ diff --git a/tests/Console/ModelsCommand/Attributes/Models/Simple.php b/tests/Console/ModelsCommand/Attributes/Models/Simple.php index f64861b..d2b8609 100644 --- a/tests/Console/ModelsCommand/Attributes/Models/Simple.php +++ b/tests/Console/ModelsCommand/Attributes/Models/Simple.php @@ -27,7 +27,7 @@ class Simple extends Model * phpdoc is ignored here deliberately due to performance reasons and also * isn't supported by Laravel itself. * - * @return \Illuminate\Database\Eloquent\Casts\Attribute + * @return Attribute */ protected function notAnAttribute() { diff --git a/tests/Console/ModelsCommand/Attributes/Test.php b/tests/Console/ModelsCommand/Attributes/Test.php index 32bdbfd..15a5663 100644 --- a/tests/Console/ModelsCommand/Attributes/Test.php +++ b/tests/Console/ModelsCommand/Attributes/Test.php @@ -9,15 +9,6 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; class Test extends AbstractModelsCommand { - protected function setUp(): void - { - parent::setUp(); - - if (!class_exists('\Illuminate\Database\Eloquent\Casts\Attribute')) { - $this->markTestSkipped('This test requires Laravel 8.77 or newer'); - } - } - public function test(): void { $command = $this->app->make(ModelsCommand::class); diff --git a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php index df68639..ef96b27 100644 --- a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php @@ -38,7 +38,7 @@ class Simple extends Model * phpdoc is ignored here deliberately due to performance reasons and also * isn't supported by Laravel itself. * - * @return \Illuminate\Database\Eloquent\Casts\Attribute + * @return Attribute */ protected function notAnAttribute() { diff --git a/tests/Console/ModelsCommand/DynamicRelations/Test.php b/tests/Console/ModelsCommand/DynamicRelations/Test.php index dedfb22..064797d 100644 --- a/tests/Console/ModelsCommand/DynamicRelations/Test.php +++ b/tests/Console/ModelsCommand/DynamicRelations/Test.php @@ -17,19 +17,11 @@ class Test extends AbstractModelsCommand '--write' => true, ]); - if (PHP_VERSION_ID >= 80000) { - $errors = [ - 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Attempt to read property "created_at" on null', - 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Attempt to read property "created_at" on null', - 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Attempt to read property "created_at" on null', - ]; - } else { - $errors = [ - "Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Trying to get property 'created_at' of non-object", - "Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Trying to get property 'created_at' of non-object", - "Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Trying to get property 'created_at' of non-object", - ]; - } + $errors = [ + 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Attempt to read property "created_at" on null', + 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Attempt to read property "created_at" on null', + 'Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Attempt to read property "created_at" on null', + ]; $this->assertSame(0, $tester->getStatusCode()); $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); diff --git a/tests/Console/ModelsCommand/Factories/Test.php b/tests/Console/ModelsCommand/Factories/Test.php index 1e96e34..f601911 100644 --- a/tests/Console/ModelsCommand/Factories/Test.php +++ b/tests/Console/ModelsCommand/Factories/Test.php @@ -8,41 +8,12 @@ use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; use Closure; use Illuminate\Database\Eloquent\Factories\Factory; -use Illuminate\Foundation\Application; use Illuminate\Support\Str; class Test extends AbstractModelsCommand { - public function test_8(): void + public function testFactory(): void { - if (!version_compare(Application::VERSION, '8.2', '>=') || !version_compare(Application::VERSION, '9', '<')) { - $this->markTestSkipped( - 'This test only works in Laravel >= 8.2 and < 9' - ); - } - - Factory::guessFactoryNamesUsing(static::getFactoryNameResolver()); - - $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->assertStringNotContainsString('not found', $tester->getDisplay()); - $this->assertMatchesMockedSnapshot(); - } - - public function test_9(): void - { - if (!version_compare(Application::VERSION, '9', '>=')) { - $this->markTestSkipped( - 'This test only works in Laravel >= 9' - ); - } - Factory::guessFactoryNamesUsing(static::getFactoryNameResolver()); $command = $this->app->make(ModelsCommand::class); diff --git a/tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_9__1.php b/tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php similarity index 100% rename from tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_9__1.php rename to tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php diff --git a/tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_8__1.php b/tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_8__1.php deleted file mode 100644 index 6c70514..0000000 --- a/tests/Console/ModelsCommand/Factories/__snapshots__/Test__test_8__1.php +++ /dev/null @@ -1,94 +0,0 @@ -markTestSkipped('This test requires PHP 8.0 or higher'); - } - } - public function test(): void { $command = $this->app->make(ModelsCommand::class); diff --git a/tests/MacroTest.php b/tests/MacroTest.php index a0fa904..cf1f79f 100644 --- a/tests/MacroTest.php +++ b/tests/MacroTest.php @@ -190,10 +190,6 @@ class MacroTest extends TestCase public function testInitPhpDocParamsWithUnionTypes(): void { - if (PHP_VERSION_ID < 80000) { - $this->markTestSkipped('This test requires PHP 8.0 or higher'); - } - $phpdoc = (new MacroMock())->getPhpDoc(eval(<<<'PHP' return new ReflectionFunction( /** @@ -231,7 +227,7 @@ class MacroTest extends TestCase { $reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke'); - $macro = new Macro($reflectionMethod, UrlGenerator::class, new \ReflectionClass(UrlGenerator::class), 'macroName'); + $macro = new Macro($reflectionMethod, UrlGenerator::class, new ReflectionClass(UrlGenerator::class), 'macroName'); $this->assertInstanceOf(Macro::class, $macro); } @@ -243,7 +239,7 @@ class MacroTest extends TestCase { $reflectionMethod = new \ReflectionMethod(UrlGeneratorMacroClass::class, '__invoke'); - $macro = new Macro($reflectionMethod, 'URL', new \ReflectionClass(UrlGenerator::class), 'macroName'); + $macro = new Macro($reflectionMethod, 'URL', new ReflectionClass(UrlGenerator::class), 'macroName'); $output = <<<'DOC' /** * From 115068e57bbecc5ee6fd202b230c795fabff77be Mon Sep 17 00:00:00 2001 From: Toby Twigger Date: Wed, 7 Feb 2024 13:36:45 +0000 Subject: [PATCH 12/57] Clarify use of --reset and --smart-reset flags in documentation (#1494) * Update README.md Clarified model behaviour when using the --reset option * Add --smart-reset to the documentation --------- Co-authored-by: Toby Twigger --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e354271..bd00f5a 100644 --- a/README.md +++ b/README.md @@ -145,9 +145,9 @@ The class name will be different from the model, avoiding the IDE duplicate anno > Please make sure to back up your models, before writing the info. -Writing to the models should keep the existing comments and only append new properties/methods. -The existing PHPDoc is replaced, or added if not found. -With the `--reset (-R)` option, the existing PHPDocs are ignored, and only the newly found columns/relations are saved as PHPDocs. +Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods. + +With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made. The `--smart-reset` option will instead keep the 'text' part of the phpdoc comment, and just replace all the property/method defininitions. ```bash php artisan ide-helper:models "App\Models\Post" From 512612f22ffd6500efc0015be60fa8fd75609afc Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Wed, 7 Feb 2024 19:29:10 +0100 Subject: [PATCH 13/57] Remove outdated dev references to older versions (#1508) --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 07d7a02..537d760 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,8 @@ "illuminate/view": "^9 || ^10", "mockery/mockery": "^1.4", "orchestra/testbench": "^7 || ^8", - "phpunit/phpunit": "^8.5 || ^9", - "spatie/phpunit-snapshot-assertions": "^3 || ^4", + "phpunit/phpunit": "^9", + "spatie/phpunit-snapshot-assertions": "^4", "vimeo/psalm": "^5.4" }, "suggest": { From cc9ed4423b594867373d00cef53a907b1f1bd532 Mon Sep 17 00:00:00 2001 From: Jackey Cheung Date: Thu, 8 Feb 2024 02:30:35 +0800 Subject: [PATCH 14/57] disable inspections of helper files (#1486) * disables all jetbrains inspections * disables all jetbrains' & phpcs' inspections --- resources/views/helper.php | 1 + resources/views/meta.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/resources/views/helper.php b/resources/views/helper.php index ddf2922..4a925bc 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -8,6 +8,7 @@ */ ?> +/* @noinspection ALL */ // @formatter:off // phpcs:ignoreFile diff --git a/resources/views/meta.php b/resources/views/meta.php index 2840d91..5b7b9c2 100644 --- a/resources/views/meta.php +++ b/resources/views/meta.php @@ -1,6 +1,8 @@ +/* @noinspection ALL */ // @formatter:off +// phpcs:ignoreFile namespace PHPSTORM_META { From f4656256fc8f41dc7bbfafda307da4a37b8caaf3 Mon Sep 17 00:00:00 2001 From: netpok Date: Wed, 7 Feb 2024 21:06:31 +0100 Subject: [PATCH 15/57] Fix non-facade classes will result in no autocomplete (#841) * Filter out non-facade base classes * Remove Model as it is already skipped because it's not a facade --- resources/views/helper.php | 23 ++++++++++------------- src/Generator.php | 5 ++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/views/helper.php b/resources/views/helper.php index 4a925bc..90b7413 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -23,15 +23,12 @@ */ $aliases) : ?> - -namespace { +namespace { - getDocComment(' ')) ?> + getDocComment(' ')) ?> getClassType() ?> getExtendsClass() ?> { getMethods() as $method) : ?> - getDocComment(' ')) ?> + getDocComment(' ')) ?> public static function getName() ?>(getParamsWithDefault() ?>) {getDeclaringClass() !== $method->getRoot()) : ?> //Method inherited from getDeclaringClass() ?> @@ -42,19 +39,19 @@ namespace { shouldReturn() ? 'return ' : '' ?>getRootMethodCall() ?>; } - + } - + } $aliases) : ?> -namespace { +namespace { getClassType() ?> getShortName() ?> extends getExtends() ?> {getExtendsNamespace() == '\Illuminate\Database\Eloquent') : ?> - getMethods() as $method) : ?> - getDocComment(' ')) ?> + getMethods() as $method) : ?> + getDocComment(' ')) ?> public static function getName() ?>(getParamsWithDefault() ?>) {getDeclaringClass() !== $method->getRoot()) : ?> //Method inherited from getDeclaringClass() ?> @@ -67,14 +64,14 @@ namespace { } } - + } namespace { - + } diff --git a/src/Generator.php b/src/Generator.php index abad534..9df9291 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -13,6 +13,7 @@ namespace Barryvdh\LaravelIdeHelper; use Illuminate\Foundation\AliasLoader; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Facade; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; use ReflectionClass; @@ -175,7 +176,9 @@ class Generator */ protected function getAliasesByExtendsNamespace() { - $aliases = $this->getValidAliases(); + $aliases = $this->getValidAliases()->filter(static function (Alias $alias) { + return is_subclass_of($alias->getExtends(), Facade::class); + }); $this->addMacroableClasses($aliases); From 9d14b019f63d08f7a9742364d2b3c6f469c28785 Mon Sep 17 00:00:00 2001 From: PapaBear Date: Wed, 7 Feb 2024 21:19:43 +0100 Subject: [PATCH 16/57] skip swoole, otherwise fatal error (#1477) Co-authored-by: Timo Frenzel --- src/Generator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Generator.php b/src/Generator.php index 9df9291..4a92d35 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -153,6 +153,11 @@ class Generator if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) { continue; } + + // Skip the swoole + if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { + continue; + } $magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : []; $alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces); From f3ad1342426e4c964063e7bf24d65749b2ad8f1a Mon Sep 17 00:00:00 2001 From: Allan Laal Date: Wed, 7 Feb 2024 22:24:42 +0200 Subject: [PATCH 17/57] FIX vulnerability CVE-2021-43608 (#1392) Doctrine DBAL 3.x before 3.1.4 allows SQL Injection: https://www.cve.org/CVERecord?id=CVE-2021-43608 Co-authored-by: Barry vd. Heuvel --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 537d760..18e3902 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "ext-json": "*", "barryvdh/reflection-docblock": "^2.0.6", "composer/class-map-generator": "^1.0", - "doctrine/dbal": "^2.6 || ^3", + "doctrine/dbal": "^2.6 || ^3.1.4", "illuminate/console": "^9 || ^10", "illuminate/filesystem": "^9 || ^10", "illuminate/support": "^9 || ^10", From f64ff9c0b1fa12dff9d79fadb118019b062a512e Mon Sep 17 00:00:00 2001 From: Ruben Robles Date: Wed, 7 Feb 2024 21:27:30 +0100 Subject: [PATCH 18/57] Add support for enum default arguments using enum cases (#1464) * add case when default value is of type enum * Update CHANGELOG.md * add tests for enum arguments default values * ignore psalm issue (built-in `\UnitEnum` class does not exists in PHP7) * Update run-static-analysis.yml to use PHP8.1 --------- Co-authored-by: Barry vd. Heuvel Co-authored-by: Barry vd. Heuvel --- .github/workflows/run-static-analysis.yml | 2 +- CHANGELOG.md | 4 + psalm-baseline.xml | 5 + src/Console/ModelsCommand.php | 2 + .../Enums/PostStatus.php | 12 ++ .../Models/Post.php | 17 ++ .../Test.php | 30 +++ .../__snapshots__/Test__test__1.php | 172 ++++++++++++++++++ 8 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php create mode 100644 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Models/Post.php create mode 100644 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php create mode 100644 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php diff --git a/.github/workflows/run-static-analysis.yml b/.github/workflows/run-static-analysis.yml index 1085dfe..c8c29bb 100644 --- a/.github/workflows/run-static-analysis.yml +++ b/.github/workflows/run-static-analysis.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.1 coverage: none extensions: pdo_sqlite diff --git a/CHANGELOG.md b/CHANGELOG.md index 16fa904..d638d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. ### Changed - Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) + +### Added +- Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464) + 2024-02-05, 2.14.0 ------------------ diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f6a5b14..84de223 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -16,4 +16,9 @@ \Storage + + + \UnitEnum + + diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index c2ce4a6..13735c2 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1099,6 +1099,8 @@ class ModelsCommand extends Command $default = 'null'; } elseif (is_int($default)) { //$default = $default; + } elseif ($default instanceof \UnitEnum) { + $default = '\\' . get_class($default) . '::' . $default->name; } else { $default = "'" . trim($default) . "'"; } diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php new file mode 100644 index 0000000..afe6b9b --- /dev/null +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php @@ -0,0 +1,12 @@ +=')) { + $this->markTestSkipped( + 'This test only works in PHP >= 8.1' + ); + } + + $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(); + } +} diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..b4229da --- /dev/null +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -0,0 +1,172 @@ + Date: Thu, 8 Feb 2024 05:31:12 +0900 Subject: [PATCH 19/57] reset foreignKeyConstraintsColumns on model loop start (#1461) --- src/Console/ModelsCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 13735c2..fd34432 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -266,6 +266,7 @@ class ModelsCommand extends Command } $this->properties = []; $this->methods = []; + $this->foreignKeyConstraintsColumns = []; if (class_exists($name)) { try { // handle abstract classes, interfaces, ... From 04c1a8d444e9e30ee96ca7befbed7387efbd4037 Mon Sep 17 00:00:00 2001 From: Filip Iulian Pacurar Date: Wed, 7 Feb 2024 22:35:02 +0200 Subject: [PATCH 20/57] Support generating helper files for real-time facades (#1455) * Support generating helper files for real-time facades Add changelog entry for real-time facades support Mention real-time facades support in readme Fix code style Import * Remove useless assertions We cannot 100% control the output file has only the real-time facades, anything else can be in the final output --- CHANGELOG.md | 1 + README.md | 4 + resources/views/helper.php | 10 +++ src/Generator.php | 49 ++++++++++ tests/RealTimeFacadesTest.php | 90 +++++++++++++++++++ ...0385307adf5db34c7986ecbd11646061356ec8.php | 21 +++++ ...31b04ec1494fc71a1bc848f020044aba2af7b1.php | 21 +++++ 7 files changed, 196 insertions(+) create mode 100644 tests/RealTimeFacadesTest.php create mode 100644 tests/stubs/facade-0e0385307adf5db34c7986ecbd11646061356ec8.php create mode 100644 tests/stubs/facade-9431b04ec1494fc71a1bc848f020044aba2af7b1.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d638d2d..4de848a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. ### Added - Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) +- Add support for real-time facades in the helper file. [pending PR](#) 2023-02-04, 2.13.0 ------------------ diff --git a/README.md b/README.md index bd00f5a..a151675 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,10 @@ The generator tries to identify the real class, but if it cannot be found, you c Some classes need a working database connection. If you do not have a default working connection, some facades will not be included. You can use an in-memory SQLite driver by adding the `-M` option. +If you use [real-time facades](https://laravel.com/docs/master/facades#real-time-facades) in your app, those will also be included in the generated file using a `@mixin` annotation and extending the original class underneath the facade. + +**Note**: this feature uses the generated real-time facades files in the `storage/framework/cache` folder. Those files are generated on-demand as you use the real-time facade, so if the framework has not generated that first, it will not be included in the helper file. Run the route/command/code first and then regenerate the helper file and this time the real-time facade will be included in it. + You can choose to include helper files. This is not enabled by default, but you can override it with the `--helpers (-H)` option. The `Illuminate/Support/helpers.php` is already set up, but you can add/remove your own files in the config file. diff --git a/resources/views/helper.php b/resources/views/helper.php index 90b7413..26a9abc 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -69,6 +69,16 @@ namespace { + + +namespace { + /** + * @mixin + */ + class extends {} +} + + namespace { diff --git a/src/Generator.php b/src/Generator.php index 4a92d35..0c7acc6 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -16,6 +16,10 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; +use PhpParser\Lexer\Emulative; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\Namespace_; +use PhpParser\Parser\Php7; use ReflectionClass; use Symfony\Component\Console\Output\OutputInterface; @@ -76,6 +80,7 @@ class Generator return $this->view->make('helper') ->with('namespaces_by_extends_ns', $this->getAliasesByExtendsNamespace()) ->with('namespaces_by_alias_ns', $this->getAliasesByAliasNamespace()) + ->with('real_time_facades', $this->getRealTimeFacades()) ->with('helpers', $this->helpers) ->with('version', $app->version()) ->with('include_fluent', $this->config->get('ide-helper.include_fluent', true)) @@ -174,6 +179,50 @@ class Generator return $aliases; } + protected function getRealTimeFacades() + { + $facades = []; + $realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php')); + foreach($realTimeFacadeFiles as $file) { + try { + $name = $this->getFullyQualifiedClassNameInFile($file); + $facades[$name] = $name; + } catch (\Exception $e) { + continue; + } + } + + return $facades; + } + + protected function getFullyQualifiedClassNameInFile(string $path) { + $contents = file_get_contents($path); + + $parsers = new Php7(new Emulative); + + $parsed = collect($parsers->parse($contents) ?: []); + + $namespace = $parsed->first(function ($node) { + return $node instanceof Namespace_; + }); + + if($namespace) { + $name = $namespace->name->toString(); + + $class = collect($namespace->stmts)->first(function ($node) { + return $node instanceof Class_; + }); + + if($class) { + $name .= '\\' . $class->name->toString(); + } + + return $name; + } + } + + + /** * Regroup aliases by namespace of extended classes * diff --git a/tests/RealTimeFacadesTest.php b/tests/RealTimeFacadesTest.php new file mode 100644 index 0000000..42895b8 --- /dev/null +++ b/tests/RealTimeFacadesTest.php @@ -0,0 +1,90 @@ +app['config'], $this->app['view'], null, false); + + // Clear aliases and macros to have a small output file + AliasLoader::getInstance()->setAliases([]); + Request::flushMacros(); + + // Generate the helper file and return the content + $content = $generator->generate(); + + $this->assertStringContainsString('namespace Facades\Illuminate\Foundation\Exceptions {', $content, 'Could not find Facades\Illuminate\Foundation\Exceptions namespace in the generated helper file.'); + $this->assertStringContainsString('namespace Facades\App\Exceptions {', $content, 'Could not find Facades\App\Exceptions namespace in the generated helper file.'); + + $parsed = collect((new Php7(new Emulative()))->parse($content) ?: []); + + // test the Facades\Illuminate\Foundation\Exceptions namespace in the generated helper file + $frameworkExceptionsNamespace = $parsed->first(function ($stmt) { + return ($stmt instanceof Namespace_) && $stmt->name->toString() === 'Facades\Illuminate\Foundation\Exceptions'; + }); + $this->assertNotNull($frameworkExceptionsNamespace, 'Could not find Facades\Illuminate\Foundation\Exceptions namespace'); + $this->assertSame('Facades\Illuminate\Foundation\Exceptions', $frameworkExceptionsNamespace->name->toString()); + $this->verifyNamespace($frameworkExceptionsNamespace, 'Illuminate\Foundation\Exceptions\Handler'); + + // test the Facades\App\Exceptions namespace in the generated helper file + $appExceptionsNamespace = $parsed->first(function ($stmt) { + return ($stmt instanceof Namespace_) && $stmt->name->toString() === 'Facades\App\Exceptions'; + }); + $this->assertNotNull($appExceptionsNamespace, 'Could not find Facades\App\Exceptions namespace'); + $this->assertSame('Facades\App\Exceptions', $appExceptionsNamespace->name->toString()); + $this->verifyNamespace($appExceptionsNamespace, 'App\Exceptions\Handler'); + } + + private function verifyNamespace(Namespace_ $namespace, $target) + { + $stmts = collect($namespace->stmts); + + $this->assertInstanceOf(Class_::class, $stmts[0], 'Expected instance of Class_'); + + $statement = $stmts[0]; + $this->assertArrayHasKey('comments', $statement->getAttributes()); + + $this->assertStringContainsString('@mixin \\' . $target, $statement->getAttributes()['comments'][0]->getText(), 'Mixin comment not found'); + $this->assertSame(class_basename($target), $statement->name->toString(), 'Class name not found'); + $this->assertSame($target, $statement->extends->toString(), 'Class extends not found'); + } + + protected function getPackageProviders($app) + { + return [IdeHelperServiceProvider::class]; + } +} diff --git a/tests/stubs/facade-0e0385307adf5db34c7986ecbd11646061356ec8.php b/tests/stubs/facade-0e0385307adf5db34c7986ecbd11646061356ec8.php new file mode 100644 index 0000000..6a8ad57 --- /dev/null +++ b/tests/stubs/facade-0e0385307adf5db34c7986ecbd11646061356ec8.php @@ -0,0 +1,21 @@ + Date: Wed, 7 Feb 2024 21:37:51 +0100 Subject: [PATCH 21/57] Update CHANGELOG.md --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4de848a..ffb3068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,9 @@ All notable changes to this project will be documented in this file. ### Changed - Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) - ### Added - Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464) +- Add support for real-time facades in the helper file. [#1455 / filipac](https://github.com/barryvdh/laravel-ide-helper/pull/1455) 2024-02-05, 2.14.0 ------------------ @@ -26,7 +26,6 @@ All notable changes to this project will be documented in this file. ### Added - Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) -- Add support for real-time facades in the helper file. [pending PR](#) 2023-02-04, 2.13.0 ------------------ From 16548fc878896301d2976e8f32b95ba975776c8c Mon Sep 17 00:00:00 2001 From: James Bhatta Date: Thu, 8 Feb 2024 02:25:24 +0545 Subject: [PATCH 22/57] Update README.md (#1451) Fix intra page link for PHPDocs for models --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a151675..b0bc074 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ If for some reason you want manually control this: _Check out [this Laracasts video](https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/15) for a quick introduction/explanation!_ - `php artisan ide-helper:generate` - [PHPDoc generation for Laravel Facades ](#automatic-phpdoc-generation-for-laravel-facades) -- `php artisan ide-helper:models` - [PHPDocs for models](#automatic-PHPDocs-for-models) +- `php artisan ide-helper:models` - [PHPDocs for models](#automatic-phpdocs-for-models) - `php artisan ide-helper:meta` - [PhpStorm Meta file](#phpstorm-meta-for-container-instances) From 2535f8e6ab78a233f444a6bd26da8fecb12a93cb Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 7 Feb 2024 21:44:48 +0100 Subject: [PATCH 23/57] Fix tests and CS --- resources/views/helper.php | 2 +- src/Generator.php | 17 +++++++++-------- .../Enums/PostStatus.php | 4 +++- .../Models/Post.php | 6 +++--- .../__snapshots__/Test__test__1.php | 6 +++--- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/resources/views/helper.php b/resources/views/helper.php index 26a9abc..9479a7e 100644 --- a/resources/views/helper.php +++ b/resources/views/helper.php @@ -70,7 +70,7 @@ namespace { - + namespace { /** * @mixin diff --git a/src/Generator.php b/src/Generator.php index 0c7acc6..a509958 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -158,9 +158,9 @@ class Generator if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) { continue; } - - // Skip the swoole - if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { + + // Skip the swoole + if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) { continue; } @@ -183,7 +183,7 @@ class Generator { $facades = []; $realTimeFacadeFiles = glob(storage_path('framework/cache/facade-*.php')); - foreach($realTimeFacadeFiles as $file) { + foreach ($realTimeFacadeFiles as $file) { try { $name = $this->getFullyQualifiedClassNameInFile($file); $facades[$name] = $name; @@ -195,10 +195,11 @@ class Generator return $facades; } - protected function getFullyQualifiedClassNameInFile(string $path) { + protected function getFullyQualifiedClassNameInFile(string $path) + { $contents = file_get_contents($path); - $parsers = new Php7(new Emulative); + $parsers = new Php7(new Emulative()); $parsed = collect($parsers->parse($contents) ?: []); @@ -206,14 +207,14 @@ class Generator return $node instanceof Namespace_; }); - if($namespace) { + if ($namespace) { $name = $namespace->name->toString(); $class = collect($namespace->stmts)->first(function ($node) { return $node instanceof Class_; }); - if($class) { + if ($class) { $name .= '\\' . $class->name->toString(); } diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php index afe6b9b..8a69af9 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Enums/PostStatus.php @@ -1,5 +1,7 @@ Date: Thu, 8 Feb 2024 04:48:09 +0800 Subject: [PATCH 24/57] Fix unsetMethod in ModelsCommand (#1453) * Fix unsetMethod in ModelsCommand * composer fix-style --------- Co-authored-by: Barry vd. Heuvel Co-authored-by: laravel-ide-helper --- CHANGELOG.md | 3 +++ src/Console/ModelsCommand.php | 7 ++++++- .../Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php | 2 +- tests/Console/ModelsCommand/ModelHooks/Test.php | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffb3068..d9dfde6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.14.0...master) -------------- +### Fixed +- Fix case issue in `ModelsCommand::unsetMethod()` [#1453 / leo108](https://github.com/barryvdh/laravel-ide-helper/pull/1453) + ### Changed - Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index fd34432..a2439b1 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -892,7 +892,12 @@ class ModelsCommand extends Command public function unsetMethod($name) { - unset($this->methods[strtolower($name)]); + foreach ($this->methods as $k => $v) { + if (strtolower($k) === strtolower($name)) { + unset($this->methods[$k]); + return; + } + } } public function getMethodType(Model $model, string $classType) diff --git a/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php b/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php index 6dfad54..23b53d1 100644 --- a/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php +++ b/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php @@ -12,6 +12,6 @@ class UnsetMethod implements ModelHookInterface { public function run(ModelsCommand $command, Model $model): void { - $command->unsetMethod('query'); + $command->unsetMethod('newmodelquery'); } } diff --git a/tests/Console/ModelsCommand/ModelHooks/Test.php b/tests/Console/ModelsCommand/ModelHooks/Test.php index 05ffea2..fadaf6c 100644 --- a/tests/Console/ModelsCommand/ModelHooks/Test.php +++ b/tests/Console/ModelsCommand/ModelHooks/Test.php @@ -76,8 +76,8 @@ use Illuminate\Database\Eloquent\Model; * @property int $id * @property-read string $custom * @method static \Illuminate\Database\Eloquent\Builder|Simple custom($custom) - * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|Simple query() * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */ From 62fc436c4cadf1e949fcc5a632cc1c3e7d6d29dc Mon Sep 17 00:00:00 2001 From: Ben Poulson Date: Wed, 7 Feb 2024 20:55:16 +0000 Subject: [PATCH 25/57] Reintroduce support for multi-db setups (#1426) This snipet was lost in the 2.12.x => 2.13.x change. Needs to be reintroduced to allow those who use fully qualified db+table names. (Eg, `database.table`) --- src/Console/ModelsCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index a2439b1..42dfc95 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -510,6 +510,10 @@ class ModelsCommand extends Command $schema = $model->getConnection()->getDoctrineSchemaManager(); $databasePlatform = $schema->getDatabasePlatform(); $databasePlatform->registerDoctrineTypeMapping('enum', 'string'); + + if (strpos($table, '.')) { + [$database, $table] = explode('.', $table); + } $platformName = $databasePlatform->getName(); $customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", []); From 7d69dc6ea09f5b7e36a0f90dfc4467a5dd395750 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 7 Feb 2024 21:58:39 +0100 Subject: [PATCH 26/57] CS --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 42dfc95..8e6be5c 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -510,7 +510,7 @@ class ModelsCommand extends Command $schema = $model->getConnection()->getDoctrineSchemaManager(); $databasePlatform = $schema->getDatabasePlatform(); $databasePlatform->registerDoctrineTypeMapping('enum', 'string'); - + if (strpos($table, '.')) { [$database, $table] = explode('.', $table); } From 5c886fb653386ce057070258d99f7d850161ae1f Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 7 Feb 2024 22:01:48 +0100 Subject: [PATCH 27/57] Support the BINARY(...) database field type (#1434) In singlestore we define some strings as $table->char($columnName, 40)->charset('binary')->collation('binary'); In singelstore, this becomes 'BINARY(40)' instead of 'CHAR(40) CHARACTER SET 'binary' COLLATE 'binary' This change would allow the generated proeperties to be 'string' instead of 'mixed', as using a string is correct in this case. --- src/Console/ModelsCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 8e6be5c..8759a34 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -551,6 +551,7 @@ class ModelsCommand extends Command case 'datetimetz': case 'datetime': case 'decimal': + case 'binary': $type = 'string'; break; case 'integer': From 6115100a0fc82ae2d10c1bb039e2b929cdcca0d8 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Thu, 8 Feb 2024 00:42:27 -0600 Subject: [PATCH 28/57] Add support for composite keys (#1479) * Add support for composite keys * chore: add composite foreign key test --- CHANGELOG.md | 1 + config/ide-helper.php | 3 +- src/Console/ModelsCommand.php | 14 +++-- .../Models/CompositeBelongsToVariation.php | 41 ++++++++++++ .../Console/ModelsCommand/Relations/Test.php | 1 + .../Relations/__snapshots__/Test__test__1.php | 62 +++++++++++++++++++ 6 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 tests/Console/ModelsCommand/Relations/Models/CompositeBelongsToVariation.php diff --git a/CHANGELOG.md b/CHANGELOG.md index d9dfde6..0a91860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. ### Added - Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464) - Add support for real-time facades in the helper file. [#1455 / filipac](https://github.com/barryvdh/laravel-ide-helper/pull/1455) +- Add support for relations with composite keys. [#1479 / calebdw](https://github.com/barryvdh/laravel-ide-helper/pull/1479) 2024-02-05, 2.14.0 ------------------ diff --git a/config/ide-helper.php b/config/ide-helper.php index 80afdb2..cec91c6 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -322,7 +322,8 @@ return [ | | When using custom relation types its possible for the class name to not contain | the proper return type of the relation. The key of the array is the relationship - | method name. The value of the array is the return type of the relation. + | method name. The value of the array is the return type of the relation ('many' + | or 'morphTo'). | e.g. `'relationName' => 'many'`. | */ diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 8759a34..b5cb107 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -38,6 +38,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; use Illuminate\Support\Str; use phpDocumentor\Reflection\Types\ContextFactory; @@ -843,12 +844,17 @@ class ModelsCommand extends Command $fkProp = $reflectionObj->getProperty('foreignKey'); $fkProp->setAccessible(true); - if ($relation === 'belongsTo') { - return isset($this->nullableColumns[$fkProp->getValue($relationObj)]) || - !in_array($fkProp->getValue($relationObj), $this->foreignKeyConstraintsColumns, true); + foreach (Arr::wrap($fkProp->getValue($relationObj)) as $foreignKey) { + if (isset($this->nullableColumns[$foreignKey])) { + return true; + } + + if (!in_array($foreignKey, $this->foreignKeyConstraintsColumns, true)) { + return true; + } } - return isset($this->nullableColumns[$fkProp->getValue($relationObj)]); + return false; } /** diff --git a/tests/Console/ModelsCommand/Relations/Models/CompositeBelongsToVariation.php b/tests/Console/ModelsCommand/Relations/Models/CompositeBelongsToVariation.php new file mode 100644 index 0000000..5fb041d --- /dev/null +++ b/tests/Console/ModelsCommand/Relations/Models/CompositeBelongsToVariation.php @@ -0,0 +1,41 @@ +belongsTo( + self::class, + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ); + } + + public function nonNullableMixedWithoutForeignKeyConstraint(): BelongsTo + { + return $this->belongsTo( + self::class, + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_no_foreign_key_constraint'], + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_no_foreign_key_constraint'], + ); + } + + public function nullableMixedWithForeignKeyConstraint(): BelongsTo + { + return $this->belongsTo( + self::class, + ['nullable_column_with_no_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ['nullable_column_with_no_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ); + } +} diff --git a/tests/Console/ModelsCommand/Relations/Test.php b/tests/Console/ModelsCommand/Relations/Test.php index fd94d23..3995747 100644 --- a/tests/Console/ModelsCommand/Relations/Test.php +++ b/tests/Console/ModelsCommand/Relations/Test.php @@ -6,6 +6,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations; use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyMorphedRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType; diff --git a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php index 863b180..2412f14 100644 --- a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php @@ -57,6 +57,68 @@ declare(strict_types=1); namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; + +/** + * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\CompositeBelongsToVariation + * + * @property integer $id + * @property integer $not_null_column_with_foreign_key_constraint + * @property integer $not_null_column_with_no_foreign_key_constraint + * @property integer|null $nullable_column_with_foreign_key_constraint + * @property integer|null $nullable_column_with_no_foreign_key_constraint + * @property-read CompositeBelongsToVariation $bothNonNullableWithForeignKeyConstraint + * @property-read CompositeBelongsToVariation|null $nonNullableMixedWithoutForeignKeyConstraint + * @property-read CompositeBelongsToVariation|null $nullableMixedWithForeignKeyConstraint + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation query() + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation whereNotNullColumnWithForeignKeyConstraint($value) + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation whereNotNullColumnWithNoForeignKeyConstraint($value) + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation whereNullableColumnWithForeignKeyConstraint($value) + * @method static \Illuminate\Database\Eloquent\Builder|CompositeBelongsToVariation whereNullableColumnWithNoForeignKeyConstraint($value) + * @mixin \Eloquent + */ +class CompositeBelongsToVariation extends Model +{ + public $table = 'belongs_to_variations'; + + public function bothNonNullableWithForeignKeyConstraint(): BelongsTo + { + // Note, duplicating the keys here for simplicity. + return $this->belongsTo( + self::class, + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ); + } + + public function nonNullableMixedWithoutForeignKeyConstraint(): BelongsTo + { + return $this->belongsTo( + self::class, + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_no_foreign_key_constraint'], + ['not_null_column_with_foreign_key_constraint', 'not_null_column_with_no_foreign_key_constraint'], + ); + } + + public function nullableMixedWithForeignKeyConstraint(): BelongsTo + { + return $this->belongsTo( + self::class, + ['nullable_column_with_no_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ['nullable_column_with_no_foreign_key_constraint', 'not_null_column_with_foreign_key_constraint'], + ); + } +} + Date: Thu, 8 Feb 2024 09:20:47 +0100 Subject: [PATCH 29/57] Accept `scope` & `scopes` as relation (#1452) --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index b5cb107..b350caf 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -673,7 +673,7 @@ class ModelsCommand extends Command $comment = $this->getCommentFromDocBlock($reflection); $this->setProperty($name, null, null, true, $comment); } - } elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery') { + } elseif (Str::startsWith($method, 'scope') && $method !== 'scopeQuery' && $method !== 'scope' && $method !== 'scopes') { //Magic setAttribute $name = Str::camel(substr($method, 5)); if (!empty($name)) { From f12d933ab1eb12991539b271c2d0bb0a39094f92 Mon Sep 17 00:00:00 2001 From: Hans van Luttikhuizen-Ross Date: Thu, 8 Feb 2024 09:39:10 +0100 Subject: [PATCH 30/57] Add support for non type-hinted attribute accessors with no backed property (#1411) * Read Attribute type from parameter * Update CHANGELOG.md * Update ModelsCommand.php --------- Co-authored-by: Barry vd. Heuvel Co-authored-by: Barry vd. Heuvel --- CHANGELOG.md | 3 +- src/Console/ModelsCommand.php | 60 +++++++------ .../Attributes/Models/Simple.php | 76 ++++++++++++++++- .../__snapshots__/Test__test__1.php | 84 ++++++++++++++++++- 4 files changed, 194 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a91860..ca3bb91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - Add support for enum default arguments using enum cases. [#1464 / d8vjork](https://github.com/barryvdh/laravel-ide-helper/pull/1464) - Add support for real-time facades in the helper file. [#1455 / filipac](https://github.com/barryvdh/laravel-ide-helper/pull/1455) - Add support for relations with composite keys. [#1479 / calebdw](https://github.com/barryvdh/laravel-ide-helper/pull/1479) +- Add support for attribute accessors with no backing field or type hinting [#1411 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1411). 2024-02-05, 2.14.0 ------------------ @@ -24,12 +25,12 @@ All notable changes to this project will be documented in this file. - Refactor resolving of null information for custom casted attribute types [#1330 / wimski](https://github.com/barryvdh/laravel-ide-helper/pull/1330) ### Fixed -- Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) - Catch exceptions when loading aliases [#1465 / dongm2ez](https://github.com/barryvdh/laravel-ide-helper/pull/1465) ### Added - Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) +- Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) 2023-02-04, 2.13.0 ------------------ diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index b350caf..98991cd 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -620,10 +620,7 @@ class ModelsCommand extends Command // methods that resemble mutators but aren't. $reflections = array_filter($reflections, function (\ReflectionMethod $methodReflection) { return !$methodReflection->isPrivate() && !( - in_array( - \Illuminate\Database\Eloquent\Concerns\HasAttributes::class, - $methodReflection->getDeclaringClass()->getTraitNames() - ) && ( + $methodReflection->getDeclaringClass()->getName() === \Illuminate\Database\Eloquent\Model::class && ( $methodReflection->getName() === 'setClassCastableAttribute' || $methodReflection->getName() === 'setEnumCastableAttribute' ) @@ -649,18 +646,15 @@ class ModelsCommand extends Command $this->setProperty($name, $type, true, null, $comment); } } elseif ($isAttribute) { - $name = Str::snake($method); - $types = $this->getAttributeReturnType($model, $reflection); - $comment = $this->getCommentFromDocBlock($reflection); - - if ($types->has('get')) { - $type = $this->getTypeInModel($model, $types['get']); - $this->setProperty($name, $type, true, null, $comment); - } - - if ($types->has('set')) { - $this->setProperty($name, null, null, true, $comment); - } + $types = $this->getAttributeTypes($model, $reflection); + $type = $this->getTypeInModel($model, $types->get('get') ?: $types->get('set')) ?: null; + $this->setProperty( + Str::snake($method), + $type, + $types->has('get'), + $types->has('set'), + $this->getCommentFromDocBlock($reflection) + ); } elseif ( Str::startsWith($method, 'set') && Str::endsWith( $method, @@ -1192,7 +1186,10 @@ class ModelsCommand extends Command return $this->laravel['config']->get('ide-helper.model_camel_case_properties', false); } - protected function getAttributeReturnType(Model $model, \ReflectionMethod $reflectionMethod): Collection + /** + * @psalm-suppress NoValue + */ + protected function getAttributeTypes(Model $model, \ReflectionMethod $reflectionMethod): Collection { // Private/protected ReflectionMethods require setAccessible prior to PHP 8.1 $reflectionMethod->setAccessible(true); @@ -1200,13 +1197,25 @@ class ModelsCommand extends Command /** @var Attribute $attribute */ $attribute = $reflectionMethod->invoke($model); - return collect([ - 'get' => $attribute->get ? optional(new \ReflectionFunction($attribute->get))->getReturnType() : null, - 'set' => $attribute->set ? optional(new \ReflectionFunction($attribute->set))->getReturnType() : null, - ]) - ->filter() + $methods = new Collection(); + + if ($attribute->get) { + $methods['get'] = optional(new \ReflectionFunction($attribute->get))->getReturnType(); + } + if ($attribute->set) { + $function = optional(new \ReflectionFunction($attribute->set)); + if ($function->getNumberOfParameters() === 0) { + $methods['set'] = null; + } else { + $methods['set'] = $function->getParameters()[0]->getType(); + } + } + + return $methods ->map(function ($type) { - if ($type instanceof \ReflectionUnionType) { + if ($type === null) { + $types = collect([]); + } elseif ($type instanceof \ReflectionUnionType) { $types = collect($type->getTypes()) /** @var ReflectionType $reflectionType */ ->map(function ($reflectionType) { @@ -1217,7 +1226,7 @@ class ModelsCommand extends Command $types = collect($this->extractReflectionTypes($type)); } - if ($type->allowsNull()) { + if ($type && $type->allowsNull()) { $types->push('null'); } @@ -1467,8 +1476,7 @@ class ModelsCommand extends Command { $reflection = $model instanceof ReflectionClass ? $model - : new ReflectionObject($model) - ; + : new ReflectionObject($model); $className = trim($className, '\\'); $writingToExternalFile = !$this->write || $this->write_mixin; diff --git a/tests/Console/ModelsCommand/Attributes/Models/Simple.php b/tests/Console/ModelsCommand/Attributes/Models/Simple.php index d2b8609..56d1c7f 100644 --- a/tests/Console/ModelsCommand/Attributes/Models/Simple.php +++ b/tests/Console/ModelsCommand/Attributes/Models/Simple.php @@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model; class Simple extends Model { + // With a backed property protected function name(): Attribute { return new Attribute( @@ -16,11 +17,84 @@ class Simple extends Model return $name; }, function (?string $name): ?string { - return $name === null ? null : ucfirst($name); + return $name; } ); } + // Without backed properties + + protected function typeHintedGetAndSet(): Attribute + { + return new Attribute( + function (): ?string { + return $this->name; + }, + function (?string $name) { + $this->name = $name; + } + ); + } + + protected function divergingTypeHintedGetAndSet(): Attribute + { + return new Attribute( + function (): int { + return strlen($this->name); + }, + function (?string $name) { + $this->name = $name; + } + ); + } + + protected function typeHintedGet(): Attribute + { + return Attribute::get(function (): ?string { + return $this->name; + }); + } + + protected function typeHintedSet(): Attribute + { + return Attribute::set(function (?string $name) { + $this->name = $name; + }); + } + + protected function nonTypeHintedGetAndSet(): Attribute + { + return new Attribute( + function () { + return $this->name; + }, + function ($name) { + $this->name = $name; + } + ); + } + + protected function nonTypeHintedGet(): Attribute + { + return Attribute::get(function () { + return $this->name; + }); + } + + protected function nonTypeHintedSet(): Attribute + { + return Attribute::set(function ($name) { + $this->name = $name; + }); + } + + protected function parameterlessSet(): Attribute + { + return Attribute::set(function () { + $this->name = null; + }); + } + /** * ide-helper does not recognize this method being an Attribute * because the method has no actual return type; diff --git a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php index ef96b27..8cb8961 100644 --- a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php @@ -11,7 +11,15 @@ use Illuminate\Database\Eloquent\Model; * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Attributes\Models\Simple * * @property integer $id + * @property int $diverging_type_hinted_get_and_set * @property string|null $name + * @property-read mixed $non_type_hinted_get + * @property mixed $non_type_hinted_get_and_set + * @property-write mixed $non_type_hinted_set + * @property-write mixed $parameterless_set + * @property-read string|null $type_hinted_get + * @property string|null $type_hinted_get_and_set + * @property-write string|null $type_hinted_set * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() @@ -20,6 +28,7 @@ use Illuminate\Database\Eloquent\Model; */ class Simple extends Model { + // With a backed property protected function name(): Attribute { return new Attribute( @@ -27,11 +36,84 @@ class Simple extends Model return $name; }, function (?string $name): ?string { - return $name === null ? null : ucfirst($name); + return $name; } ); } + // Without backed properties + + protected function typeHintedGetAndSet(): Attribute + { + return new Attribute( + function (): ?string { + return $this->name; + }, + function (?string $name) { + $this->name = $name; + } + ); + } + + protected function divergingTypeHintedGetAndSet(): Attribute + { + return new Attribute( + function (): int { + return strlen($this->name); + }, + function (?string $name) { + $this->name = $name; + } + ); + } + + protected function typeHintedGet(): Attribute + { + return Attribute::get(function (): ?string { + return $this->name; + }); + } + + protected function typeHintedSet(): Attribute + { + return Attribute::set(function (?string $name) { + $this->name = $name; + }); + } + + protected function nonTypeHintedGetAndSet(): Attribute + { + return new Attribute( + function () { + return $this->name; + }, + function ($name) { + $this->name = $name; + } + ); + } + + protected function nonTypeHintedGet(): Attribute + { + return Attribute::get(function () { + return $this->name; + }); + } + + protected function nonTypeHintedSet(): Attribute + { + return Attribute::set(function ($name) { + $this->name = $name; + }); + } + + protected function parameterlessSet(): Attribute + { + return Attribute::set(function () { + $this->name = null; + }); + } + /** * ide-helper does not recognize this method being an Attribute * because the method has no actual return type; From 9343d3a1cca992b13e7df98854a602fe4af4178d Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 8 Feb 2024 09:41:24 +0100 Subject: [PATCH 31/57] CS --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 98991cd..a503022 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -620,7 +620,7 @@ class ModelsCommand extends Command // methods that resemble mutators but aren't. $reflections = array_filter($reflections, function (\ReflectionMethod $methodReflection) { return !$methodReflection->isPrivate() && !( - $methodReflection->getDeclaringClass()->getName() === \Illuminate\Database\Eloquent\Model::class && ( + $methodReflection->getDeclaringClass()->getName() === Model::class && ( $methodReflection->getName() === 'setClassCastableAttribute' || $methodReflection->getName() === 'setEnumCastableAttribute' ) From cee441c87ca32a3f169a79c8517e670ee41216f2 Mon Sep 17 00:00:00 2001 From: Menthol Date: Thu, 8 Feb 2024 09:48:26 +0100 Subject: [PATCH 32/57] Fix #1300 relation_return_type must take precedence if it is defined (#1394) --- src/Console/ModelsCommand.php | 16 ++++-- .../ModelsCommand/Relations/Models/Simple.php | 5 ++ .../Console/ModelsCommand/Relations/Test.php | 3 ++ .../Relations/Traits/HasTestRelations.php | 7 +++ .../SampleToBadlyNamedNotManyRelationType.php | 52 +++++++++++++++++++ .../Relations/__snapshots__/Test__test__1.php | 6 +++ 6 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 tests/Console/ModelsCommand/Relations/Types/SampleToBadlyNamedNotManyRelationType.php diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index a503022..8f6242c 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -753,9 +753,14 @@ class ModelsCommand extends Command get_class($relationObj->getRelated()) ); + $relationReturnType = $this->getRelationReturnTypes()[$relation] ?? false; + if ( - strpos(get_class($relationObj), 'Many') !== false || - ($this->getRelationReturnTypes()[$relation] ?? '') === 'many' + $relationReturnType === 'many' || + ( + !$relationReturnType && + strpos(get_class($relationObj), 'Many') !== false + ) ) { //Collection or array of models (because Collection is Arrayable) $relatedClass = '\\' . get_class($relationObj->getRelated()); @@ -782,8 +787,11 @@ class ModelsCommand extends Command ); } } elseif ( - $relation === 'morphTo' || - ($this->getRelationReturnTypes()[$relation] ?? '') === 'morphTo' + $relationReturnType === 'morphTo' || + ( + !$relationReturnType && + $relation === 'morphTo' + ) ) { // Model isn't specified because relation is polymorphic $this->setProperty( diff --git a/tests/Console/ModelsCommand/Relations/Models/Simple.php b/tests/Console/ModelsCommand/Relations/Models/Simple.php index 12e8c87..bb8387c 100644 --- a/tests/Console/ModelsCommand/Relations/Models/Simple.php +++ b/tests/Console/ModelsCommand/Relations/Models/Simple.php @@ -107,4 +107,9 @@ class Simple extends Model { return $this->testToAnyMorphedRelation(Simple::class); } + + public function relationSampleToBadlyNamedNotManyRelation() + { + return $this->testToBadlyNamedNotManyRelation(Simple::class); + } } diff --git a/tests/Console/ModelsCommand/Relations/Test.php b/tests/Console/ModelsCommand/Relations/Test.php index 3995747..3c5e41c 100644 --- a/tests/Console/ModelsCommand/Relations/Test.php +++ b/tests/Console/ModelsCommand/Relations/Test.php @@ -8,6 +8,7 @@ use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyMorphedRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyRelationType; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToBadlyNamedNotManyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType; use Illuminate\Support\Facades\Config; @@ -23,11 +24,13 @@ class Test extends AbstractModelsCommand 'testToManyRelation' => SampleToManyRelationType::class, 'testToAnyRelation' => SampleToAnyRelationType::class, 'testToAnyMorphedRelation' => SampleToAnyMorphedRelationType::class, + 'testToBadlyNamedNotManyRelation' => SampleToBadlyNamedNotManyRelationType::class, ]); Config::set('ide-helper.additional_relation_return_types', [ 'testToAnyRelation' => 'many', 'testToAnyMorphedRelation' => 'morphTo', + 'testToBadlyNamedNotManyRelation' => 'one', ]); } diff --git a/tests/Console/ModelsCommand/Relations/Traits/HasTestRelations.php b/tests/Console/ModelsCommand/Relations/Traits/HasTestRelations.php index 0d25260..d63b904 100644 --- a/tests/Console/ModelsCommand/Relations/Traits/HasTestRelations.php +++ b/tests/Console/ModelsCommand/Relations/Traits/HasTestRelations.php @@ -6,6 +6,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Traits use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyMorphedRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyRelationType; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToBadlyNamedNotManyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType; @@ -34,4 +35,10 @@ trait HasTestRelations $instance = $this->newRelatedInstance($related); return new SampleToAnyMorphedRelationType($instance->newQuery(), $this); } + + public function testToBadlyNamedNotManyRelation($related) + { + $instance = $this->newRelatedInstance($related); + return new SampleToBadlyNamedNotManyRelationType($instance->newQuery(), $this); + } } diff --git a/tests/Console/ModelsCommand/Relations/Types/SampleToBadlyNamedNotManyRelationType.php b/tests/Console/ModelsCommand/Relations/Types/SampleToBadlyNamedNotManyRelationType.php new file mode 100644 index 0000000..a8a753a --- /dev/null +++ b/tests/Console/ModelsCommand/Relations/Types/SampleToBadlyNamedNotManyRelationType.php @@ -0,0 +1,52 @@ + $relationSampleToAnyRelationType * @property-read int|null $relation_sample_to_any_relation_type_count + * @property-read Simple $relationSampleToBadlyNamedNotManyRelation * @property-read Simple $relationSampleToManyRelationType * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() @@ -257,4 +258,9 @@ class Simple extends Model { return $this->testToAnyMorphedRelation(Simple::class); } + + public function relationSampleToBadlyNamedNotManyRelation() + { + return $this->testToBadlyNamedNotManyRelation(Simple::class); + } } From 341c0ab89f49fa87cc14b4db650ce95d7454de60 Mon Sep 17 00:00:00 2001 From: Pieter Willekens Date: Thu, 8 Feb 2024 10:59:02 +0100 Subject: [PATCH 33/57] feat: add support for AsCollection and AsArrayObject casts (#1393) * feat: add support for AsCollection and AsArrayObject casts * update changelog * improve tests * remove change * composer fix-style * snapshot --------- Co-authored-by: Barry vd. Heuvel Co-authored-by: laravel-ide-helper --- CHANGELOG.md | 1 + src/Console/ModelsCommand.php | 6 ++ .../AdvancedCasts/Models/AdvancedCast.php | 29 +++++++++ .../ModelsCommand/AdvancedCasts/Test.php | 31 +++++++++ .../__snapshots__/Test__test__1.php | 65 +++++++++++++++++++ .../migrations/____advanced_casts_table.php | 30 +++++++++ 6 files changed, 162 insertions(+) create mode 100644 tests/Console/ModelsCommand/AdvancedCasts/Models/AdvancedCast.php create mode 100644 tests/Console/ModelsCommand/AdvancedCasts/Test.php create mode 100644 tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php create mode 100644 tests/Console/ModelsCommand/migrations/____advanced_casts_table.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ca3bb91..d2a2e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. - Add support for real-time facades in the helper file. [#1455 / filipac](https://github.com/barryvdh/laravel-ide-helper/pull/1455) - Add support for relations with composite keys. [#1479 / calebdw](https://github.com/barryvdh/laravel-ide-helper/pull/1479) - Add support for attribute accessors with no backing field or type hinting [#1411 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1411). +- Add support for AsCollection and AsArrayObject casts [#1393 / pataar](https://github.com/barryvdh/laravel-ide-helper/pull/1393) 2024-02-05, 2.14.0 ------------------ diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 8f6242c..e99848b 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -23,6 +23,8 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes; +use Illuminate\Database\Eloquent\Casts\AsArrayObject; +use Illuminate\Database\Eloquent\Casts\AsCollection; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Model; @@ -419,9 +421,13 @@ class ModelsCommand extends Command case 'immutable_datetime': $realType = '\Carbon\CarbonImmutable'; break; + case AsCollection::class: case 'collection': $realType = '\Illuminate\Support\Collection'; break; + case AsArrayObject::class: + $realType = '\ArrayObject'; + break; default: // In case of an optional custom cast parameter , only evaluate // the `$type` until the `:` diff --git a/tests/Console/ModelsCommand/AdvancedCasts/Models/AdvancedCast.php b/tests/Console/ModelsCommand/AdvancedCasts/Models/AdvancedCast.php new file mode 100644 index 0000000..4613056 --- /dev/null +++ b/tests/Console/ModelsCommand/AdvancedCasts/Models/AdvancedCast.php @@ -0,0 +1,29 @@ + 'date:Y-m-d', + 'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s', + 'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s', + 'cast_to_immutable_date' => 'immutable_date', + 'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s', + 'cast_to_immutable_datetime' => 'immutable_datetime', + 'cast_to_timestamp' => 'timestamp', + 'cast_to_encrypted' => 'encrypted', + 'cast_to_encrypted_array' => 'encrypted:array', + 'cast_to_encrypted_collection' => 'encrypted:collection', + 'cast_to_encrypted_json' => 'encrypted:json', + 'cast_to_encrypted_object' => 'encrypted:object', + 'cast_to_as_collection' => AsCollection::class, + 'cast_to_as_array_object' => AsArrayObject::class, + ]; +} diff --git a/tests/Console/ModelsCommand/AdvancedCasts/Test.php b/tests/Console/ModelsCommand/AdvancedCasts/Test.php new file mode 100644 index 0000000..7856703 --- /dev/null +++ b/tests/Console/ModelsCommand/AdvancedCasts/Test.php @@ -0,0 +1,31 @@ +=')) { + $this->markTestSkipped( + 'This test only works in Laravel >= 8.28' + ); + } + + $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(); + } +} diff --git a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..12a9f0d --- /dev/null +++ b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php @@ -0,0 +1,65 @@ + 'date:Y-m-d', + 'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s', + 'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s', + 'cast_to_immutable_date' => 'immutable_date', + 'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s', + 'cast_to_immutable_datetime' => 'immutable_datetime', + 'cast_to_timestamp' => 'timestamp', + 'cast_to_encrypted' => 'encrypted', + 'cast_to_encrypted_array' => 'encrypted:array', + 'cast_to_encrypted_collection' => 'encrypted:collection', + 'cast_to_encrypted_json' => 'encrypted:json', + 'cast_to_encrypted_object' => 'encrypted:object', + 'cast_to_as_collection' => AsCollection::class, + 'cast_to_as_array_object' => AsArrayObject::class, + ]; +} diff --git a/tests/Console/ModelsCommand/migrations/____advanced_casts_table.php b/tests/Console/ModelsCommand/migrations/____advanced_casts_table.php new file mode 100644 index 0000000..3c6a392 --- /dev/null +++ b/tests/Console/ModelsCommand/migrations/____advanced_casts_table.php @@ -0,0 +1,30 @@ +string('cast_to_date_serialization'); + $table->string('cast_to_datetime_serialization'); + $table->string('cast_to_custom_datetime'); + $table->string('cast_to_immutable_date'); + $table->string('cast_to_immutable_custom_datetime'); + $table->string('cast_to_immutable_datetime'); + $table->string('cast_to_timestamp'); + $table->string('cast_to_encrypted'); + $table->string('cast_to_encrypted_array'); + $table->string('cast_to_encrypted_collection'); + $table->string('cast_to_encrypted_json'); + $table->string('cast_to_encrypted_object'); + $table->string('cast_to_as_collection'); + $table->string('cast_to_as_array_object'); + }); + } +} From bc158a1b86147d351f948041071a6b688c8f51f8 Mon Sep 17 00:00:00 2001 From: GeoSot Date: Thu, 8 Feb 2024 12:09:30 +0200 Subject: [PATCH 34/57] Add `AllowDynamicProperties` Attribute to cooperate with php8.2 deprecation (#1428) * Add `AllowDynamicProperties` Attribute to cooperate with php8.2 deprecation * lint snapshot --- src/Console/ModelsCommand.php | 6 ++++-- .../GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index e99848b..343440e 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1081,9 +1081,11 @@ class ModelsCommand extends Command } $classname = $this->write_mixin ? $mixinClassName : $classname; - $output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}class {$classname} "; - if (!$this->write_mixin) { + $allowDynamicAttributes = $this->write_mixin ? "#[\AllowDynamicProperties]\n\t" : ''; + $output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}{$allowDynamicAttributes}class {$classname} "; + + if (! $this->write_mixin) { $output .= "extends \Eloquent "; if ($interfaceNames) { diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 71dab45..c290996 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -184,6 +184,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value) * @mixin \Eloquent */ + #[\AllowDynamicProperties] class IdeHelperPost {} } From c119e89cf044fd56a98cc92ac0bfc3c8d148b9ea Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 8 Feb 2024 11:11:51 +0100 Subject: [PATCH 35/57] CS --- src/Console/ModelsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 343440e..a31cce5 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1085,7 +1085,7 @@ class ModelsCommand extends Command $allowDynamicAttributes = $this->write_mixin ? "#[\AllowDynamicProperties]\n\t" : ''; $output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}{$allowDynamicAttributes}class {$classname} "; - if (! $this->write_mixin) { + if (!$this->write_mixin) { $output .= "extends \Eloquent "; if ($interfaceNames) { From dca3ebe81ea385632651791cb8b3db42153c380c Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 14 Feb 2024 12:19:26 +0100 Subject: [PATCH 36/57] Prepare 2.15 release (#1514) * Prepare 2.15 release * Prepare 2.15 release * Add missing CHANGELOG.md entries --------- Co-authored-by: Markus Podar --- CHANGELOG.md | 23 +++++++++++++++++++++-- composer.json | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a2e54..7ca111e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,29 @@ All notable changes to this project will be documented in this file. -[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.14.0...master) +[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.15.0...master) -------------- ### Fixed -- Fix case issue in `ModelsCommand::unsetMethod()` [#1453 / leo108](https://github.com/barryvdh/laravel-ide-helper/pull/1453) ### 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) +- Skip swoole, otherwise fatal error [#1477 / TimoFrenzel](https://github.com/barryvdh/laravel-ide-helper/pull/1477) +- Fix vulnerability CVE-2021-43608 [#1392 / allanlaal](https://github.com/barryvdh/laravel-ide-helper/pull/1392) +- Reset foreignKeyConstraintsColumns on model loop start [#1461 / snmatsui](https://github.com/barryvdh/laravel-ide-helper/pull/1461) +- Accept scope & scopes as relation [#1452 / Muetze42](https://github.com/barryvdh/laravel-ide-helper/pull/1452) +- Fix #1300 relation_return_type must take precedence if it is defined [#1394 / menthol](https://github.com/barryvdh/laravel-ide-helper/pull/1394) + +### Changed +- Disable inspections of helper files [#1486 / eidng8](https://github.com/barryvdh/laravel-ide-helper/pull/1486) - Removed support for Laravel 8 and therefore for PHP < 8.0 [#1504 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1504) ### Added @@ -17,6 +33,9 @@ All notable changes to this project will be documented in this file. - Add support for relations with composite keys. [#1479 / calebdw](https://github.com/barryvdh/laravel-ide-helper/pull/1479) - Add support for attribute accessors with no backing field or type hinting [#1411 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1411). - Add support for AsCollection and AsArrayObject casts [#1393 / pataar](https://github.com/barryvdh/laravel-ide-helper/pull/1393) +- Reintroduce support for multi-db setups [#1426 / benpoulson](https://github.com/barryvdh/laravel-ide-helper/pull/1426) +- Support the BINARY(...) database field type [#1434 / Sfonxs](https://github.com/barryvdh/laravel-ide-helper/pull/1434) +- Add AllowDynamicProperties Attribute to cooperate with php8.2 deprecation [#1428 / GeoSot](https://github.com/barryvdh/laravel-ide-helper/pull/1428) 2024-02-05, 2.14.0 ------------------ diff --git a/composer.json b/composer.json index 18e3902..08c1ef5 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.14-dev" + "dev-master": "2.15-dev" }, "laravel": { "providers": [ From b47a11830066b9cbad2141f788f46a5a0da36883 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Wed, 14 Feb 2024 14:49:24 +0100 Subject: [PATCH 37/57] Adjust gitattribute (#1515) and make up for the missing php-cs-fixer changes The rest of the changes is just: - sorted alphabetically - align the `export-ignore` column --- .gitattributes | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitattributes b/.gitattributes index 84b8468..ccc4e1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,14 +2,14 @@ # https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html # Ignore all test and documentation with "export-ignore". -/.gitattributes export-ignore -/.github export-ignore -/.gitignore export-ignore -/.editorconfig export-ignore -/phpunit.xml.dist export-ignore -/tests export-ignore -/.php_cs.common.php export-ignore -/.php_cs.dist export-ignore -/.php_cs.tests.php export-ignore -/psalm.xml export-ignore -/psalm-baseline.xml export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.github export-ignore +/.gitignore 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 +/tests export-ignore From 77831852bb7bc54f287246d32eb91274eaf87f8b Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 15 Feb 2024 15:23:20 +0100 Subject: [PATCH 38/57] 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 @@ + Date: Fri, 16 Feb 2024 21:38:43 +0100 Subject: [PATCH 39/57] [TEST] Show that custom phpdoc tags without space afterwards are unexpectedly changed (#981) * tests: show that custom phpdoc tags without space afterwards are unexpectedly changed This adds a test for the (current bug) behaviour of https://github.com/barryvdh/laravel-ide-helper/issues/666 If this ever gets fixed, this fails and needs to be adapted, ensuring it won't break again. * test: adapt now that #666 has been fixed --- .../CustomPhpdocTags/Models/Simple.php | 19 ++++++++++++ .../ModelsCommand/CustomPhpdocTags/Test.php | 30 +++++++++++++++++++ ...st__testNoSpaceAfterCustomPhpdocTag__1.php | 24 +++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 tests/Console/ModelsCommand/CustomPhpdocTags/Models/Simple.php create mode 100644 tests/Console/ModelsCommand/CustomPhpdocTags/Test.php create mode 100644 tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php diff --git a/tests/Console/ModelsCommand/CustomPhpdocTags/Models/Simple.php b/tests/Console/ModelsCommand/CustomPhpdocTags/Models/Simple.php new file mode 100644 index 0000000..368ad1c --- /dev/null +++ b/tests/Console/ModelsCommand/CustomPhpdocTags/Models/Simple.php @@ -0,0 +1,19 @@ +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(); + } +} diff --git a/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php b/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php new file mode 100644 index 0000000..6f883e1 --- /dev/null +++ b/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php @@ -0,0 +1,24 @@ + Date: Sat, 17 Feb 2024 11:11:50 +0100 Subject: [PATCH 40/57] Switch to 3.0 tag (#1519) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 08c1ef5..174dc3d 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.15-dev" + "dev-master": "3.0-dev" }, "laravel": { "providers": [ From 6579c0332b15970be66e86d4fe4950d59af59ee6 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sat, 17 Feb 2024 11:12:12 +0100 Subject: [PATCH 41/57] Remove doctrine (#1512) * Remove doctrine * Fix tests * normalize composer.json * Add back platform * Bump integration versions * composer fix-style * Fix stability * Bump minimum to 10.36 * Bump minimum to 10.38 * More types * Fast fail off * Bump docblock * composer fix-style * add bpchar * Use match for type detection Co-authored-by: Hafez Divandari * Use driverName Co-authored-by: Hafez Divandari * fix match * TWeak types * Update snapshots * Remove testbench 7 * composer fix-style * Update src/Console/ModelsCommand.php Co-authored-by: Hafez Divandari * Update src/Console/ModelsCommand.php Co-authored-by: Hafez Divandari * Tweak bool * Update src/Console/ModelsCommand.php Co-authored-by: Hafez Divandari * composer fix-style * Remove custom types, default to string --------- Co-authored-by: barryvdh Co-authored-by: laravel-ide-helper Co-authored-by: Hafez Divandari --- .github/workflows/fix-code-style.yml | 2 +- .github/workflows/run-integration-tests.yml | 10 +- .github/workflows/run-static-analysis.yml | 4 +- .github/workflows/run-tests.yml | 15 +-- README.md | 20 ---- composer.json | 12 +- config/ide-helper.php | 30 ----- src/Console/ModelsCommand.php | 112 +++++------------- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- .../__snapshots__/Test__test__1.php | 4 +- 22 files changed, 74 insertions(+), 187 deletions(-) diff --git a/.github/workflows/fix-code-style.yml b/.github/workflows/fix-code-style.yml index 8019a32..80e7639 100644 --- a/.github/workflows/fix-code-style.yml +++ b/.github/workflows/fix-code-style.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.3 coverage: none - name: Install dependencies diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 6edd281..7737e94 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -19,13 +19,9 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3, 8.2, 8.1, 8.0] - laravel: [10.*, 9.*] - exclude: - - php: 8.0 - laravel: 10.* - - php: 8.3 - laravel: 9.* + php: [8.3, 8.2, 8.1] + laravel: [10.*] + name: P${{ matrix.php }} - Laravel${{ matrix.laravel }} steps: - name: Checkout code diff --git a/.github/workflows/run-static-analysis.yml b/.github/workflows/run-static-analysis.yml index c8c29bb..e31f00c 100644 --- a/.github/workflows/run-static-analysis.yml +++ b/.github/workflows/run-static-analysis.yml @@ -13,11 +13,11 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none extensions: pdo_sqlite diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b94dc0d..f30727b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,16 +18,13 @@ jobs: COMPOSER_NO_INTERACTION: 1 strategy: + fail-fast: false matrix: os: [ubuntu-20.04, windows-2019] - php: [8.3, 8.2, 8.1, 8.0] - laravel: [9.*, 10.*] - dependency-version: [prefer-lowest, prefer-stable] - exclude: - - php: 8.0 - laravel: 10.* - - php: 8.0 - dependency-version: prefer-lowest + php: [8.3, 8.2, 8.1] + laravel: [10.*] + stability: [prefer-lowest, prefer-stable] + steps: - name: Set git to use LF if: ${{ matrix.os == 'windows-2019' }} @@ -50,7 +47,7 @@ jobs: composer remove vimeo/psalm --no-update --dev composer remove friendsofphp/php-cs-fixer --no-update --dev composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress - composer update --prefer-dist --no-progress + composer update --prefer-dist --no-progress --${{ matrix.stability }} - name: Execute Unit Tests run: composer test-ci diff --git a/README.md b/README.md index b0bc074..a180c55 100644 --- a/README.md +++ b/README.md @@ -271,26 +271,6 @@ add support for creating a new dedicated class instead of using local scopes in If for some reason it's undesired to have them generated (one for each column), you can disable this via config `write_model_external_builder_methods` and setting it to `false`. -#### Unsupported or custom database types - -Common column types (e.g. varchar, integer) are correctly mapped to PHP types (`string`, `int`). - -But sometimes you may want to use custom column types in your database like `geography`, `jsonb`, `citext`, `bit`, etc. which may throw an "Unknown database type"-Exception. - -For those special cases, you can map them via the config `custom_db_types`. Example: -```php -'custom_db_types' => [ - 'mysql' => [ - 'geography' => 'array', - 'point' => 'array', - ], - 'postgresql' => [ - 'jsonb' => 'string', - '_int4' => 'array', - ], -], -``` - #### Custom Relationship Types If you are using relationships not built into Laravel you will need to specify the name and returning class in the config to get proper generation. diff --git a/composer.json b/composer.json index 174dc3d..363fbd7 100644 --- a/composer.json +++ b/composer.json @@ -22,12 +22,12 @@ "require": { "php": "^8.0", "ext-json": "*", - "barryvdh/reflection-docblock": "^2.0.6", + "barryvdh/reflection-docblock": "^2.1.1", "composer/class-map-generator": "^1.0", - "doctrine/dbal": "^2.6 || ^3.1.4", - "illuminate/console": "^9 || ^10", - "illuminate/filesystem": "^9 || ^10", - "illuminate/support": "^9 || ^10", + "illuminate/console": "^10", + "illuminate/database": "^10.38", + "illuminate/filesystem": "^10", + "illuminate/support": "^10", "nikic/php-parser": "^4.18 || ^5", "phpdocumentor/type-resolver": "^1.1.0" }, @@ -37,7 +37,7 @@ "illuminate/config": "^9 || ^10", "illuminate/view": "^9 || ^10", "mockery/mockery": "^1.4", - "orchestra/testbench": "^7 || ^8", + "orchestra/testbench": "^8", "phpunit/phpunit": "^9", "spatie/phpunit-snapshot-assertions": "^4", "vimeo/psalm": "^5.4" diff --git a/config/ide-helper.php b/config/ide-helper.php index cec91c6..e3bdc57 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -200,36 +200,6 @@ return [ ], - /* - |-------------------------------------------------------------------------- - | Support for custom DB types - |-------------------------------------------------------------------------- - | - | This setting allow you to map any custom database type (that you may have - | created using CREATE TYPE statement or imported using database plugin - | / extension to a Doctrine type. - | - | Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are: - | 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql' - | - | This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant - | - | The value of the array is an array of type mappings. Key is the name of the custom type, - | (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in - | our case it is 'json_array'. Doctrine types are listed here: - | https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#types - | - | So to support jsonb in your models when working with Postgres, just add the following entry to the array below: - | - | "postgresql" => array( - | "jsonb" => "json_array", - | ), - | - */ - 'custom_db_types' => [ - - ], - /* |-------------------------------------------------------------------------- | Support for camel cased models diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 299469d..4c69661 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -17,8 +17,6 @@ use Barryvdh\Reflection\DocBlock\Context; use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer; use Barryvdh\Reflection\DocBlock\Tag; use Composer\ClassMapGenerator\ClassMapGenerator; -use Doctrine\DBAL\Exception as DBALException; -use Doctrine\DBAL\Types\Type; use Illuminate\Console\Command; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; @@ -39,6 +37,7 @@ use Illuminate\Database\Eloquent\Relations\MorphOne; use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphToMany; use Illuminate\Database\Eloquent\Relations\Relation; +use Illuminate\Database\Schema\Builder; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Arr; use Illuminate\Support\Collection; @@ -244,8 +243,6 @@ class ModelsCommand extends Command */ \n\n"; - $hasDoctrine = interface_exists('Doctrine\DBAL\Driver'); - if (empty($loadModels)) { $models = $this->loadModels(); } else { @@ -288,9 +285,7 @@ class ModelsCommand extends Command $model = $this->laravel->make($name); - if ($hasDoctrine) { - $this->getPropertiesFromTable($model); - } + $this->getPropertiesFromTable($model); if (method_exists($model, 'getCasts')) { $this->castPropertiesType($model); @@ -314,13 +309,6 @@ class ModelsCommand extends Command } } - if (!$hasDoctrine) { - $this->error( - 'Warning: `"doctrine/dbal": "~2.3"` is required to load database information. ' . - 'Please require that in your composer.json and run `composer update`.' - ); - } - return $output; } @@ -508,35 +496,14 @@ class ModelsCommand extends Command * * @param Model $model * - * @throws DBALException If custom field failed to register */ public function getPropertiesFromTable($model) { - $database = $model->getConnection()->getDatabaseName(); - $table = $model->getConnection()->getTablePrefix() . $model->getTable(); - $schema = $model->getConnection()->getDoctrineSchemaManager(); - $databasePlatform = $schema->getDatabasePlatform(); - $databasePlatform->registerDoctrineTypeMapping('enum', 'string'); + $table = $model->getTable(); + $schema = $model->getConnection()->getSchemaBuilder(); + $columns = $schema->getColumns($table); + $driverName = $model->getConnection()->getDriverName(); - if (strpos($table, '.')) { - [$database, $table] = explode('.', $table); - } - - $platformName = $databasePlatform->getName(); - $customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", []); - foreach ($customTypes as $yourTypeName => $doctrineTypeName) { - try { - if (!Type::hasType($yourTypeName)) { - Type::addType($yourTypeName, get_class(Type::getType($doctrineTypeName))); - } - } catch (DBALException $exception) { - $this->error("Failed registering custom db type \"$yourTypeName\" as \"$doctrineTypeName\""); - throw $exception; - } - $databasePlatform->registerDoctrineTypeMapping($yourTypeName, $doctrineTypeName); - } - - $columns = $schema->listTableColumns($table, $database); if (!$columns) { return; @@ -544,50 +511,28 @@ class ModelsCommand extends Command $this->setForeignKeys($schema, $table); foreach ($columns as $column) { - $name = $column->getName(); + $name = $column['name']; if (in_array($name, $model->getDates())) { $type = $this->dateClass; } else { - $type = $column->getType()->getName(); - switch ($type) { - case 'string': - case 'text': - case 'date': - case 'time': - case 'guid': - case 'datetimetz': - case 'datetime': - case 'decimal': - case 'binary': - $type = 'string'; - break; - case 'integer': - case 'bigint': - case 'smallint': - $type = 'integer'; - break; - case 'boolean': - switch ($platformName) { - case 'sqlite': - case 'mysql': - $type = 'integer'; - break; - default: - $type = 'boolean'; - break; - } - break; - case 'float': - $type = 'float'; - break; - default: - $type = 'mixed'; - break; - } + // Match types to php equivalent + $type = match ($column['type_name']) { + 'tinyint', 'bit', + 'integer', 'int', 'int4', + 'smallint', 'int2', + 'mediumint', + 'bigint', 'int8' => 'integer', + + 'boolean', 'bool' => 'boolean', + + 'float', 'real', 'float4', + 'double', 'float8' => 'float', + + default => 'string', + }; } - $comment = $column->getComment(); - if (!$column->getNotnull()) { + if ($column['nullable']) { $this->nullableColumns[$name] = true; } $this->setProperty( @@ -595,8 +540,8 @@ class ModelsCommand extends Command $this->getTypeInModel($model, $type), true, true, - $comment, - !$column->getNotnull() + $column['comment'], + $column['nullable'] ); if ($this->write_model_magic_where) { $builderClass = $this->write_model_external_builder_methods @@ -1681,14 +1626,13 @@ class ModelsCommand extends Command } /** - * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema + * @param Builder $schema * @param string $table - * @throws DBALException */ protected function setForeignKeys($schema, $table) { - foreach ($schema->listTableForeignKeys($table) as $foreignKeyConstraint) { - foreach ($foreignKeyConstraint->getLocalColumns() as $columnName) { + foreach ($schema->getForeignKeys($table) as $foreignKeyConstraint) { + foreach ($foreignKeyConstraint['columns'] as $columnName) { $this->foreignKeyConstraintsColumns[] = $columnName; } } diff --git a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php index c34f0a8..40b222e 100644 --- a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php @@ -72,8 +72,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index 526e313..467baf1 100644 --- a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -78,8 +78,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php index b559881..154ce05 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -74,8 +74,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php index aec51c9..9b6b513 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php @@ -72,8 +72,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php index 8b83890..2889ce8 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php @@ -72,8 +72,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptzNotNullable * @property integer|null $yearNullable * @property integer $yearNotNullable - * @property mixed|null $binaryNullable - * @property mixed $binaryNotNullable + * @property string|null $binaryNullable + * @property string $binaryNotNullable * @property string|null $uuidNullable * @property string $uuidNotNullable * @property string|null $ipaddressNullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php index 1681ee5..36d2db5 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php @@ -72,8 +72,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index c788ecb..b9c0a71 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -78,8 +78,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php index c634636..1bb709c 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -73,8 +73,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php index 20b2628..2b8986a 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php @@ -74,8 +74,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php index 989fd8a..c661aad 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php @@ -80,8 +80,8 @@ use Illuminate\Support\Carbon; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php index afb323d..d65673a 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php @@ -78,8 +78,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 8784f85..5a55eca 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -127,8 +127,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php index 8c9a819..dc5b63a 100644 --- a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php @@ -72,8 +72,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable diff --git a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php index 5e2a131..bba3457 100644 --- a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php @@ -73,8 +73,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property string $timestamptz_not_nullable * @property integer|null $year_nullable * @property integer $year_not_nullable - * @property mixed|null $binary_nullable - * @property mixed $binary_not_nullable + * @property string|null $binary_nullable + * @property string $binary_not_nullable * @property string|null $uuid_nullable * @property string $uuid_not_nullable * @property string|null $ipaddress_nullable From 8bfe918f656e9a1a6d01b1a2085eeaad951c798f Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sat, 17 Feb 2024 11:27:21 +0100 Subject: [PATCH 42/57] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af1aa4..763da03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file. ### Fixed ### Changed +- Use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512) + With this functionality gone, a few changes have been made: +- support for custom datatypes has been dropped (config `custom_db_types`) unknown data types default to `string` now and to fix the type, add a proper cast in Eloquent +- You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise ### Added From 05259b695d18744adb307035d8303457d78aa8ba Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sat, 17 Feb 2024 11:32:56 +0100 Subject: [PATCH 43/57] Add support for Laravel 11 (#1520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update dependencies * Implement new methods for `Authenticatable` contract * Added Laravel 11 to CI test target * normalize composer.json * Remove obsolete migration method (column type) from test * Update snapshots * Add changelog entry * Update readme --------- Co-authored-by: 武田 憲太郎 Co-authored-by: barryvdh --- .github/workflows/run-integration-tests.yml | 5 ++++- .github/workflows/run-tests.yml | 7 +++++-- CHANGELOG.md | 1 + README.md | 2 +- composer.json | 20 +++++++++---------- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../__snapshots__/Test__test__1.php | 4 ---- .../ModelsCommand/Interfaces/Models/User.php | 5 +++++ .../__snapshots__/Test__test__1.php | 2 -- .../__snapshots__/Test__test__1.php | 4 ---- .../migrations/____posts_table.php | 3 --- 21 files changed, 26 insertions(+), 71 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 7737e94..a3a4eff 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -20,7 +20,10 @@ jobs: fail-fast: false matrix: php: [8.3, 8.2, 8.1] - laravel: [10.*] + laravel: [11.*, 10.*] + exclude: + - php: 8.1 + laravel: 11.* name: P${{ matrix.php }} - Laravel${{ matrix.laravel }} steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f30727b..43176ee 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,9 +22,12 @@ jobs: matrix: os: [ubuntu-20.04, windows-2019] php: [8.3, 8.2, 8.1] - laravel: [10.*] + laravel: [10.*, 11.*] stability: [prefer-lowest, prefer-stable] - + dependency-version: [prefer-lowest, prefer-stable] + exclude: + - php: 8.1 + laravel: 11.* steps: - name: Set git to use LF if: ${{ matrix.os == 'windows-2019' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 763da03..89c90a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise ### Added +- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) 2024-02-15, 2.15.1 ------------------ diff --git a/README.md b/README.md index a180c55..49964db 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package generates helper files that enable your IDE to provide accurate autocompletion. Generation is done based on the files in your project, so they are always up-to-date. -It supports Laravel 9+ and PHP 8.0+ +The 3.x branch supports Laravel 10 and 11. For older version, use the 2.x releases. - [Installation](#installation) - [Usage](#usage) diff --git a/composer.json b/composer.json index 363fbd7..a38b986 100644 --- a/composer.json +++ b/composer.json @@ -24,26 +24,26 @@ "ext-json": "*", "barryvdh/reflection-docblock": "^2.1.1", "composer/class-map-generator": "^1.0", - "illuminate/console": "^10", - "illuminate/database": "^10.38", - "illuminate/filesystem": "^10", - "illuminate/support": "^10", + "illuminate/console": "^10 || ^11", + "illuminate/database": "^10.38 || ^11", + "illuminate/filesystem": "^10 || ^11", + "illuminate/support": "^10 || ^11", "nikic/php-parser": "^4.18 || ^5", "phpdocumentor/type-resolver": "^1.1.0" }, "require-dev": { "ext-pdo_sqlite": "*", "friendsofphp/php-cs-fixer": "^3", - "illuminate/config": "^9 || ^10", - "illuminate/view": "^9 || ^10", + "illuminate/config": "^9 || ^10 || ^11", + "illuminate/view": "^9 || ^10 || ^11", "mockery/mockery": "^1.4", - "orchestra/testbench": "^8", - "phpunit/phpunit": "^9", - "spatie/phpunit-snapshot-assertions": "^4", + "orchestra/testbench": "^8 || ^9", + "phpunit/phpunit": "^9 || ^10.5", + "spatie/phpunit-snapshot-assertions": "^4 || ^5", "vimeo/psalm": "^5.4" }, "suggest": { - "illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10)." + "illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)." }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php index 40b222e..3b82094 100644 --- a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -143,8 +141,6 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index 467baf1..d0489f4 100644 --- a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -52,8 +52,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -149,8 +147,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php index 154ce05..170ec54 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -48,8 +48,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -146,8 +144,6 @@ use Illuminate\Database\Eloquent\Model; * @method static Builder|Post whereTinyIntegerNullable($value) * @method static Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static Builder|Post whereUnsignedDecimalNullable($value) * @method static Builder|Post whereUnsignedIntegerNotNullable($value) * @method static Builder|Post whereUnsignedIntegerNullable($value) * @method static Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php index 9b6b513..3fc88b6 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -143,8 +141,6 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php index 2889ce8..9663109 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $doubleNotNullable * @property string|null $decimalNullable * @property string $decimalNotNullable - * @property string|null $unsignedDecimalNullable - * @property string $unsignedDecimalNotNullable * @property integer|null $booleanNullable * @property integer $booleanNotNullable * @property string|null $enumNullable @@ -143,8 +141,6 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php index 36d2db5..1d56199 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -143,8 +141,6 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index b9c0a71..9bfd95f 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -52,8 +52,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -152,8 +150,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTinyIntegerNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNotNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php index 1bb709c..cf869f7 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -47,8 +47,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -147,8 +145,6 @@ use Illuminate\Database\Eloquent\Model; * @method static PostExternalQueryBuilder|Post whereTinyIntegerNullable($value) * @method static PostExternalQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value) * @method static PostExternalQueryBuilder|Post whereUnsignedBigIntegerNullable($value) - * @method static PostExternalQueryBuilder|Post whereUnsignedDecimalNotNullable($value) - * @method static PostExternalQueryBuilder|Post whereUnsignedDecimalNullable($value) * @method static PostExternalQueryBuilder|Post whereUnsignedIntegerNotNullable($value) * @method static PostExternalQueryBuilder|Post whereUnsignedIntegerNullable($value) * @method static PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php index 2b8986a..1900cab 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php @@ -48,8 +48,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -149,8 +147,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php index c661aad..db37939 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php @@ -54,8 +54,6 @@ use Illuminate\Support\Carbon; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -155,8 +153,6 @@ use Illuminate\Support\Carbon; * @method static EloquentBuilder|Post whereTinyIntegerNullable($value) * @method static EloquentBuilder|Post whereUnsignedBigIntegerNotNullable($value) * @method static EloquentBuilder|Post whereUnsignedBigIntegerNullable($value) - * @method static EloquentBuilder|Post whereUnsignedDecimalNotNullable($value) - * @method static EloquentBuilder|Post whereUnsignedDecimalNullable($value) * @method static EloquentBuilder|Post whereUnsignedIntegerNotNullable($value) * @method static EloquentBuilder|Post whereUnsignedIntegerNullable($value) * @method static EloquentBuilder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php index d65673a..8c8f4b9 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php @@ -52,8 +52,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -149,8 +147,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTinyIntegerNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedDecimalNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedIntegerNotNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedIntegerNullable($value) * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 5a55eca..f0bfe9c 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -101,8 +101,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -198,8 +196,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/Interfaces/Models/User.php b/tests/Console/ModelsCommand/Interfaces/Models/User.php index 726b248..59c3c2d 100644 --- a/tests/Console/ModelsCommand/Interfaces/Models/User.php +++ b/tests/Console/ModelsCommand/Interfaces/Models/User.php @@ -19,6 +19,11 @@ class User extends Model implements Authenticatable // TODO: Implement getAuthIdentifier() method. } + public function getAuthPasswordName() + { + // TODO: Implement getAuthPasswordName() method. + } + public function getAuthPassword() { // TODO: Implement getAuthPassword() method. diff --git a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php index dc5b63a..c3e2dcd 100644 --- a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Model; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable diff --git a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php index bba3457..7460981 100644 --- a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php @@ -47,8 +47,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property string|null $unsigned_decimal_nullable - * @property string $unsigned_decimal_not_nullable * @property integer|null $boolean_nullable * @property integer $boolean_not_nullable * @property string|null $enum_nullable @@ -145,8 +143,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value) - * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value) * @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value) diff --git a/tests/Console/ModelsCommand/migrations/____posts_table.php b/tests/Console/ModelsCommand/migrations/____posts_table.php index ee81f61..511479c 100644 --- a/tests/Console/ModelsCommand/migrations/____posts_table.php +++ b/tests/Console/ModelsCommand/migrations/____posts_table.php @@ -67,9 +67,6 @@ class PostsTable extends Migration $table->decimal('decimal_nullable')->nullable(); $table->decimal('decimal_not_nullable'); - $table->unsignedDecimal('unsigned_decimal_nullable')->nullable(); - $table->unsignedDecimal('unsigned_decimal_not_nullable'); - $table->boolean('boolean_nullable')->nullable(); $table->boolean('boolean_not_nullable'); From 9af62e243de64e0fddc782fb1d125ddfc24dfea9 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Sat, 17 Feb 2024 22:08:15 +0100 Subject: [PATCH 44/57] Bump minimum PHP version to 8.1 & misc maintenance (#1521) * Bump minimum PHP version to 8.1 Laravel 10 doesn't support 8.0 anyway * Remove phpunit 9 * gha: remove unused matrix dimension * gha: bump runner os * tests: remove outdated version checks --- .github/workflows/composer-normalize.yml | 2 +- .github/workflows/fix-code-style.yml | 2 +- .github/workflows/run-integration-tests.yml | 2 +- .github/workflows/run-static-analysis.yml | 2 +- .github/workflows/run-tests.yml | 3 +-- CHANGELOG.md | 14 ++++++++------ composer.json | 4 ++-- tests/Console/ModelsCommand/AdvancedCasts/Test.php | 7 ------- .../GenerateBasicPhpDocWithEnumDefaults/Test.php | 6 ------ 9 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/composer-normalize.yml b/.github/workflows/composer-normalize.yml index 9a2fc97..b7dba34 100644 --- a/.github/workflows/composer-normalize.yml +++ b/.github/workflows/composer-normalize.yml @@ -9,7 +9,7 @@ on: jobs: normalize: timeout-minutes: 15 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Git checkout uses: actions/checkout@v4 diff --git a/.github/workflows/fix-code-style.yml b/.github/workflows/fix-code-style.yml index 80e7639..da75524 100644 --- a/.github/workflows/fix-code-style.yml +++ b/.github/workflows/fix-code-style.yml @@ -7,7 +7,7 @@ jobs: fix-style: name: Fix Code Style timeout-minutes: 15 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: COMPOSER_NO_INTERACTION: 1 diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index a3a4eff..ed33366 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -12,7 +12,7 @@ on: jobs: php-laravel-integration-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 15 env: COMPOSER_NO_INTERACTION: 1 diff --git a/.github/workflows/run-static-analysis.yml b/.github/workflows/run-static-analysis.yml index e31f00c..2c9ea0d 100644 --- a/.github/workflows/run-static-analysis.yml +++ b/.github/workflows/run-static-analysis.yml @@ -9,7 +9,7 @@ on: jobs: build: timeout-minutes: 15 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 43176ee..9aa055f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -20,11 +20,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019] + os: [ubuntu-22.04, windows-2019] php: [8.3, 8.2, 8.1] laravel: [10.*, 11.*] stability: [prefer-lowest, prefer-stable] - dependency-version: [prefer-lowest, prefer-stable] exclude: - php: 8.1 laravel: 11.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c90a7..fe6fa3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,17 @@ All notable changes to this project will be documented in this file. ### Fixed -### Changed -- Use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512) - With this functionality gone, a few changes have been made: -- support for custom datatypes has been dropped (config `custom_db_types`) unknown data types default to `string` now and to fix the type, add a proper cast in Eloquent -- You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise - ### Added - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) +### Removed +- Support for Laravel 9 and use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512) + With this functionality gone, a few changes have been made: + - support for custom datatypes has been dropped (config `custom_db_types`) unknown data types default to `string` now and to fix the type, add a proper cast in Eloquent + - You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise + - Minimum PHP version, due to Laravel 10, is now PHP 8.1 + + 2024-02-15, 2.15.1 ------------------ diff --git a/composer.json b/composer.json index a38b986..3ff3f21 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "ext-json": "*", "barryvdh/reflection-docblock": "^2.1.1", "composer/class-map-generator": "^1.0", @@ -38,7 +38,7 @@ "illuminate/view": "^9 || ^10 || ^11", "mockery/mockery": "^1.4", "orchestra/testbench": "^8 || ^9", - "phpunit/phpunit": "^9 || ^10.5", + "phpunit/phpunit": "^10.5", "spatie/phpunit-snapshot-assertions": "^4 || ^5", "vimeo/psalm": "^5.4" }, diff --git a/tests/Console/ModelsCommand/AdvancedCasts/Test.php b/tests/Console/ModelsCommand/AdvancedCasts/Test.php index 7856703..7e46e26 100644 --- a/tests/Console/ModelsCommand/AdvancedCasts/Test.php +++ b/tests/Console/ModelsCommand/AdvancedCasts/Test.php @@ -6,18 +6,11 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts; use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; -use Illuminate\Foundation\Application; class Test extends AbstractModelsCommand { public function test(): void { - if (!version_compare(Application::VERSION, '8.28', '>=')) { - $this->markTestSkipped( - 'This test only works in Laravel >= 8.28' - ); - } - $command = $this->app->make(ModelsCommand::class); $tester = $this->runCommand($command, [ diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php index 0eb640d..bb3821e 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php @@ -11,12 +11,6 @@ class Test extends AbstractModelsCommand { public function test(): void { - if (!version_compare(PHP_VERSION, '8.1', '>=')) { - $this->markTestSkipped( - 'This test only works in PHP >= 8.1' - ); - } - $command = $this->app->make(ModelsCommand::class); $tester = $this->runCommand($command, [ From d7ed749f3e1bf3ca2c28c79e3247b550b04198aa Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 19 Feb 2024 12:39:07 +0100 Subject: [PATCH 45/57] Use int/bool instead of longer variant (#1524) * Use int/bool instead of longer variant * Add changelog * Update snapshots --- CHANGELOG.md | 3 ++ src/Console/ModelsCommand.php | 8 +-- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 2 +- .../Comment/__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- ...st__testNoSpaceAfterCustomPhpdocTag__1.php | 2 +- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../__snapshots__/Test__test__1.php | 2 +- .../Getter/__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../Test__testNoinspectionNotPresent__1.php | 2 +- .../Test__testNoinspectionPresent__1.php | 2 +- .../__snapshots__/Test__test__1.php | 50 +++++++++---------- .../Relations/__snapshots__/Test__test__1.php | 22 ++++---- .../__snapshots__/Test__testNoReset__1.php | 2 +- .../__snapshots__/Test__testReset__1.php | 2 +- .../__snapshots__/Test__testSmartReset__1.php | 2 +- .../__snapshots__/Test__test__1.php | 10 ++-- .../__snapshots__/Test__test__1.php | 2 +- .../Variadic/__snapshots__/Test__test__1.php | 2 +- 32 files changed, 387 insertions(+), 384 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6fa3e..4a304a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ All notable changes to this project will be documented in this file. ### Added - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) +### Changed +- Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524) + ### Removed - Support for Laravel 9 and use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512) With this functionality gone, a few changes have been made: diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 4c69661..65d150e 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -378,7 +378,7 @@ class ModelsCommand extends Command break; case 'boolean': case 'bool': - $realType = 'boolean'; + $realType = 'bool'; break; case 'decimal': case 'string': @@ -394,7 +394,7 @@ class ModelsCommand extends Command case 'int': case 'integer': case 'timestamp': - $realType = 'integer'; + $realType = 'int'; break; case 'real': case 'double': @@ -521,9 +521,9 @@ class ModelsCommand extends Command 'integer', 'int', 'int4', 'smallint', 'int2', 'mediumint', - 'bigint', 'int8' => 'integer', + 'bigint', 'int8' => 'int', - 'boolean', 'bool' => 'boolean', + 'boolean', 'bool' => 'bool', 'float', 'real', 'float4', 'double', 'float8' => 'float', diff --git a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php index 12a9f0d..281a3f9 100644 --- a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php @@ -17,7 +17,7 @@ use Illuminate\Database\Eloquent\Model; * @property \Carbon\CarbonImmutable $cast_to_immutable_date * @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime - * @property integer $cast_to_timestamp + * @property int $cast_to_timestamp * @property mixed $cast_to_encrypted * @property array $cast_to_encrypted_array * @property \Illuminate\Support\Collection $cast_to_encrypted_collection diff --git a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php index 3b82094..345fc7e 100644 --- a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory\Services\Post\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -20,34 +20,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -68,8 +68,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php index 8cb8961..fe7ead2 100644 --- a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Attributes\Models\Simple * - * @property integer $id + * @property int $id * @property int $diverging_type_hinted_get_and_set * @property string|null $name * @property-read mixed $non_type_hinted_get diff --git a/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php index c3c9686..0e6a6a8 100644 --- a/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Comment\Models\Simple * - * @property integer $id + * @property int $id * @property string $both_same_name I'm a getter * @property string $both_without_getter_comment * @property-read string $faker_comment diff --git a/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php index 0b10768..eb523f6 100644 --- a/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php @@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple * - * @property integer $id + * @property int $id * @property-read SimpleCollection $relationHasMany * @property-read int|null $relation_has_many_count * @method static SimpleCollection all($columns = ['*']) diff --git a/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php b/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php index 6f883e1..801f533 100644 --- a/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php +++ b/tests/Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; * * @link https://github.com/barryvdh/laravel-ide-helper/issues/666 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index d0489f4..b4e81d6 100644 --- a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -15,7 +15,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -26,34 +26,34 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -74,8 +74,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGenerateP * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php index 170ec54..780b24b 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -22,34 +22,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -70,8 +70,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php index 3fc88b6..0573323 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -20,34 +20,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -68,8 +68,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php index 9663109..55c3c2c 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post * - * @property integer $id + * @property int $id * @property string|null $charNullable * @property string $charNotNullable * @property string|null $stringNullable @@ -20,34 +20,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $mediumTextNotNullable * @property string|null $longTextNullable * @property string $longTextNotNullable - * @property integer|null $integerNullable - * @property integer $integerNotNullable - * @property integer|null $tinyIntegerNullable - * @property integer $tinyIntegerNotNullable - * @property integer|null $smallIntegerNullable - * @property integer $smallIntegerNotNullable - * @property integer|null $mediumIntegerNullable - * @property integer $mediumIntegerNotNullable - * @property integer|null $bigIntegerNullable - * @property integer $bigIntegerNotNullable - * @property integer|null $unsignedIntegerNullable - * @property integer $unsignedIntegerNotNullable - * @property integer|null $unsignedTinyIntegerNullable - * @property integer $unsignedTinyIntegerNotNullable - * @property integer|null $unsignedSmallIntegerNullable - * @property integer $unsignedSmallIntegerNotNullable - * @property integer|null $unsignedMediumIntegerNullable - * @property integer $unsignedMediumIntegerNotNullable - * @property integer|null $unsignedBigIntegerNullable - * @property integer $unsignedBigIntegerNotNullable + * @property int|null $integerNullable + * @property int $integerNotNullable + * @property int|null $tinyIntegerNullable + * @property int $tinyIntegerNotNullable + * @property int|null $smallIntegerNullable + * @property int $smallIntegerNotNullable + * @property int|null $mediumIntegerNullable + * @property int $mediumIntegerNotNullable + * @property int|null $bigIntegerNullable + * @property int $bigIntegerNotNullable + * @property int|null $unsignedIntegerNullable + * @property int $unsignedIntegerNotNullable + * @property int|null $unsignedTinyIntegerNullable + * @property int $unsignedTinyIntegerNotNullable + * @property int|null $unsignedSmallIntegerNullable + * @property int $unsignedSmallIntegerNotNullable + * @property int|null $unsignedMediumIntegerNullable + * @property int $unsignedMediumIntegerNotNullable + * @property int|null $unsignedBigIntegerNullable + * @property int $unsignedBigIntegerNotNullable * @property float|null $floatNullable * @property float $floatNotNullable * @property float|null $doubleNullable * @property float $doubleNotNullable * @property string|null $decimalNullable * @property string $decimalNotNullable - * @property integer|null $booleanNullable - * @property integer $booleanNotNullable + * @property int|null $booleanNullable + * @property int $booleanNotNullable * @property string|null $enumNullable * @property string $enumNotNullable * @property string|null $jsonNullable @@ -68,8 +68,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestampNotNullable * @property string|null $timestamptzNullable * @property string $timestamptzNotNullable - * @property integer|null $yearNullable - * @property integer $yearNotNullable + * @property int|null $yearNullable + * @property int $yearNotNullable * @property string|null $binaryNullable * @property string $binaryNotNullable * @property string|null $uuidNullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php index 1d56199..1f1dae0 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocFinal\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -20,34 +20,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -68,8 +68,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index 9bfd95f..f442521 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -15,7 +15,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -26,34 +26,34 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -74,8 +74,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php index cf869f7..46c4432 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -21,34 +21,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -69,8 +69,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php index 1900cab..2ec9641 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php @@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -22,34 +22,34 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -70,8 +70,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php index db37939..2bc3a94 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php @@ -17,7 +17,7 @@ use Illuminate\Support\Carbon; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property CastType $char_not_nullable * @property string|null $string_nullable @@ -28,34 +28,34 @@ use Illuminate\Support\Carbon; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -76,8 +76,8 @@ use Illuminate\Support\Carbon; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php index 8c8f4b9..ce70124 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php @@ -15,7 +15,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -26,34 +26,34 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -74,8 +74,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index f0bfe9c..7db2cf7 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -64,7 +64,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * * @property $someProp * @method someMethod(string $method) - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -75,34 +75,34 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -123,8 +123,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php index 99c20c0..9e802be 100644 --- a/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php @@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenericsSyntaxDisabled\Models\Simple * - * @property integer $id + * @property int $id * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularBelongsToMany * @property-read int|null $regular_belongs_to_many_count * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularHasMany diff --git a/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php index 94b0a3e..b33ff8f 100644 --- a/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple * - * @property integer $id + * @property int $id * @property-read int|null $attribute_return_type_int_or_null * @property-read array $attribute_returns_array * @property-read bool $attribute_returns_bool diff --git a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php index c3e2dcd..7df0890 100644 --- a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -20,34 +20,34 @@ use Illuminate\Database\Eloquent\Model; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -68,8 +68,8 @@ use Illuminate\Database\Eloquent\Model; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php index 25c0e3b..611b4d2 100644 --- a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php +++ b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple * - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php index 9cb1f27..18181e5 100644 --- a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php +++ b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple * - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php index 7460981..953fe15 100644 --- a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\RelationCountProperties\Models\Post * - * @property integer $id + * @property int $id * @property string|null $char_nullable * @property string $char_not_nullable * @property string|null $string_nullable @@ -21,34 +21,34 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property string $medium_text_not_nullable * @property string|null $long_text_nullable * @property string $long_text_not_nullable - * @property integer|null $integer_nullable - * @property integer $integer_not_nullable - * @property integer|null $tiny_integer_nullable - * @property integer $tiny_integer_not_nullable - * @property integer|null $small_integer_nullable - * @property integer $small_integer_not_nullable - * @property integer|null $medium_integer_nullable - * @property integer $medium_integer_not_nullable - * @property integer|null $big_integer_nullable - * @property integer $big_integer_not_nullable - * @property integer|null $unsigned_integer_nullable - * @property integer $unsigned_integer_not_nullable - * @property integer|null $unsigned_tiny_integer_nullable - * @property integer $unsigned_tiny_integer_not_nullable - * @property integer|null $unsigned_small_integer_nullable - * @property integer $unsigned_small_integer_not_nullable - * @property integer|null $unsigned_medium_integer_nullable - * @property integer $unsigned_medium_integer_not_nullable - * @property integer|null $unsigned_big_integer_nullable - * @property integer $unsigned_big_integer_not_nullable + * @property int|null $integer_nullable + * @property int $integer_not_nullable + * @property int|null $tiny_integer_nullable + * @property int $tiny_integer_not_nullable + * @property int|null $small_integer_nullable + * @property int $small_integer_not_nullable + * @property int|null $medium_integer_nullable + * @property int $medium_integer_not_nullable + * @property int|null $big_integer_nullable + * @property int $big_integer_not_nullable + * @property int|null $unsigned_integer_nullable + * @property int $unsigned_integer_not_nullable + * @property int|null $unsigned_tiny_integer_nullable + * @property int $unsigned_tiny_integer_not_nullable + * @property int|null $unsigned_small_integer_nullable + * @property int $unsigned_small_integer_not_nullable + * @property int|null $unsigned_medium_integer_nullable + * @property int $unsigned_medium_integer_not_nullable + * @property int|null $unsigned_big_integer_nullable + * @property int $unsigned_big_integer_not_nullable * @property float|null $float_nullable * @property float $float_not_nullable * @property float|null $double_nullable * @property float $double_not_nullable * @property string|null $decimal_nullable * @property string $decimal_not_nullable - * @property integer|null $boolean_nullable - * @property integer $boolean_not_nullable + * @property int|null $boolean_nullable + * @property int $boolean_not_nullable * @property string|null $enum_nullable * @property string $enum_not_nullable * @property string|null $json_nullable @@ -69,8 +69,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property string $timestamp_not_nullable * @property string|null $timestamptz_nullable * @property string $timestamptz_not_nullable - * @property integer|null $year_nullable - * @property integer $year_not_nullable + * @property int|null $year_nullable + * @property int $year_not_nullable * @property string|null $binary_nullable * @property string $binary_not_nullable * @property string|null $uuid_nullable diff --git a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php index dd6f642..1a405a1 100644 --- a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php @@ -10,11 +10,11 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\BelongsToVariation * - * @property integer $id - * @property integer $not_null_column_with_foreign_key_constraint - * @property integer $not_null_column_with_no_foreign_key_constraint - * @property integer|null $nullable_column_with_foreign_key_constraint - * @property integer|null $nullable_column_with_no_foreign_key_constraint + * @property int $id + * @property int $not_null_column_with_foreign_key_constraint + * @property int $not_null_column_with_no_foreign_key_constraint + * @property int|null $nullable_column_with_foreign_key_constraint + * @property int|null $nullable_column_with_no_foreign_key_constraint * @property-read BelongsToVariation $notNullColumnWithForeignKeyConstraint * @property-read BelongsToVariation|null $notNullColumnWithNoForeignKeyConstraint * @property-read BelongsToVariation|null $nullableColumnWithForeignKeyConstraint @@ -63,11 +63,11 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\CompositeBelongsToVariation * - * @property integer $id - * @property integer $not_null_column_with_foreign_key_constraint - * @property integer $not_null_column_with_no_foreign_key_constraint - * @property integer|null $nullable_column_with_foreign_key_constraint - * @property integer|null $nullable_column_with_no_foreign_key_constraint + * @property int $id + * @property int $not_null_column_with_foreign_key_constraint + * @property int $not_null_column_with_no_foreign_key_constraint + * @property int|null $nullable_column_with_foreign_key_constraint + * @property int|null $nullable_column_with_no_foreign_key_constraint * @property-read CompositeBelongsToVariation $bothNonNullableWithForeignKeyConstraint * @property-read CompositeBelongsToVariation|null $nonNullableMixedWithoutForeignKeyConstraint * @property-read CompositeBelongsToVariation|null $nullableMixedWithForeignKeyConstraint @@ -134,7 +134,7 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple * - * @property integer $id + * @property int $id * @property-read Simple|null $relationBelongsTo * @property-read AnotherModel|null $relationBelongsToInAnotherNamespace * @property-read \Illuminate\Database\Eloquent\Collection $relationBelongsToMany diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testNoReset__1.php b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testNoReset__1.php index 6e5b180..54df564 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testNoReset__1.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testNoReset__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model; * Text of existing phpdoc * * @property string $foo - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php index 08f1d06..c5d3538 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple * - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testSmartReset__1.php b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testSmartReset__1.php index 3ba9c2b..de69023 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testSmartReset__1.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testSmartReset__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; /** * Text of existing phpdoc * - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple query() diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index 91a4511..a90886c 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -9,15 +9,15 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SimpleCasts\Models\SimpleCast * - * @property integer $cast_to_int - * @property integer $cast_to_integer + * @property int $cast_to_int + * @property int $cast_to_integer * @property float $cast_to_real * @property float $cast_to_float * @property float $cast_to_double * @property string $cast_to_decimal * @property string $cast_to_string - * @property boolean $cast_to_bool - * @property boolean $cast_to_boolean + * @property bool $cast_to_bool + * @property bool $cast_to_boolean * @property object $cast_to_object * @property array $cast_to_array * @property array $cast_to_json @@ -32,7 +32,7 @@ use Illuminate\Database\Eloquent\Model; * @property \Carbon\CarbonImmutable $cast_to_immutable_custom_datetime * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime * @property \Carbon\CarbonImmutable $cast_to_immutable_datetime_serialization - * @property integer $cast_to_timestamp + * @property int $cast_to_timestamp * @property mixed $cast_to_encrypted * @property array $cast_to_encrypted_array * @property \Illuminate\Support\Collection $cast_to_encrypted_collection diff --git a/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php index 0409634..5003b9c 100644 --- a/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple * - * @property integer $id + * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple onlyTrashed() diff --git a/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php index dd1a3d3..5ee2346 100644 --- a/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model; /** * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Variadic\Models\Simple * - * @property integer $id + * @property int $id * @method static Builder|Simple newModelQuery() * @method static Builder|Simple newQuery() * @method static Builder|Simple query() From 02af2a278a9d3186e431022f46e10c87598eeec9 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 19 Feb 2024 12:59:22 +0100 Subject: [PATCH 46/57] Merge reset/smart reset, don't set class (#1523) * Merge reset/smart reset, don't set class * Add changelog --- CHANGELOG.md | 2 +- src/Console/ModelsCommand.php | 22 +++++-------------- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../Comment/__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__testFactory__1.php | 8 +++---- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 4 ++-- .../__snapshots__/Test__test__1.php | 2 +- .../Getter/__snapshots__/Test__test__1.php | 2 +- .../Ignored/__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../Console/ModelsCommand/ModelHooks/Test.php | 2 +- .../Test__testNoinspectionNotPresent__1.php | 2 +- .../Test__testNoinspectionPresent__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../Relations/__snapshots__/Test__test__1.php | 6 ++--- .../__snapshots__/Test__testReset__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../__snapshots__/Test__test__1.php | 2 +- .../Variadic/__snapshots__/Test__test__1.php | 2 +- 38 files changed, 49 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a304a3..229b2ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) ### Changed +- Merge --reset and --smart-reset, to always keep the text. Always skipp the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) - Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524) ### Removed @@ -20,7 +21,6 @@ All notable changes to this project will be documented in this file. - You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise - Minimum PHP version, due to Laravel 10, is now PHP 8.1 - 2024-02-15, 2.15.1 ------------------ diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 65d150e..b6082d1 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -105,7 +105,6 @@ class ModelsCommand extends Command protected $write_mixin = false; protected $dirs = []; protected $reset; - protected $keep_text; protected $phpstorm_noinspections; protected $write_model_external_builder_methods; /** @@ -151,11 +150,8 @@ class ModelsCommand extends Command ); $model = $this->argument('model'); $ignore = $this->option('ignore'); - $this->reset = $this->option('reset'); + $this->reset = $this->option('reset') || $this->option('smart-reset'); $this->phpstorm_noinspections = $this->option('phpstorm-noinspections'); - if ($this->option('smart-reset')) { - $this->keep_text = $this->reset = true; - } $this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true); $this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true); $this->write_model_relation_count_properties = @@ -218,8 +214,8 @@ class ModelsCommand extends Command "Write models to {$this->filename} and adds @mixin to each model, avoiding IDE duplicate declaration warnings", ], ['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'], - ['reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'], - ['smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], + ['reset', 'R', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], + ['smart-reset', 'r', InputOption::VALUE_NONE, 'Deprecated: same as --reset'], ['phpstorm-noinspections', 'p', InputOption::VALUE_NONE, 'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' . 'noinspection tags', @@ -889,19 +885,13 @@ class ModelsCommand extends Command if ($this->reset) { $phpdoc = new DocBlock('', new Context($namespace)); - if ($this->keep_text) { - $phpdoc->setText( - (new DocBlock($reflection, new Context($namespace)))->getText() - ); - } + $phpdoc->setText( + (new DocBlock($reflection, new Context($namespace)))->getText() + ); } else { $phpdoc = new DocBlock($reflection, new Context($namespace)); } - if (!$phpdoc->getText()) { - $phpdoc->setText($class); - } - $properties = []; $methods = []; foreach ($phpdoc->getTags() as $tag) { diff --git a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php index 281a3f9..2c29482 100644 --- a/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Casts\AsCollection; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Models\AdvancedCast + * * * @property \Illuminate\Support\Carbon $cast_to_date_serialization * @property \Illuminate\Support\Carbon $cast_to_datetime_serialization diff --git a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php index 345fc7e..725a26b 100644 --- a/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirecto use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory\Services\Post\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php index 9dfa034..f4eaf6a 100644 --- a/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ArrayCastsWithCo use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ArrayCastsWithComment\Models\ArrayCastsWithComment + * * * @property array|null $cast_to_array -- These three should not be duplicated * @property array $cast_to_json some-description diff --git a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php index fe7ead2..032a1c6 100644 --- a/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Attributes\Models\Simple + * * * @property int $id * @property int $diverging_type_hinted_get_and_set diff --git a/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php index 0e6a6a8..fa5ab5d 100644 --- a/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\MorphTo; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Comment\Models\Simple + * * * @property int $id * @property string $both_same_name I'm a getter diff --git a/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php index eb523f6..057aa78 100644 --- a/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple + * * * @property int $id * @property-read SimpleCollection $relationHasMany diff --git a/tests/Console/ModelsCommand/CustomDate/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/CustomDate/__snapshots__/Test__test__1.php index cd0e846..6d7fc4a 100644 --- a/tests/Console/ModelsCommand/CustomDate/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/CustomDate/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Model use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate\Models\CustomDate + * * * @property \Carbon\CarbonImmutable|null $created_at * @property \Carbon\CarbonImmutable|null $updated_at diff --git a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index b4e81d6..787a272 100644 --- a/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -13,7 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/DynamicRelations/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/DynamicRelations/__snapshots__/Test__test__1.php index 07a8447..2044204 100644 --- a/tests/Console/ModelsCommand/DynamicRelations/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/DynamicRelations/__snapshots__/Test__test__1.php @@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic + * * * @property-read \Illuminate\Database\Eloquent\Collection $regularHasMany * @property-read int|null $regular_has_many_count diff --git a/tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php b/tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php index 1ec977b..211aaba 100644 --- a/tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php +++ b/tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models\ModelWithCustomNamespace + * * * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\CustomSpace\ModelWithCustomNamespaceFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|ModelWithCustomNamespace newModelQuery() @@ -41,7 +41,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models\ModelWithFactory + * * * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithFactoryFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|ModelWithFactory newModelQuery() @@ -60,7 +60,7 @@ declare(strict_types=1); namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models\ModelWithNestedFactory + * * * @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Factories\ModelWithNestedFactoryFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|ModelWithNestedFactory newModelQuery() @@ -81,7 +81,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Factories\Models\ModelWithoutFactory + * * * @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ModelWithoutFactory newQuery() diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php index 780b24b..8a22180 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpDocWithEnumDefaults\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php index 0573323..a5ead86 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdoc\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php index 55c3c2c..6f9bceb 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocCamel\Models\Post + * * * @property int $id * @property string|null $charNullable diff --git a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php index 1f1dae0..08f63ec 100644 --- a/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhpdocFinal\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php index f442521..d24d756 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php @@ -13,7 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php index 46c4432..fe55b17 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExte use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php index 2ec9641..5b29b8a 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php index 2bc3a94..b87f750 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php @@ -15,7 +15,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder; use Illuminate\Support\Carbon; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php index ce70124..a23e112 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php @@ -13,7 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 7db2cf7..9f1f4ca 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -45,7 +45,7 @@ class Post extends Model namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models\FinalPost + * * * @property $someProp * @method someMethod(string $method) @@ -60,7 +60,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models\Post + * * * @property $someProp * @method someMethod(string $method) diff --git a/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php index 9e802be..aabef57 100644 --- a/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenericsSyntaxDisabled\Models\Simple + * * * @property int $id * @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $regularBelongsToMany diff --git a/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php index b33ff8f..d9e703f 100644 --- a/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use DateTime; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter\Models\Simple + * * * @property int $id * @property-read int|null $attribute_return_type_int_or_null diff --git a/tests/Console/ModelsCommand/Ignored/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Ignored/__snapshots__/Test__test__1.php index 43f6607..de0fbfb 100644 --- a/tests/Console/ModelsCommand/Ignored/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Ignored/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\NotIgnored + * * * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|NotIgnored newQuery() diff --git a/tests/Console/ModelsCommand/Interfaces/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Interfaces/__snapshots__/Test__test__1.php index 6124376..feba784 100644 --- a/tests/Console/ModelsCommand/Interfaces/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Interfaces/__snapshots__/Test__test__1.php @@ -13,7 +13,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces\Models\User + * * * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|User newQuery() diff --git a/tests/Console/ModelsCommand/LaravelCustomCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/LaravelCustomCasts/__snapshots__/Test__test__1.php index 4fe3d26..44a4fc8 100644 --- a/tests/Console/ModelsCommand/LaravelCustomCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/LaravelCustomCasts/__snapshots__/Test__test__1.php @@ -23,7 +23,7 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Cas use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Models\CustomCast + * * * @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 diff --git a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php index 7df0890..caa2c76 100644 --- a/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere\Model use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/ModelHooks/Test.php b/tests/Console/ModelsCommand/ModelHooks/Test.php index fadaf6c..339c9ef 100644 --- a/tests/Console/ModelsCommand/ModelHooks/Test.php +++ b/tests/Console/ModelsCommand/ModelHooks/Test.php @@ -71,7 +71,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Model use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Models\Simple + * * * @property int $id * @property-read string $custom diff --git a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php index 611b4d2..1960bb6 100644 --- a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php +++ b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple + * * * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() diff --git a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php index 18181e5..e34fb0b 100644 --- a/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php +++ b/tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspection\Models\Simple + * * * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() diff --git a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php index 953fe15..b5bc105 100644 --- a/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\RelationCountProperties\Models\Post + * * * @property int $id * @property string|null $char_nullable diff --git a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php index 1a405a1..01dcdaf 100644 --- a/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\BelongsToVariation + * * * @property int $id * @property int $not_null_column_with_foreign_key_constraint @@ -61,7 +61,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\CompositeBelongsToVariation + * * * @property int $id * @property int $not_null_column_with_foreign_key_constraint @@ -132,7 +132,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphToMany; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models\Simple + * * * @property int $id * @property-read Simple|null $relationBelongsTo diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php index c5d3538..de69023 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartRes use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartReset\Models\Simple + * Text of existing phpdoc * * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() diff --git a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php index a90886c..cfcec0b 100644 --- a/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php @@ -7,7 +7,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SimpleCasts\Mode use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SimpleCasts\Models\SimpleCast + * * * @property int $cast_to_int * @property int $cast_to_integer diff --git a/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php index 5003b9c..1e89df1 100644 --- a/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes\Models\Simple + * * * @property int $id * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() diff --git a/tests/Console/ModelsCommand/UnionTypes/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/UnionTypes/__snapshots__/Test__test__1.php index 67f759e..fec632f 100644 --- a/tests/Console/ModelsCommand/UnionTypes/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/UnionTypes/__snapshots__/Test__test__1.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Query\Builder; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\UnionTypes\Models\UnionTypeModel + * * * @property-read string|int|null $foo * @property-read \Illuminate\Database\Eloquent\Collection $withUnionTypeReturn diff --git a/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php index 5ee2346..ca6b7af 100644 --- a/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Variadic\Models\Simple + * * * @property int $id * @method static Builder|Simple newModelQuery() From 49ac75d805293d4696889e51a1e1a0c237fd8c83 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 19 Feb 2024 14:03:16 +0100 Subject: [PATCH 47/57] Remove `--smart-reset` completely (#1525) * Remove `--smart-reset` completely See https://github.com/barryvdh/laravel-ide-helper/pull/1523#issuecomment-1952313183 * Update CHANGELOG.md --------- Co-authored-by: Barry vd. Heuvel --- CHANGELOG.md | 2 +- README.md | 2 +- src/Console/ModelsCommand.php | 3 +-- .../ModelsCommand/ResetAndSmartReset/Test.php | 14 -------------- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 229b2ba..bd2eed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ All notable changes to this project will be documented in this file. - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) ### Changed -- Merge --reset and --smart-reset, to always keep the text. Always skipp the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) +- Make `--reset` always keep the text and remove `--smart-reset`. Always skip the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) & [#1525 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1525) - Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524) ### Removed diff --git a/README.md b/README.md index 49964db..b28c0dd 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ The class name will be different from the model, avoiding the IDE duplicate anno Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods. -With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made. The `--smart-reset` option will instead keep the 'text' part of the phpdoc comment, and just replace all the property/method defininitions. +With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made. ```bash php artisan ide-helper:models "App\Models\Post" diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index b6082d1..d2d484f 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -150,7 +150,7 @@ class ModelsCommand extends Command ); $model = $this->argument('model'); $ignore = $this->option('ignore'); - $this->reset = $this->option('reset') || $this->option('smart-reset'); + $this->reset = $this->option('reset'); $this->phpstorm_noinspections = $this->option('phpstorm-noinspections'); $this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true); $this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true); @@ -215,7 +215,6 @@ class ModelsCommand extends Command ], ['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'], ['reset', 'R', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], - ['smart-reset', 'r', InputOption::VALUE_NONE, 'Deprecated: same as --reset'], ['phpstorm-noinspections', 'p', InputOption::VALUE_NONE, 'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' . 'noinspection tags', diff --git a/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php b/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php index 865684e..6ed8b80 100644 --- a/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php +++ b/tests/Console/ModelsCommand/ResetAndSmartReset/Test.php @@ -35,18 +35,4 @@ class Test extends AbstractModelsCommand $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); $this->assertMatchesMockedSnapshot(); } - - public function testSmartReset(): void - { - $command = $this->app->make(ModelsCommand::class); - - $tester = $this->runCommand($command, [ - '--write' => true, - '--smart-reset' => true, - ]); - - $this->assertSame(0, $tester->getStatusCode()); - $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); - $this->assertMatchesMockedSnapshot(); - } } From 8eab699835abad5bed053611364c72fe991b4fed Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 19 Feb 2024 20:52:29 +0100 Subject: [PATCH 48/57] phpunit --migrate-configuration (#1526) --- phpunit.xml.dist | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5168263..410be68 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,17 @@ - + tests - + src/ - + From bc1d67f01ce8c77e3f97d48ba51fa1d81874f622 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 1 Mar 2024 13:53:18 +0100 Subject: [PATCH 49/57] Prepare 3.0 release (#1530) * Prepare 3.0 release * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd2eed1..aa75436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,18 @@ All notable changes to this project will be documented in this file. -[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.15.0...master) +[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.0.0...master) -------------- ### Fixed +### Changed + +### Added + +2024-03-01, 3.0.0 +------------------ + ### Added - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) From 8e7134cf917b3bf5dd6df582fddda6b6b33bdc4a Mon Sep 17 00:00:00 2001 From: stefanScrumble Date: Fri, 8 Mar 2024 11:00:58 +0100 Subject: [PATCH 50/57] Add `AllowDynamicProperties` Attribute to cooperate with php8.2 deprecation --- .../GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index 9f1f4ca..ca1cfd3 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -45,7 +45,7 @@ class Post extends Model namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * + * * * @property $someProp * @method someMethod(string $method) @@ -60,7 +60,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * + * * * @property $someProp * @method someMethod(string $method) From f1992aea27f0d157c454d5819fc7f63b57ada652 Mon Sep 17 00:00:00 2001 From: stefanScrumble Date: Fri, 8 Mar 2024 11:04:35 +0100 Subject: [PATCH 51/57] Fix collection attribute typing --- src/Console/ModelsCommand.php | 58 ++++++++++++----- .../Models/WithCollection.php | 30 +++++++++ .../GenerateMixinCollection/Test.php | 22 +++++++ .../__snapshots__/Test__test__1.php | 62 +++++++++++++++++++ 4 files changed, 157 insertions(+), 15 deletions(-) create mode 100644 tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php create mode 100644 tests/Console/ModelsCommand/GenerateMixinCollection/Test.php create mode 100644 tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index d2d484f..6c78a63 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -194,7 +194,7 @@ class ModelsCommand extends Command protected function getArguments() { return [ - ['model', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Which models to include', []], + ['model', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Which models to include', []], ]; } @@ -206,20 +206,21 @@ class ModelsCommand extends Command protected function getOptions() { return [ - ['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file'], - ['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - 'The model dir, supports glob patterns', [], ], - ['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'], - ['write-mixin', 'M', InputOption::VALUE_NONE, - "Write models to {$this->filename} and adds @mixin to each model, avoiding IDE duplicate declaration warnings", - ], - ['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'], - ['reset', 'R', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], - ['phpstorm-noinspections', 'p', InputOption::VALUE_NONE, - 'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' . - 'noinspection tags', - ], - ['ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''], + ['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file'], + ['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, + 'The model dir, supports glob patterns', [],], + ['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'], + ['write-mixin', 'M', InputOption::VALUE_NONE, + "Write models to {$this->filename} and adds @mixin to each model, avoiding IDE duplicate declaration warnings", + ], + ['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'], + ['reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'], + ['smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'], + ['phpstorm-noinspections', 'p', InputOption::VALUE_NONE, + 'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' . + 'noinspection tags', + ], + ['ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''], ]; } @@ -1236,12 +1237,39 @@ class ModelsCommand extends Command $phpdoc = new DocBlock($reflection, $context); if ($phpdoc->hasTag('return')) { + $returnTag = $phpdoc->getTagsByName('return')[0]; + + if ($typeAlias = $this->extractTypeAlias($returnTag->getContent(), $context->getNamespaceAliases())) { + return $typeAlias; + } + $type = $phpdoc->getTagsByName('return')[0]->getType(); } return $type; } + /** + * @param string $typeAlias + * @param array $namespaceAliases + * @return string|null + */ + private function extractTypeAlias(string $typeAlias, array $namespaceAliases): string|null { + $matches = []; + preg_match('/(\w+)(<.*>)/', $typeAlias, $matches); + $matchCount = count($matches); + + if ($matchCount === 0 || $matchCount === 1) { + return null; + } + + if (empty($namespaceAliases[$matches[1]])) { + return null; + } + + return $namespaceAliases[$matches[1]].($matches[2] ?? ''); + } + protected function getReturnTypeFromReflection(\ReflectionMethod $reflection): ?string { $returnType = $reflection->getReturnType(); diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php b/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php new file mode 100644 index 0000000..997ae3b --- /dev/null +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php @@ -0,0 +1,30 @@ + + */ + public function getCollectionAttribute(): Collection + { + return new Collection(); + } + + /** + * @return Collection + */ + public function getCollectionWithoutTemplateAttribute(): Collection + { + return new Collection(); + } + + public function getCollectionWithoutDocBlockAttribute(): Collection + { + return new Collection(); + } +} diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/Test.php b/tests/Console/ModelsCommand/GenerateMixinCollection/Test.php new file mode 100644 index 0000000..2231752 --- /dev/null +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/Test.php @@ -0,0 +1,22 @@ +app->make(ModelsCommand::class); + + $tester = $this->runCommand($command, [ + '--write-mixin' => true, + ]); + + $this->assertSame(0, $tester->getStatusCode()); + $this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay()); + $this->assertMatchesMockedSnapshot(); + } +} diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php new file mode 100644 index 0000000..e3abb05 --- /dev/null +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php @@ -0,0 +1,62 @@ + + */ + public function getCollectionAttribute(): Collection + { + return new Collection(); + } + + /** + * @return Collection + */ + public function getCollectionWithoutTemplateAttribute(): Collection + { + return new Collection(); + } + + public function getCollectionWithoutDocBlockAttribute(): Collection + { + return new Collection(); + } +} + + */ + + +namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\Models{ +/** + * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\Models\WithCollection + * + * @property-read \Illuminate\Support\Collection $collection + * @property-read \Illuminate\Support\Collection $collection_without_doc_block + * @property-read \Illuminate\Support\Collection $collection_without_template + * @method static \Illuminate\Database\Eloquent\Builder|WithCollection newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WithCollection newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|WithCollection query() + * @mixin \Eloquent + */ + #[\AllowDynamicProperties] + class IdeHelperWithCollection {} +} + From dcdb0c8030bb734a97d46e7bf2c8642db0b5c1d6 Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:48:01 +0100 Subject: [PATCH 52/57] Update CHANGELOG.md --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa75436..7d18f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,17 @@ All notable changes to this project will be documented in this file. - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) - Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) +2024-01-04, v2.14.0 +------------------ + +### Fixes + +- Add AllowDynamicProperties when creating mixin: credit to GeoSot - https://github.com/GeoSot/laravel-ide-helper +- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. + +### Extra +This release contains all commits from the main laravel-ide-helper repo up to 04-01-2024. + 2023-02-04, 2.13.0 ------------------ From 8ae2632f7a72835e9303a76e4611d7c89566c925 Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Thu, 4 Jan 2024 12:49:07 +0100 Subject: [PATCH 53/57] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d18f27..d77229a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,7 +84,7 @@ All notable changes to this project will be documented in this file. ### Fixes - Add AllowDynamicProperties when creating mixin: credit to GeoSot - https://github.com/GeoSot/laravel-ide-helper -- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. +- Fix for getSomethingAttribute functions which return a collection with type templating in the phpDoc. https://github.com/scrumble-nl/laravel-ide-helper/pull/1 ### Extra This release contains all commits from the main laravel-ide-helper repo up to 04-01-2024. From 98252fe740a5495951b9c0308a2d318f51b96ffa Mon Sep 17 00:00:00 2001 From: stefanScrumble <89080949+stefanScrumble@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:51:10 +0100 Subject: [PATCH 54/57] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3ff3f21..1585378 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "barryvdh/laravel-ide-helper", + "name": "scrumble-nl/laravel-ide-helper", "description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.", "license": "MIT", "keywords": [ From 7ad31cc54f980d0d8f072e7d18caa26cb078e030 Mon Sep 17 00:00:00 2001 From: laravel-ide-helper Date: Fri, 8 Mar 2024 10:06:31 +0000 Subject: [PATCH 55/57] composer fix-style --- src/Console/ModelsCommand.php | 7 ++++--- .../GenerateMixinCollection/Models/WithCollection.php | 2 ++ .../Console/ModelsCommand/GenerateMixinCollection/Test.php | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 6c78a63..9e29a5e 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -208,7 +208,7 @@ class ModelsCommand extends Command return [ ['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file'], ['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - 'The model dir, supports glob patterns', [],], + 'The model dir, supports glob patterns', [], ], ['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'], ['write-mixin', 'M', InputOption::VALUE_NONE, "Write models to {$this->filename} and adds @mixin to each model, avoiding IDE duplicate declaration warnings", @@ -1254,7 +1254,8 @@ class ModelsCommand extends Command * @param array $namespaceAliases * @return string|null */ - private function extractTypeAlias(string $typeAlias, array $namespaceAliases): string|null { + private function extractTypeAlias(string $typeAlias, array $namespaceAliases): string|null + { $matches = []; preg_match('/(\w+)(<.*>)/', $typeAlias, $matches); $matchCount = count($matches); @@ -1267,7 +1268,7 @@ class ModelsCommand extends Command return null; } - return $namespaceAliases[$matches[1]].($matches[2] ?? ''); + return $namespaceAliases[$matches[1]] . ($matches[2] ?? ''); } protected function getReturnTypeFromReflection(\ReflectionMethod $reflection): ?string diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php b/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php index 997ae3b..11bfb98 100644 --- a/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/Models/WithCollection.php @@ -1,5 +1,7 @@ Date: Fri, 8 Mar 2024 11:13:45 +0100 Subject: [PATCH 56/57] Fix tests --- .../GenerateMixinCollection/__snapshots__/Test__test__1.php | 2 +- .../GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php index e3abb05..a6e5c0d 100644 --- a/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php @@ -46,7 +46,7 @@ class WithCollection extends Model namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\Models{ /** - * Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateMixinCollection\Models\WithCollection + * * * @property-read \Illuminate\Support\Collection $collection * @property-read \Illuminate\Support\Collection $collection_without_doc_block diff --git a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php index ca1cfd3..9f1f4ca 100644 --- a/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php @@ -45,7 +45,7 @@ class Post extends Model namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * + * * * @property $someProp * @method someMethod(string $method) @@ -60,7 +60,7 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithMixin\Models{ /** - * + * * * @property $someProp * @method someMethod(string $method) From 788c33b1c50d7bbb096bb86048fe45ecc6c3204c Mon Sep 17 00:00:00 2001 From: stefanScrumble Date: Fri, 8 Mar 2024 11:16:27 +0100 Subject: [PATCH 57/57] Fix tests --- .../GenerateMixinCollection/__snapshots__/Test__test__1.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php index a6e5c0d..97940aa 100644 --- a/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php +++ b/tests/Console/ModelsCommand/GenerateMixinCollection/__snapshots__/Test__test__1.php @@ -1,5 +1,7 @@