Development

- Removed unused exception from PHP-docs.
- Fixed types not same as declared.
- Fixed issues with reg-ex and php-unit tests.
- Removed unnecessary type casting.
- Declared functions as static (better scoping + performance).
- Moved `\is_callable($callback) === false` as the execution costs less than previous in `Router.php`.
- Changed `ob_get_contents` to `ob_get_clean`.
- Added type hints to methods.
This commit is contained in:
Simon Sessingø
2021-03-17 20:20:28 +01:00
parent 27cd8b8a1f
commit ca88e86c3d
15 changed files with 40 additions and 37 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ class Url implements \JsonSerializable
/**
* Url constructor.
*
* @param string $url
* @param ?string $url
* @throws MalformedUrlException
*/
public function __construct(?string $url)
@@ -385,7 +385,7 @@ class Url implements \JsonSerializable
{
$encodedUrl = preg_replace_callback(
'/[^:\/@?&=#]+/u',
function ($matches) {
static function ($matches) {
return urlencode($matches[0]);
},
$url
@@ -412,7 +412,7 @@ class Url implements \JsonSerializable
if (\count($getParams) !== 0) {
if ($includeEmpty === false) {
$getParams = array_filter($getParams, function ($item) {
$getParams = array_filter($getParams, static function ($item) {
return (trim($item) !== '');
});
}