Skip to content

Commit e2b4687

Browse files
committed
Minor grammar/consistency fixes in upgrade guide
[ci skip]
1 parent 77172c2 commit e2b4687

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

UPGRADING

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PHP 8.0 UPGRADE NOTES
4949
parameter consistent with isset() and normal array access. All key types now
5050
use the usual coercions and array/object keys throw a TypeError.
5151
. Any array that has a number n as its first numeric key will use n+1 for
52-
its next implicit key. Even if n is negative.
52+
its next implicit key, even if n is negative.
5353
RFC: https://wiki.php.net/rfc/negative_array_index
5454
. The default error_reporting level is now E_ALL. Previously it excluded
5555
E_NOTICE and E_DEPRECATED.
@@ -91,7 +91,7 @@ PHP 8.0 UPGRADE NOTES
9191
. The precedence of the concatenation operator has changed relative to
9292
bitshifts and addition as well as subtraction.
9393
RFC: https://wiki.php.net/rfc/concatenation_precedence
94-
. Arguments with a default-value that resolves to null at run-time will no
94+
. Arguments with a default value that resolves to null at runtime will no
9595
longer implicitly mark the argument type as nullable. Either use an explicit
9696
nullable type, or an explicit null default value instead.
9797

@@ -121,7 +121,7 @@ PHP 8.0 UPGRADE NOTES
121121
* Attempting to access an array index of a non-array.
122122
* Attempting to convert an array to string.
123123
* Attempting to use a resource as an array key.
124-
* Attempting to use null, a boolean or a float as a string offset.
124+
* Attempting to use null, a boolean, or a float as a string offset.
125125
* Attempting to read an out-of-bounds string offset.
126126
* Attempting to assign an empty string to a string offset.
127127

@@ -134,7 +134,7 @@ PHP 8.0 UPGRADE NOTES
134134
. Uncaught exceptions now go through "clean shutdown", which means that
135135
destructors will be called after an uncaught exception.
136136
. Compile time fatal error "Only variables can be passed by reference" has
137-
been delayed until run-time and converted to "Cannot pass parameter by
137+
been delayed until runtime and converted to "Cannot pass parameter by
138138
reference" exception.
139139
. Some "Only variables should be passed by reference" notices have been
140140
converted to "Cannot pass parameter by reference" exception.
@@ -150,13 +150,6 @@ PHP 8.0 UPGRADE NOTES
150150

151151
The name shown above is still followed by a null byte and and a unique
152152
suffix.
153-
. Declaring a required parameter after an optional one is deprecated. As an
154-
exception, declaring a parameter of the form "Type $param = null" before
155-
a required one continues to be allowed, because this pattern was sometimes
156-
used to achieve nullable types in older PHP versions.
157-
158-
function test($a = [], $b) {} // Deprecated
159-
function test(Foo $a = null, $b) {} // Allowed
160153
. Non-absolute trait method references in trait alias adaptations are now
161154
required to be unambiguous:
162155

@@ -239,9 +232,8 @@ PHP 8.0 UPGRADE NOTES
239232
"Illegal string offset 'string'" for illegal string offsets. The behavior
240233
of explicit casts to int/float from strings has not been changed.
241234
RFC: https://wiki.php.net/rfc/saner-numeric-strings
242-
. Magic Methods will now have their arguments and return types
243-
checked if they have them declared. The signatures should
244-
match the following list:
235+
. Magic Methods will now have their arguments and return types checked if
236+
they have them declared. The signatures should match the following list:
245237

246238
__call(string $name, array $arguments): mixed
247239
__callStatic(string $name, array $arguments): mixed
@@ -327,7 +319,7 @@ PHP 8.0 UPGRADE NOTES
327319
gmp_random_bits() should be used instead.
328320

329321
- Iconv:
330-
. iconv() implementations which do not properly set errno in case of errors,
322+
. iconv() implementations which do not properly set errno in case of errors
331323
are no longer supported.
332324

333325
- Intl:
@@ -378,7 +370,7 @@ PHP 8.0 UPGRADE NOTES
378370
. The $is_hex parameter, which was not used internally, has been removed from
379371
mb_decode_numericentity().
380372
. The legacy behavior of passing the encoding as the third argument instead
381-
of an offset for the mb_strrpos() function has been removed, provide an
373+
of an offset for the mb_strrpos() function has been removed; provide an
382374
explicit 0 offset with the encoding as the fourth argument instead.
383375
. The ISO_8859-* character encoding aliases have been replaced by ISO8859-*
384376
aliases for better interoperability with the iconv extension. The mbregex
@@ -549,10 +541,10 @@ PHP 8.0 UPGRADE NOTES
549541
. Specifying out of range rounds for sha256/sha526 crypt() will now fail with
550542
*0 instead of clamping to the closest limit. This matches glibc behavior.
551543
. The result of sorting functions may have changed, if the array contains
552-
equal-comparing elements.
553-
. Sort comparison functions return true/false will now throw a deprecation
554-
warning and should be replaced with an implementation return an integer
555-
smaller than, equal to, or greater than zero.
544+
elements that compare as equal.
545+
. Sort comparison functions that return true or false will now throw a
546+
deprecation warning, and should be replaced with an implementation
547+
that returns an integer less than, equal to, or greater than zero.
556548

557549
// Replace
558550
usort($array, fn($a, $b) => $a > $b);
@@ -565,8 +557,8 @@ PHP 8.0 UPGRADE NOTES
565557
This was already the case for most, but not all, functions previously.
566558
. The HTTP stream wrapper as used by functions like file_get_contents()
567559
now advertises HTTP/1.1 rather than HTTP/1.0 by default. This does not
568-
change the behaviour of the client, but may cause servers to respond
569-
differently. To retain the old behaviour, set the 'protocol_version'
560+
change the behavior of the client, but may cause servers to respond
561+
differently. To retain the old behavior, set the 'protocol_version'
570562
stream context option, e.g.
571563

572564
$ctx = stream_context_create(['http' => ['protocol_version' => '1.0']]);
@@ -614,8 +606,8 @@ PHP 8.0 UPGRADE NOTES
614606
objects instead of resources.
615607

616608
- Zip:
617-
. ZipArchive::OPSYS_Z_CPM have been removed, should use ZipArchive::OPSYS_CPM
618-
(this name was a typo).
609+
. ZipArchive::OPSYS_Z_CPM has been removed (this name was a typo). Use
610+
ZipArchive::OPSYS_CPM instead.
619611

620612
- Zlib:
621613
. gzgetss() has been removed.
@@ -787,6 +779,13 @@ PHP 8.0 UPGRADE NOTES
787779
========================================
788780

789781
- Core:
782+
. Declaring a required parameter after an optional one is deprecated. As an
783+
exception, declaring a parameter of the form "Type $param = null" before
784+
a required one continues to be allowed, because this pattern was sometimes
785+
used to achieve nullable types in older PHP versions.
786+
787+
function test($a = [], $b) {} // Deprecated
788+
function test(Foo $a = null, $b) {} // Allowed
790789
. Calling get_defined_functions() with $exclude_disabled explicitly set to
791790
false is deprecated. get_defined_functions() will never include disabled
792791
functions.

0 commit comments

Comments
 (0)