Skip to content
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

!!! TASK: Refactor uri helpers #3336

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
TASK: Add types to UriHelper
  • Loading branch information
mhsdesign committed Mar 28, 2024
commit 112c3e3eb0d39b3d2cd6bc5f9af051b7d1debf70
10 changes: 5 additions & 5 deletions Neos.Flow/Classes/Http/Helper/UriHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private function __construct()
}

/**
* @var array
* @var array<string, int>
*/
private static $defaultPortsByScheme = [
'http' => 80,
Expand All @@ -45,14 +45,14 @@ private function __construct()
* Returns the path relative to the $baseUri
*
* @param UriInterface $baseUri The base URI to start from
* @param UriInterface $uri The URI in quesiton
* @param UriInterface $uri The URI in question
* @return string
*/
public static function getRelativePath(UriInterface $baseUri, UriInterface $uri): string
{
$baseUriString = (string)$baseUri;
$uriString = (string)$uri;
if (empty($baseUriString) || strpos($uriString, $baseUriString) !== 0) {
if (empty($baseUriString) || !str_starts_with($uriString, $baseUriString)) {
return '';
}

Expand All @@ -63,7 +63,7 @@ public static function getRelativePath(UriInterface $baseUri, UriInterface $uri)
/**
* Sets and replaces the query parameters.
*
* @param array $queryParameters
* @param array<string, mixed> $queryParameters
* @return UriInterface A new instance with the replaced query parameters.
*/
public static function uriWithQueryParameters(UriInterface $uri, array $queryParameters): UriInterface
Expand All @@ -75,7 +75,7 @@ public static function uriWithQueryParameters(UriInterface $uri, array $queryPar
/**
* Merges the additional query parameters recursively into the current query parameters.
*
* @param array $queryParameters
* @param array<string, mixed> $queryParameters
* @return UriInterface A new instance with the additional query parameters.
*/
public static function uriWithAdditionalQueryParameters(UriInterface $uri, array $queryParameters): UriInterface
Expand Down
1 change: 0 additions & 1 deletion Neos.Flow/Classes/Mvc/Routing/Dto/UriConstraints.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Neos\Flow\Annotations as Flow;
use GuzzleHttp\Psr7\Uri;
use Neos\Flow\Http\Helper\UriHelper;
use Neos\Utility\Arrays;
use Psr\Http\Message\UriInterface;

/**
Expand Down
Loading