Review main Merged

65064[TASK] Use stdWrapValue where possible (part 2)

Nikita Hovratov CR +2 V +2 Hard +149 −227 updated 10/07/21, 18:36

Commit message

This is the second part to replace stdWrap calls where stdWrapValue
is possible instead.
The type int is now a possible return type for stdWrapValue.
In addition stdWrapValue can return now the string "0" if returned by
stdWrap operation.

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
    • Andreas Kienast +1
    • TYPO3com +1 CI

Issues 2

Files 11

Review log 2837

Show 812 earlier messages
  1. Nikita Hovratov uploaded patch set 1 07/21/20, 14:27

  2. TYPO3com voted on patch set 1 V -1 07/21/20, 14:39 Completed build in 11m 10s on Tue, 21 Jul, 02:39 PM Test Summary: 69 of 73396 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4180

  3. Nikita Hovratov uploaded patch set 2 07/21/20, 16:51

  4. TYPO3com voted on patch set 2 V -1 07/21/20, 17:02 Completed build in 11m 19s on Tue, 21 Jul, 05:02 PM Test Summary: 57 of 73396 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4182

  5. Nikita Hovratov uploaded patch set 3 07/21/20, 18:15

  6. TYPO3com voted on patch set 3 V -1 07/21/20, 18:26 Completed build in 11m 17s on Tue, 21 Jul, 06:26 PM Test Summary: 72909 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4184

  7. Nikita Hovratov uploaded patch set 4 07/21/20, 18:29

  8. TYPO3com voted on patch set 4 V +1 07/21/20, 18:40 Completed build in 10m 50s on Tue, 21 Jul, 06:40 PM Test Summary: 72909 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4185

  9. Jörg Bösche commented on patch set 4 CR -1 09/02/20, 08:26

    ContentObjectRenderer.php:3239

    The return types of stdWrapValue are string|null. If we define an integer as default return value, there is a need to add the return type int to the stdWrapValue method. ------------------------------------ Example wit added return type "int". ------------------------------------ /** * Gets a configuration value by passing them through stdWrap first and taking a default value if stdWrap doesn't yield a result. * * @param string $key The config variable key (from TS array). * @param array $config The TypoScript array. * @param string|null $defaultValue Optional default value. * @return string|int|null Value of the config variable */ public function stdWrapValue($key, array $config, $defaultValue = '') { ... }
  10. Nikita Hovratov commented on patch set 4 09/02/20, 12:10

    ContentObjectRenderer.php:3239 Reply Unresolved

    Yes, you are right. Maybe change the return type to mixed, so it can be anything? Bool, int, float etc.
  11. Jörg Bösche commented on patch set 4 09/02/20, 12:43

    > Patch Set 4: > > (1 comment) Yes, unfortunately it looks as if mixed is the correct value, but we should mention the three return values in the annotation. Please check, if the core has boolean parameters to this method. If so, just add the return types. It is better to handle, if you see that a method can return type of string, null, int, bool instead of "mixed".
  12. Nikita Hovratov uploaded patch set 5 09/02/20, 12:56

  1. TYPO3com voted on patch set 5 V +1 09/02/20, 13:07 Completed build in 10m 52s on Wed, 2 Sep, 01:07 PM Test Summary: 73164 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5142

  2. Anja Leichsenring updated the commit message in patch set 6 09/02/20, 18:11

  3. Anja Leichsenring commented on patch set 6 V +1 CR +1 09/02/20, 18:13

    I hope my +1 on verify is not premature, because I am not overly confident my instance uses all the changed methods and looked at all the consuming places. Still, reads quite straight forward.
  4. TYPO3com voted on patch set 6 V +1 09/02/20, 18:23 Completed build in 11m 41s on Wed, 2 Sep, 06:23 PM Test Summary: 73182 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5151

  5. Jörg Bösche voted on patch set 6 V +1 CR +1 09/03/20, 09:17

  6. Christian Kuhn commented on patch set 6 09/03/20, 19:43

    Thanks for this patch! It makes a lot of code better readable. I'm only asking if a unit test for the change in the stdWrapValue() method could be do-able, to reflect and show the change happening there. Do you think that is possible without too much hassle, if so, we should do it. If it becomes too complicated, I could live without, though. Other than that, I'd be ready for merge.

    ContentObjectRenderer.php:1323 Unresolved

    this change would be worth a unit test, or is it hard to test for?
  7. Nikita Hovratov uploaded patch set 7 09/04/20, 07:43

  8. TYPO3com voted on patch set 7 V +1 09/04/20, 07:59 Completed build in 15m 37s on Fri, 4 Sep, 07:59 AM Test Summary: 73206 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5210

  9. Nikita Hovratov commented on patch set 7 09/04/20, 08:00

    > Patch Set 6: > > (1 comment) > > Thanks for this patch! It makes a lot of code better readable. > I'm only asking if a unit test for the change in the stdWrapValue() method could be do-able, to reflect and show the change happening there. Do you think that is possible without too much hassle, if so, we should do it. If it becomes too complicated, I could live without, though. > Other than that, I'd be ready for merge. Thanks! I added a unit test for this specific case.
  10. Nikita Hovratov uploaded patch set 8 09/04/20, 08:09

  11. TYPO3com voted on patch set 8 V +1 09/04/20, 08:21 Completed build in 11m 50s on Fri, 4 Sep, 08:21 AM Test Summary: 73206 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5213

  12. Alexander Schnitzler commented on patch set 8 09/04/20, 10:27

    ContentObjectRenderer.php:1307

    Is it really necessary to introduce a second possible type here?
  13. Christian Kuhn commented on patch set 8 09/04/20, 12:05

    ContentObjectRenderer.php:1307 Reply

    Hmm, it's already possible to feed stdWrapValue() with an int as defaultValue and stdwrap.intval also makes stdwrap() itself return an int (I guess). So, this annotation change is just there to state this fact, I'd say.
  14. Christian Kuhn voted on patch set 8 V +1 CR +1 09/04/20, 14:20

  15. Alexander Schnitzler commented on patch set 8 09/04/20, 14:29

    ContentObjectRenderer.php:1307 Reply Unresolved

    Ok, I always lived under the impression that in typoscript we don't really have other types than array, strings and null and that even integers are represented by numeric strings.
  16. Andreas Kienast commented on patch set 8 09/05/20, 08:47

    ContentObjectRenderer.php:1067 Unresolved

    Isn't this if() superfluous now? If I read the code correctly, basically the same is already in stdWrapValue().
  17. Andreas Kienast uploaded patch set 9 09/05/20, 08:49

  18. Andreas Kienast voted on patch set 9 V +1 CR +1 09/05/20, 08:49

  19. TYPO3com voted on patch set 9 V +1 09/05/20, 09:06 Completed build in 16m 54s on Sat, 5 Sep, 09:06 AM Test Summary: 73212 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5259

  20. Christian Kuhn voted on patch set 9 V +1 CR +1 09/05/20, 10:41

  21. Anja Leichsenring voted on patch set 9 V +2 CR +2 09/05/20, 10:45

  22. Anja Leichsenring merged patch set 10 09/05/20, 10:45

  23. Benni Mack commented on patch set 10 09/05/20, 15:35

    ContentObjectRenderer.php:1042

    this now breaks my frontend, as I have a setup where $conf is null instead of an array. I suggest to adapt stdWrapValue(..., ?array $conf...) with a nullable second argument?
  24. Nikita Hovratov commented on patch set 10 09/05/20, 16:49

    ContentObjectRenderer.php:1042 Reply Unresolved

    This might be good a solution, possibly there are other setups with a similar issue. In a perfect world conf would be always loaded with a default value. This is one of the things i am trying to accomplish with the ConfigurationProcessor.
  25. Georg Ringer commented on patch set 10 10/07/21, 18:36