fix code style

This commit is contained in:
Daniel Seifert 2023-11-23 15:05:40 +01:00
parent 53a9effeac
commit dd077688ad
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
4 changed files with 38 additions and 16 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

@ -127,7 +127,8 @@ class d3DicHandler implements d3DicHandlerInterface
public function d3GetFileLoader(ContainerBuilder $container): YamlFileLoader
{
/** @var YamlFileLoader $fileLoader */
$fileLoader = oxNew(YamlFileLoader::class,
$fileLoader = oxNew(
YamlFileLoader::class,
$container,
oxNew(FileLocator::class, d3DicUtilities::getVendorDir())
);
@ -161,13 +162,15 @@ class d3DicHandler implements d3DicHandlerInterface
*/
public function buildContainer(bool $compileAndDump = true): Container
{
if (Registry::get( ConfigFile::class)->getVar( 'iDebug')) startProfile(__METHOD__);
if (Registry::get(ConfigFile::class)->getVar('iDebug')) {
startProfile(__METHOD__);
}
$config = $this->d3GetConfig();
if ( $config->isProductiveMode()
&& ! $config->getConfigParam( 'iDebug' )
&& ( ! defined( 'OXID_PHP_UNIT' ) || defined( 'D3_MODCFG_TEST' ) )
if ($config->isProductiveMode()
&& ! $config->getConfigParam('iDebug')
&& (! defined('OXID_PHP_UNIT') || defined('D3_MODCFG_TEST'))
&& file_exists($this->d3GetCacheFilePath())
) {
$container = $this->d3GetCacheContainer();
@ -178,14 +181,16 @@ class d3DicHandler implements d3DicHandlerInterface
if ($compileAndDump) {
$container->compile();
if ( ! defined( 'OXID_PHP_UNIT' ) ) {
if (! defined('OXID_PHP_UNIT')) {
$dumper = new PhpDumper($container);
file_put_contents($this->d3GetCacheFilePath(), $dumper->dump(array('class' => 'd3DIContainerCache')));
file_put_contents($this->d3GetCacheFilePath(), $dumper->dump(['class' => 'd3DIContainerCache']));
}
}
}
if (Registry::get( ConfigFile::class)->getVar( 'iDebug')) stopProfile(__METHOD__);
if (Registry::get(ConfigFile::class)->getVar('iDebug')) {
stopProfile(__METHOD__);
}
return $container;
}
@ -198,10 +203,14 @@ class d3DicHandler implements d3DicHandlerInterface
/**
* clone
*/
public function __clone() {}
public function __clone()
{
}
/**
* constructor
*/
public function __construct() {}
public function __construct()
{
}
}

View File

@ -23,4 +23,4 @@ use Symfony\Component\DependencyInjection\Container;
interface d3DicHandlerInterface
{
public static function getInstance(): ?Container;
}
}

View File

@ -22,11 +22,11 @@ class definitionFileContainer
public const TYPE_YAML = 'yml';
protected array $definitionFiles = [
self::TYPE_YAML => []
self::TYPE_YAML => [],
];
protected array $allowedTypes = [
self::TYPE_YAML
self::TYPE_YAML,
];
public function __construct()
@ -43,7 +43,7 @@ class definitionFileContainer
public function addDefinitions(string $definitionFile, string $type): void
{
if (!in_array($type, $this->allowedTypes)) {
throw new InvalidArgumentException( 'invalid definition file type');
throw new InvalidArgumentException('invalid definition file type');
}
$this->definitionFiles[$type][md5($definitionFile)] = $definitionFile;
@ -67,7 +67,7 @@ class definitionFileContainer
public function getDefinitions(string $type): array
{
if (!in_array($type, $this->allowedTypes)) {
throw new InvalidArgumentException( 'invalid definition file type');
throw new InvalidArgumentException('invalid definition file type');
}
return $this->definitionFiles[$type];
@ -99,4 +99,4 @@ class definitionFileContainer
{
$this->definitionFiles = [];
}
}
}