1 | <?php |
||
2 | |||
3 | namespace Drupal\graphql\GraphQL\Cache; |
||
4 | |||
5 | use Drupal\Core\Cache\CacheableDependencyInterface; |
||
0 ignored issues
–
show
|
|||
6 | use Drupal\Core\Cache\CacheableMetadata; |
||
0 ignored issues
–
show
The type
Drupal\Core\Cache\CacheableMetadata was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | use Drupal\graphql\GraphQL\ValueWrapperInterface; |
||
8 | |||
9 | /** |
||
10 | * Wrapper class for transporting cache metadata for resolved values. |
||
11 | * |
||
12 | * In some cases, especially when resolving leaf (scalar / null) values, the |
||
13 | * yielded values can't transport any cache metadata themselves. In these cases, |
||
14 | * you can use this wrapper to decorate your resolved values with cache |
||
15 | * metadata without having to implement a custom class. |
||
16 | * |
||
17 | * @see \Drupal\Core\Cache\RefinableCacheableDependencyInterface |
||
18 | */ |
||
19 | class CacheableValue extends CacheableMetadata implements ValueWrapperInterface { |
||
20 | |||
21 | /** |
||
22 | * @var mixed |
||
23 | * The actual value being wrapped. |
||
24 | */ |
||
25 | protected $value; |
||
26 | |||
27 | /** |
||
28 | * CacheableValue constructor. |
||
29 | * |
||
30 | * @param mixed $value |
||
31 | * The actual value to be wrapped. |
||
32 | * @param array $dependencies |
||
33 | * An array of cache dependencies. |
||
34 | */ |
||
35 | public function __construct($value, array $dependencies = []) { |
||
36 | $this->value = $value; |
||
37 | |||
38 | if ($value instanceof CacheableDependencyInterface) { |
||
39 | $this->addCacheableDependency($value); |
||
40 | } |
||
41 | |||
42 | foreach ($dependencies as $dependency) { |
||
43 | if ($dependency instanceof CacheableDependencyInterface) { |
||
44 | $this->addCacheableDependency($dependency); |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function setValue($value) { |
||
53 | $this->value = $value; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function getValue() { |
||
60 | return $this->value; |
||
61 | } |
||
62 | |||
63 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths