[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:core-ci <typo3@b13.com> Tested-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com> Tested-by:
Felix P. <f.pachowsky@neusta.de> Tested-by:
Henning Liebe <h.liebe@neusta.de> Tested-by:
Vanessa Räbiger <vmartens91@gmail.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Simon Schaufelberger <simonschaufi+typo3@gmail.com> Reviewed-by:
Felix P. <f.pachowsky@neusta.de> Reviewed-by:
Henning Liebe <h.liebe@neusta.de> Reviewed-by:
Vanessa Räbiger <vmartens91@gmail.com> Reviewed-by:
Stefan Bürk <stefan@buerk.tech>
Showing
- Build/phpstan/phpstan-baseline.neon 0 additions, 10 deletionsBuild/phpstan/phpstan-baseline.neon
- typo3/sysext/fluid/Classes/ViewHelpers/Asset/CssViewHelper.php 1 addition, 1 deletion.../sysext/fluid/Classes/ViewHelpers/Asset/CssViewHelper.php
- typo3/sysext/fluid/Classes/ViewHelpers/Asset/ScriptViewHelper.php 1 addition, 1 deletion...sext/fluid/Classes/ViewHelpers/Asset/ScriptViewHelper.php
Please register or sign in to comment