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 | namespace nstdio\svg\shape; |
||
3 | |||
4 | use nstdio\svg\animation\BaseAnimation; |
||
5 | use nstdio\svg\ElementInterface; |
||
6 | use nstdio\svg\filter\BaseFilter; |
||
7 | use nstdio\svg\filter\DiffuseLighting; |
||
8 | use nstdio\svg\filter\Filter; |
||
9 | use nstdio\svg\filter\GaussianBlur; |
||
10 | use nstdio\svg\gradient\Gradient; |
||
11 | use nstdio\svg\gradient\UniformGradient; |
||
12 | use nstdio\svg\SVGElement; |
||
13 | use nstdio\svg\traits\StyleTrait; |
||
14 | use nstdio\svg\traits\TransformTrait; |
||
15 | use nstdio\svg\util\transform\Transform; |
||
16 | |||
17 | /** |
||
18 | * Class Shape |
||
19 | * |
||
20 | * @property float height The height of shape. |
||
21 | * @property float width The width of shape. |
||
22 | * @property string stroke Stroke color. |
||
23 | * @property float strokeWidth Width of stroke. |
||
24 | * @property string strokeLocation |
||
25 | * @property string style |
||
26 | * @property string fill |
||
27 | * @property string fillUrl The id part of fill attribute. |
||
28 | * @property float fillOpacity specifies the opacity of the painting operation used to paint the interior the |
||
29 | * current |
||
30 | * @property string filter |
||
31 | * @property string filterUrl The id part of filter attribute. |
||
32 | * @property string transform |
||
33 | * @package nstdio\svg\shape |
||
34 | * @author Edgar Asatryan <[email protected]> |
||
35 | */ |
||
36 | abstract class Shape extends SVGElement implements ShapeInterface |
||
37 | { |
||
38 | use StyleTrait, TransformTrait; |
||
39 | |||
40 | 74 | public function __construct(ElementInterface $parent) |
|
41 | { |
||
42 | 74 | parent::__construct($parent); |
|
43 | |||
44 | 74 | $this->transformImpl = Transform::newInstance($this->getTransformAttribute()); |
|
45 | 74 | } |
|
46 | |||
47 | /** |
||
48 | * @inheritdoc |
||
49 | */ |
||
50 | 74 | public function getTransformAttribute() |
|
51 | { |
||
52 | 74 | return $this->transform; |
|
53 | } |
||
54 | |||
55 | abstract public function getBoundingBox(); |
||
56 | |||
57 | 1 | public function setTransformAttribute($transformList) |
|
58 | { |
||
59 | 1 | $this->transform = $transformList; |
|
60 | |||
61 | 1 | return $this; |
|
62 | } |
||
63 | |||
64 | 1 | public function animate(BaseAnimation $animation) |
|
65 | { |
||
66 | 1 | $this->element->appendChild($animation->getElement()); |
|
0 ignored issues
–
show
|
|||
67 | |||
68 | 1 | return $this; |
|
69 | } |
||
70 | |||
71 | 2 | public function filterGaussianBlur($stdDeviation, $in = null, $filterId = null) |
|
72 | { |
||
73 | 2 | $filter = new Filter($this->getRoot(), $filterId); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\ElementInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
74 | 2 | $blur = new GaussianBlur($filter); |
|
75 | 2 | $blur->stdDeviation = $stdDeviation; |
|
76 | 2 | $blur->in = $in; |
|
77 | |||
78 | 2 | $this->applyFilter($filter); |
|
79 | |||
80 | 2 | return $this; |
|
81 | } |
||
82 | |||
83 | 3 | public function applyFilter(BaseFilter $filter) |
|
84 | { |
||
85 | 3 | $svg = $this->getSVG(); |
|
86 | 3 | if ($this->filter === null) { |
|
87 | 3 | $this->filterUrl = $filter->id; |
|
88 | 3 | $defs = $svg->getFirstChild(); |
|
89 | 3 | $filter->selfRemove(); |
|
90 | 3 | $defs->append($filter); |
|
91 | 3 | } else { |
|
92 | 1 | $currentFilter = $svg->getFirstChild()->getChildById($this->filterUrl); |
|
93 | 1 | if ($currentFilter !== null) { |
|
94 | 1 | foreach ($filter->getChildren() as $child) { |
|
95 | 1 | $currentFilter->append($child); |
|
96 | 1 | } |
|
97 | 1 | $filter->selfRemove(); |
|
98 | 1 | } |
|
99 | } |
||
100 | |||
101 | 3 | return $this; |
|
102 | } |
||
103 | |||
104 | 1 | public function diffusePointLight(array $pointLightConfig = [], array $diffuseLightingConfig = [], $filterId = null) |
|
105 | { |
||
106 | $pointConfig = [ |
||
107 | 1 | 'x' => $this->getCenterX(), |
|
108 | 1 | 'y' => $this->getCenterY(), |
|
109 | 1 | 'z' => 25, |
|
110 | 1 | ]; |
|
111 | 1 | foreach ($pointConfig as $key => $value) { |
|
112 | 1 | if (isset($pointLightConfig[$key])) { |
|
113 | 1 | $pointConfig[$key] = $value + $pointLightConfig[$key]; |
|
114 | 1 | } |
|
115 | 1 | } |
|
116 | 1 | $filter = DiffuseLighting::diffusePointLight($this->getRoot(), $pointConfig, $diffuseLightingConfig, $filterId); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
117 | 1 | $this->applyFilter($filter); |
|
118 | |||
119 | 1 | return $this; |
|
120 | } |
||
121 | |||
122 | abstract protected function getCenterX(); |
||
123 | |||
124 | abstract protected function getCenterY(); |
||
125 | |||
126 | 1 | public function linearGradientFromTop(array $colors, $id = null) |
|
127 | { |
||
128 | 1 | return $this->applyGradient(UniformGradient::verticalFromTop($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
129 | } |
||
130 | |||
131 | 17 | public function applyGradient(Gradient $gradient) |
|
132 | { |
||
133 | 17 | $this->fillUrl = $gradient->id; |
|
134 | |||
135 | 17 | return $this; |
|
136 | } |
||
137 | |||
138 | 1 | public function linearGradientFromBottom(array $colors, $id = null) |
|
139 | { |
||
140 | 1 | return $this->applyGradient(UniformGradient::verticalFromBottom($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
141 | } |
||
142 | |||
143 | 1 | public function linearGradientFromLeft(array $colors, $id = null) |
|
144 | { |
||
145 | 1 | return $this->applyGradient(UniformGradient::horizontalFromLeft($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
146 | } |
||
147 | |||
148 | 1 | public function linearGradientFromRight(array $colors, $id = null) |
|
149 | { |
||
150 | 1 | return $this->applyGradient(UniformGradient::horizontalFromRight($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
151 | } |
||
152 | |||
153 | 1 | public function linearGradientFromTopLeft(array $colors, $id = null) |
|
154 | { |
||
155 | 1 | return $this->applyGradient(UniformGradient::diagonalFromTopLeft($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
156 | } |
||
157 | |||
158 | 1 | public function linearGradientFromTopRight(array $colors, $id = null) |
|
159 | { |
||
160 | 1 | return $this->applyGradient(UniformGradient::diagonalFromTopRight($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
161 | } |
||
162 | |||
163 | 1 | public function linearGradientFromBottomLeft(array $colors, $id = null) |
|
164 | { |
||
165 | 1 | return $this->applyGradient(UniformGradient::diagonalFromBottomLeft($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
166 | } |
||
167 | |||
168 | 1 | public function linearGradientFromBottomRight(array $colors, $id = null) |
|
169 | { |
||
170 | 1 | return $this->applyGradient(UniformGradient::diagonalFromBottomRight($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
171 | } |
||
172 | |||
173 | 1 | public function radialGradientFromTopLeft(array $colors, $id = null) |
|
174 | { |
||
175 | 1 | return $this->applyGradient(UniformGradient::radialTopLeft($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
176 | } |
||
177 | |||
178 | 1 | public function radialGradientFromTopRight(array $colors, $id = null) |
|
179 | { |
||
180 | 1 | return $this->applyGradient(UniformGradient::radialTopRight($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
181 | } |
||
182 | |||
183 | 1 | public function radialGradientFromBottomLeft(array $colors, $id = null) |
|
184 | { |
||
185 | 1 | return $this->applyGradient(UniformGradient::radialBottomLeft($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
186 | } |
||
187 | |||
188 | 1 | public function radialGradientFromBottomRight(array $colors, $id = null) |
|
189 | { |
||
190 | 1 | return $this->applyGradient(UniformGradient::radialBottomRight($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
191 | } |
||
192 | |||
193 | 1 | public function radialGradientFromTopCenter(array $colors, $id = null) |
|
194 | { |
||
195 | 1 | return $this->applyGradient(UniformGradient::radialTopCenter($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
196 | } |
||
197 | |||
198 | 1 | public function radialGradientFromLeftCenter(array $colors, $id = null) |
|
199 | { |
||
200 | 1 | return $this->applyGradient(UniformGradient::radialLeftCenter($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
201 | } |
||
202 | |||
203 | 1 | public function radialGradientFromBottomCenter(array $colors, $id = null) |
|
204 | { |
||
205 | 1 | return $this->applyGradient(UniformGradient::radialBottomCenter($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
206 | } |
||
207 | |||
208 | 1 | public function radialGradientFromRightCenter(array $colors, $id = null) |
|
209 | { |
||
210 | 1 | return $this->applyGradient(UniformGradient::radialRightCenter($this->getRoot(), $colors, $id)); |
|
0 ignored issues
–
show
$this->getRoot() is of type object<nstdio\svg\XMLDocumentInterface> , but the function expects a object<nstdio\svg\container\ContainerInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() \nstdio\svg\gradient\Uni...etRoot(), $colors, $id) of type object<nstdio\svg\ElementInterface> is not a sub-type of object<nstdio\svg\gradient\Gradient> . It seems like you assume a concrete implementation of the interface nstdio\svg\ElementInterface to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
211 | } |
||
212 | } |
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.