PHP 7.2.x から PHP 7.3.x への移行の勝手な日本語訳 後方互換のない変更③
PHP 7.2.x から PHP 7.3.x への移行の日本語訳がないので勝手に翻訳して備忘録にする。
https://www.php.net/manual/ja/migration73.incompatible.php
Continue Targeting Switch issues Warning
スイッチの問題をターゲットにし続ける警告
continue statements targeting switch control flow structures will now generate a warning. In PHP such continue statements are equivalent to break, while they behave as continue 2 in other languages.
スイッチ制御フロー構造を対象としたcontinueステートメントは、警告を生成します。 PHPでは、このようなcontinueステートメントはbreakと同等ですが、他の言語ではcontinue 2のように動作します。
<?php
while ($foo) {
switch ($bar) {
case "baz":
continue;
// Warning: "continue" targeting switch is equivalent to
// "break". Did you mean to use "continue 2"?
}
}
?>
つづいて。
Strict Interpretation of Integer String Keys on ArrayAccess
ArrayAccessでの整数文字列キーの厳密な解釈
Array accesses of type $obj["123"], where $obj implements ArrayAccess and "123" is an integer string literal will no longer result in an implicit conversion to integer, i.e., $obj->offsetGet("123") will be called instead of $obj->offsetGet(123). This matches existing behavior for non-literals. The behavior of arrays is not affected in any way, they continue to implicitly convert integeral string keys to integers.
$ obj ["123"]型の配列アクセス。$ objはArrayAccessを実装し、 "123"は整数文字列リテラルであるため、暗黙的に整数に変換されることはなくなりました。つまり、$ obj-> offsetGet( "123")は $ obj-> offsetGet(123)の代わりに呼び出されます。 これは非リテラルの既存の動作と一致します。 配列の振る舞いは何の影響も受けず、暗黙のうちに整数文字列キーを整数に変換し続けます。
|