Review main Abandoned

66286[TASK] Use correct data type in null coalesce in linkvalidator

Sybille Peters CR 0 V 0 Easy +14 −14 updated 11/05/21, 10:06

Commit message

Use correct datatype when using null coalescing operator.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 3

Review log 1823

  1. Sybille Peters uploaded patch set 1 10/26/20, 17:09

  2. TYPO3com voted on patch set 1 V +1 10/26/20, 17:21 Completed build in 12m 34s on Mon, 26 Oct, 05:21 PM Test Summary: 73560 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6895

  3. Sybille Peters marked it work in progress 10/26/20, 17:49

  4. Oliver Klee commented on patch set 1 10/26/20, 18:16

    LinkAnalyzer.php:166

    These should both still be false as this is a condition, i.e., a boolean.
  5. Sybille Peters uploaded patch set 2 10/27/20, 18:03

  6. Sybille Peters uploaded patch set 3 10/27/20, 18:10

  7. TYPO3com voted on patch set 2 V +1 10/27/20, 18:30 Completed build in 23m 32s on Tue, 27 Oct, 06:30 PM Test Summary: 73560 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6932

  8. TYPO3com voted on patch set 3 V +1 10/27/20, 18:44 Completed build in 19m 35s on Tue, 27 Oct, 06:44 PM Test Summary: 73558 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6934

  9. Benni Mack uploaded patch set 4 11/04/21, 11:16

  10. Benni Mack marked it ready for review 11/04/21, 11:16

  11. Benni Mack commented on patch set 4 11/04/21, 11:17

    Hey Sybille, can you check Oli's comments? How to proceed here?
  12. core-ci voted on patch set 4 V +1 11/04/21, 11:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18863

  13. Sybille Peters uploaded patch set 5 11/04/21, 13:24

  14. Sybille Peters commented on patch set 5 11/04/21, 13:25

    LinkAnalyzer.php:166 Reply

    Done
  15. core-ci voted on patch set 5 V +1 11/04/21, 13:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18882

  16. Oliver Klee commented on patch set 5 CR +1 11/04/21, 13:48

    Beautiful!
  17. Sybille Peters wrote 11/04/21, 16:21

    Topic set to Linkvalidator
  18. Benni Mack voted on patch set 5 V +1 CR +1 11/04/21, 17:10

  19. Nikita Hovratov commented on patch set 5 CR -1 11/04/21, 17:23

    ExternalLinktype.php:108

    Same as Olis comment before. This should be rather checked for an empty array/string.
  20. Tymoteusz Motylewski commented on patch set 5 11/05/21, 08:24

    ExternalLinktype.php:108 Reply

    if $config['headers.'] would be an empty array, that would be ok, wouldn;t it? or you want to avoid unnecessary array_merge with empty array? for the string - is there a case where headers. would be a string?
  21. Sybille Peters commented on patch set 5 11/05/21, 08:28

    ExternalLinktype.php:108 Reply

    Hey everyone, patch was created a long time ago, I am wondering if it makes sense at all this way. Please look at initial change: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66286/1 Code was ok, the way it was, e.g. if ($config['httpAgentName'] ?? false) { So, I would like to close and work on very urgent bugs now. Apart from that, these kind of things, I am not sure how it should be done in the core - do you have external resources I can read? I looked at https://github.com/jupeter/clean-code-php but there is no example for this kind of thing.
  22. Sybille Peters abandoned the change 11/05/21, 09:54

    Abandon because code was ok the way it was before.
  23. Nikita Hovratov commented on patch set 5 11/05/21, 10:06

    ExternalLinktype.php:108 Reply Unresolved

    Hey, we don't have any external resource for that. Everyone is doing it kinda his own way. Rule of thumb to mitigate warnings are: In boolean context: if ($variable['foo']) => if (!empty($variable['foo'])) OR if ($variable['foo']) => if ($variable['foo'] ?? false) Both work the same. People have different opinions about the "empty" function. Most prefer the second one. Everywhere else it should fallback to the expected default value, but it has to be checked first, if the missing value not a bug.