From 17e67af66ddb0e46c7e063a0efa1eba7f449097e Mon Sep 17 00:00:00 2001 From: Tanner Date: Fri, 26 May 2023 09:41:32 -0400 Subject: [PATCH] Add Hashed Type to Map (#59) --- composer.lock | 233 +++++++++++------- phpstan.neon | 2 + src/Actions/BuildModelDetails.php | 8 +- src/Actions/GenerateCliOutput.php | 6 + src/Actions/GenerateJsonOutput.php | 7 + src/Actions/GetModels.php | 2 + src/Actions/RunModelShowCommand.php | 2 + src/Actions/WriteColumnAttribute.php | 3 +- src/Actions/WriteEnumConst.php | 2 + src/Actions/WriteRelationship.php | 3 +- src/Constants/TypescriptMappings.php | 4 + .../ErrorEmittingConsoleComponentFactory.php | 4 +- src/Traits/ModelRefClass.php | 2 +- src/TypescriptInterface.php | 6 + 14 files changed, 191 insertions(+), 93 deletions(-) diff --git a/composer.lock b/composer.lock index 7ca4296..42dd230 100644 --- a/composer.lock +++ b/composer.lock @@ -651,16 +651,16 @@ }, { "name": "laravel/framework", - "version": "v10.9.0", + "version": "v10.12.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "35078125f61ef0b125edf524de934f108d4b47fd" + "reference": "9e6dcff23ab1d4b522bef56074c31625cf077576" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/35078125f61ef0b125edf524de934f108d4b47fd", - "reference": "35078125f61ef0b125edf524de934f108d4b47fd", + "url": "https://api.github.com/repos/laravel/framework/zipball/9e6dcff23ab1d4b522bef56074c31625cf077576", + "reference": "9e6dcff23ab1d4b522bef56074c31625cf077576", "shasum": "" }, "require": { @@ -847,7 +847,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-04-25T13:47:18+00:00" + "time": "2023-05-23T18:04:16+00:00" }, { "name": "laravel/serializable-closure", @@ -1099,19 +1099,20 @@ }, { "name": "league/flysystem", - "version": "3.14.0", + "version": "3.15.1", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158" + "reference": "a141d430414fcb8bf797a18716b09f759a385bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e2a279d7f47d9098e479e8b21f7fb8b8de230158", - "reference": "e2a279d7f47d9098e479e8b21f7fb8b8de230158", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a141d430414fcb8bf797a18716b09f759a385bed", + "reference": "a141d430414fcb8bf797a18716b09f759a385bed", "shasum": "" }, "require": { + "league/flysystem-local": "^3.0.0", "league/mime-type-detection": "^1.0.0", "php": "^8.0.2" }, @@ -1170,7 +1171,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.14.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.15.1" }, "funding": [ { @@ -1182,7 +1183,67 @@ "type": "github" } ], - "time": "2023-04-11T18:11:47+00:00" + "time": "2023-05-04T09:04:26+00:00" + }, + { + "name": "league/flysystem-local", + "version": "3.15.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-local.git", + "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/543f64c397fefdf9cfeac443ffb6beff602796b3", + "reference": "543f64c397fefdf9cfeac443ffb6beff602796b3", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/flysystem": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Local\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Local filesystem adapter for Flysystem.", + "keywords": [ + "Flysystem", + "file", + "files", + "filesystem", + "local" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem-local/issues", + "source": "https://github.com/thephpleague/flysystem-local/tree/3.15.0" + }, + "funding": [ + { + "url": "https://ecologi.com/frankdejonge", + "type": "custom" + }, + { + "url": "https://github.com/frankdejonge", + "type": "github" + } + ], + "time": "2023-05-02T20:02:14+00:00" }, { "name": "league/mime-type-detection", @@ -4687,25 +4748,25 @@ }, { "name": "consolidation/annotated-command", - "version": "4.8.2", + "version": "4.9.1", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "7f5dd1aafb93a10593ed70f3caa6a0cd5a32f0e3" + "reference": "e01152f698eff4cb5df3ebfe5e097ef335dbd3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/7f5dd1aafb93a10593ed70f3caa6a0cd5a32f0e3", - "reference": "7f5dd1aafb93a10593ed70f3caa6a0cd5a32f0e3", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/e01152f698eff4cb5df3ebfe5e097ef335dbd3c9", + "reference": "e01152f698eff4cb5df3ebfe5e097ef335dbd3c9", "shasum": "" }, "require": { - "consolidation/output-formatters": "^4.1.1", + "consolidation/output-formatters": "^4.3.1", "php": ">=7.1.3", - "psr/log": "^1|^2|^3", - "symfony/console": "^4.4.8|^5|^6", - "symfony/event-dispatcher": "^4.4.8|^5|^6", - "symfony/finder": "^4.4.8|^5|^6" + "psr/log": "^1 || ^2 || ^3", + "symfony/console": "^4.4.8 || ^5 || ^6", + "symfony/event-dispatcher": "^4.4.8 || ^5 || ^6", + "symfony/finder": "^4.4.8 || ^5 || ^6" }, "require-dev": { "composer-runtime-api": "^2.0", @@ -4737,9 +4798,9 @@ "description": "Initialize Symfony Console commands from annotated command class methods.", "support": { "issues": "https://github.com/consolidation/annotated-command/issues", - "source": "https://github.com/consolidation/annotated-command/tree/4.8.2" + "source": "https://github.com/consolidation/annotated-command/tree/4.9.1" }, - "time": "2023-03-11T19:32:28+00:00" + "time": "2023-05-20T04:19:01+00:00" }, { "name": "consolidation/config", @@ -4855,16 +4916,16 @@ }, { "name": "consolidation/output-formatters", - "version": "4.2.4", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "b377db7e9435c50c4e019c26ec164b547e754ca0" + "reference": "f65524e9ecd2bd0021c4b18710005caaa6dcbd86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/b377db7e9435c50c4e019c26ec164b547e754ca0", - "reference": "b377db7e9435c50c4e019c26ec164b547e754ca0", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/f65524e9ecd2bd0021c4b18710005caaa6dcbd86", + "reference": "f65524e9ecd2bd0021c4b18710005caaa6dcbd86", "shasum": "" }, "require": { @@ -4903,9 +4964,9 @@ "description": "Format text by applying transformations provided by plug-in formatters.", "support": { "issues": "https://github.com/consolidation/output-formatters/issues", - "source": "https://github.com/consolidation/output-formatters/tree/4.2.4" + "source": "https://github.com/consolidation/output-formatters/tree/4.3.1" }, - "time": "2023-02-24T03:39:10+00:00" + "time": "2023-05-20T03:23:06+00:00" }, { "name": "consolidation/robo", @@ -5376,16 +5437,16 @@ }, { "name": "fakerphp/faker", - "version": "v1.21.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d" + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/92efad6a967f0b79c499705c69b662f738cc9e4d", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/f85772abd508bd04e20bb4b1bbe260a68d0066d2", + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2", "shasum": "" }, "require": { @@ -5438,9 +5499,9 @@ ], "support": { "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.21.0" + "source": "https://github.com/FakerPHP/Faker/tree/v1.22.0" }, - "time": "2022-12-13T13:54:32+00:00" + "time": "2023-05-14T12:31:37+00:00" }, { "name": "grasmash/expander", @@ -5942,16 +6003,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.15.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", "shasum": "" }, "require": { @@ -5992,9 +6053,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-05-19T20:20:00+00:00" }, { "name": "nunomaduro/larastan", @@ -6094,22 +6155,22 @@ }, { "name": "orchestra/testbench", - "version": "v8.5.1", + "version": "v8.5.4", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "636bb5079170f1b49ca754e648712a2b32fa7aef" + "reference": "6c00e046147d7ce1586f279e87139217aaa04bab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/636bb5079170f1b49ca754e648712a2b32fa7aef", - "reference": "636bb5079170f1b49ca754e648712a2b32fa7aef", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/6c00e046147d7ce1586f279e87139217aaa04bab", + "reference": "6c00e046147d7ce1586f279e87139217aaa04bab", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", "fakerphp/faker": "^1.21", - "laravel/framework": ">=10.8.0 <10.10.0", + "laravel/framework": ">=10.8.0 <10.13.0", "mockery/mockery": "^1.5.1", "orchestra/testbench-core": ">=8.5.0 <8.6.0", "php": "^8.1", @@ -6143,22 +6204,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v8.5.1" + "source": "https://github.com/orchestral/testbench/tree/v8.5.4" }, - "time": "2023-04-24T05:40:14+00:00" + "time": "2023-05-24T00:44:58+00:00" }, { "name": "orchestra/testbench-core", - "version": "v8.5.0", + "version": "v8.5.2", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "4d0ed25a83179d8e59487198f619b57b64d4410f" + "reference": "bc3331081bf8d85cc0806187427fce35471df6a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/4d0ed25a83179d8e59487198f619b57b64d4410f", - "reference": "4d0ed25a83179d8e59487198f619b57b64d4410f", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/bc3331081bf8d85cc0806187427fce35471df6a8", + "reference": "bc3331081bf8d85cc0806187427fce35471df6a8", "shasum": "" }, "require": { @@ -6167,7 +6228,7 @@ }, "require-dev": { "fakerphp/faker": "^1.21", - "laravel/framework": "^10.8", + "laravel/framework": "^10.10", "laravel/pint": "^1.6", "mockery/mockery": "^1.5.1", "orchestra/canvas": "^8.1", @@ -6181,7 +6242,7 @@ "suggest": { "brianium/paratest": "Allow using parallel tresting (^6.4 || ^7.1.4).", "fakerphp/faker": "Allow using Faker for testing (^1.21).", - "laravel/framework": "Required for testing (^10.8).", + "laravel/framework": "Required for testing (^10.10).", "mockery/mockery": "Allow using Mockery for testing (^1.5.1).", "nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.4).", "orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).", @@ -6194,11 +6255,6 @@ "testbench" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.0-dev" - } - }, "autoload": { "files": [ "src/helpers.php" @@ -6232,7 +6288,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2023-04-18T14:07:29+00:00" + "time": "2023-05-17T00:13:44+00:00" }, { "name": "phar-io/manifest", @@ -6590,16 +6646,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.14", + "version": "1.10.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c" + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", "shasum": "" }, "require": { @@ -6648,20 +6704,20 @@ "type": "tidelift" } ], - "time": "2023-04-19T13:47:27+00:00" + "time": "2023-05-09T15:28:01+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.1", + "version": "10.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "884a0da7f9f46f28b2cb69134217fd810b793974" + "reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/884a0da7f9f46f28b2cb69134217fd810b793974", - "reference": "884a0da7f9f46f28b2cb69134217fd810b793974", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/db1497ec8dd382e82c962f7abbe0320e4882ee4e", + "reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e", "shasum": "" }, "require": { @@ -6718,7 +6774,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.1" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.2" }, "funding": [ { @@ -6726,20 +6782,20 @@ "type": "github" } ], - "time": "2023-04-17T12:15:40+00:00" + "time": "2023-05-22T09:04:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.0.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd" + "reference": "5647d65443818959172645e7ed999217360654b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/fd9329ab3368f59fe1fe808a189c51086bd4b6bd", - "reference": "fd9329ab3368f59fe1fe808a189c51086bd4b6bd", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/5647d65443818959172645e7ed999217360654b6", + "reference": "5647d65443818959172645e7ed999217360654b6", "shasum": "" }, "require": { @@ -6778,7 +6834,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.0.2" }, "funding": [ { @@ -6786,7 +6843,7 @@ "type": "github" } ], - "time": "2023-02-10T16:53:14+00:00" + "time": "2023-05-07T09:13:23+00:00" }, { "name": "phpunit/php-invoker", @@ -6971,16 +7028,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.1.2", + "version": "10.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6f0cd95be71add539f8fd2be25b2a4a29789000b" + "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6f0cd95be71add539f8fd2be25b2a4a29789000b", - "reference": "6f0cd95be71add539f8fd2be25b2a4a29789000b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2379ebafc1737e71cdc84f402acb6b7f04198b9d", + "reference": "2379ebafc1737e71cdc84f402acb6b7f04198b9d", "shasum": "" }, "require": { @@ -7052,7 +7109,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.1.3" }, "funding": [ { @@ -7068,7 +7125,7 @@ "type": "tidelift" } ], - "time": "2023-04-22T07:38:19+00:00" + "time": "2023-05-11T05:16:22+00:00" }, { "name": "pimple/pimple", @@ -8433,16 +8490,16 @@ }, { "name": "spatie/ray", - "version": "1.37.1", + "version": "1.37.2", "source": { "type": "git", "url": "https://github.com/spatie/ray.git", - "reference": "a915e327f04c0fbed3bdd26e076e39feea091062" + "reference": "dea16182d4bc9d9833adec7e39fbb3d7b553425d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/ray/zipball/a915e327f04c0fbed3bdd26e076e39feea091062", - "reference": "a915e327f04c0fbed3bdd26e076e39feea091062", + "url": "https://api.github.com/repos/spatie/ray/zipball/dea16182d4bc9d9833adec7e39fbb3d7b553425d", + "reference": "dea16182d4bc9d9833adec7e39fbb3d7b553425d", "shasum": "" }, "require": { @@ -8493,7 +8550,7 @@ ], "support": { "issues": "https://github.com/spatie/ray/issues", - "source": "https://github.com/spatie/ray/tree/1.37.1" + "source": "https://github.com/spatie/ray/tree/1.37.2" }, "funding": [ { @@ -8505,7 +8562,7 @@ "type": "other" } ], - "time": "2023-03-06T07:22:28+00:00" + "time": "2023-05-17T06:35:47+00:00" }, { "name": "symfony/filesystem", diff --git a/phpstan.neon b/phpstan.neon index c4dc04a..fe43c2d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,6 +8,8 @@ parameters: # Determines the level of checking. 5 is a good starter point 8 is max level: 5 + checkGenericClassInNonGenericObjectType: false + ignoreErrors: - '#Call to an undefined method ReflectionType::getName\(\)#' diff --git a/src/Actions/BuildModelDetails.php b/src/Actions/BuildModelDetails.php index 1ab1f9b..66296c2 100644 --- a/src/Actions/BuildModelDetails.php +++ b/src/Actions/BuildModelDetails.php @@ -9,6 +9,10 @@ use ReflectionException; use Symfony\Component\Finder\SplFileInfo; +/** + * @template TKey + * @template TValue{reflectionModel: \ReflectionClass, name: string, columns: \Illuminate\Support\Collection, nonColumns: \Illuminate\Support\Collection, relations: \Illuminate\Support\Collection, interfaces: \Illuminate\Support\Collection, imports: \Illuminate\Support\Collection} + */ class BuildModelDetails { use ClassBaseName; @@ -17,7 +21,7 @@ class BuildModelDetails /** * Build the model details. * - * @return array + * @return array|null * * @throws ReflectionException */ @@ -84,6 +88,8 @@ public function __invoke(SplFileInfo $modelFile, bool $resolveAbstract = false): } /** + * @return array|null + * * @throws NestedCommandException */ private function getModelDetails(SplFileInfo $modelFile, bool $resolveAbstract): ?array diff --git a/src/Actions/GenerateCliOutput.php b/src/Actions/GenerateCliOutput.php index ecfee5f..a8bcd05 100644 --- a/src/Actions/GenerateCliOutput.php +++ b/src/Actions/GenerateCliOutput.php @@ -18,8 +18,14 @@ class GenerateCliOutput protected string $indent = ''; + /** + * @var array + */ protected array $enumReflectors = []; + /** + * @var array> + */ protected array $imports = []; /** diff --git a/src/Actions/GenerateJsonOutput.php b/src/Actions/GenerateJsonOutput.php index fb49eb6..36a01a2 100644 --- a/src/Actions/GenerateJsonOutput.php +++ b/src/Actions/GenerateJsonOutput.php @@ -5,12 +5,19 @@ use FumeApp\ModelTyper\Traits\ClassBaseName; use FumeApp\ModelTyper\Traits\ModelRefClass; use Illuminate\Support\Collection; +use ReflectionClass; use Symfony\Component\Finder\SplFileInfo; class GenerateJsonOutput { + /** + * @var array> + */ protected array $output = []; + /** + * @var array + */ protected array $enumReflectors = []; use ClassBaseName; diff --git a/src/Actions/GetModels.php b/src/Actions/GetModels.php index c11a48a..a0d3683 100644 --- a/src/Actions/GetModels.php +++ b/src/Actions/GetModels.php @@ -14,6 +14,8 @@ class GetModels /** * Return collection of models. * + * @param array|null $includedModels + * @param array|null $excludedModels * @return Collection */ public function __invoke(?string $model = null, ?array $includedModels = null, ?array $excludedModels = null): Collection diff --git a/src/Actions/RunModelShowCommand.php b/src/Actions/RunModelShowCommand.php index 6c380df..0415e3e 100644 --- a/src/Actions/RunModelShowCommand.php +++ b/src/Actions/RunModelShowCommand.php @@ -28,6 +28,8 @@ public function __construct(Application $app = null) * * @see https://github.com/laravel/framework/blob/9.x/src/Illuminate/Foundation/Console/ShowModelCommand.php * + * @return array + * * @throws NestedCommandException */ public function __invoke(string $model, bool $resolveAbstract = false): array diff --git a/src/Actions/WriteColumnAttribute.php b/src/Actions/WriteColumnAttribute.php index 1337436..95348a0 100644 --- a/src/Actions/WriteColumnAttribute.php +++ b/src/Actions/WriteColumnAttribute.php @@ -16,7 +16,8 @@ class WriteColumnAttribute /** * Get model columns and attributes to the output. * - * @param array $attribute <{name: string, type: string, increments: bool, nullable: bool, default: mixed, unique: bool, fillable: bool, hidden: bool, appended: mixed, cast: string}> + * @param array{name: string, type: string, increments: bool, nullable: bool, default: mixed, unique: bool, fillable: bool, hidden?: bool, appended: mixed, cast?: string|null, forceType?: bool} $attribute + * @return array{array{name: string, type: string}, ReflectionClass|null}|array{string, ReflectionClass|null}|array{null, null} */ public function __invoke(ReflectionClass $reflectionModel, array $attribute, string $indent = '', bool $jsonOutput = false, bool $noHidden = false, bool $timestampsDate = false, bool $optionalNullables = false): array { diff --git a/src/Actions/WriteEnumConst.php b/src/Actions/WriteEnumConst.php index 418426d..46beb5c 100644 --- a/src/Actions/WriteEnumConst.php +++ b/src/Actions/WriteEnumConst.php @@ -8,6 +8,8 @@ class WriteEnumConst { /** * Write the enum const to the output. + * + * @return array{type: string, name: string}|string */ public function __invoke(ReflectionClass $reflection, string $indent = '', bool $jsonOutput = false): array|string { diff --git a/src/Actions/WriteRelationship.php b/src/Actions/WriteRelationship.php index 9ff0d77..1716a9c 100644 --- a/src/Actions/WriteRelationship.php +++ b/src/Actions/WriteRelationship.php @@ -12,7 +12,8 @@ class WriteRelationship /** * Write the relationship to the output. * - * @param array $relation <{name: string, type: string, related:string}> + * @param array{name: string, type: string, related:string} $relation + * @return array{type: string, name: string}|string */ public function __invoke(array $relation, string $indent = '', bool $jsonOutput = false, bool $optionalRelation = false, bool $plurals = false): array|string { diff --git a/src/Constants/TypescriptMappings.php b/src/Constants/TypescriptMappings.php index bf8bde2..798e764 100644 --- a/src/Constants/TypescriptMappings.php +++ b/src/Constants/TypescriptMappings.php @@ -4,6 +4,9 @@ class TypescriptMappings { + /** + * @var array + */ public static array $mappings = [ 'bigint' => 'number', 'int' => 'number', @@ -20,5 +23,6 @@ class TypescriptMappings 'array' => 'string[]', 'point' => 'Point', 'guid' => 'string', + 'hashed' => 'string', ]; } diff --git a/src/Overrides/ErrorEmittingConsoleComponentFactory.php b/src/Overrides/ErrorEmittingConsoleComponentFactory.php index c41288b..a948839 100644 --- a/src/Overrides/ErrorEmittingConsoleComponentFactory.php +++ b/src/Overrides/ErrorEmittingConsoleComponentFactory.php @@ -24,8 +24,10 @@ public function __construct(Factory $factory, bool $throwExceptions = false) /** * Reroute calls to underlying instance unless intercepted by override. + * + * @param array $arguments */ - public function __call($name, $arguments) + public function __call(string $name, array $arguments): mixed { if ($name === 'error') { return $this->emitError(...$arguments); diff --git a/src/Traits/ModelRefClass.php b/src/Traits/ModelRefClass.php index 82687de..c7c6871 100644 --- a/src/Traits/ModelRefClass.php +++ b/src/Traits/ModelRefClass.php @@ -9,7 +9,7 @@ trait ModelRefClass /** * Get the reflection interface. * - * @param array $info - The model details from the model:show command. + * @param array $info */ public function getRefInterface(array $info): ReflectionClass { diff --git a/src/TypescriptInterface.php b/src/TypescriptInterface.php index 18e277f..709d33e 100644 --- a/src/TypescriptInterface.php +++ b/src/TypescriptInterface.php @@ -4,6 +4,12 @@ class TypescriptInterface { + /** + * @param array $columns + * @param array $mutators + * @param array $relations + * @param array $interfaces + */ public function __construct( public string $name, public array $columns,