From 1b8188507b508a13ea18002a391fe492a5da8c68 Mon Sep 17 00:00:00 2001
From: PedroTroller <pierre.plazanet@knplabs.com>
Date: Mon, 11 Nov 2024 15:19:51 +0100
Subject: [PATCH] refactor: apply standards for php-cs-fixer

---
 .github/workflows/tests.yaml                  |  15 +-
 .php-cs-fixer.dist.php                        |  28 +++
 .php-cs-fixer.php                             | 184 ------------------
 composer.json                                 |   2 +
 src/Backend/Dompdf/DompdfAdapter.php          |   8 +-
 src/Backend/Dompdf/DompdfFactory.php          |   6 +-
 .../WkHtmlToPdf/WkHtmlToPdfAdapter.php        |   8 +-
 .../WkHtmlToPdf/WkHtmlToPdfFactory.php        |   7 +-
 src/Core/Backend/Adapter.php                  |   4 +-
 src/Core/Backend/Adapter/DOMDocumentToPdf.php |   5 +-
 src/Core/Backend/Adapter/HtmlFileToPdf.php    |   5 +-
 src/Core/Backend/Adapter/HtmlToPdf.php        |   2 +-
 src/Core/Backend/Adapter/Reconfigurable.php   |   4 +-
 src/Core/Backend/Adapter/UriToPdf.php         |   2 +-
 src/Core/Backend/Factory.php                  |   2 +-
 src/Core/Backend/Options.php                  |   6 +-
 src/Core/Backend/Options/PageOrientation.php  |   2 +-
 src/Core/Bridge/FromHtmlFileToHtmlToPdf.php   |  18 +-
 src/Core/Bridge/FromHtmlToHtmlFileToPdf.php   |   9 +-
 src/Core/Stream/FileStream.php                |  12 +-
 src/Core/Stream/StreamWrapper.php             |   2 +
 src/Core/Tests/Stream/FileStreamTest.php      |  25 ++-
 .../DependencyInjection/Configuration.php     |  16 +-
 .../BackendConfigurationFactory.php           |   2 +-
 .../DompdfConfigurationFactory.php            |   4 +-
 .../WkHtmlToPdfConfigurationFactory.php       |   4 +-
 .../DependencyInjection/SnappyExtension.php   |  12 +-
 src/Framework/Symfony/SnappyBundle.php        |   2 +-
 .../SnappyExtensionTest.php                   |  29 +--
 tools/php-cs-fixer/composer.json              |   6 -
 30 files changed, 129 insertions(+), 302 deletions(-)
 create mode 100644 .php-cs-fixer.dist.php
 delete mode 100644 .php-cs-fixer.php
 delete mode 100644 tools/php-cs-fixer/composer.json

diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 52341c17..b621fabe 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -9,12 +9,9 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - uses: shivammathur/setup-php@v2
-      - name: composer install
-        run: |
-          composer --working-dir=tools/php-cs-fixer install
+      - run: composer install
       - name: php-cs-fixer
-        run: |
-          tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --diff --show-progress=dots .
+        run: vendor/bin/php-cs-fixer fix --dry-run --diff --show-progress=dots .
   packages:
     runs-on: ubuntu-20.04
     needs: php-cs-fixer
@@ -67,9 +64,5 @@ jobs:
         #   sparse-checkout: |
         #     ${{ matrix.path }}
       - uses: shivammathur/setup-php@v2
-      - name: composer install
-        run: |
-          composer install
-      - name: vendor/bin/phpunit
-        run: |
-          vendor/bin/phpunit
+      - run: composer install
+      - run: vendor/bin/phpunit
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 00000000..71b6cb91
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+use PedroTroller\CS\Fixer\Fixers;
+use PedroTroller\CS\Fixer\RuleSetFactory;
+use PhpCsFixer\Config;
+use PhpCsFixer\Finder;
+
+$finder = (new Finder())
+    ->in(__DIR__.'/src')
+    ->append([__FILE__])
+;
+
+$rules = RuleSetFactory::create()
+    ->phpCsFixer(true)
+    ->php(8.1, true)
+    ->enable('PedroTroller/exceptions_punctuation')
+    ->enable('PedroTroller/useless_code_after_return')
+    ->disable('PedroTroller/line_break_between_method_arguments')
+    ->getRules()
+;
+
+return (new Config())
+    ->setRiskyAllowed(true)
+    ->registerCustomFixers(new Fixers())
+    ->setRules($rules)
+    ->setFinder($finder)
+;
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
deleted file mode 100644
index af4d0bf5..00000000
--- a/.php-cs-fixer.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-
-declare(strict_types = 1);
-
-return (new PhpCsFixer\Config())
-    ->setRiskyAllowed(true)
-    ->registerCustomFixers(new PedroTroller\CS\Fixer\Fixers())
-    ->setRules([
-        '@PHP71Migration' => true,
-        '@PSR1' => true,
-        '@PSR2' => true,
-        'array_indentation' => true,
-        'array_syntax' => ['syntax' => 'short'],
-        'align_multiline_comment' => [
-            'comment_type' => 'all_multiline',
-        ],
-        'array_syntax' => [
-            'syntax' => 'short',
-        ],
-        'binary_operator_spaces' => true,
-        'blank_line_after_opening_tag' => true,
-        'blank_line_before_statement' => true,
-        'cast_spaces' => true,
-        'class_attributes_separation' => true,
-        'combine_consecutive_issets' => true,
-        'combine_consecutive_unsets' => true,
-        'compact_nullable_typehint' => true,
-        'concat_space' => ['spacing' => 'one'],
-        'date_time_immutable' => true,
-        'declare_equal_normalize' => [
-            'space' => 'single',
-        ],
-        'dir_constant' => true,
-        'ereg_to_preg' => true,
-        'escape_implicit_backslashes' => true,
-        'explicit_indirect_variable' => true,
-        'explicit_string_variable' => true,
-        'fopen_flag_order' => true,
-        'fopen_flags' => true,
-        'fully_qualified_strict_types' => true,
-        'function_to_constant' => [
-            'functions' => [
-                'get_class',
-                'php_sapi_name',
-                'phpversion',
-                'pi',
-            ],
-        ],
-        'function_typehint_space' => true,
-        'global_namespace_import' => true,
-        'heredoc_to_nowdoc' => true,
-        'implode_call' => true,
-        'include' => true,
-        'is_null' => true,
-        'linebreak_after_opening_tag' => true,
-        'list_syntax' => [
-            'syntax' => 'long',
-        ],
-        'logical_operators' => true,
-        'lowercase_cast' => true,
-        'lowercase_static_reference' => true,
-        'magic_constant_casing' => true,
-        'magic_method_casing' => true,
-        'method_chaining_indentation' => true,
-        'modernize_types_casting' => true,
-        'multiline_comment_opening_closing' => true,
-        'multiline_whitespace_before_semicolons' => [
-            'strategy' => 'new_line_for_chained_calls',
-        ],
-        'native_constant_invocation' => [
-            'include' => ['@internal'],
-            'scope' => 'all',
-        ],
-        'native_function_casing' => true,
-        'native_function_invocation' => ['include' => ['@all']],
-        'native_function_type_declaration_casing' => true,
-        'new_with_braces' => true,
-        'no_alternative_syntax' => true,
-        'no_binary_string' => true,
-        'no_blank_lines_after_class_opening' => true,
-        'no_blank_lines_after_phpdoc' => true,
-        'no_empty_comment' => true,
-        'no_empty_phpdoc' => true,
-        'no_empty_statement' => true,
-        'no_extra_blank_lines' => [
-            'tokens' => ['extra'],
-        ],
-        'no_leading_import_slash' => true,
-        'no_leading_namespace_whitespace' => true,
-        'no_mixed_echo_print' => true,
-        'no_multiline_whitespace_around_double_arrow' => true,
-        'no_short_bool_cast' => true,
-        'echo_tag_syntax' => ['format' => 'long'],
-        'no_singleline_whitespace_before_semicolons' => true,
-        'no_spaces_around_offset' => [
-            'positions' => ['inside', 'outside'],
-        ],
-        'no_superfluous_elseif' => true,
-        'no_superfluous_phpdoc_tags' => false,
-        'no_trailing_comma_in_list_call' => true,
-        'no_trailing_comma_in_singleline_array' => true,
-        'no_unneeded_curly_braces' => true,
-        'no_unused_imports' => true,
-        'no_useless_else' => true,
-        'no_useless_return' => true,
-        'no_whitespace_before_comma_in_array' => true,
-        'no_whitespace_in_blank_line' => true,
-        'normalize_index_brace' => true,
-        'object_operator_without_whitespace' => true,
-        'ordered_class_elements' => [
-            'order' => [
-                'use_trait',
-                'constant_public',
-                'constant_protected',
-                'constant_private',
-                'property_public',
-                'property_protected',
-                'property_private',
-                'construct',
-                'destruct',
-                'magic',
-                'phpunit',
-                'method_public',
-                'method_protected',
-                'method_private',
-            ],
-        ],
-        'php_unit_construct' => [
-            'assertions' => [
-                'assertEquals',
-                'assertSame',
-                'assertNotEquals',
-                'assertNotSame',
-            ],
-        ],
-        // Check on other phpunit stuff
-        'phpdoc_align' => [
-            'align' => 'vertical',
-        ],
-        'phpdoc_indent' => true,
-        'general_phpdoc_tag_rename' => ['fix_inline' => true],
-        'phpdoc_no_access' => true,
-        'phpdoc_no_alias_tag' => true,
-        'phpdoc_no_empty_return' => false,
-        'phpdoc_no_package' => true,
-        'phpdoc_no_useless_inheritdoc' => true,
-        'phpdoc_order' => true,
-        'phpdoc_return_self_reference' => true,
-        'phpdoc_scalar' => true,
-        'phpdoc_separation' => true,
-        'phpdoc_single_line_var_spacing' => true,
-        'phpdoc_summary' => true,
-        'phpdoc_to_comment' => true,
-        'phpdoc_trim' => true,
-        'phpdoc_trim_consecutive_blank_line_separation' => true,
-        'phpdoc_types' => true,
-        'phpdoc_types_order' => true,
-        'phpdoc_var_annotation_correct_order' => true,
-        'phpdoc_var_without_name' => true,
-        'return_assignment' => true,
-        'return_type_declaration' => true,
-        'semicolon_after_instruction' => true,
-        'short_scalar_cast' => true,
-        'single_blank_line_before_namespace' => true,
-        'single_line_comment_style' => true,
-        'single_line_throw' => true,
-        'single_quote' => true,
-        'single_trait_insert_per_statement' => true,
-        'space_after_semicolon' => true,
-        'standardize_increment' => true,
-        'standardize_not_equals' => true,
-        'strict_comparison' => true,
-        'ternary_operator_spaces' => true,
-        'trailing_comma_in_multiline' => ['elements' => ['arrays']],
-        'trim_array_spaces' => true,
-        'unary_operator_spaces' => true,
-        'whitespace_after_comma_in_array' => true,
-        'PedroTroller/exceptions_punctuation' => true,
-        'PedroTroller/line_break_between_method_arguments' => [
-            'max-args' => 5,
-        ],
-        'PedroTroller/useless_code_after_return' => true,
-    ])
-;
diff --git a/composer.json b/composer.json
index fd30a2c9..993034fc 100644
--- a/composer.json
+++ b/composer.json
@@ -35,7 +35,9 @@
         "symfony/process": "^5.4|^6.4|^7.1"
     },
     "require-dev": {
+        "friendsofphp/php-cs-fixer": "^3.64",
         "nyholm/psr7": "^1.8",
+        "pedrotroller/php-cs-custom-fixer": "^2.33",
         "phpstan/extension-installer": "^1.4",
         "phpstan/phpstan": "^1.12",
         "phpstan/phpstan-phpunit": "^1.4",
diff --git a/src/Backend/Dompdf/DompdfAdapter.php b/src/Backend/Dompdf/DompdfAdapter.php
index 8cb2e4fe..fbb5451b 100644
--- a/src/Backend/Dompdf/DompdfAdapter.php
+++ b/src/Backend/Dompdf/DompdfAdapter.php
@@ -1,10 +1,9 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Backend\Dompdf;
 
-use DOMDocument;
 use Dompdf;
 use KNPLabs\Snappy\Core\Backend\Adapter\DOMDocumentToPdf;
 use KNPLabs\Snappy\Core\Backend\Adapter\HtmlFileToPdf;
@@ -13,7 +12,6 @@
 use KNPLabs\Snappy\Core\Backend\Options;
 use Psr\Http\Message\StreamFactoryInterface;
 use Psr\Http\Message\StreamInterface;
-use SplFileInfo;
 
 final readonly class DompdfAdapter implements DOMDocumentToPdf, HtmlFileToPdf, HtmlToPdf
 {
@@ -28,7 +26,7 @@ public function __construct(DompdfFactory $factory, Options $options, private St
         $this->options = $options;
     }
 
-    public function generateFromDOMDocument(DOMDocument $DOMDocument): StreamInterface
+    public function generateFromDOMDocument(\DOMDocument $DOMDocument): StreamInterface
     {
         $dompdf = $this->buildDompdf();
         $dompdf->loadDOM($DOMDocument);
@@ -36,7 +34,7 @@ public function generateFromDOMDocument(DOMDocument $DOMDocument): StreamInterfa
         return $this->createStream($dompdf);
     }
 
-    public function generateFromHtmlFile(SplFileInfo $file): StreamInterface
+    public function generateFromHtmlFile(\SplFileInfo $file): StreamInterface
     {
         $dompdf = $this->buildDompdf();
         $dompdf->loadHtmlFile($file->getPath());
diff --git a/src/Backend/Dompdf/DompdfFactory.php b/src/Backend/Dompdf/DompdfFactory.php
index b8e83b6b..6482eec7 100644
--- a/src/Backend/Dompdf/DompdfFactory.php
+++ b/src/Backend/Dompdf/DompdfFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Backend\Dompdf;
 
@@ -13,9 +13,7 @@
  */
 final readonly class DompdfFactory implements Factory
 {
-    public function __construct(private readonly StreamFactoryInterface $streamFactory)
-    {
-    }
+    public function __construct(private readonly StreamFactoryInterface $streamFactory) {}
 
     public function create(Options $options): DompdfAdapter
     {
diff --git a/src/Backend/WkHtmlToPdf/WkHtmlToPdfAdapter.php b/src/Backend/WkHtmlToPdf/WkHtmlToPdfAdapter.php
index 59babeb4..ace60f2d 100644
--- a/src/Backend/WkHtmlToPdf/WkHtmlToPdfAdapter.php
+++ b/src/Backend/WkHtmlToPdf/WkHtmlToPdfAdapter.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Backend\WkHtmlToPdf;
 
@@ -8,8 +8,6 @@
 use KNPLabs\Snappy\Core\Backend\Adapter\Reconfigurable;
 use KNPLabs\Snappy\Core\Backend\Options;
 use Psr\Http\Message\StreamInterface;
-use SplFileInfo;
-use Exception;
 
 final class WkHtmlToPdfAdapter implements HtmlFileToPdf
 {
@@ -32,8 +30,8 @@ public function __construct(
         $this->options = $options;
     }
 
-    public function generateFromHtmlFile(SplFileInfo $file): StreamInterface
+    public function generateFromHtmlFile(\SplFileInfo $file): StreamInterface
     {
-        throw new Exception("Not implemented for {$this->binary} with timeout {$this->timeout}.");
+        throw new \Exception("Not implemented for {$this->binary} with timeout {$this->timeout}.");
     }
 }
diff --git a/src/Backend/WkHtmlToPdf/WkHtmlToPdfFactory.php b/src/Backend/WkHtmlToPdf/WkHtmlToPdfFactory.php
index c73ba6a6..634cd93f 100644
--- a/src/Backend/WkHtmlToPdf/WkHtmlToPdfFactory.php
+++ b/src/Backend/WkHtmlToPdf/WkHtmlToPdfFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Backend\WkHtmlToPdf;
 
@@ -17,10 +17,7 @@ final class WkHtmlToPdfFactory implements Factory
      * @param non-empty-string $binary
      * @param positive-int     $timeout
      */
-    public function __construct(private readonly string $binary, private readonly int $timeout)
-    {
-
-    }
+    public function __construct(private readonly string $binary, private readonly int $timeout) {}
 
     public function create(Options $options): Adapter
     {
diff --git a/src/Core/Backend/Adapter.php b/src/Core/Backend/Adapter.php
index fad7207d..a11433d4 100644
--- a/src/Core/Backend/Adapter.php
+++ b/src/Core/Backend/Adapter.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend;
 
@@ -9,5 +9,5 @@ interface Adapter
     /**
      * @param (callable(Options $options): Options)|Options $options
      */
-    public function withOptions(Options|callable $options): static;
+    public function withOptions(callable|Options $options): static;
 }
diff --git a/src/Core/Backend/Adapter/DOMDocumentToPdf.php b/src/Core/Backend/Adapter/DOMDocumentToPdf.php
index 826ffc38..e6040137 100644
--- a/src/Core/Backend/Adapter/DOMDocumentToPdf.php
+++ b/src/Core/Backend/Adapter/DOMDocumentToPdf.php
@@ -1,14 +1,13 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend\Adapter;
 
 use KNPLabs\Snappy\Core\Backend\Adapter;
 use Psr\Http\Message\StreamInterface;
-use DOMDocument;
 
 interface DOMDocumentToPdf extends Adapter
 {
-    public function generateFromDOMDocument(DOMDocument $DOMDocument): StreamInterface;
+    public function generateFromDOMDocument(\DOMDocument $DOMDocument): StreamInterface;
 }
diff --git a/src/Core/Backend/Adapter/HtmlFileToPdf.php b/src/Core/Backend/Adapter/HtmlFileToPdf.php
index c8467952..0cb33d21 100644
--- a/src/Core/Backend/Adapter/HtmlFileToPdf.php
+++ b/src/Core/Backend/Adapter/HtmlFileToPdf.php
@@ -1,14 +1,13 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend\Adapter;
 
 use KNPLabs\Snappy\Core\Backend\Adapter;
 use Psr\Http\Message\StreamInterface;
-use SplFileInfo;
 
 interface HtmlFileToPdf extends Adapter
 {
-    public function generateFromHtmlFile(SplFileInfo $file): StreamInterface;
+    public function generateFromHtmlFile(\SplFileInfo $file): StreamInterface;
 }
diff --git a/src/Core/Backend/Adapter/HtmlToPdf.php b/src/Core/Backend/Adapter/HtmlToPdf.php
index 9638306d..2cf07e3a 100644
--- a/src/Core/Backend/Adapter/HtmlToPdf.php
+++ b/src/Core/Backend/Adapter/HtmlToPdf.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend\Adapter;
 
diff --git a/src/Core/Backend/Adapter/Reconfigurable.php b/src/Core/Backend/Adapter/Reconfigurable.php
index e7ce6e6c..43fbc513 100644
--- a/src/Core/Backend/Adapter/Reconfigurable.php
+++ b/src/Core/Backend/Adapter/Reconfigurable.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace KNPLabs\Snappy\Core\Backend\Adapter;
 
 use KNPLabs\Snappy\Core\Backend\Adapter;
@@ -21,7 +23,7 @@ trait Reconfigurable
     /**
      * @return TAdapter
      */
-    public function withOptions(Options|callable $options): static
+    public function withOptions(callable|Options $options): static
     {
         if (\is_callable($options)) {
             $options = $options($this->options);
diff --git a/src/Core/Backend/Adapter/UriToPdf.php b/src/Core/Backend/Adapter/UriToPdf.php
index e62f303d..df2c21e1 100644
--- a/src/Core/Backend/Adapter/UriToPdf.php
+++ b/src/Core/Backend/Adapter/UriToPdf.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend\Adapter;
 
diff --git a/src/Core/Backend/Factory.php b/src/Core/Backend/Factory.php
index 4a73800e..497b7eea 100644
--- a/src/Core/Backend/Factory.php
+++ b/src/Core/Backend/Factory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend;
 
diff --git a/src/Core/Backend/Options.php b/src/Core/Backend/Options.php
index 86541561..f4d319cd 100644
--- a/src/Core/Backend/Options.php
+++ b/src/Core/Backend/Options.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend;
 
@@ -11,9 +11,7 @@ final class Options
     /**
      * @param array<mixed> $extraOptions
      */
-    public function __construct(public readonly ?PageOrientation $pageOrientation, public readonly array $extraOptions)
-    {
-    }
+    public function __construct(public readonly ?PageOrientation $pageOrientation, public readonly array $extraOptions) {}
 
     public static function create(): self
     {
diff --git a/src/Core/Backend/Options/PageOrientation.php b/src/Core/Backend/Options/PageOrientation.php
index 7556cfe9..c1e64b5e 100644
--- a/src/Core/Backend/Options/PageOrientation.php
+++ b/src/Core/Backend/Options/PageOrientation.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Backend\Options;
 
diff --git a/src/Core/Bridge/FromHtmlFileToHtmlToPdf.php b/src/Core/Bridge/FromHtmlFileToHtmlToPdf.php
index c5b70662..a701b9d2 100644
--- a/src/Core/Bridge/FromHtmlFileToHtmlToPdf.php
+++ b/src/Core/Bridge/FromHtmlFileToHtmlToPdf.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Core\Bridge;
 
@@ -8,27 +8,23 @@
 use KNPLabs\Snappy\Core\Backend\Adapter\HtmlToPdf;
 use KNPLabs\Snappy\Core\Backend\Options;
 use Psr\Http\Message\StreamInterface;
-use RuntimeException;
-use SplFileInfo;
 
-final class FromHtmlFileToHtmlStringToPdf implements HtmlFileToPdf
+final class FromHtmlFileToHtmlToPdf implements HtmlFileToPdf
 {
-    public function __construct(private HtmlToPdf $adapter)
-    {
-    }
+    public function __construct(private HtmlToPdf $adapter) {}
 
-    public function generateFromHtmlFile(SplFileInfo $file): StreamInterface
+    public function generateFromHtmlFile(\SplFileInfo $file): StreamInterface
     {
-        $html = \file_get_contents($file->getPathname());
+        $html = file_get_contents($file->getPathname());
 
         if (false === $html) {
-            throw new RuntimeException('Unable to read file.');
+            throw new \RuntimeException('Unable to read file.');
         }
 
         return $this->adapter->generateFromHtml($html);
     }
 
-    public function withOptions(Options|callable $options): self
+    public function withOptions(callable|Options $options): self
     {
         return new self($this->adapter->withOptions($options));
     }
diff --git a/src/Core/Bridge/FromHtmlToHtmlFileToPdf.php b/src/Core/Bridge/FromHtmlToHtmlFileToPdf.php
index faa3961b..b33935f6 100644
--- a/src/Core/Bridge/FromHtmlToHtmlFileToPdf.php
+++ b/src/Core/Bridge/FromHtmlToHtmlFileToPdf.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Core\Bridge;
 
@@ -16,19 +16,18 @@ final class FromHtmlToHtmlFileToPdf implements HtmlToPdf
     public function __construct(
         private readonly HtmlFileToPdf $adapter,
         private readonly StreamFactoryInterface $streamFactory
-    ) {
-    }
+    ) {}
 
     public function generateFromHtml(string $html): StreamInterface
     {
         $temporary = FileStream::createTmpFile($this->streamFactory);
 
-        \file_put_contents($temporary->file->getPathname(), $html);
+        file_put_contents($temporary->file->getPathname(), $html);
 
         return $this->adapter->generateFromHtmlFile($temporary->file);
     }
 
-    public function withOptions(Options|callable $options): self
+    public function withOptions(callable|Options $options): self
     {
         return new self(
             $this->adapter->withOptions($options),
diff --git a/src/Core/Stream/FileStream.php b/src/Core/Stream/FileStream.php
index 5a8b4585..c2491347 100644
--- a/src/Core/Stream/FileStream.php
+++ b/src/Core/Stream/FileStream.php
@@ -1,34 +1,32 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Stream;
 
 use Psr\Http\Message\StreamFactoryInterface;
 use Psr\Http\Message\StreamInterface;
-use SplFileInfo;
-use UnexpectedValueException;
 
 final class FileStream implements StreamInterface
 {
     use StreamWrapper;
 
-    public function __construct(public readonly SplFileInfo $file, StreamInterface $stream)
+    public function __construct(public readonly \SplFileInfo $file, StreamInterface $stream)
     {
         $this->stream = $stream;
     }
 
     public static function createTmpFile(StreamFactoryInterface $streamFactory): self
     {
-        $stream = $streamFactory->createStreamFromResource(\tmpfile());
+        $stream = $streamFactory->createStreamFromResource(tmpfile());
         $filename = $stream->getMetadata('uri');
 
         if (false === \is_string($filename)) {
-            throw new UnexpectedValueException('Unable to retrieve the uri of the temporary file created.');
+            throw new \UnexpectedValueException('Unable to retrieve the uri of the temporary file created.');
         }
 
         return new self(
-            new SplFileInfo($filename),
+            new \SplFileInfo($filename),
             $stream
         );
     }
diff --git a/src/Core/Stream/StreamWrapper.php b/src/Core/Stream/StreamWrapper.php
index efc85e70..5240412e 100644
--- a/src/Core/Stream/StreamWrapper.php
+++ b/src/Core/Stream/StreamWrapper.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace KNPLabs\Snappy\Core\Stream;
 
 use Psr\Http\Message\StreamInterface;
diff --git a/src/Core/Tests/Stream/FileStreamTest.php b/src/Core/Tests/Stream/FileStreamTest.php
index 58aeaa1a..8895ec35 100644
--- a/src/Core/Tests/Stream/FileStreamTest.php
+++ b/src/Core/Tests/Stream/FileStreamTest.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Core\Tests\Stream;
 
@@ -8,11 +8,16 @@
 use Nyholm\Psr7\Factory\Psr17Factory;
 use PHPUnit\Framework\TestCase;
 
+/**
+ * @internal
+ *
+ * @coversNothing
+ */
 final class FileStreamTest extends TestCase
 {
     private FileStream $stream;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         $this->stream = FileStream::createTmpFile(
             new Psr17Factory(),
@@ -23,18 +28,18 @@ public function testTmpFileStreamCreateTemporaryFile(): void
     {
         $file = $this->stream->file;
 
-        $this->assertFileExists($file->getPathname());
-        $this->assertFileIsReadable($file->getPathname());
-        $this->assertFileIsWritable($file->getPathname());
+        self::assertFileExists($file->getPathname());
+        self::assertFileIsReadable($file->getPathname());
+        self::assertFileIsWritable($file->getPathname());
     }
 
     public function testTmpFileStreamReadTheFile(): void
     {
         $file = $this->stream->file;
 
-        \file_put_contents($file->getPathname(), 'the content');
+        file_put_contents($file->getPathname(), 'the content');
 
-        $this->assertEquals(
+        self::assertSame(
             (string) $this->stream,
             'the content',
         );
@@ -44,10 +49,10 @@ public function testTmpFileIsAutomaticalyRemoved(): void
     {
         $file = $this->stream->file;
 
-        $this->assertFileExists($file->getPathname());
+        self::assertFileExists($file->getPathname());
 
-        unset($this->stream);
+        $this->stream = null;
 
-        $this->assertFileDoesNotExist($file->getPathname());
+        self::assertFileDoesNotExist($file->getPathname());
     }
 }
diff --git a/src/Framework/Symfony/DependencyInjection/Configuration.php b/src/Framework/Symfony/DependencyInjection/Configuration.php
index f2705735..7349a483 100644
--- a/src/Framework/Symfony/DependencyInjection/Configuration.php
+++ b/src/Framework/Symfony/DependencyInjection/Configuration.php
@@ -1,14 +1,14 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\DependencyInjection;
 
 use KNPLabs\Snappy\Core\Backend\Options\PageOrientation;
 use KNPLabs\Snappy\Framework\Symfony\DependencyInjection\Configuration\BackendConfigurationFactory;
+use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 use Symfony\Component\Config\Definition\ConfigurationInterface;
-use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
 
 final class Configuration implements ConfigurationInterface
 {
@@ -32,9 +32,9 @@ public function getConfigTreeBuilder(): TreeBuilder
             ->arrayNode('backends')
             ->useAttributeAsKey('name')
             ->example(
-                \array_merge(
-                    ...\array_map(
-                        fn (BackendConfigurationFactory $factory): array => [
+                array_merge(
+                    ...array_map(
+                        static fn (BackendConfigurationFactory $factory): array => [
                             $factory->getKey() => [
                                 'pageOrientation' => PageOrientation::PORTRAIT->value,
                                 'options' => [],
@@ -49,7 +49,7 @@ public function getConfigTreeBuilder(): TreeBuilder
         ;
 
         foreach ($this->factories as $factory) {
-            $name = \str_replace('-', '_', $factory->getKey());
+            $name = str_replace('-', '_', $factory->getKey());
 
             $factoryNode = $backendNodeBuilder
                 ->children()
@@ -76,8 +76,8 @@ private function buildOptionsConfiguration(ArrayNodeDefinition $node): void
             ->children()
             ->enumNode('pageOrientation')
             ->values(
-                \array_map(
-                    fn (PageOrientation $pageOrientation): string => $pageOrientation->value,
+                array_map(
+                    static fn (PageOrientation $pageOrientation): string => $pageOrientation->value,
                     PageOrientation::cases(),
                 )
             )
diff --git a/src/Framework/Symfony/DependencyInjection/Configuration/BackendConfigurationFactory.php b/src/Framework/Symfony/DependencyInjection/Configuration/BackendConfigurationFactory.php
index e58b18a0..06b0ce4e 100644
--- a/src/Framework/Symfony/DependencyInjection/Configuration/BackendConfigurationFactory.php
+++ b/src/Framework/Symfony/DependencyInjection/Configuration/BackendConfigurationFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\DependencyInjection\Configuration;
 
diff --git a/src/Framework/Symfony/DependencyInjection/Configuration/DompdfConfigurationFactory.php b/src/Framework/Symfony/DependencyInjection/Configuration/DompdfConfigurationFactory.php
index 5a5dbcf4..e43992bc 100644
--- a/src/Framework/Symfony/DependencyInjection/Configuration/DompdfConfigurationFactory.php
+++ b/src/Framework/Symfony/DependencyInjection/Configuration/DompdfConfigurationFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\DependencyInjection\Configuration;
 
@@ -21,7 +21,7 @@ public function getKey(): string
 
     public function isAvailable(): bool
     {
-        return \class_exists(DompdfAdapter::class);
+        return class_exists(DompdfAdapter::class);
     }
 
     public function create(
diff --git a/src/Framework/Symfony/DependencyInjection/Configuration/WkHtmlToPdfConfigurationFactory.php b/src/Framework/Symfony/DependencyInjection/Configuration/WkHtmlToPdfConfigurationFactory.php
index 267b1b3a..d0b14d92 100644
--- a/src/Framework/Symfony/DependencyInjection/Configuration/WkHtmlToPdfConfigurationFactory.php
+++ b/src/Framework/Symfony/DependencyInjection/Configuration/WkHtmlToPdfConfigurationFactory.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\DependencyInjection\Configuration;
 
@@ -20,7 +20,7 @@ public function getKey(): string
 
     public function isAvailable(): bool
     {
-        return \class_exists(WkHtmlToPdfAdapter::class);
+        return class_exists(WkHtmlToPdfAdapter::class);
     }
 
     public function create(
diff --git a/src/Framework/Symfony/DependencyInjection/SnappyExtension.php b/src/Framework/Symfony/DependencyInjection/SnappyExtension.php
index cdd9f59a..69753df7 100644
--- a/src/Framework/Symfony/DependencyInjection/SnappyExtension.php
+++ b/src/Framework/Symfony/DependencyInjection/SnappyExtension.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\DependencyInjection;
 
@@ -23,8 +23,8 @@ public function load(array $configuration, ContainerBuilder $container): void
             $configuration
         );
 
-        $factories = \array_merge(
-            ...\array_map(
+        $factories = array_merge(
+            ...array_map(
                 static fn (BackendConfigurationFactory $factory): array => [$factory->getKey() => $factory],
                 $this->getFactories(),
             ),
@@ -63,7 +63,7 @@ public function getConfiguration(array $configuration, ContainerBuilder $contain
      */
     private function getFactories(): array
     {
-        return \array_filter(
+        return array_filter(
             [
                 new DompdfConfigurationFactory(),
                 new WkHtmlToPdfConfigurationFactory(),
@@ -100,7 +100,7 @@ private function buildOptions(string $backendName, string $backendType, array $c
 
         if (isset($configuration['pageOrientation'])) {
             if (false === \is_string($configuration['pageOrientation'])) {
-                throw new InvalidConfigurationException(\sprintf('Invalid “%s” type for “snappy.backends.%s.%s.options.pageOrientation”. The expected type is “string”.', $backendName, $backendType, \gettype($configuration['pageOrientation'])), );
+                throw new InvalidConfigurationException(\sprintf('Invalid “%s” type for “snappy.backends.%s.%s.options.pageOrientation”. The expected type is “string”.', $backendName, $backendType, \gettype($configuration['pageOrientation'])));
             }
 
             $arguments['$pageOrientation'] = PageOrientation::from($configuration['pageOrientation']);
@@ -108,7 +108,7 @@ private function buildOptions(string $backendName, string $backendType, array $c
 
         if (isset($configuration['extraOptions'])) {
             if (false === \is_array($configuration['extraOptions'])) {
-                throw new InvalidConfigurationException(\sprintf('Invalid “%s” type for “snappy.backends.%s.%s.options.extraOptions”. The expected type is “array”.', $backendName, $backendType, \gettype($configuration['extraOptions'])), );
+                throw new InvalidConfigurationException(\sprintf('Invalid “%s” type for “snappy.backends.%s.%s.options.extraOptions”. The expected type is “array”.', $backendName, $backendType, \gettype($configuration['extraOptions'])));
             }
 
             $arguments['$extraOptions'] = $configuration['extraOptions'];
diff --git a/src/Framework/Symfony/SnappyBundle.php b/src/Framework/Symfony/SnappyBundle.php
index bbc57ffb..eabd7da0 100644
--- a/src/Framework/Symfony/SnappyBundle.php
+++ b/src/Framework/Symfony/SnappyBundle.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony;
 
diff --git a/src/Framework/Symfony/Tests/DependencyInjection/SnappyExtensionTest.php b/src/Framework/Symfony/Tests/DependencyInjection/SnappyExtensionTest.php
index 9630740a..9abfa112 100644
--- a/src/Framework/Symfony/Tests/DependencyInjection/SnappyExtensionTest.php
+++ b/src/Framework/Symfony/Tests/DependencyInjection/SnappyExtensionTest.php
@@ -1,6 +1,6 @@
 <?php
 
-declare(strict_types = 1);
+declare(strict_types=1);
 
 namespace KNPLabs\Snappy\Framework\Symfony\Tests\DependencyInjection;
 
@@ -15,13 +15,18 @@
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Definition;
 
+/**
+ * @internal
+ *
+ * @coversNothing
+ */
 final class SnappyExtensionTest extends TestCase
 {
     private SnappyExtension $extension;
 
     private ContainerBuilder $container;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         $this->extension = new SnappyExtension();
         $this->container = new ContainerBuilder();
@@ -41,8 +46,8 @@ public function testLoadEmptyConfiguration(): void
             $this->container,
         );
 
-        $this->assertEquals(
-            \array_keys($this->container->getDefinitions()),
+        self::assertSame(
+            array_keys($this->container->getDefinitions()),
             [
                 'service_container',
                 StreamFactoryInterface::class,
@@ -76,8 +81,8 @@ public function testDompdfBackendConfiguration(): void
 
         $this->extension->load($configuration, $this->container);
 
-        $this->assertEquals(
-            \array_keys($this->container->getDefinitions()),
+        self::assertSame(
+            array_keys($this->container->getDefinitions()),
             [
                 'service_container',
                 StreamFactoryInterface::class,
@@ -88,25 +93,25 @@ public function testDompdfBackendConfiguration(): void
 
         $streamFactory = $this->container->get(StreamFactoryInterface::class);
 
-        $this->assertInstanceOf(StreamFactoryInterface::class, $streamFactory);
+        self::assertInstanceOf(StreamFactoryInterface::class, $streamFactory);
 
         $factory = $this->container->get('snappy.backend.myBackend.factory');
 
-        $this->assertInstanceOf(DompdfFactory::class, $factory);
-        $this->assertEquals(
+        self::assertInstanceOf(DompdfFactory::class, $factory);
+        self::assertSame(
             $factory,
             new DompdfFactory($streamFactory)
         );
 
         $backend = $this->container->get('snappy.backend.myBackend');
 
-        $this->assertInstanceOf(DompdfAdapter::class, $backend);
-        $this->assertEquals(
+        self::assertInstanceOf(DompdfAdapter::class, $backend);
+        self::assertSame(
             $factory,
             new DompdfFactory($streamFactory),
         );
 
-        $this->assertEquals(
+        self::assertSame(
             $backend,
             new DompdfAdapter(
                 $factory,
diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json
deleted file mode 100644
index 6bd14d7e..00000000
--- a/tools/php-cs-fixer/composer.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-    "require-dev": {
-        "friendsofphp/php-cs-fixer": "^3.64",
-        "pedrotroller/php-cs-custom-fixer": "^2.33"
-    }
-}