描述此 Pull Request 的变更
兼容 PHP 8.1:
Passing null to a non-nullable argument of a built-in function is deprecated.
描述变更理由
基于 PHP 8.1 升级文档: https://github.com/php/php-src/blob/php-8.1.0beta2/UPGRADING
不兼容性其中一点为:
Passing null to a non-nullable argument of a built-in function is
deprecated. This matches the behavior of user-defined functions, where null
is never accepted by non-nullable arguments.
user-defined functions.var_dump(str_contains("foobar", null)); // Deprecated: Passing null to parameter #2 ($needle) of type string // is deprecated
RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
点2: float 需要明确转换为 Int:
Implicit conversion of floats to integers that result in loss of precision,
e.g. a truncation from 1.9 to 1, is deprecated. This affects array keys,
int parameter and return types, and operators working on integers.
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate
点3:
Automatic conversion of "false" into an empty array on write operands is deprecated.
RFC: https://wiki.php.net/rfc/autovivification_false