Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,23 @@ jobs:
with:
ref: ${{ github.head_ref }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@36de00d5f5a8a4e12d443e01671daa12a18f4c79 # 2.6
# NOT aglipanci/laravel-pint-action with `configPath: pint.json`. This
# package ships no pint.json, and Pint handed a config path that does not
# exist falls back to its OWN defaults and exits 0 rather than failing. So
# this job was rewriting the code to Pint's defaults and committing that -
# while `composer pint` checks the shared laranail config. The two
# disagreed, and this one won because it pushes.
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
configPath: pint.json
verboseMode: true
php-version: '8.5'
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Fix PHP code style issues
run: composer pint-fix

- name: Pull latest changes
env:
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,22 @@ Entries below `Unreleased` are written by CI from the GitHub release body — se

## Unreleased

_Nothing yet._
### Fixed

- **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
own defaults and exits 0, so the job rewrote every touched file to the wrong style and committed
the result, while `composer pint` graded against
`vendor/laranail/package-tools/pint.json`. The job now installs dependencies and runs
`composer pint-fix`, which is the same command the `lint` gate checks. 259 files are reformatted
by this change; no behaviour is affected (6276 tests, 10486 assertions, identical before and after).

### Changed

- `PostIncDecToPreIncDecRector` is skipped. Rector rewrote `$i++` to `++$i` in 21 files and Pint's
`increment_style` rewrote every one of them back, so the two gates could never both pass.
Formatting belongs to Pint.

## v0.1.0 - 2026-08-27

Expand Down
208 changes: 104 additions & 104 deletions benchmark.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/laranail-validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

'aliases' => [
'enabled' => env('LARANAIL_VALIDATION_ALIASES', false),
'prefix' => 'laranail_',
'prefix' => 'laranail_',
],

/*
Expand Down
2 changes: 1 addition & 1 deletion rector-migrate-1.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Simtabi\Laranail\Validation\Builder\Nodes\ArrayRule;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;

/**
* The 0.x → 1.0 migration set (UPGRADING.md, v1.0.0). Run it against an
Expand Down
30 changes: 18 additions & 12 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

declare(strict_types=1);

use Rector\Config\RectorConfig;
use RectorPest\Set\PestSetList;
use RectorLaravel\Set\LaravelSetList;
use RectorPest\Rules\UseToMatchRector;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Carbon\Rector\FuncCall\DateFuncCallToCarbonRector;
use Rector\CodeQuality\Rector\BooleanOr\RepeatedOrEqualToInArrayRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\Config\RectorConfig;
use Rector\Carbon\Rector\FuncCall\DateFuncCallToCarbonRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodeQuality\Rector\BooleanOr\RepeatedOrEqualToInArrayRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use RectorLaravel\Set\LaravelSetList;
use RectorPest\Rules\UseToMatchRector;
use RectorPest\Set\PestSetList;

return RectorConfig::configure()
->withCache(
Expand All @@ -25,10 +26,10 @@
containerCacheDirectory: './.cache/rectorContainer',
)
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSkipPath(__DIR__.'/tests/Fixtures/MacroableFootgun')
->withSkipPath(__DIR__ . '/tests/Fixtures/MacroableFootgun')
->withPreparedSets(
deadCode: true,
codeQuality: true,
Expand Down Expand Up @@ -60,6 +61,11 @@
PestSetList::PEST_LARAVEL,
])
->withSkip([
// Pint owns formatting, and it disagrees: Rector rewrites $i++ to ++$i,
// Pint's laravel preset rewrites it straight back. Verified by running
// them in sequence - Rector changed 21 files, Pint reverted every one,
// so the two gates could never both pass. Formatting goes to Pint.
PostIncDecToPreIncDecRector::class,
DateFuncCallToCarbonRector::class,
NullToStrictStringFuncCallArgRector::class,
AddArrowFunctionReturnTypeRector::class,
Expand All @@ -78,6 +84,6 @@
// Hot-path closure allocates a literal array on every invocation
// when in_array() is used. Explicit === comparisons avoid that.
RepeatedOrEqualToInArrayRector::class => [
__DIR__.'/src/FastCheckCompiler.php',
__DIR__ . '/src/FastCheckCompiler.php',
],
]);
Loading