Skip to content

Commit 7623bf0

Browse files
committed
ext/intl: breakiterator::setText returns false on failure.
Close GH-10820
1 parent d78b3fe commit 7623bf0

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ PHP NEWS
5555
the Spoofchecker's class. (David Carlier)
5656
. Updated datefmt_set_timezone/IntlDateformatter::setTimezone returns type.
5757
(David Carlier).
58+
. Updated IntlBreakInterator::setText return type. (David Carlier)
5859

5960
- JSON:
6061
. Added json_validate(). (Juan Morales)

UPGRADING

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ PHP 8.3 UPGRADE NOTES
8484

8585
- Intl:
8686
. datefmt_set_timezone (and its alias IntlDateformatter::setTimeZone)
87-
now returns true on sucess, previously null was returned.
87+
now returns true on success, previously null was returned.
88+
. IntlBreakiterator::setText() now returns false on failure, previously
89+
null was returned.
8890

8991
- MBString:
9092
. mb_strtolower, mb_strtotitle, and mb_convert_case implement conditional

ext/intl/breakiterator/breakiterator.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function preceding(int $offset): int {}
164164
public function previous(): int {}
165165

166166
/** @tentative-return-type */
167-
public function setText(string $text): ?bool {} // TODO return false instead of null in case of failure
167+
public function setText(string $text): bool {}
168168

169169
public function getIterator(): Iterator {}
170170
}

ext/intl/breakiterator/breakiterator_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/intl/breakiterator/breakiterator_methods.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ U_CFUNC PHP_METHOD(IntlBreakIterator, setText)
153153
BREAKITER_METHOD_FETCH_OBJECT;
154154

155155
ut = utext_openUTF8(ut, ZSTR_VAL(text), ZSTR_LEN(text), BREAKITER_ERROR_CODE_P(bio));
156-
INTL_METHOD_CHECK_STATUS_OR_NULL(bio, "breakiter_set_text: error opening UText");
156+
INTL_METHOD_CHECK_STATUS(bio, "breakiter_set_text: error opening UText");
157157

158158
bio->biter->setText(ut, BREAKITER_ERROR_CODE(bio));
159159
utext_close(ut); /* ICU shallow clones the UText */
160-
INTL_METHOD_CHECK_STATUS_OR_NULL(bio, "breakiter_set_text: error calling "
160+
INTL_METHOD_CHECK_STATUS(bio, "breakiter_set_text: error calling "
161161
"BreakIterator::setText()");
162162

163163
/* When ICU clones the UText, it does not copy the buffer, so we have to

0 commit comments

Comments
 (0)