Skip to content

Commit

Permalink
Removed unnecessary docblocks and imports from #23
Browse files Browse the repository at this point in the history
Since we now use native parameter type declarations, we no longer need
to have `@param string $param` declarations.

Also, `is_string()` and `gettype()` are no longer in use (were used when
throwing an exception based on invalid input).

Note that `@return string` is preserved: we cannot introduce native return
type declarations, as that would lead to downstream crashes in inheritance
scenarios, when the consumer didn't declare `: string` return types themselves
too.
  • Loading branch information
Ocramius committed Jun 26, 2021
1 parent f43be95 commit a7c428a
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
use function bin2hex;
use function ctype_digit;
use function function_exists;
use function gettype;
use function hexdec;
use function htmlspecialchars;
use function iconv;
use function in_array;
use function is_string;
use function mb_convert_encoding;
use function ord;
use function preg_match;
Expand Down Expand Up @@ -132,7 +130,6 @@ class Escaper
* Constructor: Single parameter allows setting of global encoding for use by
* the current object.
*
* @param string|null $encoding
* @throws Exception\InvalidArgumentException
*/
public function __construct(?string $encoding = null)
Expand Down Expand Up @@ -178,7 +175,6 @@ public function getEncoding()
* Escape a string for the HTML Body context where there are very few characters
* of special meaning. Internally this will use htmlspecialchars().
*
* @param string $string
* @return string
*/
public function escapeHtml(string $string)
Expand All @@ -191,7 +187,6 @@ public function escapeHtml(string $string)
* to escape that are not covered by htmlspecialchars() to cover cases where an attribute
* might be unquoted or quoted illegally (e.g. backticks are valid quotes for IE).
*
* @param string $string
* @return string
*/
public function escapeHtmlAttr(string $string)
Expand All @@ -214,7 +209,6 @@ public function escapeHtmlAttr(string $string)
* Backslash escaping is not used as it still leaves the escaped character as-is and so
* is not useful in a HTML context.
*
* @param string $string
* @return string
*/
public function escapeJs(string $string)
Expand All @@ -233,7 +227,6 @@ public function escapeJs(string $string)
* an entire URI - only a subcomponent being inserted. The function is a simple proxy
* to rawurlencode() which now implements RFC 3986 since PHP 5.3 completely.
*
* @param string $string
* @return string
*/
public function escapeUrl(string $string)
Expand All @@ -245,7 +238,6 @@ public function escapeUrl(string $string)
* Escape a string for the CSS context. CSS escaping can be applied to any string being
* inserted into CSS and escapes everything except alphanumerics.
*
* @param string $string
* @return string
*/
public function escapeCss(string $string)
Expand Down

0 comments on commit a7c428a

Please sign in to comment.