Skip to content
Snippets Groups Projects
Commit 9e7025c7 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[BUGFIX] Prefer to throw in IdentifierFunctionLine

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.

Resolves: #103977
Related: #97816
Releases: main, 12.4
Change-Id: I772d774fbaae3c2ec7ff4c9abc6ef4964254259d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84496


Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent ecd1aee6
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment