From 0e4d7d4a6b4d785083cdb85995ab798a8c70c267 Mon Sep 17 00:00:00 2001 From: Anthony Birkett Date: Mon, 31 May 2021 13:42:44 +0100 Subject: [PATCH] Bring in stricter CS Fixer rules. --- .php-cs-fixer.php | 27 ++ Examples/Example.php | 2 +- Examples/RconExample.php | 2 +- Examples/View.php | 66 ++--- SourceQuery/Buffer.php | 43 ++-- .../Exception/AuthenticationException.php | 4 +- .../Exception/InvalidArgumentException.php | 4 +- .../Exception/InvalidPacketException.php | 4 +- SourceQuery/Exception/SocketException.php | 4 +- .../Exception/SourceQueryException.php | 4 +- SourceQuery/Rcon/AbstractRcon.php | 12 +- SourceQuery/Rcon/GoldSourceRcon.php | 46 +--- SourceQuery/Rcon/RconInterface.php | 17 +- SourceQuery/Rcon/SourceRcon.php | 42 +--- SourceQuery/Socket/AbstractSocket.php | 78 ++---- SourceQuery/Socket/GoldSourceSocket.php | 14 +- SourceQuery/Socket/SocketInterface.php | 35 +-- SourceQuery/Socket/SocketType.php | 4 +- SourceQuery/Socket/SourceSocket.php | 13 +- SourceQuery/Socket/TestableSocket.php | 61 +---- SourceQuery/SourceQuery.php | 233 ++++++++---------- Tests/Tests.php | 77 ++---- composer.json | 6 + 23 files changed, 288 insertions(+), 510 deletions(-) create mode 100644 .php-cs-fixer.php diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..54d86a2 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,27 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR1' => true, + '@PSR12' => true, + '@PSR12:risky' => true, + '@PSR2' => true, + '@PhpCsFixer' => true, + '@PhpCsFixer:risky' => true, + '@Symfony' => true, + '@Symfony:risky' => true, + 'concat_space' => false, + 'native_constant_invocation' => false, + 'native_function_invocation' => false, + 'php_unit_fqcn_annotation' => false, + ]) + ->setFinder(PhpCsFixer\Finder::create() + ->exclude('vendor') + ->in('Examples') + ->in('SourceQuery') + ->in('Tests') + ) +; diff --git a/Examples/Example.php b/Examples/Example.php index 9ad9b85..1ce622e 100644 --- a/Examples/Example.php +++ b/Examples/Example.php @@ -4,8 +4,8 @@ declare(strict_types=1); require __DIR__ . '/../vendor/autoload.php'; -use xPaw\SourceQuery\SourceQuery; use xPaw\SourceQuery\Socket\SourceSocket; +use xPaw\SourceQuery\SourceQuery; // For the sake of this example header('Content-Type: text/plain'); diff --git a/Examples/RconExample.php b/Examples/RconExample.php index f367bbc..c07bf27 100644 --- a/Examples/RconExample.php +++ b/Examples/RconExample.php @@ -4,8 +4,8 @@ declare(strict_types=1); require __DIR__ . '/../vendor/autoload.php'; -use xPaw\SourceQuery\SourceQuery; use xPaw\SourceQuery\Socket\SourceSocket; +use xPaw\SourceQuery\SourceQuery; // For the sake of this example header('Content-Type: text/plain'); diff --git a/Examples/View.php b/Examples/View.php index bcccc40..b0f4287 100644 --- a/Examples/View.php +++ b/Examples/View.php @@ -4,8 +4,8 @@ declare(strict_types=1); require __DIR__ . '/../vendor/autoload.php'; -use xPaw\SourceQuery\SourceQuery; use xPaw\SourceQuery\Socket\SourceSocket; +use xPaw\SourceQuery\SourceQuery; $timer = microtime(true); @@ -37,28 +37,28 @@ $timer = number_format(microtime(true) - $timer, 4, '.', ''); Source Query PHP Library - +