In an existing Symfony console app, I achieved a modified output I wanted to do (as a proof-of-concept exercise) by changing this class:
vendor/symfony/console/Helper/DescriptorHelper.php
I changed this method:
protected function describeApplication(Application $application, array $options = []): void
and added a couple of auxiliary private methods.
But now I want to do it "the right way", with some kind of class extension or decoration instead of changing the core classes in vendor directory.
How can that be elegantly achieved in a way that any code calling the "old" TextDescriptor gets my class instead?
(I was reading about decoration, this seemed a good case for it, but it seems that the decorating classes can only see the public methods of the decorated class, so this one wouldn't be available to me...)
TextDescriptor. You can see here it is instantiated withnewkeyword. So there are no options to dynamically replace it with your class.