Hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 đi kèm với PHP 8. 0 là một nỗ lực để cải thiện hàm if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5 trả về các giá trị không nhất quán và không mở rộng để tiết lộ tên lớp của các đối tượngMột trong những trường hợp sử dụng của hàm này là sử dụng nó như một cách dễ dàng để giải thích một biến không mong muốn trong nhật ký lỗi hoặc thông báo ngoại lệ vì kiểu trả về của
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5 thường không đủ dài để có nghĩaif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 so với if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
Các phần sau đây sẽ giải thích sự khác biệt giữa hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 mới và giá trị trả về của hàm if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5 hiện tạicác loại vô hướng
TypeExample valuegettype[]get_debug_type[]Stringif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
1if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
2_______02Arraysif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
5Nullif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
7if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
8if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
7Integersif [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
0if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
1if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
2Floatif [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
3if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
4if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
5Booleanif [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
6if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
7if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
8Boolean_______99if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
7_______98Lưu ý cách hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 mới trả về các kiểu chính xác mà bạn sử dụng khi nhập vô hướngĐối tượng lớp và chức năng ẩn danh
LoạiGiá trị ví dụgettype[]get_debug_type[]Đối tượng lớpif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
23if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
25Đối tượng lớpif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
26if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
28Đối tượng lớpif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
29if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
41Closeif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
42if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
44Lớp ẩn danhif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
45if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
47Lớp con ẩn danhif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
48if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
24_______250Như bạn có thể thấy,
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 đang bắt đầu trở nên hữu ích hơn ở đây, bởi vì nó báo cáo tên của lớp hoặc các chi tiết khác về các lớp ẩn danh một cách hữu íchNếu một bao đóng được thông qua [là một đối tượng bên trong], thì
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 sẽ trả về giá trị đó là if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
44Khi một đối tượng lớp ẩn danh được chuyển, nó trả về
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
47 cho các lớp không có cha/giao diện hoặc tên cha/giao diện, theo sau là if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
55Đây là lúc hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 trở nên khá hữu ích vì thay vì gọi if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
57 và if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
58, if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 trực tiếp trả về một tên hữu ích cho đối tượng đã cho. Điều này có thể giúp giảm thiểu mã soạn sẵn và mã sưng lên khi các ngoại lệ được đưa ra và các lỗi được ghi lạiTài nguyên
LoạiGiá trị ví dụgettype[]get_debug_type[]Streamsif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
50if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
51if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
52Trình xử lý cuộn trònif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
53if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
51if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
55Trình xử lý cuộn tròn đã đóngif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
56if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
57if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
57Tài liệu XMLif [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
59if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
51if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
41. if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
51____243Đối với tất cả các loại tài nguyên trong PHP, hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 cũng sẽ trả về loại tài nguyên đóTrường hợp sử dụng
Khi bạn muốn xuất một thông báo lỗi dài dòng về một loại không mong muốn, thay vì thực hiện tra cứu loại xấu, thường bỏ qua các loại biến khác, giờ đây bạn có thể dễ dàng lấy loại biến đã truyền
trước đây
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
1Hiện nay
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
Polyfill
if [!function_exists['get_debug_type']] {
function get_debug_type[$value]: string {
switch [true] {
case null === $value: return 'null';
case \is_bool[$value]: return 'bool';
case \is_string[$value]: return 'string';
case \is_array[$value]: return 'array';
case \is_int[$value]: return 'int';
case \is_float[$value]: return 'float';
case \is_object[$value]: break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if [null === $type = @get_resource_type[$value]] {
return 'unknown';
}
if ['Unknown' === $type] {
$type = 'closed';
}
return "resource [$type]";
}
$class = \get_class[$value];
if [false === strpos[$class, '@']] {
return $class;
}
return [get_parent_class[$class] ?: key[class_implements[$class]] ?: 'class'].'@anonymous';
}
}
Trên đây là một polyfill mà bạn có thể sử dụng trong mã của mình nếu bạn muốn đưa hàm
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 vào mã của riêng mình mà không thể yêu cầu PHP 8. 0 để chạy. Đoạn mã này là từ Symfony's PHP 8. 0 polyfillTác động tương thích ngược
if [![$foo instanceof Foo]] {
throw new TypeError[
sprintf[
'Parameter 1 is expected to be of type "%s", got "%s" instead.',
Foo::class,
get_debug_type[$foo]
]
];
}
4 là một chức năng mới. Trừ khi bạn đã khai báo một hàm có cùng tên trong không gian tên chung, điều này sẽ không gây ra bất kỳ sự cố BC nào