Issues (45)

src/Frontend/Ast/Description.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Frontend\Ast;
13
14
use Railt\TypeSystem\Value\StringValue;
15
16
/**
17
 * Class Description
18
 */
19
class Description extends Node
20
{
21
    /**
22
     * @var StringValue|null
23
     */
24
    public ?StringValue $value = null;
25
26
    /**
27
     * Description constructor.
28
     *
29
     * @param StringValue|null $value
30
     */
31
    public function __construct(?StringValue $value)
32
    {
33
        $this->value = $value;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function __toString(): string
40
    {
41
        return $this->value->toPHPValue();
0 ignored issues
show
The method toPHPValue() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
        return $this->value->/** @scrutinizer ignore-call */ toPHPValue();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
    }
43
44
    /**
45
     * @param StringValue|null $description
46
     * @return static
47
     */
48
    public static function create(?StringValue $description): self
49
    {
50
        return new static($description);
51
    }
52
}
53