Skip to content

Commit 2133ea0

Browse files
committed
Simplify UriTemplate adding missing parameters
1 parent b641594 commit 2133ea0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

uri/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All Notable changes to `League\Uri` will be documented in this file
1717
- Query order not respected in `BaseUri::isSameDocument` method [165](https://github.com/thephpleague/uri-src/issues/165)
1818
- Fix Host resolution using the new `HostRecord` class, some registered name were wrongly throwing exceptions.
1919
- Fix `Uri::withPath` improve handling of path leading slash presence
20+
- Fix `UriTemplate::exapndToUrl` and `UriTemplate::expandToUrlOrFail` adding the missing softErrors argument by reference.
2021

2122
### Deprecated
2223

uri/UriTemplate.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ class_exists(Rfc3986Uri::class) || throw new MissingFeature('Support for '.Rfc39
158158
* @throws InvalidUrlException if the base URI cannot be converted to a Uri\Whatwg\Url instance
159159
* @throws InvalidUrlException if the resulting expansion cannot be converted to a Uri\Whatwg\Url instance
160160
*/
161-
public function expandToUrl(iterable $variables = [], Rfc3986Uri|WhatWgUrl|Stringable|string|null $baseUrl = null): WhatWgUrl
161+
public function expandToUrl(iterable $variables = [], Rfc3986Uri|WhatWgUrl|Stringable|string|null $baseUrl = null, array|null &$errors = []): WhatWgUrl
162162
{
163163
class_exists(WhatWgUrl::class) || throw new MissingFeature('Support for '.WhatWgUrl::class.' requires PHP8.5+ or a polyfill. Run "composer require league/uri-polyfill" or use you own polyfill.');
164164

165-
return new WhatWgUrl($this->templateExpanded($variables), $this->newWhatWgUrl($baseUrl));
165+
return new WhatWgUrl($this->templateExpanded($variables), $this->newWhatWgUrl($baseUrl), $errors);
166166
}
167167

168168
/**
@@ -217,11 +217,11 @@ class_exists(Rfc3986Uri::class) || throw new MissingFeature('Support for '.Rfc39
217217
* @throws InvalidUrlException if the base URI cannot be converted to a Uri\Whatwg\Url instance
218218
* @throws InvalidUrlException if the resulting expansion cannot be converted to a Uri\Whatwg\Url instance
219219
*/
220-
public function expandToUrlOrFail(iterable $variables = [], Rfc3986Uri|WhatWgUrl|Stringable|string|null $baseUrl = null): WhatWgUrl
220+
public function expandToUrlOrFail(iterable $variables = [], Rfc3986Uri|WhatWgUrl|Stringable|string|null $baseUrl = null, array|null &$errors = []): WhatWgUrl
221221
{
222222
class_exists(WhatWgUrl::class) || throw new MissingFeature('Support for '.WhatWgUrl::class.' requires PHP8.5+ or a polyfill. Run "composer require league/uri-polyfill" or use you own polyfill.');
223223

224-
return new WhatWgUrl($this->templateExpandedOrFail($variables), $this->newWhatWgUrl($baseUrl));
224+
return new WhatWgUrl($this->templateExpandedOrFail($variables), $this->newWhatWgUrl($baseUrl), $errors);
225225
}
226226

227227
/**

0 commit comments

Comments
 (0)