ReturnAssembler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Descriptor\Builder\Reflector\Tags;
17
18
use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
19
use phpDocumentor\Descriptor\Tag\ReturnDescriptor;
20
use phpDocumentor\Reflection\DocBlock\Tags\Return_;
21
use phpDocumentor\Reflection\Types\Compound;
22
23
/**
24
 * Constructs a new descriptor from the Reflector for an `@return` tag.
25
 *
26
 * This object will read the reflected information for the `@return` tag and create a {@see ReturnDescriptor} object
27
 * that can be used in the rest of the application and templates.
28
 */
29
class ReturnAssembler extends AssemblerAbstract
30
{
31
    /**
32
     * Creates a new Descriptor from the given Reflector.
33
     *
34
     * @param Return_ $data
35
     *
36
     * @return ReturnDescriptor
37
     */
38 1
    public function create($data)
39
    {
40 1
        $descriptor = new ReturnDescriptor($data->getName());
41 1
        $descriptor->setDescription($data->getDescription());
0 ignored issues
show
Bug introduced by
It seems like $data->getDescription() targeting phpDocumentor\Reflection...seTag::getDescription() can also be of type null or object<phpDocumentor\Ref...n\DocBlock\Description>; however, phpDocumentor\Descriptor...iptor::setDescription() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
42 1
        $descriptor->setType(AssemblerAbstract::deduplicateTypes($data->getType()));
43
44 1
        return $descriptor;
45
    }
46
}
47