GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Subscription::setTopic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the CCDNForum ForumBundle
5
 *
6
 * (c) CCDN (c) CodeConsortium <http://www.codeconsortium.com/>
7
 *
8
 * Available on github <http://www.github.com/codeconsortium/>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace CCDNForum\ForumBundle\Entity\Model;
15
16
use Symfony\Component\Security\Core\User\UserInterface;
17
18
use CCDNForum\ForumBundle\Entity\Forum as ConcreteForum;
19
use CCDNForum\ForumBundle\Entity\Topic as ConcreteTopic;
20
21
abstract class Subscription
22
{
23
    /** @var Topic $topic */
24
    protected $forum = null;
25
26
    /** @var Topic $topic */
27
    protected $topic = null;
28
29
    /** @var UserInterface $ownedBy */
30
    protected $ownedBy = null;
31
32
    /**
33
     *
34
     * @access public
35
     */
36
    public function __construct()
37
    {
38
        // your own logic
39
    }
40
41
    /**
42
     * Get topic
43
     *
44
     * @return Forum
0 ignored issues
show
Documentation introduced by
Should the return type not be Topic?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
45
     */
46
    public function getForum()
47
    {
48
        return $this->forum;
49
    }
50
51
    /**
52
     * Set topic
53
     *
54
     * @param  Forum        $forum
0 ignored issues
show
Documentation introduced by
Should the type for parameter $forum not be null|ConcreteForum?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
55
     * @return Subscription
56
     */
57
    public function setForum(ConcreteForum $forum = null)
58
    {
59
        $this->forum = $forum;
0 ignored issues
show
Documentation Bug introduced by
It seems like $forum can also be of type object<CCDNForum\ForumBundle\Entity\Forum>. However, the property $forum is declared as type object<CCDNForum\ForumBundle\Entity\Model\Topic>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
60
61
        return $this;
62
    }
63
64
    /**
65
     * Get topic
66
     *
67
     * @return Topic
68
     */
69
    public function getTopic()
70
    {
71
        return $this->topic;
72
    }
73
74
    /**
75
     * Set topic
76
     *
77
     * @param  Topic        $topic
0 ignored issues
show
Documentation introduced by
Should the type for parameter $topic not be null|ConcreteTopic?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
78
     * @return Subscription
79
     */
80
    public function setTopic(ConcreteTopic $topic = null)
81
    {
82
        $this->topic = $topic;
83
84
        return $this;
85
    }
86
87
    /**
88
     * Get owned_by
89
     *
90
     * @return UserInterface
91
     */
92
    public function getOwnedBy()
93
    {
94
        return $this->ownedBy;
95
    }
96
97
    /**
98
     * Set owned_by
99
     *
100
     * @param  UserInterface $ownedBy
0 ignored issues
show
Documentation introduced by
Should the type for parameter $ownedBy not be null|UserInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
101
     * @return Subscription
102
     */
103
    public function setOwnedBy(UserInterface $ownedBy = null)
104
    {
105
        $this->ownedBy = $ownedBy;
106
107
        return $this;
108
    }
109
}
110