Skip to content

Commit c424209

Browse files
Fix the Collator return types in phpdoc
The types were incoherent with the PHP documentation. There are still some issues with types (e.g. constructor should not accept `null` value). But changing them would break the API so I thought it wasn't a good idea to fix them. Reference: https://www.php.net/manual/class.collator.php
1 parent 69d3c46 commit c424209

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Intl/Icu/Collator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function asort(array &$array, int $flags = self::SORT_REGULAR)
120120
/**
121121
* Not supported. Compare two Unicode strings.
122122
*
123-
* @return bool|int
123+
* @return int|false
124124
*
125125
* @see https://php.net/collator.compare
126126
*
@@ -134,7 +134,7 @@ public function compare(string $string1, string $string2)
134134
/**
135135
* Not supported. Get a value of an integer collator attribute.
136136
*
137-
* @return bool|int The attribute value on success or false on error
137+
* @return int|false The attribute value on success or false on error
138138
*
139139
* @see https://php.net/collator.getattribute
140140
*
@@ -148,7 +148,7 @@ public function getAttribute(int $attribute)
148148
/**
149149
* Returns collator's last error code. Always returns the U_ZERO_ERROR class constant value.
150150
*
151-
* @return int The error code from last collator call
151+
* @return int|false The error code from last collator call
152152
*/
153153
public function getErrorCode()
154154
{
@@ -158,7 +158,7 @@ public function getErrorCode()
158158
/**
159159
* Returns collator's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
160160
*
161-
* @return string The error message from last collator call
161+
* @return string|false The error message from last collator call
162162
*/
163163
public function getErrorMessage()
164164
{
@@ -168,8 +168,8 @@ public function getErrorMessage()
168168
/**
169169
* Returns the collator's locale.
170170
*
171-
* @return string The locale used to create the collator. Currently always
172-
* returns "en".
171+
* @return string|false The locale used to create the collator. Currently
172+
* always returns "en".
173173
*/
174174
public function getLocale(int $type = Locale::ACTUAL_LOCALE)
175175
{
@@ -179,7 +179,7 @@ public function getLocale(int $type = Locale::ACTUAL_LOCALE)
179179
/**
180180
* Not supported. Get sorting key for a string.
181181
*
182-
* @return string The collation key for $string
182+
* @return string|false The collation key for $string
183183
*
184184
* @see https://php.net/collator.getsortkey
185185
*
@@ -193,7 +193,7 @@ public function getSortKey(string $string)
193193
/**
194194
* Not supported. Get current collator's strength.
195195
*
196-
* @return bool|int The current collator's strength or false on failure
196+
* @return int The current collator's strength or false on failure
197197
*
198198
* @see https://php.net/collator.getstrength
199199
*

0 commit comments

Comments
 (0)