Skip to content

Fix accepted types for escaper methods #40114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public function canSendCommentEmail()
/**
* Replace links in string
*
* @param array|string $data
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
* @param null|array $allowedTags
* @return string
* @return ($data is array ? string[] : string)
*/
public function escapeHtml($data, $allowedTags = null)
{
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Sales/Block/Adminhtml/Order/View/History.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2013 Adobe
* All Rights Reserved.
*/
namespace Magento\Sales\Block\Adminhtml\Order\View;

Expand Down Expand Up @@ -132,9 +132,9 @@ public function isCustomerNotificationNotApplicable(\Magento\Sales\Model\Order\S
/**
* Replace links in string
*
* @param array|string $data
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
* @param null|array $allowedTags
* @return string
* @return ($data is array ? string[] : string)
*/
public function escapeHtml($data, $allowedTags = null)
{
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Sales/Helper/Admin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2013 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

Expand Down Expand Up @@ -154,9 +154,9 @@ public function applySalableProductTypesFilter($collection)
/**
* Escape string preserving links
*
* @param string $data
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
* @param null|array $allowedTags
* @return string
* @return ($data is array ? string[] : string)
*/
public function escapeHtmlWithLinks($data, $allowedTags = null)
{
Expand Down
12 changes: 6 additions & 6 deletions lib/internal/Magento/Framework/Escaper.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

Expand Down Expand Up @@ -70,9 +70,9 @@ class Escaper
* AllowedTags will not be escaped, except the following: script, img, embed,
* iframe, video, source, object, audio
*
* @param string|array $data
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
* @param array|null $allowedTags
* @return string|array
* @return ($data is array ? string[] : string)
*/
public function escapeHtml($data, $allowedTags = null)
{
Expand Down Expand Up @@ -267,7 +267,7 @@ private function escapeAttributeValue($name, $value)
/**
* Escape a string for the HTML attribute context
*
* @param string $string
* @param string|int|float|\Stringable $string
* @param boolean $escapeSingleQuote
* @return string
* @since 101.0.0
Expand Down Expand Up @@ -313,7 +313,7 @@ public function encodeUrlParam($string)
/**
* Escape string for the JavaScript context
*
* @param string $string
* @param string|int|float|\Stringable $string
* @return string
* @since 101.0.0
*/
Expand Down
12 changes: 6 additions & 6 deletions lib/internal/Magento/Framework/View/Element/AbstractBlock.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2014 Adobe
* All Rights Reserved.
*/
declare(strict_types=1);

Expand Down Expand Up @@ -892,9 +892,9 @@ public static function extractModuleName($className)
/**
* Escape HTML entities
*
* @param string|array $data
* @param string|int|float|\Stringable|array<string|int|float|\Stringable> $data
* @param array|null $allowedTags
* @return string
* @return ($data is array ? string[] : string)
* @deprecated 103.0.0 Use $escaper directly in templates and in blocks.
* @see Escaper Usage
*/
Expand All @@ -906,7 +906,7 @@ public function escapeHtml($data, $allowedTags = null)
/**
* Escape string for the JavaScript context
*
* @param string $string
* @param string|int|float|\Stringable $string
* @return string
* @since 101.0.0
* @deprecated 103.0.0 Use $escaper directly in templates and in blocks.
Expand All @@ -920,7 +920,7 @@ public function escapeJs($string)
/**
* Escape a string for the HTML attribute context
*
* @param string $string
* @param string|int|float|\Stringable $string
* @param boolean $escapeSingleQuote
* @return string
* @since 101.0.0
Expand Down