-
Notifications
You must be signed in to change notification settings - Fork 27
Add Stubs for Magento's loosey-string behavior #346
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
navarr
wants to merge
1
commit into
bitExpert:master
Choose a base branch
from
navarr:feature/additional-stubs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Magento\Framework; | ||
|
||
use Stringable; | ||
|
||
/** | ||
* @phpstan-type CastableToString null|scalar|Stringable | ||
*/ | ||
class Escaper | ||
{ | ||
/** | ||
* @param CastableToString|array<CastableToString> $data | ||
* @param string[]|null $allowedTags | ||
* @return ($data is array ? string[] : string) | ||
*/ | ||
public function escapeHtml($data, array|null $allowedTags = null) {} | ||
|
||
/** | ||
* @param CastableToString $string | ||
* @param bool $escapeSingleQuote | ||
* @return string | ||
*/ | ||
public function escapeHtmlAttr($string, bool $escapeSingleQuote = true) {} | ||
|
||
/** | ||
* @param CastableToString $string | ||
* @return string | ||
*/ | ||
public function escapeUrl($string) {} | ||
|
||
/** | ||
* @param CastableToString $string | ||
* @return string | ||
*/ | ||
public function encodeUrlParam($string) {} | ||
|
||
/** | ||
* @param CastableToString $string | ||
* @return string | ||
*/ | ||
public function escapeJs($string) {} | ||
|
||
/** | ||
* @param CastableToString $string | ||
* @return string | ||
*/ | ||
public function escapeCss($string) {} | ||
|
||
/** | ||
* @param CastableToString[]|CastableToString $data | ||
* @param string $quote | ||
* @return ($data is array ? string[] : string) | ||
*/ | ||
public function escapeJsQuote($data, string $quote = '\'') {} | ||
|
||
/** | ||
* @param CastableToString $data | ||
* @return string | ||
*/ | ||
public function escapeXssInUrl($data) {} | ||
|
||
/** | ||
* @param string $data | ||
* @param bool $addSlashes | ||
* @return string | ||
*/ | ||
public function escapeQuote(string $data, bool $addSlashes = false) {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Framework\Message; | ||
|
||
use \Stringable; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
|
||
/** | ||
* Adds different types of messages to the session, and allows access to existing messages. | ||
* | ||
* @api | ||
* @since 100.0.2 | ||
*/ | ||
interface ManagerInterface | ||
{ | ||
/** | ||
* Retrieve messages | ||
* | ||
* @param bool $clear | ||
* @param string|null $group | ||
* @return Collection | ||
*/ | ||
public function getMessages($clear = false, $group = null); | ||
|
||
/** | ||
* Retrieve default message group | ||
* | ||
* @return string | ||
*/ | ||
public function getDefaultGroup(); | ||
|
||
/** | ||
* Adds new message to message collection | ||
* | ||
* @param MessageInterface $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addMessage(MessageInterface $message, $group = null); | ||
|
||
/** | ||
* Adds messages array to message collection | ||
* | ||
* @param MessageInterface[] $messages | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addMessages(array $messages, $group = null); | ||
|
||
/** | ||
* Adds new error message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
* @deprecated 100.1.0 | ||
* @see \Magento\Framework\Message\ManagerInterface::addErrorMessage | ||
*/ | ||
public function addError($message, $group = null); | ||
|
||
/** | ||
* Adds new warning message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
* @deprecated 100.1.0 | ||
* @see \Magento\Framework\Message\ManagerInterface::addWarningMessage | ||
*/ | ||
public function addWarning($message, $group = null); | ||
|
||
/** | ||
* Adds new notice message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
* @deprecated 100.1.0 | ||
* @see \Magento\Framework\Message\ManagerInterface::addNoticeMessage | ||
*/ | ||
public function addNotice($message, $group = null); | ||
|
||
/** | ||
* Adds new success message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
* @deprecated 100.1.0 | ||
* @see \Magento\Framework\Message\ManagerInterface::addSuccessMessage | ||
*/ | ||
public function addSuccess($message, $group = null); | ||
|
||
/** | ||
* Adds new error message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addErrorMessage($message, $group = null); | ||
|
||
/** | ||
* Adds new warning message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addWarningMessage($message, $group = null); | ||
|
||
/** | ||
* Adds new notice message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addNoticeMessage($message, $group = null); | ||
|
||
/** | ||
* Adds new success message | ||
* | ||
* @param null|scalar|Stringable $message | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addSuccessMessage($message, $group = null); | ||
|
||
/** | ||
* Adds new complex error message | ||
* | ||
* @param string $identifier | ||
* @param mixed[] $data | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addComplexErrorMessage($identifier, array $data = [], $group = null); | ||
|
||
/** | ||
* Adds new complex warning message | ||
* | ||
* @param string $identifier | ||
* @param mixed[] $data | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addComplexWarningMessage($identifier, array $data = [], $group = null); | ||
|
||
/** | ||
* Adds new complex notice message | ||
* | ||
* @param string $identifier | ||
* @param mixed[] $data | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addComplexNoticeMessage($identifier, array $data = [], $group = null); | ||
|
||
/** | ||
* Adds new complex success message | ||
* | ||
* @param string $identifier | ||
* @param mixed[] $data | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addComplexSuccessMessage($identifier, array $data = [], $group = null); | ||
|
||
/** | ||
* Adds messages array to message collection, without adding duplicate messages | ||
* | ||
* @param MessageInterface[] $messages | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addUniqueMessages(array $messages, $group = null); | ||
|
||
/** | ||
* Adds a message describing an exception. Does not contain Exception handling logic. | ||
* | ||
* @param \Exception $exception | ||
* @param scalar|Stringable|null $alternativeText | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
* @deprecated 100.1.0 | ||
* @see \Magento\Framework\Message\ManagerInterface::addExceptionMessage | ||
*/ | ||
public function addException(\Exception $exception, $alternativeText = null, $group = null); | ||
|
||
/** | ||
* Adds a message describing an exception. Does not contain Exception handling logic. | ||
* | ||
* @param \Exception $exception | ||
* @param scalar|Stringable|null $alternativeText | ||
* @param string|null $group | ||
* @return ManagerInterface | ||
*/ | ||
public function addExceptionMessage(\Exception $exception, $alternativeText = null, $group = null); | ||
|
||
/** | ||
* Creates identified message | ||
* | ||
* @param string $type | ||
* @param string|null $identifier | ||
* @return MessageInterface | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function createMessage($type, $identifier = null); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.