diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 29ef69ef..33f4467d 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -15,9 +15,14 @@ '@Symfony' => true, '@Symfony:risky' => true, 'array_syntax' => ['syntax' => 'short'], - 'braces' => [ - 'allow_single_line_closure' => true, - ], + 'single_space_around_construct' => true, + 'control_structure_braces' => true, + 'control_structure_continuation_position' => true, + 'declare_parentheses' => true, + 'no_multiple_statements_per_line' => true, + 'braces_position' => true, + 'statement_indentation' => true, + 'no_extra_blank_lines' => true, 'concat_space' => [ 'spacing' => 'one', ], diff --git a/src/ContainerBuilder.php b/src/ContainerBuilder.php index 7a7285c7..6615d0b6 100644 --- a/src/ContainerBuilder.php +++ b/src/ContainerBuilder.php @@ -125,10 +125,8 @@ public function build() // Mutable definition source $source->setMutableDefinitionSource(new DefinitionArray([], $autowiring)); - if ($this->sourceCache) { - if (!SourceCache::isSupported()) { - throw new \Exception('APCu is not enabled, PHP-DI cannot use it as a cache'); - } + // use cache if isSupported check passes, otherwise proceed without cache and do not throw an exception + if ($this->sourceCache && SourceCache::isSupported()) { // Wrap the source with the cache decorator $source = new SourceCache($source, $this->sourceCacheNamespace); }