diff --git a/CHANGELOG.md b/CHANGELOG.md index a7e06a6..4835bd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ Entries below `Unreleased` are written by CI from the GitHub release body — se ## [Unreleased] ### Fixed +- **`composer rector` failed with `Class "Rector\Transform\ValueObject\ArrayDimFetchToMethodCall" not found`.** + rector/rector 2.8.0 removed that class, and driftingly/rector-laravel 2.7.0, which `^2.3` still allowed beside + it, uses it in its array-access set. The floor is now `^2.7.1`, the first release without it, so the required + `rector` check cannot resolve the broken pair. - **The code-style CI job was formatting against Pint's defaults, not the shared laranail config.** `fix-php-code-style-issues.yml` ran `aglipanci/laravel-pint-action` with `configPath: pint.json` - a file this package does not ship. Pint handed a config path that does not exist falls back to its diff --git a/composer.json b/composer.json index 2245960..f2a5821 100644 --- a/composer.json +++ b/composer.json @@ -87,7 +87,7 @@ "symfony/process": "^7.4 || ^8.0" }, "require-dev": { - "driftingly/rector-laravel": "^2.3", + "driftingly/rector-laravel": "^2.7.1", "laranail/phone": "^0.1", "laranail/validation-js": "^0.1", "larastan/larastan": "^3.9.3", diff --git a/rector.php b/rector.php index 008a7b7..b77ab92 100644 --- a/rector.php +++ b/rector.php @@ -17,6 +17,7 @@ use Rector\CodeQuality\Rector\BooleanOr\RepeatedOrEqualToInArrayRector; use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector; use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; +use RectorLaravel\Rector\Class_\RemoveDefaultAuthorizeTrueFromFormRequestRector; use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector; return RectorConfig::configure() @@ -81,6 +82,11 @@ // links without changing their subject — both produce failing // (or nonsensical) assertions. mrpunyapal/rector-pest 0.2.17. UseToMatchRector::class, + // rector-laravel 2.7 deletes an authorize() that returns true. Laravel + // treats a missing authorize() as authorized, so src behaves the same, + // but the test fixtures define it on purpose (AuthorizedEach..., + // MergeRulesBaseRequest) to cover the path where the method exists. + RemoveDefaultAuthorizeTrueFromFormRequestRector::class, // Hot-path closure allocates a literal array on every invocation // when in_array() is used. Explicit === comparisons avoid that. RepeatedOrEqualToInArrayRector::class => [ diff --git a/src/Commands/DoctorCommand.php b/src/Commands/DoctorCommand.php index 18f1771..b93f4e8 100644 --- a/src/Commands/DoctorCommand.php +++ b/src/Commands/DoctorCommand.php @@ -40,7 +40,7 @@ public function handle(RuleRegistrar $registrar): int return is_array($config) && $config !== [] ? ['OK', 'flat laranail.validation key present'] - : ['FAIL', 'config(\'laranail.validation\') is empty — provider not registered?']; + : ['FAIL', "config('laranail.validation') is empty — provider not registered?"]; }], ['rule registry', function () use ($registrar): array { $count = count($registrar->classes()); diff --git a/src/Exceptions/TypedBuilderHint.php b/src/Exceptions/TypedBuilderHint.php index 4f72b49..88dc9bc 100644 --- a/src/Exceptions/TypedBuilderHint.php +++ b/src/Exceptions/TypedBuilderHint.php @@ -113,9 +113,9 @@ public static function for(string $method): ?string private static function specialCase(string $method): ?string { return match ($method) { - 'accepted' => 'Use `FluentRule::accepted()` for permissive accepted values (`\'yes\'`, `\'on\'`, `\'1\'`, `true`). Avoid `FluentRule::boolean()->accepted()` — the `boolean` base rule rejects `\'yes\'`/`\'on\'`.', + 'accepted' => "Use `FluentRule::accepted()` for permissive accepted values (`'yes'`, `'on'`, `'1'`, `true`). Avoid `FluentRule::boolean()->accepted()` — the `boolean` base rule rejects `'yes'`/`'on'`.", 'declined' => "Use `FluentRule::boolean()->declined(...)` for strict boolean-only input. If HTML form values (`'no'`, `'off'`) need to pass, use `->rule('declined')` on the untyped builder instead.", - 'size' => 'No `size()` method — use `->exactly(...)` on a typed builder. (This package renames Laravel\'s `size:` rule to `exactly()` for clarity.)', + 'size' => "No `size()` method — use `->exactly(...)` on a typed builder. (This package renames Laravel's `size:` rule to `exactly()` for clarity.)", 'gt', 'gte', 'lt', 'lte' => 'No `gt()`/`lt()` methods — use `FluentRule::numeric()->greaterThan(FIELD)`, `->greaterThanOrEqualTo(FIELD)`, `->lessThan(FIELD)`, `->lessThanOrEqualTo(FIELD)`.', 'alphaNum' => 'No `alphaNum()` method — use `FluentRule::string()->alphaNumeric(...)`.', 'contains' => 'Use `FluentRule::array()->contains(...)` (this package exposes `contains` on `array()`, not `string()`).', diff --git a/tests/Rules/Markup/XmlTest.php b/tests/Rules/Markup/XmlTest.php index b7cacbd..55374f0 100644 --- a/tests/Rules/Markup/XmlTest.php +++ b/tests/Rules/Markup/XmlTest.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Illuminate\Support\Facades\File; use Illuminate\Contracts\Translation\Translator; use Simtabi\Laranail\Validation\Rules\Markup\Xml; use Illuminate\Translation\PotentiallyTranslatedString; @@ -69,7 +70,7 @@ ->and(ruleAccepts($rule, 'ten'))->toBeFalse() ->and(ruleAccepts($rule, '10.50'))->toBeFalse(); - @unlink($schema); + File::delete($schema); }); it('blames the deployment, not the document, when the schema is missing', function (): void {