74313[TASK] Add native types for PermutationUtility
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Oliver Klee +1
- crell +1
- Stefan Bürk +1
-
Verified V +2 Done
- Benni Mack +2
- Stefan Bürk +1
- core-ci +1 CI
Issues 3
Files 1
Review log 2629
Show 34 earlier messages
-
crell uploaded patch set 1 04/13/22, 17:39
-
core-ci voted on patch set 1 V +1 04/13/22, 17:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26000
-
Oliver Klee voted on patch set 1 CR +1 04/13/22, 17:52
-
Jörg Bösche commented on patch set 1 CR -1 04/14/22, 08:10
-
Chris Müller commented on patch set 1 04/14/22, 09:37
PermutationUtility.php:97ReplyTYPO3 v12 will require PHP 8.1+. -
Stefan Bürk commented on patch set 1 04/14/22, 11:22
PermutationUtility.php:97ReplyNot will, it already do. min php is 8.1. And this is main only. Changed min requirements for v12 has been already announced: https://typo3.org/article/new-system-requirements-for-upcoming-typo3-v12#:~:text=TYPO3%20v12%20will%20require%20MariaDB,available%20in%20major%20Linux%20distributions. So please remove the -1 as this was the only argument for the -1 vote. -
Jörg Bösche voted on patch set 1 CR +1 04/14/22, 11:45
-
crell commented on patch set 1 04/14/22, 14:09
PermutationUtility.php:97ReplyDone -
Benni Mack commented on patch set 1 04/16/22, 20:07
This change is not breaking.PermutationUtility.php:97Replywhat's the benefit of using "mixed" vs not having a type? -
Benni Mack voted on patch set 1 CR -1 04/16/22, 20:08
-
Oliver Hader commented on patch set 1 CR -1 04/16/22, 20:17
This is not a breaking change... PoC: https://3v4l.org/kKYvP#v8.1.5 -
Oliver Hader commented on patch set 1 04/16/22, 20:18
Reply
Mixed order: https://3v4l.org/lIW3B#v8.1.5 -
crell commented on patch set 1 04/18/22, 14:28
PermutationUtility.php:97ReplyExplicitness. It makes it clear that the design of the function accepts/works with any type, as opposed to omitting it entirely which could also mean "I don't actually know what my code does". It also signals to callers that any type is allowed, not "you have to go read the function to reverse engineer what types are/are not allowed." At this point in PHP's life, the type system is robust enough that there are no parameters that should be left untyped. (The one exception being those that need combined union/intersection types, but those are very rare and should be supported fairly soon, I wager.) -
crell updated the commit message in patch set 2 04/18/22, 14:29
-
Oliver Klee commented on patch set 2 04/18/22, 14:30
PermutationUtility.php:97ReplyWhat Larry says. It's for communicating to the reader. -
Oliver Klee voted on patch set 2 CR +1 04/18/22, 14:31
-
core-ci voted on patch set 2 V +1 04/18/22, 14:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26155
-
Stefan Bürk commented on patch set 2 04/18/22, 16:22
PermutationUtility.php:97ReplyTo pick up Benni's question and precise it: What's the benefit of adding mixed instead of a concrete type. If we do a change here, we should consider if a concreter type can be used which make sense prior to simply adding a "mixed" for explictness without deeper meaning. Wouldn't 'string|\Stringable' be a more resonable type here ? See: https://3v4l.org/3FKKQ#v8.1.5 -
crell commented on patch set 2 04/18/22, 17:13
PermutationUtility.php:97ReplyChanging the function to take only `string|Stringable` would have the effect of its body being reduced to: ``` function asString(string|\Stringable $item): string return (string)$item; } ``` and it would change the throwable that gets thrown for non-string types. That is, the types effectively render this function pointless and callers to it should just change to check the type themselves. This method is only called once within this class, I believe, so we certainly could just inline the logic in meltStringItems(). Arguably we could just replace it with nothing, as the array in question is documented as taking an array of strings, and concatenation will already either invoke __toString, throw an exception for a non-stringable object, or raise a Warning on an array. (It used to be a notice, but became a warning on 8.0.) So if we're OK with the error type changing and being *slightly* less picky (arrays become a warning, not a LogicException), we can just remove the method entirely and not replace it with anything. After ducking it through to myself above, I think that's my preferred approach. It doesn't really give us much at this point that we actually need. -
Oliver Klee commented on patch set 2 04/18/22, 17:17
PermutationUtility.php:97ReplySounds good to me. -
Stefan Bürk commented on patch set 2 04/18/22, 17:32
PermutationUtility.php:97ReplyIt seems, that this util is mainly ( **only** ) used to prepare data in tests. And not used in normal core code. And in the end, would not make sense for real extension to use it anyway. -
Stefan Bürk commented on patch set 2 04/18/22, 17:40
PermutationUtility.php:97ReplyI would go with leaving the protected method and use "string|\Stringable" type here. Or remove it and do a check on the item and if not string or stringable throw the LogicExpection directly in the method. -
Stefan Bürk uploaded patch set 3 04/18/22, 17:58
-
Oliver Klee voted on patch set 3 CR +1 04/18/22, 18:04
-
crell commented on patch set 3 CR +1 04/18/22, 18:11
PermutationUtility.php:97ReplyDone -
core-ci voted on patch set 3 V +1 04/18/22, 18:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26164
-
Stefan Bürk voted on patch set 3 V +1 CR +1 04/18/22, 18:25
-
Benni Mack voted on patch set 3 V +2 CR +2 04/19/22, 10:01
-
Benni Mack merged patch set 4 04/19/22, 10:01
PermutationUtility.php:97