|
9 | 9 | */ |
10 | 10 | final class Path { |
11 | 11 |
|
12 | | - /** |
13 | | - * @var bool |
14 | | - */ |
15 | | - private $absolute; |
16 | | - |
17 | | - /** |
18 | | - * @var bool |
19 | | - */ |
20 | | - private $hasTail; |
| 12 | + private bool $absolute; |
| 13 | + private bool $hasTail; |
| 14 | + private string $fileExtension; |
21 | 15 |
|
22 | | - /** |
23 | | - * @var string[] |
24 | | - */ |
25 | | - private $parts; |
26 | | - /** |
27 | | - * @var string |
28 | | - */ |
29 | | - private $fileExtension; |
| 16 | + /** @var string[] */ |
| 17 | + private array $parts; |
30 | 18 |
|
31 | 19 | /** |
32 | 20 | * @param string $path |
@@ -67,20 +55,14 @@ static function createFromString (string $path) : Path { |
67 | 55 | function __construct (bool $absolute, bool $hasTail, string $fileExtension, string ...$parts) { |
68 | 56 | $this->absolute = $absolute; |
69 | 57 | $this->hasTail = $hasTail; |
70 | | - $this->parts = $parts; |
71 | 58 | $this->fileExtension = $fileExtension; |
| 59 | + $this->parts = $parts; |
72 | 60 | } |
73 | 61 |
|
74 | | - /** |
75 | | - * @return bool |
76 | | - */ |
77 | 62 | function isAbsolute () : bool { |
78 | 63 | return $this->absolute; |
79 | 64 | } |
80 | 65 |
|
81 | | - /** |
82 | | - * @return bool |
83 | | - */ |
84 | 66 | function hasTail () : bool { |
85 | 67 | return $this->hasTail; |
86 | 68 | } |
@@ -122,7 +104,7 @@ function getFileExtension () { |
122 | 104 | * This might be dangerous in some cases, e.g. when allowing multiple slashes |
123 | 105 | * in a URI that has no authority part |
124 | 106 | * |
125 | | - * (It would allow XSS or open redirects by omitting the scheme, but setting a new |
| 107 | + * (It would allow XSS or open redirects by omitting the scheme by setting a new |
126 | 108 | * authority like `//malicious-website.com/foo/bar`). |
127 | 109 | * |
128 | 110 | * @see https://framework.zend.com/security/advisory/ZF2015-05.html |
@@ -155,10 +137,6 @@ function __toString () : string { |
155 | 137 | return $this->compose(); |
156 | 138 | } |
157 | 139 |
|
158 | | - /** |
159 | | - * @param string $part |
160 | | - * @return string |
161 | | - */ |
162 | 140 | private function encodePathPart (string $part) : string { |
163 | 141 | // To ensure compliance to php-http/psr7-integration-tests, we have to lowercase all replaced url entities |
164 | 142 | // PSR-7 itself does not specify this and allows upper- as well as lowercase |
|
0 commit comments