Review main Merged

75259[TASK] Revamp Template Object Browser

Christian Kuhn CR +2 V +2 Nightmare +1617 −1002 updated 07/25/22, 13:48

Commit message

Second main usage of the new TypoScript parser is
the ext:tstemplate Object Browser.

In contrast to the Template Analyzer patch that brought
a fully revamped view with new features, this Object Browser
patch is mostly just a modernization of the view, so this
patch is not marked as feature.

The Object Browser now renders both setup and constant
tree at the same time. Other than that, most existing
features are kept and streamlined along the way. As
example, searching for a constant name now reveals
constant usages in setup, plus similar small gems.

The only missing features are currently the comments
rendering, plus rendering of parser errors. Comments
are a bigger issue that will be implemented with a
revamped Constant Editor, Object Browser will then
add comment rendering as side effect. Parts of the
parser errors (detecting invalid lines) will be added
to Template Analyzer with a dedicated patch soon, further
details will be added to Object Browser when suitable.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 2

Files 30

Show 10 more files

Review log 4565

Show 2740 earlier messages
  1. Christian Kuhn uploaded patch set 1 07/22/22, 11:27

  2. core-ci voted on patch set 1 V -1 07/22/22, 11:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29421

  3. Christian Kuhn uploaded patch set 2 07/22/22, 18:59

  4. core-ci voted on patch set 2 V -1 07/22/22, 19:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29435

  5. Christian Kuhn uploaded patch set 3 07/23/22, 11:04

  6. Oliver Klee commented on patch set 3 07/23/22, 11:11

    CurrentObjectPath.php:68

    This will ignore path node names that are falsy, e.g. "0". So this should be this instead: if ($name !== '') { (And this also should be covered with a test.)
  7. core-ci voted on patch set 3 V -1 07/23/22, 11:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29448

  8. Christian Kuhn uploaded patch set 4 07/23/22, 11:59

  9. Christian Kuhn uploaded patch set 5 07/23/22, 12:05

  10. core-ci voted on patch set 4 V -1 07/23/22, 12:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29450

  11. core-ci voted on patch set 5 V -1 07/23/22, 12:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29451

  12. Christian Kuhn commented on patch set 5 07/23/22, 12:23

    CurrentObjectPath.php:68 Reply

    you're right. great catch! fixed with set 5->6
  13. Christian Kuhn uploaded patch set 6 07/23/22, 12:24

  14. Oliver Klee commented on patch set 6 07/23/22, 12:26

    CurrentObjectPath.php:68

    Thinking … Would it make sense to change this check and the exception so that instead the node constructor expects a non-empty string as name (annotated as @param non-empty-string) and throws an InvalidArgumentException if the name is empty?
  15. Oliver Klee commented on patch set 6 07/23/22, 12:28

    CurrentObjectPath.php:68 Reply

    Thanks! In general, empty() often behaves in mysterious and rather unexpected ways. That why the strict PHPStan ruleset complains about its use (IIRC). :-)
  16. Christian Kuhn commented on patch set 6 07/23/22, 12:28

    CurrentObjectPath.php:68 Reply

    yeah. might be do-able. will try.
  17. Christian Kuhn commented on patch set 6 07/23/22, 12:29

    CurrentObjectPath.php:68 Reply

    i'm aware of empty() shenanigans and try to use it with care / when it makes sense.
  18. core-ci voted on patch set 6 V -1 07/23/22, 12:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29452

  19. Christian Kuhn commented on patch set 6 07/23/22, 12:39

    CurrentObjectPath.php:68 Reply

    Not possible since RootNode has name 'null': A nullable node-name can be added.
  20. Christian Kuhn commented on patch set 6 07/23/22, 12:51

    CurrentObjectPath.php:68 Reply

    it's just "if it's a string, it must be non empty". I'd like to keep that check "lazy" in usages and not in constructor since this object is a heavy-used one during ast-building, so an if in __construct() would result in lot's of if's that aren't needed in most cases during ast-building. doing that check late in thise less-often used method is more performant.
  21. Christian Kuhn uploaded patch set 7 07/24/22, 06:35

  22. core-ci voted on patch set 7 V +1 07/24/22, 06:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29460

  23. Christian Kuhn uploaded patch set 8 07/24/22, 08:51

  24. core-ci voted on patch set 8 V -1 07/24/22, 08:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29461

  25. Christian Kuhn uploaded patch set 9 07/24/22, 10:28

  26. core-ci voted on patch set 9 V -1 07/24/22, 10:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29462

  27. Christian Kuhn updated the commit message in patch set 10 07/24/22, 10:50

  28. Christian Kuhn uploaded patch set 11 07/24/22, 10:57

  29. core-ci voted on patch set 10 V -1 07/24/22, 10:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29463

  30. core-ci voted on patch set 11 V +1 07/24/22, 11:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29464

  31. Christian Kuhn uploaded patch set 12 07/24/22, 11:18

  32. core-ci voted on patch set 12 V +1 07/24/22, 11:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29465

  33. Oliver Klee commented on patch set 12 07/24/22, 12:32

    Added a few thoughts.

    CurrentObjectPathTest.php:80

    The assertion here is never executed due to the exception being throw. So the getPathAsString call should suffice.

    CurrentObjectPathTest.php:86

    Won't this in all practical scenarios always be the root node, i.e., should we rename the tested method to getRootNode?

    CurrentObjectPathTest.php:114

    We also should have a test for scenarios where there is only one node (the root node).

    ObjectBrowserTree.html:66

    I'd recommend us not to have instanceof checks in Fluid templates - they rely on the classes/class names and not on certain properties. Also, they won't get updated if the class is renamed/moved using the automated refactoring in PhpStorm. Instead, I propose we add some has*/is*/can* methods to our node classes with hardcoded boolean return values. What do you think?
  34. Stefan Bürk commented on patch set 12 07/24/22, 12:53

    CurrentObjectPathTest.php:80 Reply

    Ack here.

    CurrentObjectPathTest.php:86 Reply

    rootNode is something different then the first node in the path. So test method naming is correct. (root nodes do not have a name and are class RootNode, not ChildNode. So using getRootNode... here would be technical wrong.

    CurrentObjectPathTest.php:114 Reply

    See above. RootNode and first node are not the same.
  35. Christian Kuhn commented on patch set 12 07/24/22, 13:51

    CurrentObjectPathTest.php:80 Reply

    true. should be removed.

    CurrentObjectPathTest.php:86 Reply

    yes. but does not matter. i wanted to test with an identifiable node here.

    CurrentObjectPathTest.php:114 Reply

    but good idea to test for "there's only one node". will do.

    ObjectBrowserTree.html:66 Reply

    yeah. it's a bit funny. we're using that in template analyzer with success already and i don't want to add further sub-class specific clutter to nodeinterface. i'd like to keep it for now.
  36. Christian Kuhn commented on patch set 12 07/24/22, 13:54

    CurrentObjectPathTest.php:80 Reply

    Done

    CurrentObjectPathTest.php:114 Reply

    Done
  37. Christian Kuhn uploaded patch set 13 07/24/22, 13:55

  38. core-ci voted on patch set 13 V +1 07/24/22, 14:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29467

  39. Oliver Klee commented on patch set 13 07/24/22, 14:02

    ObjectBrowserTree.html:66 Reply

    My main concern is the thing about PhpStorm not recognizing that the class is used, which breaks the rename (and the "search for usage") features. How should we solve that? And in general, from an architectural standpoint, I think one thing that classes are is "concepts with behavior, not concepts by name". So a class having a certain behavior (and providing information about that) would be cleaner, I think. (I also don't consider this to be clutter. The term "clutter" implies that it's not useful, with which I disagree.)
  40. Stefan Bürk voted on patch set 13 V +1 CR +1 07/24/22, 14:04

  1. Christian Kuhn commented on patch set 13 07/24/22, 14:33

    ObjectBrowserTree.html:66 Reply

    i understand your concern. however i'll not change this now. i'll think about this ugly isinstanceof VH in the next iteration to see if we could come up with something better.
  2. Christian Kuhn rebased onto patch set 14 07/24/22, 18:02

  3. core-ci voted on patch set 14 V +1 07/24/22, 18:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29477

  4. Stefan Bürk voted on patch set 14 V +1 CR +1 07/24/22, 18:38

  5. Christian Kuhn commented on patch set 14 CR -1 07/25/22, 10:07

    will drop isInstanceOf VH.
  6. Christian Kuhn uploaded patch set 15 07/25/22, 10:20

  7. core-ci voted on patch set 15 V +1 07/25/22, 10:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29490

  8. Nikita Hovratov uploaded patch set 16 07/25/22, 11:13

  9. core-ci voted on patch set 16 V +1 07/25/22, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29495

  10. Nikita Hovratov uploaded patch set 17 07/25/22, 12:15

  11. Nikita Hovratov voted on patch set 17 V +1 07/25/22, 12:15

  12. Stefan Bürk voted on patch set 17 V +1 CR +1 07/25/22, 12:19

  13. core-ci voted on patch set 17 V +1 07/25/22, 12:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29496

  14. Nikita Hovratov uploaded patch set 18 07/25/22, 13:13

  15. core-ci voted on patch set 18 V +1 07/25/22, 13:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29499

  16. Oliver Hader voted on patch set 18 CR +1 07/25/22, 13:30

  17. Nikita Hovratov uploaded patch set 19 07/25/22, 13:32

  18. Nikita Hovratov uploaded patch set 20 07/25/22, 13:37

  19. Nikita Hovratov voted on patch set 20 V +1 CR +1 07/25/22, 13:37

  20. core-ci voted on patch set 19 V +1 07/25/22, 13:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29501

  21. Stefan Bürk voted on patch set 20 V +1 CR +1 07/25/22, 13:42

  22. core-ci voted on patch set 20 V +1 07/25/22, 13:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29502

  23. Oliver Hader voted on patch set 20 CR +1 07/25/22, 13:46

  24. Christian Kuhn commented on patch set 20 V +2 CR +2 07/25/22, 13:48

    thank you for working on it an reviews!
  25. Christian Kuhn merged patch set 21 07/25/22, 13:48