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 | * @author Patsura Dmitry https://github.com/ovr <[email protected]> |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace PHPSA; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * An Issue the compiler or an analyzer found |
||
| 10 | */ |
||
| 11 | class Issue |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @todo Description |
||
| 15 | * |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | const CATEGORY_BUG_RISK = 'Bug Risk'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @todo Description |
||
| 22 | * |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | const CATEGORY_CLARITY = 'Clarity'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @todo Description |
||
| 29 | * |
||
| 30 | * @var string |
||
| 31 | */ |
||
| 32 | const CATEGORY_COMPATIBILITY = 'Compatibility'; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @todo Description |
||
| 36 | * |
||
| 37 | * @var string |
||
| 38 | */ |
||
| 39 | const CATEGORY_COMPLEXITY = 'Complexity'; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @todo Description |
||
| 43 | * |
||
| 44 | * @var string |
||
| 45 | */ |
||
| 46 | const CATEGORY_DUPLICATION = 'Duplication'; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @todo Description |
||
| 50 | * |
||
| 51 | * @var string |
||
| 52 | */ |
||
| 53 | const CATEGORY_PERFORMANCE = 'Performance'; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @todo Description |
||
| 57 | * |
||
| 58 | * @var string |
||
| 59 | */ |
||
| 60 | const CATEGORY_SECURITY = 'Security'; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @todo Description |
||
| 64 | * |
||
| 65 | * @var string |
||
| 66 | */ |
||
| 67 | const CATEGORY_STYLE = 'Style'; |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Required. Must always be "issue". |
||
| 71 | * |
||
| 72 | * @var string |
||
| 73 | */ |
||
| 74 | protected $type = 'issue'; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Required. A unique name representing the static analysis check that emitted this issue. |
||
| 78 | * |
||
| 79 | * @var string |
||
| 80 | */ |
||
| 81 | protected $checkName; |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Required. A string explaining the issue that was detected. |
||
| 85 | * |
||
| 86 | * @var string |
||
| 87 | */ |
||
| 88 | protected $description; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Optional. A markdown snippet describing the issue, including deeper explanations and links to other resources. |
||
| 92 | * |
||
| 93 | * @var string |
||
| 94 | */ |
||
| 95 | protected $content; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * Required. At least one category indicating the nature of the issue being reported. |
||
| 99 | * |
||
| 100 | * @var string |
||
| 101 | */ |
||
| 102 | protected $categories; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Required. A Location object representing the place in the source code where the issue was discovered. |
||
| 106 | * |
||
| 107 | * @var IssueLocation |
||
| 108 | */ |
||
| 109 | protected $location; |
||
| 110 | |||
| 111 | /** |
||
| 112 | * @param string $checkName |
||
| 113 | * @param string $description |
||
| 114 | * @param IssueLocation $location |
||
| 115 | * @param array $categories |
||
| 116 | */ |
||
| 117 | public function __construct($checkName, $description, IssueLocation $location, array $categories = [self::CATEGORY_BUG_RISK]) |
||
| 118 | { |
||
| 119 | $this->checkName = $checkName; |
||
| 120 | $this->description = $description; |
||
| 121 | $this->location = $location; |
||
| 122 | $this->categories = $categories; |
||
|
0 ignored issues
–
show
|
|||
| 123 | } |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @return array |
||
| 127 | */ |
||
| 128 | public function toArray() |
||
| 129 | { |
||
| 130 | return [ |
||
| 131 | 'type' => $this->type, |
||
| 132 | 'check_name' => $this->checkName, |
||
| 133 | 'description' => $this->description, |
||
| 134 | 'location' => $this->location->toArray(), |
||
| 135 | 'categories' => $this->categories, |
||
| 136 | ]; |
||
| 137 | } |
||
| 138 | |||
| 139 | /** |
||
| 140 | * @return IssueLocation |
||
| 141 | */ |
||
| 142 | public function getLocation() |
||
| 143 | { |
||
| 144 | return $this->location; |
||
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * @return string |
||
| 149 | */ |
||
| 150 | public function getType() |
||
| 151 | { |
||
| 152 | return $this->type; |
||
| 153 | } |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @return string |
||
| 157 | */ |
||
| 158 | public function getCheckName() |
||
| 159 | { |
||
| 160 | return $this->checkName; |
||
| 161 | } |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @return string |
||
| 165 | */ |
||
| 166 | public function getDescription() |
||
| 167 | { |
||
| 168 | return $this->description; |
||
| 169 | } |
||
| 170 | } |
||
| 171 |
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..