Review main Merged

62200[BUGFIX] Fix PHPDoc of BackendUtility::getRecordLocalization

Tomita Militaru CR +2 V +2 Easy +1 −1 updated 11/08/19, 11:44

Commit message

Now the return annotation states out that an empty array will
be returned if no localized records can be found and FALSE only
if the table is not localizable.

Review

  • Code review CR +2 Done
    • Frank Nägler +2
    • Kevin Ditscheid +1
  • Verified V +2 Done
    • Frank Nägler +2
    • Kevin Ditscheid +1
    • TYPO3com +1 CI

Issues 1

Files 1

Review log 3138

Show 1113 earlier messages
  1. Tomita Militaru uploaded patch set 1 11/05/19, 22:20

  2. TYPO3com voted on patch set 1 V -1 11/05/19, 22:30 Completed build in 10m 05s on Tue, 5 Nov, 10:30 PM Test Summary: 1 of 48490 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38025

  3. Oli Bartsch commented on patch set 1 11/06/19, 06:08

    Unresolved

    Could we please add the term 'localized' here so it gets clear we are talking about fetching localized records.

    BackendUtility.php:304 Unresolved

    We could simplify this by using shorthanded if/else: ’$recordLocalization = $queryBuilder->execute()->fetchAll() ?: false;’ What do you think?
  4. Kevin Ditscheid commented on patch set 1 11/06/19, 06:23

    > Patch Set 1: > > (2 comments) Simplify this further by initializing empty $recordLocalization at the beginning and then do `return $recordLocalization === [] ? FALSE : $recordLocalization;`
  5. Oli Bartsch commented on patch set 1 11/06/19, 06:54

    > Patch Set 1: > > > Patch Set 1: > > > > (2 comments) > > Simplify this further by initializing empty $recordLocalization at the beginning and then do > `return $recordLocalization === [] ? FALSE : $recordLocalization;` Better. But AFAIK you can use ?: here as this includes empty arrays: `return $recordLocalization ?: false;`
  6. Kevin Ditscheid commented on patch set 1 11/06/19, 06:57

    > Patch Set 1: > > > Patch Set 1: > > > > > Patch Set 1: > > > > > > (2 comments) > > > > Simplify this further by initializing empty $recordLocalization at the beginning and then do > > `return $recordLocalization === [] ? FALSE : $recordLocalization;` > > Better. But AFAIK you can use ?: here as this includes empty arrays: > > `return $recordLocalization ?: false;` Sure. We just need to be clear here, because mixed return is kinda meh in the first place :-/
  7. Tomita Militaru uploaded patch set 2 11/06/19, 22:43

  8. TYPO3com voted on patch set 2 V -1 11/06/19, 22:43 Completed build in 13s on Wed, 6 Nov, 10:43 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38053

  9. Oli Bartsch commented on patch set 2 V -1 11/07/19, 06:56

    BackendUtility.php:303 Unresolved

    Sorry but this way it won’t work at all. You removed the execution of the query. In the current state `$recordLocalization` will be false anyway as it’s defined at the top and doesn’t get changed anymore. We were only talking about simplify the comparison in your first patch set. I’ll provide a new patch set for this.
  10. Oli Bartsch uploaded patch set 3 11/07/19, 07:08

  11. Kevin Ditscheid commented on patch set 3 CR -1 11/07/19, 07:12

    Sry but now it returns an empty array, if the table can not be localized. Please do the shorthand if at the return and not at the queryBuilder
  12. Oli Bartsch commented on patch set 3 V +1 CR +1 11/07/19, 07:12

    This works now as expected. However as BackendUtility is of official public api this may be a breaking change as someone could rely on the wrong return type. Some core dev must have a look at it. If so, currently only changing the PHPDoc (remove the "if none exist, FALSE is returned") would be possible.
  13. Oli Bartsch commented on patch set 3 V -1 CR 0 11/07/19, 07:14

    > Patch Set 3: Code-Review-1 > > Sry but now it returns an empty array, if the table can not be localized. Please do the shorthand if at the return and not at the queryBuilder Ah, good catch, your are right will change this.
  1. Oli Bartsch uploaded patch set 4 11/07/19, 07:16

  2. TYPO3com voted on patch set 3 V +1 11/07/19, 07:19 Completed build in 10m 33s on Thu, 7 Nov, 07:19 AM Test Summary: 48147 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38055

  3. Kevin Ditscheid voted on patch set 4 CR +1 11/07/19, 07:24

  4. TYPO3com voted on patch set 4 V -1 11/07/19, 07:25 Completed build in 08m 44s on Thu, 7 Nov, 07:25 AM Test Summary: 47895 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38056

  5. TYPO3com voted on patch set 4 V +1 11/07/19, 07:38 Completed build in 11m 45s on Thu, 7 Nov, 07:38 AM Test Summary: 48147 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38057

  6. Alexander Schnitzler commented on patch set 4 CR -1 11/07/19, 12:38

    BackendUtility.php:306

    Technically that's correct but what we really want here is to get rid of false as a return type. It should be an array or null to avoid mixed return types. Our goal is strict types, specifically ?array.
  7. Oli Bartsch commented on patch set 4 11/07/19, 12:46

    BackendUtility.php:306 Reply

    Alright. Is this something we should do now? - than I'll provide a new patchset. (See my comment above about possible breaking change)
  8. Kevin Ditscheid commented on patch set 4 11/07/19, 13:51

    I think we should fix this for TYPO3 9 and 10 according to the function doc block, because a general change in the return type would indeed mean a breaking change and though probably a release for TYPO3 11 and honestly this is to late for this simple fix in my opinion.
  9. Alexander Schnitzler commented on patch set 4 11/07/19, 14:01

    > Patch Set 4: > > I think we should fix this for TYPO3 9 and 10 according to the function doc block, because a general change in the return type would indeed mean a breaking change and though probably a release for TYPO3 11 and honestly this is to late for this simple fix in my opinion. Well, technically that method already broke because a the moment it never returns false. And as we don't have a strict type hint but only a doc block, I don't see a breaking change here. But in the end I am ok with both solutions. We can take the long road or ride that "it is already breaking" horse and do it right. I'll remove my -1 and let you decide.
  10. Alexander Schnitzler voted on patch set 4 CR 0 11/07/19, 14:01

  11. Kevin Ditscheid commented on patch set 4 11/07/19, 14:23

    > Patch Set 4: > > > Patch Set 4: > > > > I think we should fix this for TYPO3 9 and 10 according to the function doc block, because a general change in the return type would indeed mean a breaking change and though probably a release for TYPO3 11 and honestly this is to late for this simple fix in my opinion. > > Well, technically that method already broke because a the moment it never returns false. And as we don't have a strict type hint but only a doc block, I don't see a breaking change here. But in the end I am ok with both solutions. We can take the long road or ride that "it is already breaking" horse and do it right. I'll remove my -1 and let you decide. How about another opinion about that from someone else? I mean, I am not a core dev and I do not want to be the expert here :)
  12. Benni Mack commented on patch set 4 11/07/19, 14:37

    BackendUtility.php:306 Reply Unresolved

    tbh, I wouldn't care about this right now - This method is broken in various ways (esp. due to BackendWorkspaceRestriction), in this case, I suggest we should move various functions of this kind into one common place to deal with this kind of things. Personally, to fix the issue mentioned in the issue tracker, we should fix the doc comment for now!
  13. Oli Bartsch uploaded patch set 5 11/07/19, 15:04

  14. TYPO3com voted on patch set 5 V -1 11/07/19, 15:15 Completed build in 11m 23s on Thu, 7 Nov, 03:15 PM Test Summary: 17 of 48506 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38076

  15. TYPO3com voted on patch set 5 V +1 11/07/19, 15:18 Completed build in 25m 08s on Thu, 7 Nov, 03:18 PM Test Summary: 48147 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38076

  16. Kevin Ditscheid commented on patch set 5 CR -1 11/07/19, 15:23

    BackendUtility.php:269

    Now this is a long ass ugly line now :-/
  17. Oli Bartsch commented on patch set 5 11/07/19, 15:24

    BackendUtility.php:269 Reply

    Open for suggestions ;)
  18. Kevin Ditscheid commented on patch set 5 CR 0 11/07/19, 15:25

    > Patch Set 5: > > (1 com

    BackendUtility.php:269 Reply

    I am indeed thinking what to ommit to make this look better, but I honestly struggle with comming up with something better instead :-[
  19. Alexander Schnitzler commented on patch set 5 11/07/19, 17:19

    BackendUtility.php:269 Reply

    Why not just use @return array here? That's the correct type given the current implementation. A short explanation can follow. So in total: > @return array Returns an empty array if table is not localizable.
  20. Oli Bartsch commented on patch set 5 11/07/19, 20:24

    BackendUtility.php:269 Reply

    But that’s the point. It returns FALSE if table is not localizable. It only returns an empty array it there are no localized records.
  21. Tomita Militaru commented on patch set 5 11/07/19, 21:22

    I would go with Alexander's suggestion. Or Patch #1 - I think we are overcomplicating things here.
  22. Oli Bartsch commented on patch set 5 11/08/19, 08:00

    > Patch Set 5: > > I would go with Alexander's suggestion. Or Patch #1 - I think we are overcomplicating things here. Yes meanwhile. But as I wrote in my last comment to Alexander, we don't have @return array. we have @return mixed. That's why his suggestion would not describe the implementation correct because there is the possibility for getting false as a return.
  23. Kevin Ditscheid commented on patch set 5 V +1 CR +1 11/08/19, 08:10

    BackendUtility.php:269 Reply

    Let's keep the line then. I am for being more descriptive then dropping description because of beauty alone
  24. Frank Nägler voted on patch set 5 V +2 CR +2 11/08/19, 11:44

  25. Frank Nägler merged patch set 6 11/08/19, 11:44