Review main Merged

84495[BUGFIX] Prefer to throw in IdentifierFunctionLine

Christian Kuhn CR +2 V +2 Easy +27 −5 updated 06/04/24, 18:23

Commit message

There is a subtle difference between a PHP error and a
dedicated thrown exception: When an object knows it
should return something, but can't, because it has not
been set up correctly, then the implementation is
responsible of throwing a "i'm incomplete" exception:
This is not an error in the class, but a wrong set up
usage, and this should throw, and should not error out
with a return type mismatch error.

The patch changes two getters of TS parser related
IdentifierFunctionLine to obey this difference and
now throws in case it "has been set up incompletely".

In this case, an IdentifierFunctionLine is only
"complete" after at least an identifier token stream
and a function name token has been set: After being
fully set up, these two properties must have a value.
The object knows this and the two getters now throw
an exception instead of failing with a type error.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 2