This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * @link https://github.com/old-town/workflow-doctrine |
||
4 | * @author Malofeykin Andrey <[email protected]> |
||
5 | */ |
||
6 | namespace OldTown\Workflow\Spi\Doctrine\Entity; |
||
7 | |||
8 | use Doctrine\Common\Collections\ArrayCollection; |
||
9 | use Doctrine\ORM\Mapping as ORM; |
||
10 | |||
11 | |||
12 | /** |
||
13 | * Class WorkflowName |
||
14 | * |
||
15 | * @ORM\Entity() |
||
16 | * @ORM\Table(name="wf_entry") |
||
17 | * @ORM\InheritanceType(value="SINGLE_TABLE") |
||
18 | * @ORM\DiscriminatorColumn(name="type", type="string") |
||
19 | * |
||
20 | * @package OldTown\Workflow\Spi\Doctrine |
||
21 | */ |
||
22 | abstract class AbstractEntry implements EntryInterface |
||
23 | { |
||
24 | /** |
||
25 | * @ORM\Id() |
||
26 | * @ORM\Column(name="id", type="integer") |
||
27 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $id; |
||
32 | |||
33 | /** |
||
34 | * @ORM\Column(name="workflow_name", type="string", length=60) |
||
35 | * |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $workflowName; |
||
40 | |||
41 | /** |
||
42 | * @ORM\Column(name="state", type="integer") |
||
43 | * |
||
44 | * |
||
45 | * @var integer |
||
46 | */ |
||
47 | protected $state; |
||
48 | |||
49 | /** |
||
50 | * Шаги привязанные к процессу wf |
||
51 | * |
||
52 | * @ORM\OneToMany(targetEntity="Step", mappedBy="entry") |
||
53 | * |
||
54 | * @var StepInterface |
||
55 | */ |
||
56 | protected $steps; |
||
57 | |||
58 | /** |
||
59 | * AbstractEntry constructor. |
||
60 | */ |
||
61 | public function __construct() |
||
62 | { |
||
63 | $this->steps = new ArrayCollection(); |
||
0 ignored issues
–
show
|
|||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getId() |
||
70 | { |
||
71 | return $this->id; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param string $id |
||
76 | * |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function setId($id) |
||
80 | { |
||
81 | $this->id = (integer)$id; |
||
0 ignored issues
–
show
The property
$id was declared of type string , but (int) $id is of type integer . Maybe add a type cast?
This check looks for assignments to scalar types that may be of the wrong type. To ensure the code behaves as expected, it may be a good idea to add an explicit type cast. $answer = 42;
$correct = false;
$correct = (bool) $answer;
![]() |
|||
82 | |||
83 | return $this; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getWorkflowName() |
||
90 | { |
||
91 | return $this->workflowName; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * @param string $workflowName |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function setWorkflowName($workflowName) |
||
100 | { |
||
101 | $this->workflowName = (string)$workflowName; |
||
102 | |||
103 | return $this; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * @return integer |
||
108 | */ |
||
109 | public function getState() |
||
110 | { |
||
111 | return $this->state; |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * @param integer $state |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function setState($state) |
||
120 | { |
||
121 | $this->state = (integer)$state; |
||
122 | |||
123 | return $this; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * Определяет иницилазирован ли процесс workflow |
||
128 | * |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function isInitialized() |
||
132 | { |
||
133 | return $this->state > 0; |
||
134 | } |
||
135 | |||
136 | |||
137 | /** |
||
138 | * @return ArrayCollection|StepInterface[] |
||
139 | */ |
||
140 | public function getSteps() |
||
141 | { |
||
142 | return $this->steps; |
||
0 ignored issues
–
show
The return type of
return $this->steps; (OldTown\Workflow\Spi\Doctrine\Entity\StepInterface ) is incompatible with the return type declared by the interface OldTown\Workflow\Spi\Doc...ntryInterface::getSteps of type Doctrine\Common\Collecti...\Entity\StepInterface[] .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
143 | } |
||
144 | |||
145 | /** |
||
146 | * @param StepInterface $step |
||
147 | * |
||
148 | * @return $this |
||
149 | */ |
||
150 | public function addCurrentStep(StepInterface $step) |
||
151 | { |
||
152 | $step->setEntry($this); |
||
153 | if (!$this->getSteps()->contains($step)) { |
||
0 ignored issues
–
show
The method
contains() does not seem to exist on object<OldTown\Workflow\...e\Entity\StepInterface> .
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. ![]() |
|||
154 | $this->getSteps()->add($step); |
||
0 ignored issues
–
show
The method
add() does not seem to exist on object<OldTown\Workflow\...e\Entity\StepInterface> .
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. ![]() |
|||
155 | } |
||
156 | |||
157 | return $this; |
||
158 | } |
||
159 | } |
||
160 |
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..