mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00

PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".
This a followup to ce1d69a1f6
, which
implements the same change for integer->int.
49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
--TEST--
|
|
IntlTimeZone::getDisplayName(): errors
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('intl'))
|
|
die('skip intl extension not enabled');
|
|
--FILE--
|
|
<?php
|
|
ini_set("intl.error_level", E_WARNING);
|
|
|
|
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
|
|
var_dump($tz->getDisplayName(array()));
|
|
var_dump($tz->getDisplayName(false, array()));
|
|
var_dump($tz->getDisplayName(false, -1));
|
|
var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, array()));
|
|
var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, NULL, NULL));
|
|
|
|
var_dump(intltz_get_display_name(null, IntlTimeZone::DISPLAY_SHORT, false, 'pt_PT'));
|
|
|
|
--EXPECTF--
|
|
|
|
Warning: IntlTimeZone::getDisplayName() expects parameter 1 to be bool, array given in %s on line %d
|
|
|
|
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: IntlTimeZone::getDisplayName() expects parameter 2 to be int, array given in %s on line %d
|
|
|
|
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: wrong display type in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: IntlTimeZone::getDisplayName() expects parameter 3 to be string, array given in %s on line %d
|
|
|
|
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
|
|
bool(false)
|
|
|
|
Warning: IntlTimeZone::getDisplayName() expects at most 3 parameters, 4 given in %s on line %d
|
|
|
|
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
|
|
bool(false)
|
|
|
|
Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_display_name() must be an instance of IntlTimeZone, null given in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): intltz_get_display_name(NULL, 1, false, 'pt_PT')
|
|
#1 {main}
|
|
thrown in %s on line %d
|