Issues (281)

src/Definition/Traits/DeprecateTrait.php (1 issue)

1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Definition\Traits;
12
13
use Ynlo\GraphQLBundle\Definition\DeprecateInterface;
14
15
/**
16
 * Trait DeprecateTrait
17
 */
18
trait DeprecateTrait
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $deprecationReason;
24
25
    /**
26
     * @param string $deprecationReason
27
     *
28
     * @return DeprecateInterface
29
     */
30 33
    public function setDeprecationReason(?string $deprecationReason): DeprecateInterface
31
    {
32 33
        $this->deprecationReason = $deprecationReason;
33
34 33
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Ynlo\GraphQLBundle\Defin...n\Traits\DeprecateTrait which is incompatible with the type-hinted return Ynlo\GraphQLBundle\Definition\DeprecateInterface.
Loading history...
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function isDeprecated(): bool
41
    {
42
        return (bool) $this->getDeprecationReason();
43
    }
44
45
    /**
46
     * @return string
47
     */
48 2
    public function getDeprecationReason():?string
49
    {
50 2
        return $this->deprecationReason;
51
    }
52
}
53