From c07fb6c71466db452775ca0d96e8eb11b45573f1 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Sat, 15 Jun 2024 23:10:49 +0200 Subject: [PATCH] fix code style --- .php-cs-fixer.php | 25 +++++++++++++++++++-- autoload/functions_oxDIC.php | 10 +++++---- d3DicException.php | 8 ++++--- d3DicHandler.php | 11 ++++----- d3DicHandlerInterface.php | 8 ++++--- d3DicUtilities.php | 8 ++++--- definitionFileContainer.php | 8 ++++--- rector.php | 13 +++++++++++ tests/classAlias.php | 8 ++++--- tests/unit/autoload/functions_oxDICTest.php | 8 ++++--- tests/unit/d3DicExceptionTest.php | 10 +++++---- tests/unit/d3DicHandlerTest.php | 20 ++++++++++------- tests/unit/d3DicUtilitiesTest.php | 8 ++++--- tests/unit/definitionFileContainerTest.php | 8 ++++--- 14 files changed, 106 insertions(+), 47 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 9f6799a..c67cf5a 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,13 +1,34 @@ in(__DIR__) ; +$header = << +@link https://www.oxidmodule.com +EOF; + $config = new PhpCsFixer\Config(); return $config->setRules([ '@PHP80Migration' => true, - '@PSR12' => true + '@PSR12' => true, + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => $header, + 'location' => 'after_open', + 'separate' => 'both', + ], ]) ->setFinder($finder) -; \ No newline at end of file + ; \ No newline at end of file diff --git a/autoload/functions_oxDIC.php b/autoload/functions_oxDIC.php index 701fa17..0aeb2be 100644 --- a/autoload/functions_oxDIC.php +++ b/autoload/functions_oxDIC.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ @@ -33,7 +35,7 @@ function d3GetOxidDIC(): Container { try { return d3GetOxidDIC_withExceptions(); - // @codeCoverageIgnoreStart + // @codeCoverageIgnoreStart } catch (d3DicException $exception) { trigger_error($exception->getMessage(), E_USER_ERROR); } diff --git a/d3DicException.php b/d3DicException.php index eefe526..974da31 100644 --- a/d3DicException.php +++ b/d3DicException.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/d3DicHandler.php b/d3DicHandler.php index 37c2706..468f155 100644 --- a/d3DicHandler.php +++ b/d3DicHandler.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ @@ -19,7 +21,6 @@ use d3DIContainerCache; use Exception; use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Registry; -use OxidEsales\Facts\Config\ConfigFile; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -176,6 +177,6 @@ class d3DicHandler implements d3DicHandlerInterface public function getPhpDumper(ContainerBuilder $containerBuilder): PhpDumper { - return new PhpDumper( $containerBuilder); + return new PhpDumper($containerBuilder); } } diff --git a/d3DicHandlerInterface.php b/d3DicHandlerInterface.php index 9338b5e..9991649 100644 --- a/d3DicHandlerInterface.php +++ b/d3DicHandlerInterface.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/d3DicUtilities.php b/d3DicUtilities.php index f085871..6309916 100644 --- a/d3DicUtilities.php +++ b/d3DicUtilities.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/definitionFileContainer.php b/definitionFileContainer.php index fb21c88..6ffc48d 100644 --- a/definitionFileContainer.php +++ b/definitionFileContainer.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/rector.php b/rector.php index 1348169..b5e9c75 100644 --- a/rector.php +++ b/rector.php @@ -1,5 +1,18 @@ + * @link https://www.oxidmodule.com + */ + declare(strict_types=1); use Rector\Config\RectorConfig; diff --git a/tests/classAlias.php b/tests/classAlias.php index 3decb97..b48597c 100644 --- a/tests/classAlias.php +++ b/tests/classAlias.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/tests/unit/autoload/functions_oxDICTest.php b/tests/unit/autoload/functions_oxDICTest.php index 490a105..13090ce 100644 --- a/tests/unit/autoload/functions_oxDICTest.php +++ b/tests/unit/autoload/functions_oxDICTest.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/tests/unit/d3DicExceptionTest.php b/tests/unit/d3DicExceptionTest.php index a4a4e0b..1a8d222 100644 --- a/tests/unit/d3DicExceptionTest.php +++ b/tests/unit/d3DicExceptionTest.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ @@ -47,4 +49,4 @@ class d3DicExceptionTest extends TestCase $exception->getCode() ); } -} \ No newline at end of file +} diff --git a/tests/unit/d3DicHandlerTest.php b/tests/unit/d3DicHandlerTest.php index bad4a42..1db91ea 100644 --- a/tests/unit/d3DicHandlerTest.php +++ b/tests/unit/d3DicHandlerTest.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ @@ -39,7 +41,7 @@ class d3DicHandlerTest extends TestCase { parent::setUp(); - d3DicHandler::removeInstance(); + d3DicHandler::removeInstance(); } /** @@ -145,12 +147,14 @@ class d3DicHandlerTest extends TestCase $sut = $this->getMockBuilder(d3DicHandler::class) ->onlyMethods(['buildContainer', 'getFunctionNameFromTrace']) ->getMock(); - if ($throwException) - $sut->method( 'buildContainer' )->willThrowException( new Exception( 'fixture' ) ); + if ($throwException) { + $sut->method('buildContainer')->willThrowException(new Exception('fixture')); + } $sut->method('getFunctionNameFromTrace')->willReturn($circularReferenceMethod); - if ($expectException) + if ($expectException) { $this->expectException(d3DicException::class); + } $this->callMethod( $sut, @@ -400,7 +404,7 @@ class d3DicHandlerTest extends TestCase ->onlyMethods(['isProductiveMode', 'getConfigParam']) ->getMock(); $configMock->method('isProductiveMode')->willReturn($productive); - $configMock->method('getConfigParam')->willReturnMap([['iDebug', NULL, $debug]]); + $configMock->method('getConfigParam')->willReturnMap([['iDebug', null, $debug]]); /** @var d3DicHandler|MockObject $sut */ $sut = $this->getMockBuilder(d3DicHandler::class) diff --git a/tests/unit/d3DicUtilitiesTest.php b/tests/unit/d3DicUtilitiesTest.php index a24b5b9..9714975 100644 --- a/tests/unit/d3DicUtilitiesTest.php +++ b/tests/unit/d3DicUtilitiesTest.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */ diff --git a/tests/unit/definitionFileContainerTest.php b/tests/unit/definitionFileContainerTest.php index aa783b1..b7a6ec6 100644 --- a/tests/unit/definitionFileContainerTest.php +++ b/tests/unit/definitionFileContainerTest.php @@ -1,13 +1,15 @@ + * @author D3 Data Development - Daniel Seifert * @link https://www.oxidmodule.com */