Issues (70)

Reader/Extend/QueryExtendReader.php (2 issues)

1
<?php
2
3
namespace WebStream\Annotation\Reader\Extend;
4
5
use WebStream\Container\Container;
0 ignored issues
show
The type WebStream\Container\Container 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * QueryExtendReader
9
 * @author Ryuichi Tanaka
10
 * @since 2017/01/16
11
 * @version 0.7
12
 */
13
class QueryExtendReader extends ExtendReader
14
{
15
    /**
16
     * @var array<Container> アノテーション情報リスト
17
     */
18
    private $annotationInfo;
19
/**
20
     * {@inheritdoc}
21
     */
22 4
    public function getAnnotationInfo()
23
    {
24 4
        return $this->annotationInfo;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 4
    public function read(array $annotationInfoList)
31
    {
32 4
        $func = function ($queryKey, $xpath) use ($annotationInfoList) {
33
34 4
            $queryList = [];
35 4
            foreach ($annotationInfoList as $annotationInfo) {
36 4
                $xmlObjects = $annotationInfo[$queryKey];
37 4
                foreach ($xmlObjects as $xmlObject) {
38 4
                    $xmlElement = $xmlObject->xpath($xpath);
39 4
                    if (!empty($xmlElement)) {
40 4
                            $query = ["sql" => trim($xmlElement[0]->__toString()), "method" => $xmlElement[0]->getName()];
41 4
                            $entity = $xmlElement[0]->attributes()["entity"];
42 4
                            $query["entity"] = $entity !== null ? $entity->__toString() : null;
43 4
                            $queryList[] = $query;
44
                    }
45
                }
46
            }
47
48 4
            return $queryList;
49 4
        };
50 4
        $this->annotationInfo = function ($queryKey, $xpath) use ($func) {
0 ignored issues
show
Documentation Bug introduced by
It seems like function(...) { /* ... */ } of type callable is incompatible with the declared type WebStream\Container\Container[] of property $annotationInfo.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
51
52 4
            return $func($queryKey, $xpath);
53
        };
54
    }
55
}
56