65464[TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:frontend
Commit message
Review
-
Code review CR +2 Done
- Daniel Goerz +2
- Christian Kuhn +1
-
Verified V +2 Done
- Daniel Goerz +2
- Christian Kuhn +1
- TYPO3com +1 CI
Issues 1
Files 24
- typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php+6 −6
- typo3/sysext/frontend/Classes/ContentObject/Menu/CategoryMenuUtility.php+3 −3
- typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php+3 −3
- typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php+1 −1
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php61+113 −81
- typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php+5 −5
- typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php+7 −5
- typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php+9 −9
- typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php+5 −5
- typo3/sysext/frontend/Classes/ContentObject/ScalableVectorGraphicsContentObject.php+3 −3
- typo3/sysext/frontend/Classes/Controller/ShowImageController.php+2 −2
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php+6 −6
- typo3/sysext/frontend/Classes/DataProcessing/CommaSeparatedValueProcessor.php+2 −2
- typo3/sysext/frontend/Classes/DataProcessing/FilesProcessor.php+4 −4
- typo3/sysext/frontend/Classes/DataProcessing/SplitProcessor.php+1 −1
- typo3/sysext/frontend/Classes/Imaging/GifBuilder.php+9 −5
- typo3/sysext/frontend/Classes/Page/CacheHashConfiguration.php+2 −2
- typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php+6 −6
- typo3/sysext/frontend/Classes/Resource/FileCollector.php+3 −0
- typo3/sysext/frontend/Classes/Typolink/FileOrFolderLinkBuilder.php+1 −1
Review log 3954
Show 1829 earlier messages
-
Alexander Schnitzler uploaded patch set 1 08/26/20, 13:22
-
Alexander Schnitzler wrote 08/26/20, 13:28
Topic set to phpstan -
TYPO3com voted on patch set 1 V -1 08/26/20, 14:16 Completed build in 38m 42s on Wed, 26 Aug, 02:16 PM Test Summary: 48 of 71605 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4985
-
TYPO3com commented on patch set 1 08/27/20, 08:34 Completed build in 19h 35m 02s on Thu, 27 Aug, 08:34 AM Test Summary: 32 of 73577 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4985
-
Alexander Schnitzler uploaded patch set 2 08/28/20, 07:52
-
TYPO3com voted on patch set 2 V -1 08/28/20, 08:04 Completed build in 12m 01s on Fri, 28 Aug, 08:04 AM Test Summary: 72763 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5024
-
TYPO3com voted on patch set 2 V +1 08/28/20, 08:11 Completed build in 31m 30s on Fri, 28 Aug, 08:11 AM Test Summary: 73092 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5024
-
Oliver Klee voted on patch set 2 CR +1 08/28/20, 10:37
-
Jörg Bösche commented on patch set 2 V +1 CR +1 08/28/20, 13:21
Verified on v11-dev (master) with EXT:bootstrap (11.1.0-dev) and EXT:introduction (4.2.0). Frontend works for me. -
Alexander Schnitzler updated the commit message in patch set 3 09/03/20, 15:50
-
TYPO3com voted on patch set 3 V +1 09/03/20, 16:40 Completed build in 43m 08s on Thu, 3 Sep, 04:40 PM Test Summary: 73182 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5194
-
Oliver Klee voted on patch set 3 CR +1 09/04/20, 07:49
-
Alexander Schnitzler uploaded patch set 4 09/07/20, 12:14
-
Alexander Schnitzler commented on patch set 4 09/07/20, 12:15
I had to rebase this patch and add a lot of type casts due to previously merged patches which introduced a lot of new errors. -
TYPO3com voted on patch set 4 V -1 09/07/20, 12:28 Completed build in 13m 19s on Mon, 7 Sep, 12:28 PM Test Summary: 73227 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5322
-
Alexander Schnitzler uploaded patch set 5 09/07/20, 13:07
-
TYPO3com voted on patch set 5 V +1 09/07/20, 13:19 Completed build in 11m 40s on Mon, 7 Sep, 01:19 PM Test Summary: 73227 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5324
-
Oliver Klee voted on patch set 5 CR +1 09/07/20, 13:24
-
Alexander Schnitzler uploaded patch set 6 09/08/20, 09:33
-
Alexander Schnitzler wrote 09/08/20, 09:34
Description set to "rebase" -
Oliver Klee voted on patch set 6 CR +1 09/08/20, 09:46
-
TYPO3com voted on patch set 6 V -1 09/08/20, 09:46 Completed build in 12m 37s on Tue, 8 Sep, 09:46 AM Test Summary: 1 of 73712 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5358
-
TYPO3com voted on patch set 6 V +1 09/08/20, 09:55 Completed build in 34m 44s on Tue, 8 Sep, 09:55 AM Test Summary: 73227 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5358
-
Daniel Goerz commented on patch set 6 CR -1 09/09/20, 11:31
on it -
Daniel Goerz uploaded patch set 7 09/09/20, 12:28
-
Daniel Goerz uploaded patch set 8 09/09/20, 12:35
-
TYPO3com voted on patch set 7 V +1 09/09/20, 12:39 Completed build in 10m 55s on Wed, 9 Sep, 12:39 PM Test Summary: 73173 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5411
-
TYPO3com voted on patch set 8 V +1 09/09/20, 12:48 Completed build in 12m 25s on Wed, 9 Sep, 12:48 PM Test Summary: 73173 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5412
-
Daniel Goerz commented on patch set 8 09/09/20, 12:57
ContentObjectRenderer.php:1004Unresolved$imageFile can be instanceof File and instanceof FileReference which would cause problems here and on multiple different places in this function where it is treated as a string.
-
Daniel Goerz voted on patch set 8 V +1 CR +1 09/09/20, 12:59
-
Sascha Egerer commented on patch set 8 CR -1 09/09/20, 13:07
I'm open for comments - please don't feel offended :) I may also be wrong at some placesContentObjectRenderer.php:1004File and FileReference do not have a toString method so this will fail, right? But i wonder why phpstan does not catch this issueContentObjectRenderer.php:1257I would do the cast in line 1253 instead. $functionType = (string)($this->stdWrapOrder[$functionName] ?? '');ContentObjectRenderer.php:1306UnresolvedI think we could use scalar|null as type as float would also be possibleContentObjectRenderer.php:1368I would now use "trim($tags) !== ''" instead but this would change the behavior a bit but IMO it would fix a bug as the value "0" would not work with the current implementation. Opinions?ContentObjectRenderer.php:1898I would also change the type here as we expect a floatContentObjectRenderer.php:1902Default value for content could be 0 now as we are casting it to float anywaysContentObjectRenderer.php:2006type should be adjusted to intContentObjectRenderer.php:2010default value should be changed to 0 as we cast it to int anywaysContentObjectRenderer.php:2640I think we can return early if $temp is empty. "?:" should IMO be prevented as it does some internal castings again and could end up in unexspacted behavior in some cases. $temp = explode($char, $content); if (empty($temp)) { return ''; }ContentObjectRenderer.php:2949This is a good place where some logging could be added as if preg_split is false we are sure that something went wrong. IMO ignoring the false value does hide an existing issue. Opinions?ContentObjectRenderer.php:3132value "0" will now return true but did not before that change. So the behavior is changedContentObjectRenderer.php:3204Should be cast be done in line 3172? The value is also used at 3195 and 3213 but without a cast. Not sure about the code flow but don't really see a reason to not cast the value in general. By the way $typoScriptService->explodeConfigurationForOptionSplit can only handle strings and arrays anyway so changing this would also change behavior but i think is a change that will end up in an expected behaviorContentObjectRenderer.php:3436Good place to add some logging if return value is "null". This may happen not only if the regex is wrong but also other things happen like backtrack-limit is reached. https://www.php.net/manual/en/pcre.configuration.php#ini.pcre.backtrack-limitContentObjectRenderer.php:3798I would use null coalesce here as it's more explicit $linkUrl = $this->processUrl(UrlProcessorInterface::CONTEXT_COMMON, $scheme . $parts[0], $conf) ?? '';ContentObjectRenderer.php:3851I would cast $conf to an array at the beginning of the method as it's expected to be an array also at other placesContentObjectRenderer.php:4990If preg_replace does not return a string i would add some logging instead of just casting it to stringContentObjectRenderer.php:5191Instead of casting i would do an early return here. $listArr = preg_split('/[,;' . LF . ']/', $content); if ($listArr === false) { return ''; }ContentObjectRenderer.php:6504we can remove "?? []", right?ContentObjectRenderer.php:6524we can remove "?? []", right?ContentObjectRenderer.php:6537we can remove "?? []", right? -
Daniel Goerz commented on patch set 8 09/09/20, 13:41
ContentObjectRenderer.php:1004Replyyes, see my comment. This probably needs to be tackled in a master only patch because this method is @internal only in master. This method is "broken" not only hereContentObjectRenderer.php:1257ReplyDoneContentObjectRenderer.php:1368Reply UnresolvedLets not change behavior here if we can avoid itContentObjectRenderer.php:1898Replythe stdWrap_ functions will always receive strings see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::stdWrap, so I would not change that as we would introduce even more problemsContentObjectRenderer.php:1902Replythe stdWrap_ functions will always receive strings see aboveContentObjectRenderer.php:2006Replythe stdWrap_ functions will always receive strings see aboveContentObjectRenderer.php:2010Replythe stdWrap_ functions will always receive strings see aboveContentObjectRenderer.php:2640ReplyI thought about this as well but wanted to change as little as possible but you are probably right.ContentObjectRenderer.php:2949ReplyLets not add logging in phpstan patches :) You are welcome to open an issue where we can track such thingsContentObjectRenderer.php:3132ReplyAckContentObjectRenderer.php:3204ReplyDoneContentObjectRenderer.php:3436Replysee aboveContentObjectRenderer.php:3798ReplyDoneContentObjectRenderer.php:3851ReplyThat was not part of this patchContentObjectRenderer.php:5191ReplyDone -
Daniel Goerz uploaded patch set 9 09/09/20, 13:42
-
Daniel Goerz commented on patch set 9 V +1 CR +1 09/09/20, 13:42
ContentObjectRenderer.php:6504ReplyDoneContentObjectRenderer.php:6524ReplyDoneContentObjectRenderer.php:6537ReplyDone -
TYPO3com voted on patch set 9 V +1 09/09/20, 13:55 Completed build in 12m 50s on Wed, 9 Sep, 01:55 PM Test Summary: 73173 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5416
-
Oliver Klee voted on patch set 9 CR +1 09/09/20, 15:07
-
Alexander Schnitzler commented on patch set 9 CR -1 09/09/20, 16:41
ContentObjectRenderer.php:6507The now removed ?? [] has been introduced a few days ago because something broke Bennis frontend. See https://review.typo3.org/c/Packages/TYPO3.CMS/+/65618 please. I don't have any stakes in this, just wanted to point to that very recent change. We should double check what solution is right. -
Daniel Goerz commented on patch set 9 09/09/20, 16:47
ContentObjectRenderer.php:6507ReplyHow can $configuration be null here? -
Daniel Goerz commented on patch set 9 09/09/20, 16:49
ContentObjectRenderer.php:6507ReplyOnly the three places are adapted that have $configuration always defined as an array, all other places are not touched -
Daniel Goerz commented on patch set 9 09/09/20, 17:27
ContentObjectRenderer.php:6507Reply UnresolvedHaving those null checks are phpstan errors by itself Line ContentObjectRenderer.php 6507 Variable $configuration on left side of ?? always exists and is not nullable. You can check this by turning the nullCoalesce toggle on parameters: featureToggles: nullCoalesce: true -
Alexander Schnitzler voted on patch set 9 CR 0 09/09/20, 17:34
-
Sascha Egerer commented on patch set 9 CR -1 09/10/20, 04:57
ContentObjectRenderer.php:1004ReplyOk so should this be done i a difference patch set, first?ContentObjectRenderer.php:1004My previous comment is still valid. $imageFile can be a File or FileReference which do not have a toString method as far as i can see. So this will fail if $imageFile is not already a scalar value, right? Check should be adjusted to if (isset($conf['file.'] && is_scalar($imageFile))) {ContentObjectRenderer.php:1898ReplyAckContentObjectRenderer.php:1902ReplyAckContentObjectRenderer.php:2006ReplyAckContentObjectRenderer.php:2010ReplyAckContentObjectRenderer.php:2640ReplyAs it would prevent access to non existing array keys and therefore prevent a php info message i would vote for this change. Running the code with an empty $temp does not make sense at all...ContentObjectRenderer.php:2949ReplyBut phpstan points exactly to those points. If we do now "fix" those issues we won't find them anymore. This is exactly why i'm a bit unhappy if those patches are merged. I'm fine with not adding the log message in this patch but then we should add the logging at least in a separate patch before merging this patch. Opinions?ContentObjectRenderer.php:3436ReplyIMO logging should be added first in a different patchContentObjectRenderer.php:3851ReplyBut if we merge that patch we won't find those places anymore. So we should first fix that issue before merging this patch.ContentObjectRenderer.php:4990ReplyLogging should be addd before merging this patch. -
Daniel Goerz uploaded patch set 10 09/23/20, 14:03
-
Daniel Goerz commented on patch set 10 09/23/20, 14:07
ContentObjectRenderer.php:1004Reply Unresolveddoes not need to go first, IMHO, lets, keep this as is for now (first line of stdWrap($content, $config) is $content = (string)$content; btw) So this does not introduce a new problem. Lets come back to this in a dedicated patch and get this one in so we can move on.ContentObjectRenderer.php:1004ReplyDoneContentObjectRenderer.php:2640ReplyDoneContentObjectRenderer.php:2949ReplyDoneContentObjectRenderer.php:3436ReplyDoneContentObjectRenderer.php:3851ReplyDoneContentObjectRenderer.php:4990ReplyDone -
TYPO3com voted on patch set 10 V +1 09/23/20, 14:15 Completed build in 11m 34s on Wed, 23 Sep, 02:15 PM Test Summary: 73682 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5863
-
Oliver Klee voted on patch set 10 CR +1 09/23/20, 14:49
-
Daniel Goerz uploaded patch set 11 09/23/20, 15:36
-
Daniel Goerz uploaded patch set 12 09/23/20, 15:37
-
TYPO3com voted on patch set 11 V -1 09/23/20, 15:50 Completed build in 14m 42s on Wed, 23 Sep, 03:50 PM Test Summary: 72869 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5876
-
TYPO3com voted on patch set 12 V +1 09/23/20, 15:57 Completed build in 18m 15s on Wed, 23 Sep, 03:57 PM Test Summary: 73681 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5877
-
Christian Kuhn voted on patch set 12 V +1 CR +1 09/23/20, 16:01
-
Daniel Goerz voted on patch set 12 V +1 CR +1 09/23/20, 16:13
-
Daniel Goerz voted on patch set 12 V +2 CR +2 09/23/20, 16:38
-
Daniel Goerz merged patch set 13 09/23/20, 16:39