From 07494e299d2704c3ea61b51196d1639b0897e4ec Mon Sep 17 00:00:00 2001 From: Julius Kiekbusch Date: Mon, 15 Jan 2024 17:30:37 +0100 Subject: [PATCH] [1.x] Replace custom phpdoc_align rule with php-cs-fixer option (#242) * Bump dependencies * Replace custom phpdoc_align fixer with php-cs-fixer option * fix tests and format --- app/Factories/ConfigurationFactory.php | 7 +- app/Fixers/LaravelPhpdocAlignmentFixer.php | 109 ----------- app/Output/Concerns/InteractsWithSymbols.php | 4 +- composer.json | 6 +- composer.lock | 180 +++++++++--------- resources/presets/laravel.php | 9 +- .../LaravelPhpdocAlignmentFixerTest.php | 2 + tests/Feature/FormatTest.php | 2 +- .../fixers/laravel_phpdoc_alignment.php | 3 +- 9 files changed, 107 insertions(+), 215 deletions(-) delete mode 100644 app/Fixers/LaravelPhpdocAlignmentFixer.php diff --git a/app/Factories/ConfigurationFactory.php b/app/Factories/ConfigurationFactory.php index f6df2454..9321ade8 100644 --- a/app/Factories/ConfigurationFactory.php +++ b/app/Factories/ConfigurationFactory.php @@ -2,7 +2,6 @@ namespace App\Factories; -use App\Fixers\LaravelPhpdocAlignmentFixer; use App\Repositories\ConfigurationJsonRepository; use PhpCsFixer\Config; use PhpCsFixer\Finder; @@ -46,11 +45,7 @@ public static function preset($rules) ->setFinder(self::finder()) ->setRules(array_merge($rules, resolve(ConfigurationJsonRepository::class)->rules())) ->setRiskyAllowed(true) - ->setUsingCache(true) - ->registerCustomFixers([ - // Laravel... - new LaravelPhpdocAlignmentFixer(), - ]); + ->setUsingCache(true); } /** diff --git a/app/Fixers/LaravelPhpdocAlignmentFixer.php b/app/Fixers/LaravelPhpdocAlignmentFixer.php deleted file mode 100644 index 8eb2f328..00000000 --- a/app/Fixers/LaravelPhpdocAlignmentFixer.php +++ /dev/null @@ -1,109 +0,0 @@ -isAnyTokenKindsFound([T_DOC_COMMENT]); - } - - /** - * {@inheritdoc} - */ - public function isRisky(): bool - { - return false; - } - - /** - * {@inheritdoc} - */ - public function fix(SplFileInfo $file, Tokens $tokens): void - { - for ($index = $tokens->count() - 1; $index > 0; $index--) { - if (! $tokens[$index]->isGivenKind([\T_DOC_COMMENT])) { - continue; - } - - $newContent = preg_replace_callback( - '/(?P@param)\s+(?P(?:'.TypeExpression::REGEX_TYPES.')?)\s+(?P(?:&|\.{3})?\$\S+)/ux', - fn ($matches) => $matches['tag'].' '.$matches['hint'].' '.$matches['var'], - $tokens[$index]->getContent() - ); - - if ($newContent == $tokens[$index]->getContent()) { - continue; - } - - $tokens[$index] = new Token([T_DOC_COMMENT, $newContent]); - } - } - - /** - * {@inheritdoc} - */ - public function getDefinition(): FixerDefinitionInterface - { - return new FixerDefinition('@param and type definition must be followed by two spaces.', []); - } - - /** - * {@inheritdoc} - */ - public function getPriority(): int - { - return -42; - } - - /** - * {@inheritdoc} - */ - public function supports(SplFileInfo $file): bool - { - return true; - } -} diff --git a/app/Output/Concerns/InteractsWithSymbols.php b/app/Output/Concerns/InteractsWithSymbols.php index 0dcef8d1..4feea45e 100644 --- a/app/Output/Concerns/InteractsWithSymbols.php +++ b/app/Output/Concerns/InteractsWithSymbols.php @@ -6,8 +6,8 @@ use PhpCsFixer\FixerFileProcessedEvent; /** - * @property \Symfony\Component\Console\Input\InputInterface $input - * @property \Symfony\Component\Console\Output\OutputInterface $output + * @property \Symfony\Component\Console\Input\InputInterface $input + * @property \Symfony\Component\Console\Output\OutputInterface $output */ trait InteractsWithSymbols { diff --git a/composer.json b/composer.json index 2801b0c9..50b201d1 100644 --- a/composer.json +++ b/composer.json @@ -23,13 +23,13 @@ "ext-xml": "*" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.46.0", - "illuminate/view": "^10.39.0", + "friendsofphp/php-cs-fixer": "^3.47.0", + "illuminate/view": "^10.40.0", "larastan/larastan": "^2.8.1", "laravel-zero/framework": "^10.3.0", "mockery/mockery": "^1.6.7", "nunomaduro/termwind": "^1.15.1", - "pestphp/pest": "^2.30.0" + "pestphp/pest": "^2.31.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 5cdb1edf..08f1d555 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d541f9b7d122bf39a4290abc5cce2b61", + "content-hash": "fc4889899c56fb10df589445ab6a4ef9", "packages": [], "packages-dev": [ { @@ -777,16 +777,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.46.0", + "version": "v3.47.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "be6831c9af1740470d2a773119b9273f8ac1c3d2" + "reference": "184dd992fe49169a18300dba4435212db55220f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/be6831c9af1740470d2a773119b9273f8ac1c3d2", - "reference": "be6831c9af1740470d2a773119b9273f8ac1c3d2", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/184dd992fe49169a18300dba4435212db55220f7", + "reference": "184dd992fe49169a18300dba4435212db55220f7", "shasum": "" }, "require": { @@ -856,7 +856,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.46.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.47.0" }, "funding": [ { @@ -864,7 +864,7 @@ "type": "github" } ], - "time": "2024-01-03T21:38:46+00:00" + "time": "2024-01-15T15:35:57+00:00" }, { "name": "fruitcake/php-cors", @@ -1138,7 +1138,7 @@ }, { "name": "illuminate/bus", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/bus.git", @@ -1191,16 +1191,16 @@ }, { "name": "illuminate/cache", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/cache.git", - "reference": "2386b503f88ebb13c0dae4f9610cdc2736282414" + "reference": "0301e5c583073ed4cad411df0c765ae57465cdc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/cache/zipball/2386b503f88ebb13c0dae4f9610cdc2736282414", - "reference": "2386b503f88ebb13c0dae4f9610cdc2736282414", + "url": "https://api.github.com/repos/illuminate/cache/zipball/0301e5c583073ed4cad411df0c765ae57465cdc0", + "reference": "0301e5c583073ed4cad411df0c765ae57465cdc0", "shasum": "" }, "require": { @@ -1249,20 +1249,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-15T14:08:40+00:00" + "time": "2024-01-06T19:14:05+00:00" }, { "name": "illuminate/collections", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "63fc240a047788fbc2ebe153de85cb72fce88440" + "reference": "82025fd7ac761cc50d5dbd9f9532ebf066821858" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/63fc240a047788fbc2ebe153de85cb72fce88440", - "reference": "63fc240a047788fbc2ebe153de85cb72fce88440", + "url": "https://api.github.com/repos/illuminate/collections/zipball/82025fd7ac761cc50d5dbd9f9532ebf066821858", + "reference": "82025fd7ac761cc50d5dbd9f9532ebf066821858", "shasum": "" }, "require": { @@ -1304,11 +1304,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-21T14:17:35+00:00" + "time": "2024-01-01T15:17:18+00:00" }, { "name": "illuminate/conditionable", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -1354,7 +1354,7 @@ }, { "name": "illuminate/config", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/config.git", @@ -1402,7 +1402,7 @@ }, { "name": "illuminate/console", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", @@ -1467,7 +1467,7 @@ }, { "name": "illuminate/container", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", @@ -1518,16 +1518,16 @@ }, { "name": "illuminate/contracts", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "f6bf37a272fda164f6c451407c99f820eb1eb95b" + "reference": "0b26d49d4bb0986da1ca30bcc701d5c22722576b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/f6bf37a272fda164f6c451407c99f820eb1eb95b", - "reference": "f6bf37a272fda164f6c451407c99f820eb1eb95b", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/0b26d49d4bb0986da1ca30bcc701d5c22722576b", + "reference": "0b26d49d4bb0986da1ca30bcc701d5c22722576b", "shasum": "" }, "require": { @@ -1562,7 +1562,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-10-30T00:59:22+00:00" + "time": "2023-12-28T16:46:25+00:00" }, { "name": "illuminate/database", @@ -1635,7 +1635,7 @@ }, { "name": "illuminate/events", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", @@ -1690,7 +1690,7 @@ }, { "name": "illuminate/filesystem", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", @@ -1757,16 +1757,16 @@ }, { "name": "illuminate/http", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/http.git", - "reference": "556553a9944ee2fb4c9996804204f0c4a5f85041" + "reference": "2e07f30f8ad387a9714446355ecc91dd9a1a95cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/http/zipball/556553a9944ee2fb4c9996804204f0c4a5f85041", - "reference": "556553a9944ee2fb4c9996804204f0c4a5f85041", + "url": "https://api.github.com/repos/illuminate/http/zipball/2e07f30f8ad387a9714446355ecc91dd9a1a95cf", + "reference": "2e07f30f8ad387a9714446355ecc91dd9a1a95cf", "shasum": "" }, "require": { @@ -1813,11 +1813,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-11-30T22:32:43+00:00" + "time": "2024-01-01T15:24:30+00:00" }, { "name": "illuminate/macroable", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -1863,7 +1863,7 @@ }, { "name": "illuminate/pipeline", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/pipeline.git", @@ -1911,7 +1911,7 @@ }, { "name": "illuminate/process", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/process.git", @@ -1962,16 +1962,16 @@ }, { "name": "illuminate/session", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/session.git", - "reference": "27fe05da9e1e8f5febddbb8bb0df173f2ac9fbb8" + "reference": "a095707b83327e27ba292c9c4d2413888b1f517c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/session/zipball/27fe05da9e1e8f5febddbb8bb0df173f2ac9fbb8", - "reference": "27fe05da9e1e8f5febddbb8bb0df173f2ac9fbb8", + "url": "https://api.github.com/repos/illuminate/session/zipball/a095707b83327e27ba292c9c4d2413888b1f517c", + "reference": "a095707b83327e27ba292c9c4d2413888b1f517c", "shasum": "" }, "require": { @@ -2015,20 +2015,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-11-30T22:32:43+00:00" + "time": "2023-12-29T21:53:12+00:00" }, { "name": "illuminate/support", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "6705007f24091863fefdf1f9320ac2c121cf37f1" + "reference": "76a79337200b06b4b2a7fe93902aa770d6dcec03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/6705007f24091863fefdf1f9320ac2c121cf37f1", - "reference": "6705007f24091863fefdf1f9320ac2c121cf37f1", + "url": "https://api.github.com/repos/illuminate/support/zipball/76a79337200b06b4b2a7fe93902aa770d6dcec03", + "reference": "76a79337200b06b4b2a7fe93902aa770d6dcec03", "shasum": "" }, "require": { @@ -2086,20 +2086,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-25T01:11:56+00:00" + "time": "2024-01-07T16:54:08+00:00" }, { "name": "illuminate/testing", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/testing.git", - "reference": "97e3253d9f33ef8569cbc5e9fbb5779e6e8cabac" + "reference": "00f267c51ecdf1b32fc469cd827ac9a210af24b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/testing/zipball/97e3253d9f33ef8569cbc5e9fbb5779e6e8cabac", - "reference": "97e3253d9f33ef8569cbc5e9fbb5779e6e8cabac", + "url": "https://api.github.com/repos/illuminate/testing/zipball/00f267c51ecdf1b32fc469cd827ac9a210af24b5", + "reference": "00f267c51ecdf1b32fc469cd827ac9a210af24b5", "shasum": "" }, "require": { @@ -2145,20 +2145,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-23T15:26:29+00:00" + "time": "2024-01-03T22:42:32+00:00" }, { "name": "illuminate/view", - "version": "v10.39.0", + "version": "v10.40.0", "source": { "type": "git", "url": "https://github.com/illuminate/view.git", - "reference": "2a921307ddf8d32f926d85a5999e529f178ac6f5" + "reference": "b117deeb9628849032888d2efff31e9da1248645" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/view/zipball/2a921307ddf8d32f926d85a5999e529f178ac6f5", - "reference": "2a921307ddf8d32f926d85a5999e529f178ac6f5", + "url": "https://api.github.com/repos/illuminate/view/zipball/b117deeb9628849032888d2efff31e9da1248645", + "reference": "b117deeb9628849032888d2efff31e9da1248645", "shasum": "" }, "require": { @@ -2199,7 +2199,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-23T15:09:08+00:00" + "time": "2024-01-06T17:18:01+00:00" }, { "name": "jean85/pretty-package-versions", @@ -2628,16 +2628,16 @@ }, { "name": "laravel/prompts", - "version": "v0.1.14", + "version": "v0.1.15", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6" + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", - "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6", + "url": "https://api.github.com/repos/laravel/prompts/zipball/d814a27514d99b03c85aa42b22cfd946568636c1", + "reference": "d814a27514d99b03c85aa42b22cfd946568636c1", "shasum": "" }, "require": { @@ -2679,9 +2679,9 @@ ], "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.14" + "source": "https://github.com/laravel/prompts/tree/v0.1.15" }, - "time": "2023-12-27T04:18:09+00:00" + "time": "2023-12-29T22:37:42+00:00" }, { "name": "league/flysystem", @@ -3574,16 +3574,16 @@ }, { "name": "pestphp/pest", - "version": "v2.30.0", + "version": "v2.31.0", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "97dc32f9d24b84dd071d9e89438a19e43c833f6f" + "reference": "3457841a9b124653edcfef1d5da24e6afe176f79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/97dc32f9d24b84dd071d9e89438a19e43c833f6f", - "reference": "97dc32f9d24b84dd071d9e89438a19e43c833f6f", + "url": "https://api.github.com/repos/pestphp/pest/zipball/3457841a9b124653edcfef1d5da24e6afe176f79", + "reference": "3457841a9b124653edcfef1d5da24e6afe176f79", "shasum": "" }, "require": { @@ -3591,7 +3591,7 @@ "nunomaduro/collision": "^7.10.0|^8.0.1", "nunomaduro/termwind": "^1.15.1|^2.0.0", "pestphp/pest-plugin": "^2.1.1", - "pestphp/pest-plugin-arch": "^2.5.0", + "pestphp/pest-plugin-arch": "^2.6.1", "php": "^8.1.0", "phpunit/phpunit": "^10.5.5" }, @@ -3602,8 +3602,8 @@ }, "require-dev": { "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.6.0", - "symfony/process": "^6.4.0|^7.0.0" + "pestphp/pest-plugin-type-coverage": "^2.8.0", + "symfony/process": "^6.4.0|^7.0.2" }, "bin": [ "bin/pest" @@ -3666,7 +3666,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v2.30.0" + "source": "https://github.com/pestphp/pest/tree/v2.31.0" }, "funding": [ { @@ -3678,7 +3678,7 @@ "type": "github" } ], - "time": "2023-12-28T10:36:40+00:00" + "time": "2024-01-11T15:33:20+00:00" }, { "name": "pestphp/pest-plugin", @@ -3752,23 +3752,23 @@ }, { "name": "pestphp/pest-plugin-arch", - "version": "v2.6.0", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/pestphp/pest-plugin-arch.git", - "reference": "0741696072b5db5989d63013a7b3e83358f4dfcf" + "reference": "99e86316325e55edf66c1f86dd9f990e4e2c2321" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/0741696072b5db5989d63013a7b3e83358f4dfcf", - "reference": "0741696072b5db5989d63013a7b3e83358f4dfcf", + "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/99e86316325e55edf66c1f86dd9f990e4e2c2321", + "reference": "99e86316325e55edf66c1f86dd9f990e4e2c2321", "shasum": "" }, "require": { "nunomaduro/collision": "^7.10.0|^8.0.1", "pestphp/pest-plugin": "^2.1.1", "php": "^8.1", - "ta-tikoma/phpunit-architecture-test": "^0.8.0" + "ta-tikoma/phpunit-architecture-test": "^0.8.4" }, "require-dev": { "pestphp/pest": "^2.30.0", @@ -3807,7 +3807,7 @@ "unit" ], "support": { - "source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.6.0" + "source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.6.1" }, "funding": [ { @@ -3819,7 +3819,7 @@ "type": "github" } ], - "time": "2024-01-05T11:06:22+00:00" + "time": "2024-01-11T11:21:05+00:00" }, { "name": "phar-io/manifest", @@ -4044,16 +4044,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -4096,9 +4096,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpmyadmin/sql-parser", @@ -4311,16 +4311,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.10.56", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "27816a01aea996191ee14d010f325434c0ee76fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", + "reference": "27816a01aea996191ee14d010f325434c0ee76fa", "shasum": "" }, "require": { @@ -4369,7 +4369,7 @@ "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-01-15T10:43:00+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/resources/presets/laravel.php b/resources/presets/laravel.php index 83c88c9b..f724ca32 100644 --- a/resources/presets/laravel.php +++ b/resources/presets/laravel.php @@ -137,6 +137,12 @@ 'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']], 'ordered_interfaces' => true, 'ordered_traits' => true, + 'phpdoc_align' => [ + 'align' => 'left', + 'spacing' => [ + 'param' => 2, + ], + ], 'phpdoc_indent' => true, 'phpdoc_inline_tag_normalizer' => true, 'phpdoc_no_access' => true, @@ -205,7 +211,4 @@ 'identical' => false, 'less_and_greater' => false, ], - - // Laravel - 'Laravel/laravel_phpdoc_alignment' => true, ]); diff --git a/tests/Feature/Fixers/LaravelPhpdocAlignmentFixerTest.php b/tests/Feature/Fixers/LaravelPhpdocAlignmentFixerTest.php index ee400885..a50357e0 100644 --- a/tests/Feature/Fixers/LaravelPhpdocAlignmentFixerTest.php +++ b/tests/Feature/Fixers/LaravelPhpdocAlignmentFixerTest.php @@ -14,7 +14,9 @@ /** * @param string $foo - * @param string $bar + - * @param string $x + * @param string $bar + + * @param string $x * @return string */ EOF, diff --git a/tests/Feature/FormatTest.php b/tests/Feature/FormatTest.php index 18dc8d7e..56eecfa8 100644 --- a/tests/Feature/FormatTest.php +++ b/tests/Feature/FormatTest.php @@ -10,7 +10,7 @@ expect($statusCode)->toBe(1) ->and($output) ->toContain('') - ->toContain('') + ->toContain('toContain('') ->not->toContain(sprintf('⨯ %s', implode(DIRECTORY_SEPARATOR, [ 'tests', 'Fixtures', 'with-fixable-issues', 'file.php', diff --git a/tests/Fixtures/fixers/laravel_phpdoc_alignment.php b/tests/Fixtures/fixers/laravel_phpdoc_alignment.php index 4dc9cff7..4b6d2c1e 100644 --- a/tests/Fixtures/fixers/laravel_phpdoc_alignment.php +++ b/tests/Fixtures/fixers/laravel_phpdoc_alignment.php @@ -3,9 +3,10 @@ /** * @param string $foo * @param string $bar + * @param string $x * @return string */ -function a($foo, $bar) +function a($foo, $bar, $x) { // .. }