Skip to content

Commit f7c7a81

Browse files
committed
Changed return type of escapeHtml method to a conditional, so phpstan knows it'll be a string or an array depending on the type of the input.
1 parent d731bd4 commit f7c7a81

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function canSendCommentEmail()
111111
*
112112
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
113113
* @param null|array $allowedTags
114-
* @return string
114+
* @return ($data is array ? string[] : string)
115115
*/
116116
public function escapeHtml($data, $allowedTags = null)
117117
{

app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function isCustomerNotificationNotApplicable(\Magento\Sales\Model\Order\S
134134
*
135135
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
136136
* @param null|array $allowedTags
137-
* @return string
137+
* @return ($data is array ? string[] : string)
138138
*/
139139
public function escapeHtml($data, $allowedTags = null)
140140
{

app/code/Magento/Sales/Helper/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function applySalableProductTypesFilter($collection)
156156
*
157157
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
158158
* @param null|array $allowedTags
159-
* @return string
159+
* @return ($data is array ? string[] : string)
160160
*/
161161
public function escapeHtmlWithLinks($data, $allowedTags = null)
162162
{

lib/internal/Magento/Framework/Escaper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Escaper
7272
*
7373
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
7474
* @param array|null $allowedTags
75-
* @return string|array
75+
* @return ($data is array ? string[] : string)
7676
*/
7777
public function escapeHtml($data, $allowedTags = null)
7878
{

lib/internal/Magento/Framework/View/Element/AbstractBlock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ public static function extractModuleName($className)
894894
*
895895
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
896896
* @param array|null $allowedTags
897-
* @return string
897+
* @return ($data is array ? string[] : string)
898898
* @deprecated 103.0.0 Use $escaper directly in templates and in blocks.
899899
* @see Escaper Usage
900900
*/

0 commit comments

Comments
 (0)