Issues (20)

CacheDirectoryPathConfigurationTrait.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Configuration;
15
16
use Ekino\Drupal\Debug\Configuration\Model\ActionConfiguration;
17
use Ekino\Drupal\Debug\Configuration\Model\DefaultsConfiguration as DefaultsConfigurationModel;
18
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
19
20
trait CacheDirectoryPathConfigurationTrait
21
{
22 19
    private static function addCacheDirectoryPathConfigurationNode(NodeBuilder $nodeBuilder, ?string $defaultCacheDirectoryPath): NodeBuilder
23
    {
24
        return $nodeBuilder
0 ignored issues
show
Bug Best Practice introduced by
The expression return $nodeBuilder->sca...heDirectoryPath)->end() returns the type null which is incompatible with the type-hinted return Symfony\Component\Config...ion\Builder\NodeBuilder.
Loading history...
25 19
            ->scalarNode('cache_directory_path')
26 19
                ->cannotBeEmpty()
27 19
                ->defaultValue($defaultCacheDirectoryPath)
28 19
            ->end();
29
    }
30
31 19
    private static function addCacheDirectoryPathConfigurationNodeFromDefaultsConfiguration(NodeBuilder $nodeBuilder, DefaultsConfigurationModel $defaultsConfiguration): NodeBuilder
32
    {
33 19
        return self::addCacheDirectoryPathConfigurationNode($nodeBuilder, $defaultsConfiguration->getCacheDirectoryPath());
34
    }
35
36 2
    private static function getConfiguredCacheDirectoryPath(ActionConfiguration $actionConfiguration): string
37
    {
38 2
        $processedConfiguration = $actionConfiguration->getProcessedConfiguration();
39
40 2
        return $processedConfiguration['cache_directory_path'];
41
    }
42
}
43