Skip to content
This repository was archived by the owner on Sep 22, 2025. It is now read-only.

Commit 7c4c12e

Browse files
committed
Update methods order
1 parent 6d956fa commit 7c4c12e

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

src/Rfc3986/Uri.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,45 @@ public function __construct(string $uri, ?string $baseUri = null)
7373
$this->rawComponents = self::addUserInfo($components);
7474
}
7575

76+
/**
77+
* @return array{__uri: string}
78+
*/
79+
public function __serialize(): array
80+
{
81+
return ['__uri' => $this->toRawString()];
82+
}
83+
84+
/**
85+
* @param array{__uri: string} $data
86+
*
87+
* @throws Exception|InvalidUriException
88+
*/
89+
public function __unserialize(array $data): void
90+
{
91+
$uri = new self($data['__uri'] ?? throw new Exception('The `__uri` property is missing from the serialized object.'));
92+
93+
$this->rawComponents = $uri->rawComponents;
94+
$this->rawUri = $uri->rawUri;
95+
$this->isNormalized = false;
96+
}
97+
98+
/**
99+
* @return array{scheme: ?string, user: ?string, password: ?string, host: ?string, port: ?int, path: ?string, query: ?string, fragment: ?string}
100+
*/
101+
public function __debugInfo(): array
102+
{
103+
return [
104+
'scheme' => $this->rawComponents['scheme'],
105+
'user' => $this->rawComponents['user'],
106+
'password' => $this->rawComponents['pass'],
107+
'host' => $this->rawComponents['host'],
108+
'port' => $this->rawComponents['port'],
109+
'path' => $this->rawComponents['path'],
110+
'query' => $this->rawComponents['query'],
111+
'fragment' => $this->rawComponents['fragment'],
112+
];
113+
}
114+
76115
/**
77116
* @throws InvalidUriException
78117
*/
@@ -375,44 +414,5 @@ public function resolve(string $uri): self
375414
{
376415
return new self($uri, $this->toRawString());
377416
}
378-
379-
/**
380-
* @return array{__uri: string}
381-
*/
382-
public function __serialize(): array
383-
{
384-
return ['__uri' => $this->toRawString()];
385-
}
386-
387-
/**
388-
* @param array{__uri: string} $data
389-
*
390-
* @throws Exception|InvalidUriException
391-
*/
392-
public function __unserialize(array $data): void
393-
{
394-
$uri = new self($data['__uri'] ?? throw new Exception('The `__uri` property is missing from the serialized object.'));
395-
396-
$this->rawComponents = $uri->rawComponents;
397-
$this->rawUri = $uri->rawUri;
398-
$this->isNormalized = false;
399-
}
400-
401-
/**
402-
* @return array{scheme: ?string, user: ?string, password: ?string, host: ?string, port: ?int, path: ?string, query: ?string, fragment: ?string}
403-
*/
404-
public function __debugInfo(): array
405-
{
406-
return [
407-
'scheme' => $this->rawComponents['scheme'],
408-
'user' => $this->rawComponents['user'],
409-
'password' => $this->rawComponents['pass'],
410-
'host' => $this->rawComponents['host'],
411-
'port' => $this->rawComponents['port'],
412-
'path' => $this->rawComponents['path'],
413-
'query' => $this->rawComponents['query'],
414-
'fragment' => $this->rawComponents['fragment'],
415-
];
416-
}
417417
}
418418
}

0 commit comments

Comments
 (0)