diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..9f6799a --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,13 @@ +in(__DIR__) +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PHP80Migration' => true, + '@PSR12' => true + ]) + ->setFinder($finder) +; \ No newline at end of file diff --git a/d3DicHandler.php b/d3DicHandler.php index b9d8921..4c741bb 100644 --- a/d3DicHandler.php +++ b/d3DicHandler.php @@ -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() + { + } } diff --git a/d3DicHandlerInterface.php b/d3DicHandlerInterface.php index f427f58..5f08359 100644 --- a/d3DicHandlerInterface.php +++ b/d3DicHandlerInterface.php @@ -23,4 +23,4 @@ use Symfony\Component\DependencyInjection\Container; interface d3DicHandlerInterface { public static function getInstance(): ?Container; -} \ No newline at end of file +} diff --git a/definitionFileContainer.php b/definitionFileContainer.php index f9761b1..ecdb1bf 100644 --- a/definitionFileContainer.php +++ b/definitionFileContainer.php @@ -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 = []; } -} \ No newline at end of file +}