From 68e9b9450352769e6bc25fd5db8706ec3d6ffc84 Mon Sep 17 00:00:00 2001 From: Bastien Philippe Date: Thu, 7 Nov 2024 13:56:41 +0100 Subject: [PATCH 1/5] Upgrade phpstan/phpdoc-parser to v2, laravel/prompts to 0.3 and use composer/class-map-generator instead of soyhuce/classmap-generator --- composer.json | 6 ++-- phpstan-baseline.neon | 52 ++++++---------------------- src/Commands/TestCommand.php | 1 + src/Domains/DocBlock/DocBlock.php | 10 ++++-- src/Domains/Test/TestNameGuesser.php | 1 + src/Support/FileOpener.php | 6 ++-- src/Support/Finder.php | 2 +- 7 files changed, 28 insertions(+), 50 deletions(-) diff --git a/composer.json b/composer.json index f98e4e3..3780390 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,13 @@ "require": { "php": "^8.2", "composer-runtime-api": "^2.0", + "composer/class-map-generator": "^1.4", "illuminate/console": "^10.17.1 || ^11.0", "illuminate/contracts": "^10.17.1 || ^11.0", "illuminate/filesystem": "^10.17.1 || ^11.0", "illuminate/support": "^10.17.1 || ^11.0", - "laravel/prompts": "^0.1.3", - "phpstan/phpdoc-parser": "^1.2.0", - "soyhuce/classmap-generator": "^1.0", + "laravel/prompts": "^0.3.1", + "phpstan/phpdoc-parser": "^2.0", "spatie/fork": "^1.1", "spatie/laravel-package-tools": "^1.11" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d9d1c3d..83ea175 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Command \"somake\\:builder\" does not have option \"model\"\\.$#" - count: 2 - path: src/Commands/BuilderCommand.php - - - - message: "#^Left side of && is always false\\.$#" - count: 1 - path: src/Commands/BuilderCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" count: 1 @@ -31,18 +21,18 @@ parameters: path: src/Commands/BuilderCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" count: 1 path: src/Commands/BuilderCommand.php - - message: "#^Left side of && is always true\\.$#" + message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" count: 1 path: src/Commands/FactoryCommand.php - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\.$#" - count: 3 + count: 2 path: src/Commands/FactoryCommand.php - @@ -56,7 +46,7 @@ parameters: path: src/Commands/FactoryCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" count: 1 path: src/Commands/FactoryCommand.php @@ -86,20 +76,10 @@ parameters: path: src/Commands/ListenerCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\ given\\.$#" count: 1 path: src/Commands/ListenerCommand.php - - - message: "#^Command \"somake\\:policy\" does not have option \"model\"\\.$#" - count: 2 - path: src/Commands/PolicyCommand.php - - - - message: "#^Left side of && is always false\\.$#" - count: 1 - path: src/Commands/PolicyCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\PolicyCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" count: 1 @@ -121,7 +101,7 @@ parameters: path: src/Commands/PolicyCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" count: 1 path: src/Commands/PolicyCommand.php @@ -151,20 +131,10 @@ parameters: path: src/Commands/RequestCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" count: 1 path: src/Commands/RequestCommand.php - - - message: "#^Command \"somake\\:resource\" does not have option \"model\"\\.$#" - count: 2 - path: src/Commands/ResourceCommand.php - - - - message: "#^Left side of && is always false\\.$#" - count: 1 - path: src/Commands/ResourceCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ResourceCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" count: 1 @@ -186,18 +156,18 @@ parameters: path: src/Commands/ResourceCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" count: 1 path: src/Commands/ResourceCommand.php - - message: "#^Left side of && is always true\\.$#" + message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askClass\\(\\) should return class\\-string but returns array\\|bool\\|string\\.$#" count: 1 path: src/Commands/TestCommand.php - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askClass\\(\\) should return class\\-string but returns string\\.$#" - count: 3 + count: 2 path: src/Commands/TestCommand.php - @@ -221,7 +191,7 @@ parameters: path: src/Commands/TestCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\> given\\.$#" + message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\ given\\.$#" count: 1 path: src/Commands/TestCommand.php diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php index 13e704a..00c6771 100644 --- a/src/Commands/TestCommand.php +++ b/src/Commands/TestCommand.php @@ -17,6 +17,7 @@ use function Laravel\Prompts\outro; use function Laravel\Prompts\select; use function Laravel\Prompts\text; +use function sprintf; class TestCommand extends Command { diff --git a/src/Domains/DocBlock/DocBlock.php b/src/Domains/DocBlock/DocBlock.php index 3eb0480..94077a4 100644 --- a/src/Domains/DocBlock/DocBlock.php +++ b/src/Domains/DocBlock/DocBlock.php @@ -10,6 +10,7 @@ use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\ParserConfig; use ReflectionClass; use function in_array; @@ -21,9 +22,12 @@ class DocBlock public function __construct() { - $constExprParser = new ConstExprParser(); - $this->lexer = new Lexer(); - $this->phpDocParser = new PhpDocParser(new TypeParser($constExprParser), $constExprParser); + $config = new ParserConfig([]); + $constExprParser = new ConstExprParser($config); + $typeParser = new TypeParser($config, $constExprParser); + + $this->lexer = new Lexer($config); + $this->phpDocParser = new PhpDocParser($config, $typeParser, $constExprParser); } /** diff --git a/src/Domains/Test/TestNameGuesser.php b/src/Domains/Test/TestNameGuesser.php index 394f581..73c8efd 100644 --- a/src/Domains/Test/TestNameGuesser.php +++ b/src/Domains/Test/TestNameGuesser.php @@ -3,6 +3,7 @@ namespace Soyhuce\Somake\Domains\Test; use Illuminate\Support\Str; +use function sprintf; class TestNameGuesser { diff --git a/src/Support/FileOpener.php b/src/Support/FileOpener.php index 6638e8c..d77f98b 100644 --- a/src/Support/FileOpener.php +++ b/src/Support/FileOpener.php @@ -3,8 +3,10 @@ namespace Soyhuce\Somake\Support; use Illuminate\Support\Collection; +use Illuminate\Support\Env; use Spatie\Fork\Fork; use Symfony\Component\Process\Process; +use function is_string; class FileOpener { @@ -27,8 +29,8 @@ public function openFiles(): void return; } - $ide = env('IDE'); - if ($ide === null) { + $ide = Env::get('IDE'); + if (!is_string($ide)) { return; } diff --git a/src/Support/Finder.php b/src/Support/Finder.php index 7433d29..688345f 100644 --- a/src/Support/Finder.php +++ b/src/Support/Finder.php @@ -2,11 +2,11 @@ namespace Soyhuce\Somake\Support; +use Composer\ClassMapGenerator\ClassMapGenerator; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; use Illuminate\Support\Facades\File; use Illuminate\Support\Str; -use Soyhuce\ClassMapGenerator\ClassMapGenerator; use Spatie\LaravelData\Data; use Throwable; From 7b0e7dfa44a2602c78706d9fb0f758989a052daf Mon Sep 17 00:00:00 2001 From: Bastien Philippe Date: Thu, 21 Nov 2024 08:46:20 +0100 Subject: [PATCH 2/5] Upgrade to phpstan 2.0 / larastan 3.0 --- .github/workflows/run-tests.yml | 9 +- composer.json | 4 +- phpstan-baseline.neon | 153 ++++++++++++++++++++++---------- phpstan.neon.dist | 1 - test-laravel/composer.json | 2 +- 5 files changed, 113 insertions(+), 56 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b6a7d5b..a50ca2a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,17 +14,12 @@ jobs: matrix: os: [ubuntu-latest] php: [8.2, 8.3] - laravel: [10.*, 11.*] - laravel-data: [^3.0, ^4.0] + laravel: [11.*] + laravel-data: [^4.0] stability: [prefer-lowest, prefer-stable] include: - - laravel: 10.* - testbench: 8.* - laravel: 11.* testbench: 9.* - exclude: - - laravel: 11.* - laravel-data: ^3.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - laraveldata${{ matrix.laravel-data }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 3780390..7976d87 100644 --- a/composer.json +++ b/composer.json @@ -31,12 +31,12 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.7", "nunomaduro/collision": "^7.7 || ^8.0", - "larastan/larastan": "^2.6.4", + "larastan/larastan": "^3.0", "orchestra/testbench": "^8.0 || ^9.0", "pestphp/pest": "^2.12", "pestphp/pest-plugin-laravel": "^2.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-deprecation-rules": "^2.0", "spatie/laravel-data": "^3.0 || ^4.0", "spatie/pest-plugin-snapshots": "^2.0.1", "test-laravel/test-laravel": "*" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 83ea175..a0f05ca 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,227 +1,290 @@ parameters: ignoreErrors: - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" + message: '#^Called ''env'' outside of the config directory which returns null when the config is cached, use ''config''\.$#' + identifier: larastan.noEnvCallsOutsideOfConfig + count: 1 + path: config/somake.php + + - + message: '#^Method Soyhuce\\Somake\\Commands\\BuilderCommand\:\:askModel\(\) should return class\-string\ but returns array\|bool\|string\.$#' + identifier: return.type count: 1 path: src/Commands/BuilderCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\BuilderCommand\:\:askModel\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/BuilderCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\BuilderCommand\:\:askModel\(\) should return class\-string\ but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/BuilderCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:disambiguateModel\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\BuilderCommand\:\:disambiguateModel\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/BuilderCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\, class\-string\\> given\.$#' + identifier: argument.type count: 1 path: src/Commands/BuilderCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\FactoryCommand\:\:askModel\(\) should return class\-string\ but returns array\|bool\|string\.$#' + identifier: return.type count: 1 path: src/Commands/FactoryCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\FactoryCommand\:\:askModel\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/FactoryCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\FactoryCommand\:\:askModel\(\) should return class\-string\ but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/FactoryCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\FactoryCommand\\:\\:disambiguateModel\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\FactoryCommand\:\:disambiguateModel\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/FactoryCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\, class\-string\\> given\.$#' + identifier: argument.type count: 1 path: src/Commands/FactoryCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ListenerCommand\\:\\:askEvent\\(\\) should return ''\\|class\\-string but returns non\\-empty\\-string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ListenerCommand\:\:askEvent\(\) should return ''''\|class\-string but returns non\-empty\-string\.$#' + identifier: return.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ListenerCommand\\:\\:askEvent\\(\\) should return ''\\|class\\-string but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ListenerCommand\:\:askEvent\(\) should return ''''\|class\-string but returns string\.$#' + identifier: return.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ListenerCommand\\:\\:askEvent\\(\\) should return ''\\|class\\-string but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ListenerCommand\:\:askEvent\(\) should return ''''\|class\-string but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ListenerCommand\\:\\:disambiguateEvent\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ListenerCommand\:\:disambiguateEvent\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ListenerCommand\\:\\:qualifyEvent\\(\\) should return class\\-string but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ListenerCommand\:\:qualifyEvent\(\) should return class\-string but returns string\.$#' + identifier: return.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\ given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\ given\.$#' + identifier: argument.type count: 1 path: src/Commands/ListenerCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\PolicyCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\PolicyCommand\:\:askModel\(\) should return class\-string\ but returns array\|bool\|string\.$#' + identifier: return.type count: 1 path: src/Commands/PolicyCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\PolicyCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\PolicyCommand\:\:askModel\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/PolicyCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\PolicyCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\PolicyCommand\:\:askModel\(\) should return class\-string\ but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/PolicyCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\PolicyCommand\\:\\:disambiguateModel\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\PolicyCommand\:\:disambiguateModel\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/PolicyCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\, class\-string\\> given\.$#' + identifier: argument.type count: 1 path: src/Commands/PolicyCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\RequestCommand\\:\\:askData\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\RequestCommand\:\:askData\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/RequestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\RequestCommand\\:\\:askData\\(\\) should return class\\-string\\ but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\RequestCommand\:\:askData\(\) should return class\-string\ but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/RequestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\RequestCommand\\:\\:disambiguateDatas\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\RequestCommand\:\:disambiguateDatas\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/RequestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\RequestCommand\\:\\:qualifyData\\(\\) should return class\\-string\\ but returns class\\-string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\RequestCommand\:\:qualifyData\(\) should return class\-string\ but returns class\-string\.$#' + identifier: return.type count: 1 path: src/Commands/RequestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\RequestCommand\\:\\:qualifyData\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\RequestCommand\:\:qualifyData\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 1 path: src/Commands/RequestCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\, class\-string\\> given\.$#' + identifier: argument.type count: 1 path: src/Commands/RequestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ResourceCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ResourceCommand\:\:askModel\(\) should return class\-string\ but returns array\|bool\|string\.$#' + identifier: return.type count: 1 path: src/Commands/ResourceCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ResourceCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ResourceCommand\:\:askModel\(\) should return class\-string\ but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/ResourceCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ResourceCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ResourceCommand\:\:askModel\(\) should return class\-string\ but returns string\|null\.$#' + identifier: return.type count: 1 path: src/Commands/ResourceCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\ResourceCommand\\:\\:disambiguateModel\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\ResourceCommand\:\:disambiguateModel\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/ResourceCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\, class\\-string\\\\> given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\, class\-string\\> given\.$#' + identifier: argument.type count: 1 path: src/Commands/ResourceCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askClass\\(\\) should return class\\-string but returns array\\|bool\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:askClass\(\) should return class\-string but returns array\|bool\|string\.$#' + identifier: return.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askClass\\(\\) should return class\\-string but returns string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:askClass\(\) should return class\-string but returns string\.$#' + identifier: return.type count: 2 path: src/Commands/TestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askClass\\(\\) should return class\\-string but returns string\\|null\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:askClass\(\) should return class\-string but returns string\|null\.$#' + identifier: return.type + count: 1 + path: src/Commands/TestCommand.php + + - + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:askType\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:askType\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:disambiguateClass\(\) should return string but returns int\|string\.$#' + identifier: return.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:disambiguateClass\\(\\) should return string but returns int\\|string\\.$#" + message: '#^Method Soyhuce\\Somake\\Commands\\TestCommand\:\:qualifyClass\(\) should return class\-string but returns string\.$#' + identifier: return.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\TestCommand\\:\\:qualifyClass\\(\\) should return class\\-string but returns string\\.$#" + message: '#^Parameter \#1 \$suggestions of method Soyhuce\\Somake\\Commands\\TestCommand\:\:wrapSuggestions\(\) expects Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\ given\.$#' + identifier: argument.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\ given\\.$#" + message: '#^Parameter \$options of function Laravel\\Prompts\\select expects array\\|Illuminate\\Support\\Collection\, Illuminate\\Support\\Collection\ given\.$#' + identifier: argument.type count: 1 path: src/Commands/TestCommand.php - - message: "#^Access to an undefined property PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\PhpDocTagValueNode\\:\\:\\$type\\.$#" + message: '#^Access to an undefined property PHPStan\\PhpDocParser\\Ast\\PhpDoc\\PhpDocTagValueNode\:\:\$type\.$#' + identifier: property.notFound count: 1 path: src/Domains/DocBlock/DocBlock.php - - message: "#^Parameter \\#1 \\$subject of static method Illuminate\\\\Support\\\\Str\\:\\:after\\(\\) expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$subject of static method Illuminate\\Support\\Str\:\:after\(\) expects string, string\|null given\.$#' + identifier: argument.type count: 2 path: src/Domains/Model/Model.php - - message: "#^Unable to resolve the template type TMakeKey in call to method static method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:make\\(\\)$#" + message: '#^Unable to resolve the template type TMakeKey in call to method static method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:make\(\)$#' + identifier: argument.templateType count: 1 path: src/Domains/Test/UnitTestGenerator.php - - message: "#^Unable to resolve the template type TMakeValue in call to method static method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:make\\(\\)$#" + message: '#^Unable to resolve the template type TMakeValue in call to method static method Illuminate\\Support\\Collection\<\(int\|string\),mixed\>\:\:make\(\)$#' + identifier: argument.templateType count: 1 path: src/Domains/Test/UnitTestGenerator.php - - message: "#^Parameter \\#1 \\$callback of method Illuminate\\\\Container\\\\Container\\:\\:call\\(\\) expects \\(callable\\(\\)\\: mixed\\)\\|string, array\\{Illuminate\\\\Foundation\\\\Http\\\\FormRequest, 'rules'\\} given\\.$#" + message: '#^Parameter \#1 \$callback of method Illuminate\\Container\\Container\:\:call\(\) expects \(callable\(\)\: mixed\)\|string, array\{Illuminate\\Foundation\\Http\\FormRequest, ''rules''\} given\.$#' + identifier: argument.type count: 1 path: src/Domains/Test/UnitTestGenerators/FormRequestTestGenerator.php - - message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" + message: '#^Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class\-string\\|T of object, string given\.$#' + identifier: argument.type count: 1 path: src/Domains/Test/UnitTestGenerators/ListenerTestGenerator.php + - + message: '#^Parameter \#1 \$view of function view expects view\-string\|null, string given\.$#' + identifier: argument.type + count: 2 + path: src/Support/PendingWriter.php + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f0b5a1b..a5b7683 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -8,5 +8,4 @@ parameters: - config checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: true diff --git a/test-laravel/composer.json b/test-laravel/composer.json index 0959383..d740d6c 100644 --- a/test-laravel/composer.json +++ b/test-laravel/composer.json @@ -11,7 +11,7 @@ "php": "^8.2" }, "require-dev": { - "spatie/laravel-data": "^3.0 || ^4.0" + "spatie/laravel-data": "^4.0" }, "config": { "optimize-autoloader": true, From f0623373c4fac3f940616c68c99f02f0ca5d9762 Mon Sep 17 00:00:00 2001 From: Bastien Philippe Date: Thu, 21 Nov 2024 08:48:08 +0100 Subject: [PATCH 3/5] Drop support for Laravel 10 --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 7976d87..29aa27d 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ "php": "^8.2", "composer-runtime-api": "^2.0", "composer/class-map-generator": "^1.4", - "illuminate/console": "^10.17.1 || ^11.0", - "illuminate/contracts": "^10.17.1 || ^11.0", - "illuminate/filesystem": "^10.17.1 || ^11.0", - "illuminate/support": "^10.17.1 || ^11.0", + "illuminate/console": "^11.0", + "illuminate/contracts": "^11.0", + "illuminate/filesystem": "^11.0", + "illuminate/support": "^11.0", "laravel/prompts": "^0.3.1", "phpstan/phpdoc-parser": "^2.0", "spatie/fork": "^1.1", @@ -30,14 +30,14 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.7", - "nunomaduro/collision": "^7.7 || ^8.0", + "nunomaduro/collision": "^8.0", "larastan/larastan": "^3.0", - "orchestra/testbench": "^8.0 || ^9.0", + "orchestra/testbench": "^9.0", "pestphp/pest": "^2.12", "pestphp/pest-plugin-laravel": "^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^2.0", - "spatie/laravel-data": "^3.0 || ^4.0", + "spatie/laravel-data": "^4.0", "spatie/pest-plugin-snapshots": "^2.0.1", "test-laravel/test-laravel": "*" }, From 496e3fdd830b9a4b7aefaf6e40ba3285b1d1aa3e Mon Sep 17 00:00:00 2001 From: Bastien Philippe Date: Thu, 21 Nov 2024 08:53:55 +0100 Subject: [PATCH 4/5] Fix readme --- .github/workflows/php-cs-fixer.yml | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index 96e9a2d..6b3a11c 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -1,4 +1,4 @@ -name: Check & fix styling +name: Fix PHP code style issues on: [push] diff --git a/README.md b/README.md index 1f80896..b0d4fae 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # An opinionated package to generate classes in your Laravel project [![Latest Version on Packagist](https://img.shields.io/packagist/v/soyhuce/laravel-somake.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-somake) -[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-somake/run-tests?label=tests)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3Arun-tests+branch%3Amain) -[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-somake/Check%20&%20fix%20styling?label=code%20style)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) -[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-somake/PHPStan?label=phpstan)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3APHPStan+branch%3Amain) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/soyhuce/laravel-somake/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3Arun-tests+branch%3Amain) +[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/soyhuce/laravel-somake/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) +[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-somake/phpstan.yml?branch=main&label=PHPStan&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"PHPStan"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/soyhuce/laravel-somake.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-somake) A set of commands to easily generate classes on the right place. From 068239c4c0ff9b5ea626615e515f11a282b4124e Mon Sep 17 00:00:00 2001 From: Bastien Philippe Date: Thu, 21 Nov 2024 08:56:07 +0100 Subject: [PATCH 5/5] Fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0d4fae..834f2a1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Latest Version on Packagist](https://img.shields.io/packagist/v/soyhuce/laravel-somake.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-somake) [![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/soyhuce/laravel-somake/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3Arun-tests+branch%3Amain) [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/soyhuce/laravel-somake/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) -[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-somake/phpstan.yml?branch=main&label=PHPStan&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"PHPStan"+branch%3Amain) +[![GitHub PHPStan Action Status](https://img.shields.io/github/actions/workflow/status/soyhuce/laravel-somake/phpstan.yml?branch=main&label=PHPStan&style=flat-square)](https://github.com/soyhuce/laravel-somake/actions?query=workflow%3A"PHPStan"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/soyhuce/laravel-somake.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-somake) A set of commands to easily generate classes on the right place.