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/.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/README.md b/README.md index 1f80896..834f2a1 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/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. diff --git a/composer.json b/composer.json index f98e4e3..29aa27d 100644 --- a/composer.json +++ b/composer.json @@ -18,26 +18,26 @@ "require": { "php": "^8.2", "composer-runtime-api": "^2.0", - "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", + "composer/class-map-generator": "^1.4", + "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", "spatie/laravel-package-tools": "^1.11" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.7", - "nunomaduro/collision": "^7.7 || ^8.0", - "larastan/larastan": "^2.6.4", - "orchestra/testbench": "^8.0 || ^9.0", + "nunomaduro/collision": "^8.0", + "larastan/larastan": "^3.0", + "orchestra/testbench": "^9.0", "pestphp/pest": "^2.12", "pestphp/pest-plugin-laravel": "^2.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "spatie/laravel-data": "^3.0 || ^4.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "spatie/laravel-data": "^4.0", "spatie/pest-plugin-snapshots": "^2.0.1", "test-laravel/test-laravel": "*" }, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d9d1c3d..a0f05ca 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,257 +1,290 @@ 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\\.$#" + message: '#^Called ''env'' outside of the config directory which returns null when the config is cached, use ''config''\.$#' + identifier: larastan.noEnvCallsOutsideOfConfig count: 1 - path: src/Commands/BuilderCommand.php + path: config/somake.php - - message: "#^Method Soyhuce\\\\Somake\\\\Commands\\\\BuilderCommand\\:\\:askModel\\(\\) should return class\\-string\\ but returns array\\|bool\\|string\\.$#" + 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\\<\\(int\\|string\\), 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: "#^Left side of && is always true\\.$#" + 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\\.$#" - count: 3 + 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\\<\\(int\\|string\\), 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\\<\\(int\\|string\\), class\\-string\\> 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: "#^Command \"somake\\:policy\" does not have option \"model\"\\.$#" - count: 2 - path: src/Commands/PolicyCommand.php - - - - message: "#^Left side of && is always false\\.$#" + 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 array\\|bool\\|string\\.$#" - 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\\<\\(int\\|string\\), 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\\<\\(int\\|string\\), 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: "#^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\\.$#" + 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\\<\\(int\\|string\\), 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: "#^Left side of && is always true\\.$#" + 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\\.$#" - count: 3 + 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\\.$#" + 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\\:\\:disambiguateClass\\(\\) 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\\:\\:qualifyClass\\(\\) should return class\\-string but returns 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: "#^Parameter \\$options of function Laravel\\\\Prompts\\\\select expects array\\\\|Illuminate\\\\Support\\\\Collection\\, Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\), class\\-string\\> given\\.$#" + 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: "#^Access to an undefined property PHPStan\\\\PhpDocParser\\\\Ast\\\\PhpDoc\\\\PhpDocTagValueNode\\:\\:\\$type\\.$#" + 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\.$#' + 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/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; 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,