@@ -494,36 +494,30 @@ public static function new(WhatWgUrl|Rfc3986Uri|Stringable|string $uri = ''): se
494494 public static function parse (WhatWgUrl |Rfc3986Uri |Stringable |string $ uri , WhatWgUrl |Rfc3986Uri |Stringable |string |null $ baseUri = null ): ?self
495495 {
496496 try {
497- return null === $ baseUri ? self ::new ($ uri ) : self ::fromBaseUri ($ uri , $ baseUri );
498- } catch (Throwable ) {
499- return null ;
500- }
501- }
497+ if (null === $ baseUri ) {
498+ return self ::new ($ uri );
499+ }
502500
503- /**
504- * Creates a new instance from a URI and a Base URI.
505- *
506- * The returned URI must be absolute.
507- */
508- public static function fromBaseUri (WhatWgUrl |Rfc3986Uri |Stringable |string $ uri , WhatWgUrl |Rfc3986Uri |Stringable |string |null $ baseUri = null ): self
509- {
510- if ($ uri instanceof Rfc3986Uri) {
511- $ uri = $ uri ->toRawString ();
512- }
501+ if ($ uri instanceof Rfc3986Uri) {
502+ $ uri = $ uri ->toRawString ();
503+ }
513504
514- if ($ uri instanceof WhatWgUrl) {
515- $ uri = $ uri ->toAsciiString ();
516- }
505+ if ($ uri instanceof WhatWgUrl) {
506+ $ uri = $ uri ->toAsciiString ();
507+ }
517508
518- if ($ baseUri instanceof Rfc3986Uri) {
519- $ baseUri = $ baseUri ->toRawString ();
520- }
509+ if ($ baseUri instanceof Rfc3986Uri) {
510+ $ baseUri = $ baseUri ->toRawString ();
511+ }
521512
522- if ($ baseUri instanceof WhatWgUrl) {
523- $ baseUri = $ baseUri ->toAsciiString ();
524- }
513+ if ($ baseUri instanceof WhatWgUrl) {
514+ $ baseUri = $ baseUri ->toAsciiString ();
515+ }
525516
526- return self ::new (UriString::resolve ($ uri , $ baseUri ));
517+ return self ::new (UriString::resolve ($ uri , $ baseUri ));
518+ } catch (Throwable ) {
519+ return null ;
520+ }
527521 }
528522
529523 /**
@@ -1727,6 +1721,39 @@ public function __debugInfo(): array
17271721 return $ this ->toComponents ();
17281722 }
17291723
1724+ /**
1725+ * DEPRECATION WARNING! This method will be removed in the next major point release.
1726+ *
1727+ * @deprecated Since version 7.6.0
1728+ * @codeCoverageIgnore
1729+ * @see Uri::parse()
1730+ *
1731+ * Creates a new instance from a URI and a Base URI.
1732+ *
1733+ * The returned URI must be absolute.
1734+ */
1735+ #[Deprecated(message:'use League\Uri\Uri::parse() instead ' , since:'league/uri:7.6.0 ' )]
1736+ public static function fromBaseUri (WhatWgUrl |Rfc3986Uri |Stringable |string $ uri , WhatWgUrl |Rfc3986Uri |Stringable |string |null $ baseUri = null ): self
1737+ {
1738+ if ($ uri instanceof Rfc3986Uri) {
1739+ $ uri = $ uri ->toRawString ();
1740+ }
1741+
1742+ if ($ uri instanceof WhatWgUrl) {
1743+ $ uri = $ uri ->toAsciiString ();
1744+ }
1745+
1746+ if ($ baseUri instanceof Rfc3986Uri) {
1747+ $ baseUri = $ baseUri ->toRawString ();
1748+ }
1749+
1750+ if ($ baseUri instanceof WhatWgUrl) {
1751+ $ baseUri = $ baseUri ->toAsciiString ();
1752+ }
1753+
1754+ return self ::new (UriString::resolve ($ uri , $ baseUri ));
1755+ }
1756+
17301757 /**
17311758 * DEPRECATION WARNING! This method will be removed in the next major point release.
17321759 *
0 commit comments