Giter Club home page Giter Club logo

Comments (4)

damianwadley avatar damianwadley commented on September 1, 2024 1

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.

from doc-en.

cmb69 avatar cmb69 commented on September 1, 2024

Oh, indeed there's no more RuntimeException as of PHP 8.1.0 (https://3v4l.org/sdIQd). That example needs to be fixed (but should somehow address the version dependent behavior).

from doc-en.

nielsdos avatar nielsdos commented on September 1, 2024

Quick thinking: change RuntimeException to Throwable in the example code and that would work. (and change the echo statement)

from doc-en.

cmb69 avatar cmb69 commented on September 1, 2024

Actually, I don't think we should tell people to catch TypeErrors (they should fix their code instead). Maybe we should move the var_dump($array["non-numeric"]); to the bottom, commenting that this is a TypeError (but prior to PHP 8.1.0 has been a RuntimeException).

Implementation nit: passing an out of range index still reports "Index invalid or out of range" (https://3v4l.org/GMIMC).

from doc-en.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.