-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Example in SplFixedArray docs #3679
Comments
Oh, indeed there's no more |
Quick thinking: change RuntimeException to Throwable in the example code and that would work. (and change the echo statement) |
The documentation always favors the most recent versions - that's why there are changelog tables. So why not solve this the same way other versioning issues are solved: write it to be valid for 8.3 and add a code comment to the effect of "// throws RuntimeException in PHP 8.0 and earlier"? Side note: speaking of changelog tables, the offsetGet/Set/Unset docs all say they throw RuntimeException too. |
Actually, I don't think we should tell people to catch Implementation nit: passing an out of range index still reports "Index invalid or out of range" (https://3v4l.org/GMIMC). |
From manual page: https://php.net/class.splfixedarray
In the example of SplFixedArray
Example #1 SplFixedArray usage example
, you state that the following code will giveRuntimeException
but what it is actually throws isTypeError
. So, thecatch
part will never executed.The text was updated successfully, but these errors were encountered: