improve code style

This commit is contained in:
Daniel Seifert 2024-02-02 11:39:13 +01:00
parent 1aac154bcb
commit fae28866eb
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
9 changed files with 43 additions and 27 deletions

13
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP80Migration' => true,
'@PSR12' => true
])
->setFinder($finder)
;

View File

@ -9,6 +9,7 @@
"firephp/firephp-core": "^0.5.3" "firephp/firephp-core": "^0.5.3"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "~3.13.0",
"phpstan/phpstan": "^1.10" "phpstan/phpstan": "^1.10"
}, },
"license": "GPL-3.0", "license": "GPL-3.0",
@ -32,6 +33,8 @@
} }
], ],
"scripts": { "scripts": {
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix --config=vendor/d3/oxid-sql-logger/.php-cs-fixer.php",
"phpstan": "./vendor/bin/phpstan --configuration=vendor/d3/oxid-sql-logger/phpstan.neon analyse" "phpstan": "./vendor/bin/phpstan --configuration=vendor/d3/oxid-sql-logger/phpstan.neon analyse"
} }
} }

View File

@ -73,8 +73,8 @@ class d3FirePHP extends FirePHP
*/ */
public function trace($label): bool public function trace($label): bool
{ {
return $this->fb($label, $label, FirePHP::TRACE, array( return $this->fb($label, $label, FirePHP::TRACE, [
'trace' => debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) 'trace' => debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),
)); ]);
} }
} }

View File

@ -22,7 +22,7 @@ use OxidEsales\Eshop\Core\Registry;
class d3FirePHPHandler extends AbstractProcessingHandler class d3FirePHPHandler extends AbstractProcessingHandler
{ {
const ADD_TRACE = 'addTrace'; public const ADD_TRACE = 'addTrace';
/** /**
* @param array $record * @param array $record

View File

@ -37,7 +37,7 @@ class LoggerFactory
$handlers = (isset($configuredHandlers) && is_iterable($configuredHandlers)) ? $handlers = (isset($configuredHandlers) && is_iterable($configuredHandlers)) ?
$this->getInstancesFromHandlerList($configuredHandlers) : $this->getInstancesFromHandlerList($configuredHandlers) :
[ [
$this->getStreamHandler() $this->getStreamHandler(),
]; ];
} else { } else {
$configuredHandlers = Registry::getConfig()->getConfigParam('SqlLoggerGUIHandlers'); $configuredHandlers = Registry::getConfig()->getConfigParam('SqlLoggerGUIHandlers');
@ -46,7 +46,7 @@ class LoggerFactory
$this->getInstancesFromHandlerList($configuredHandlers) : $this->getInstancesFromHandlerList($configuredHandlers) :
[ [
$this->getBrowserConsoleHandler(), $this->getBrowserConsoleHandler(),
$this->getFirePHPHandler() $this->getFirePHPHandler(),
]; ];
} }
@ -122,7 +122,7 @@ class LoggerFactory
[ [
'D3\\OxidSqlLogger', 'D3\\OxidSqlLogger',
'Doctrine\\DBAL\\Connection', 'Doctrine\\DBAL\\Connection',
'OxidEsales\\EshopCommunity\\Core\\Database\\Adapter\\Doctrine\\Database' 'OxidEsales\\EshopCommunity\\Core\\Database\\Adapter\\Doctrine\\Database',
] ]
), ),
new Monolog\Processor\PsrLogMessageProcessor(), new Monolog\Processor\PsrLogMessageProcessor(),