Skip to content
Snippets Groups Projects
Commit ba0294bc authored by Larry Garfield's avatar Larry Garfield Committed by Stefan Bürk
Browse files

[BUGFIX] Work around type issues in Fluid

Fluid's TagBuilder::getAttribute() is doc-typed as returning `string`,
but the description says it returns `?string`.  That meant PHPStan
believes the `$file !== null` check is unnecessary, when it actually is.
The TagBuilder class is not in core, though, but in the typo3fluid
vendored package, so it cannot be corrected from here.

However, the `$attributes` array is already requested above, and then
href/src is removed from it anyway because it's the same piece of data.
So just reading off of the array we already have and doing missing-value
handling there ourselves resolves the PHPStan issue, is slightly more
consistent with what the next line does (the unset() call), and is ever
so slightly faster as it skips a method call.

Resolves: #97743
Releases: main
Change-Id: I4b24eebdfded4c02c5d59eac2ee00d1cc036d0da
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74828


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Tested-by: default avatarFelix P. <f.pachowsky@neusta.de>
Tested-by: default avatarHenning Liebe <h.liebe@neusta.de>
Tested-by: default avatarVanessa Räbiger <vmartens91@gmail.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarSimon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: default avatarFelix P. <f.pachowsky@neusta.de>
Reviewed-by: default avatarHenning Liebe <h.liebe@neusta.de>
Reviewed-by: default avatarVanessa Räbiger <vmartens91@gmail.com>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
parent 33734d09
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