phpDocumentor / ReflectionDocBlock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with substituting curly braces {}

bshaffer opened this issue · comments

The DescriptionFactory class is replacing all instances of {} with }, and does not (and cannot) revert them back to {} upon render. As a result, any instance of {} in any docblock is incorrectly changed.

This happens here. The only way I can see to get around it is to create a new DescriptionFactory class, which contains the identical code to this class, with the exception of that one line.

I request that this library either:

  1. Properly substitute the {} back in during render
  2. Provide an easier way to bypass replacing {}.

I'm happy to submit the fix myself if the maintainers would like to weigh in on their preference. When I removed the substitution of {}, I have found no adverse effects, so I may need more guidance as to why this is necessary before submitting a change.

Thanks for this great library!

Related: #274

Hi,

Somehow, your requests slipped through. This library doesn't have our main focus as it has nearly any bugs that are preventing people from doing their work. Sorry for that.

{} as commented in the lines you found in the DescriptionFactory has a special purpose in docblocks to allow inline tags. Before I can answer you question properly, could you please provide an example where this replacement gives issues in our documentation process?

The {} was intended to be able to escape } in your docblocks. for example

/**
 * My method
 *
 * This is a docblock containing an inline tag to explain escaping for {@{} and {{}
 * {@see DescriptionFactory will replace {{} to allow closing braces in your description}
 */

The {} notation is quite old. Removing this escape option would break the usage of docblocks for other people. So when possible I would recommend you to change your docblocks to use {{} in order get the result {} in your documentation.

Please let us know if this helps you to understand the behavior.