@@ -58,7 +58,7 @@ public function __construct(string $uri, ?string $baseUri = null)
5858
5959 try {
6060 $ uri = null !== $ baseUri ? UriString::resolve ($ uri , $ baseUri ) : $ uri ;
61- $ components = UriString::parse ($ uri );
61+ $ components = self :: addUserInfo ( UriString::parse ($ uri) );
6262 } catch (Exception $ exception ) {
6363 throw new InvalidUriException ($ exception ->getMessage (), previous: $ exception );
6464 }
@@ -70,7 +70,7 @@ public function __construct(string $uri, ?string $baseUri = null)
7070 Encoder::isFragmentEncoded ($ components ['fragment ' ]) || throw new InvalidUriException ('The encoded fragment string component ` ' .$ components ['fragment ' ].'` contains invalid characters. ' );
7171
7272 $ this ->rawUri = $ uri ;
73- $ this ->rawComponents = self :: addUserInfo ( $ components) ;
73+ $ this ->rawComponents = $ components ;
7474 }
7575
7676 /**
@@ -140,13 +140,15 @@ private function getComponent(string $type, string $name): ?string
140140
141141 private function setNormalizedComponents (): void
142142 {
143- if (!$ this ->isNormalized ) {
144- $ this ->normalizedComponents = [
145- ...self ::addUserInfo (UriString::parseNormalized ($ this ->rawUri )),
146- ...['host ' => Encoder::normalizeHost ($ this ->rawComponents ['host ' ])],
147- ];
148- $ this ->isNormalized = true ;
143+ if ($ this ->isNormalized ) {
144+ return ;
149145 }
146+
147+ $ this ->normalizedComponents = [
148+ ...self ::addUserInfo (UriString::parseNormalized ($ this ->rawUri )),
149+ ...['host ' => Encoder::normalizeHost ($ this ->rawComponents ['host ' ])],
150+ ];
151+ $ this ->isNormalized = true ;
150152 }
151153
152154 /**
0 commit comments