Skip to content

Commit

Permalink
Merge pull request #62 from arokettu/81-ctype-digit
Browse files Browse the repository at this point in the history
Cast $raw to string to suppress ctype_digit deprecation
  • Loading branch information
harikt authored Feb 19, 2022
2 parents bdd0be7 + ecaa826 commit 75e4ae4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Escaper/AbstractEscaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ public function getEncoding()
*
* @param string $regex The regex to determine what characters to replace.
*
* @return mixed The escaped value.
* @return string The escaped value.
*
*/
protected function replace($raw, $regex)
{
$raw = (string) $raw;

// pre-empt replacement
if ($raw === '' || ctype_digit($raw)) {
return $raw;
Expand Down
4 changes: 3 additions & 1 deletion src/Escaper/HtmlEscaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ public function __construct($flags = null, $encoding = null)
*
* @param mixed $raw The value to be escaped.
*
* @return mixed The escaped value.
* @return string The escaped value.
*
*/
public function __invoke($raw)
{
$raw = (string) $raw;

// pre-empt escaping
if ($raw === '' || ctype_digit($raw)) {
return $raw;
Expand Down

0 comments on commit 75e4ae4

Please sign in to comment.