Files
pterodactyl-panel/app/Http/Controllers
DarkZmaj be0509dfb7 Apply the Rector changes reported on the current branch (#7251)
## 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.
2026-10-06 15:16:49 +01:00
..
2026-10-06 13:13:39 +01:00
2026-10-05 18:10:18 -04:00