diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5db691bc5..adc36412a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: - name: install dependencies run: composer install --prefer-dist --no-interaction --no-progress - name: run cs-fixer - run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff + run: vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --rules=psr_autoloading continue-on-error: true - name: execute unit tests run: vendor/bin/phpunit --bootstrap bootstrap/app.php tests/Unit diff --git a/.php_cs b/.php_cs.dist similarity index 80% rename from .php_cs rename to .php_cs.dist index 2da2c8ee4..3eb33508b 100644 --- a/.php_cs +++ b/.php_cs.dist @@ -3,17 +3,9 @@ use PhpCsFixer\Config; use PhpCsFixer\Finder; -$finder = (new Finder)->in([ - 'app', - 'bootstrap', - 'config', - 'database', - 'resources/lang', - 'routes', - 'tests', -]); +$finder = (new Finder())->in(__DIR__)->exclude(['vendor', 'node_modules', 'storage', 'bootstrap/cache']); -return (new Config) +return (new Config()) ->setRiskyAllowed(true) ->setFinder($finder) ->setRules([ @@ -31,8 +23,6 @@ return (new Config) 'ordered_imports' => [ 'sortAlgorithm' => 'length', ], - 'psr0' => ['dir' => 'app'], - 'psr4' => true, 'random_api_migration' => true, 'ternary_to_null_coalescing' => true, 'yoda_style' => [ diff --git a/app/Services/Servers/ServerConfigurationStructureService.php b/app/Services/Servers/ServerConfigurationStructureService.php index 0972a4180..46e50e012 100644 --- a/app/Services/Servers/ServerConfigurationStructureService.php +++ b/app/Services/Servers/ServerConfigurationStructureService.php @@ -7,15 +7,10 @@ use Pterodactyl\Models\Server; class ServerConfigurationStructureService { - /** - * @var \Pterodactyl\Services\Servers\EnvironmentService - */ - private $environment; + private EnvironmentService $environment; /** * ServerConfigurationStructureService constructor. - * - * @param \Pterodactyl\Services\Servers\EnvironmentService $environment */ public function __construct(EnvironmentService $environment) { @@ -27,8 +22,6 @@ class ServerConfigurationStructureService * * DO NOT MODIFY THIS FUNCTION. This powers legacy code handling for the new Wings * daemon, if you modify the structure eggs will break unexpectedly. - * - * @param bool $legacy deprecated */ public function handle(Server $server, array $override = [], bool $legacy = false): array { @@ -49,10 +42,8 @@ class ServerConfigurationStructureService /** * Returns the new data format used for the Wings daemon. - * - * @return array */ - protected function returnCurrentFormat(Server $server) + protected function returnCurrentFormat(Server $server): array { return [ 'uuid' => $server->uuid, @@ -89,11 +80,7 @@ class ServerConfigurationStructureService }), 'egg' => [ 'id' => $server->egg->uuid, - 'file_denylist' => [ - 'config.yml', - '**/*.json', - ], - // 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist), + 'file_denylist' => explode(PHP_EOL, $server->egg->inherit_file_denylist), ], ]; } @@ -102,11 +89,9 @@ class ServerConfigurationStructureService * Returns the legacy server data format to continue support for old egg configurations * that have not yet been updated. * - * @return array - * * @deprecated */ - protected function returnLegacyFormat(Server $server) + protected function returnLegacyFormat(Server $server): array { return [ 'uuid' => $server->uuid, diff --git a/composer.json b/composer.json index 987d7d05d..ab9dd5a0c 100644 --- a/composer.json +++ b/composer.json @@ -68,6 +68,7 @@ } }, "scripts": { + "php-cs-fixer": "php-cs-fixer fix --diff --diff-format=udiff --config=./.php_cs.dist --rules=psr_autoloading", "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], @@ -76,7 +77,7 @@ ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover" + "@php artisan package:discover || true" ] }, "prefer-stable": true,