Candidate fix for issue #255 : loosen up inline tag splitting regexp
Test output before :
There was 1 failure:
1) phpDocumentor\Reflection\DocBlock\DescriptionFactoryTest::testDescriptionCanParseStringWithInlineTagAndBraces
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'This description has a {@link http://phpdoc.org/ This contains {braces} }'
+'This description has a {@link http://phpdoc.org/ This contains {braces}} }'
Test output after :
There was 1 failure:
1) phpDocumentor\Reflection\DocBlock\DescriptionFactoryTest::testDescriptionCanParseStringWithInlineTagAndBraces
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'This description has a {@link http://phpdoc.org/ This contains {braces} }'
+'This description has a {@link http://phpdoc.org/ This contains {braces}}
The new test case still doesn't pass because the trailing space at the end of the inline tag got cleared in StandardTagFactory::create() which seems to be intended behavior (removing it solves the issue but also breaks two other tests). Discussion / guidance needed in order to move forward.
A gentle reminder ( @jaapio ), I am still waiting for any kind of feedback as to how to tackle the subsequent problem and fix the issue here if you want me to .
Should the trim() call in StandardTagFactory::create() be run conditionnally somehow ?
Hi,
Thanks for your pr. I do not think we should change the behavior of this trimmed white space. People using this library are expecting this to be done.
What problem do you think it would solve to make this conditional?
Hi @jaapio , thanks for your feedback. Can you elaborate on this please :
I do not think we should change the behavior of this trimmed white space. People using this library are expecting this to be done.
My understanding is the test case currently fails because the tag rendered from the mock object : new LinkTag('http://phpdoc.org/', new Description('This contains {braces}'))
expectedly get rendered as : {@link http://phpdoc.org/ This contains {braces}}
Whereas the fixture string seems to dictate the trailing space to be rendered as final part of the link tag's description : {@link http://phpdoc.org/ This contains {braces} }
So, where is that trailing space supposed to come from in order for the test to pass ? My understanding is it was supposed to be properly captured as part of the link description, in that case the link tag description object should be instantiated with it. It might be possible, fixing the mock object output, with a small tweak to StandardTagFactory::create() alongside the use of a new, custom (non-trimming) formatter class. Would you agree ?
Perhaps it's worth mentioning in all other scenarios I've explored so far, plenty of other tests tend to break as a result of my changes.
@jaapio please review this new commit (along with an extra test), this is how I think it should be handled with minimal risk of BC break.