mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
## Problem `vendor/bin/rector --dry-run` reports three files that would change, which fails the Static Analysis job of the Tests workflow. ## Reproduction Run `vendor/bin/rector --dry-run --no-progress-bar` on a clean checkout with PHP 8.4, as the workflow does. Rector lists `PasswordBroker.php`, `PasswordBrokerManager.php` and `FileController.php`. With PHP 8.3 the command reports nothing, because some rules depend on the running PHP version. ## Root cause Recent changes in these three files were merged without running Rector, so they differ from the style the project enforces. ## Fix Apply exactly the changes Rector prints: * `PasswordBroker`: compare the callback with `instanceof Closure` instead of `!== null`. * `PasswordBrokerManager`: use `throw_unless` and `throw_if` with the exception class string. * `FileController`: name the caught exception `$daemonConnectionException` after its type. ## Testing * `vendor/bin/rector --dry-run` no longer reports changes locally, and PHPStan and Pint still pass. * The authentication integration tests and the server file integration tests pass (86 tests). * I could not run Rector under PHP 8.4 locally, so the Static Analysis job of this pull request is the confirmation. ## Compatibility considerations Behaviour is unchanged. The `instanceof Closure` check is stricter than a null check only for callbacks that are not closures, and the parameter is already typed as a nullable closure.