74517[TASK] Introduce string fragment extraction
Commit message
Review
-
Code review CR +2 Done
- Oliver Hader +2
- Andreas Kienast +1
- Benni Mack +1
-
Verified V +2 Done
- Oliver Hader +2
- Andreas Kienast +1
- Benni Mack +1
- core-ci +1 CI
Issues 1
Files 6
- typo3/sysext/core/Classes/Utility/String/StringFragment.php10new+53 −0
- typo3/sysext/core/Classes/Utility/String/StringFragmentCollection.php4new+120 −0
- typo3/sysext/core/Classes/Utility/String/StringFragmentPattern.phpnew+42 −0
- typo3/sysext/core/Classes/Utility/String/StringFragmentSplitter.php6new+110 −0
- typo3/sysext/core/Tests/Unit/Utility/String/StringFragmentCollectionTest.phpnew+117 −0
- typo3/sysext/core/Tests/Unit/Utility/String/StringFragmentSplitterTest.php3new+96 −0
Review log 3038
Show 813 earlier messages
-
Oliver Hader uploaded patch set 1 05/04/22, 13:17
-
core-ci voted on patch set 1 V +1 05/04/22, 13:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26820
-
Oliver Hader uploaded patch set 2 05/04/22, 13:47
-
core-ci voted on patch set 2 V -1 05/04/22, 13:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26822
-
Oliver Hader uploaded patch set 3 05/04/22, 19:14
-
core-ci voted on patch set 3 V -1 05/04/22, 19:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26834
-
Oliver Hader uploaded patch set 4 05/05/22, 06:53
-
core-ci voted on patch set 4 V +1 05/05/22, 07:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26870
-
crell commented on patch set 4 05/17/22, 17:21
StringFragmentCollection.php:86Why not just diff(), since that's what the PHP functions it's mimicking used? That would be more self-documenting.StringFragmentSplitter.php:29These can all be enums now. That would make the various mentions of "type" more self-evident elsewhere in the patch.StringFragmentSplitterTest.php:31Using a series of yield statements for this kind of provider tends to make them much easier to read and more maintainable. cf: https://peakd.com/hive-168588/@crell/fun-with-phpunit-data-providers (skip down to "do you yield?") -
Oliver Hader commented on patch set 4 06/01/22, 11:30
StringFragmentCollection.php:55ReplyDoneStringFragmentCollection.php:86ReplyDone "differentiate" would be the imperative message to that instance - however, I don't care much, thus "diff" it is...StringFragmentSplitter.php:29ReplyThis change is targeted for TYPO3 v10 - no PHP 8.1 - no enums hereStringFragmentSplitterTest.php:31ReplyFor that particular test here I don't see it would be "much easier to read". The key of tests is to understand the application logic that actually should be asserted. -
Oliver Hader uploaded patch set 5 06/01/22, 11:30
-
core-ci voted on patch set 5 V -1 06/01/22, 11:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27617
-
Simon Schaufelberger commented on patch set 5 06/01/22, 12:48
StringFragment.php:38please put the contructor firstStringFragmentSplitter.php:29Replyif this patch targets v10, then more backports need to be done like line 58
-
Oliver Hader commented on patch set 5 06/01/22, 12:51
StringFragment.php:38ReplyWhy?StringFragmentSplitter.php:29ReplyThe patch IS targeted for v10, and sure property types need to be adjusted... -
Oliver Klee commented on patch set 5 06/01/22, 12:55
StringFragment.php:38ReplyBy convention, the constructor always comes as the first method (so human readers have an easier time understanding the class). (This is not codified in any PSR standard, though, AFAIK.) -
Oliver Hader commented on patch set 5 06/01/22, 13:07
StringFragment.php:38ReplyNever heard about that convention - do you have any links/resources for that? -
Oliver Klee commented on patch set 5 06/01/22, 13:34
StringFragment.php:38Replya) Robert C. Martin: Clean Code, chapter 5, page 84, on vertical ordering: Methods should be roughly ordered by dependency, i.e., if A calls B, A should come first. (And related is the idea that methods should be in "reading order", i.e. mostly in the order in they are usually called.) There's a StackExchange thread on this: https://softwareengineering.stackexchange.com/questions/199311/most-human-friendly-way-to-order-class-method-definitions b) The Flow CGL: https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartV/CodingGuideLines/PHP.html#php-in-general -
Oliver Hader commented on patch set 5 06/01/22, 17:02
StringFragment.php:38ReplyQuoting Bob Martin completely > In general we want function call dependencies to point in the downward direction. That is, a function that is called should be below a function that does the calling. This creates a nice flow down the source code module from high level to low level. → and that basically the case here, since both static functions are factory methods, invoking the constructor when creating a new instance The other two references are rather opinionated and/or not strictly followed - e.g. the Flow reference mentions `__destruct` to be declared at the end of a class, which I think does not reflect reality. I'm going to keep the ordering of this change as is. Besides having these valuable discussions about code style and format, I'm also looking forward to seeing feedback on the actual application and functionality of this change. -
core-ci voted on patch set 5 V +1 06/02/22, 06:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27617
-
Simon Schaufelberger commented on patch set 5 06/02/22, 11:32
StringFragment.php:38Replyso if the constructor should not be called directly but only via the static methods above, wouldn't it make sense to make the constructor protected? -
Simon Schaufelberger commented on patch set 5 06/02/22, 11:33
StringFragmentSplitter.php:29ReplyThat was exactly my question. Wouldn't it make sense to use PHP8.1 features here and then backport them differently? -
Oliver Hader commented on patch set 5 06/02/22, 11:33
StringFragment.php:38Reply> so if the constructor should not be called directly but only via the static methods above, wouldn't it make sense to make the constructor protected? The constructor still can be called directly -
Simon Schaufelberger commented on patch set 5 06/02/22, 11:38
StringFragment.php:38ReplyDoes it make sense to call it? -
Oliver Hader commented on patch set 5 06/02/22, 11:40
Thanks for all of your feedback on this change... I'm giving up here and probably will pick it up at a later point. -
Oliver Hader abandoned the change 06/02/22, 11:40
-
Oliver Hader restored the change 12/06/22, 12:33
-
Oliver Hader commented on patch set 5 12/06/22, 12:35
I'm giving this another try...StringFragment.php:38ReplyDoneStringFragmentSplitter.php:29ReplyNo -
Oliver Hader rebased onto patch set 6
V +112/06/22, 12:35 -
core-ci voted on patch set 6 V +1 12/06/22, 12:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34718
-
Oliver Klee wrote 12/06/22, 12:54
Removed cc Oliver Klee. -
Oliver Hader uploaded patch set 7
V +112/06/22, 13:34 -
Oliver Hader commented on patch set 7 12/06/22, 13:35
StringFragmentSplitterTest.php:31ReplyIt's not easier now, but I changed it to use `yield` -
core-ci voted on patch set 7 V +1 12/06/22, 13:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34721
-
crell wrote 12/06/22, 20:09
Removed cc crell. -
Benni Mack voted on patch set 7 V +1 CR +1 12/06/22, 22:39
-
Andreas Kienast voted on patch set 7 V +1 CR +1 12/07/22, 08:59
-
Oliver Hader voted on patch set 7 V +2 CR +2 12/07/22, 13:28
-
Oliver Hader merged patch set 8 12/07/22, 13:28
StringFragmentCollection.php:55