box icon indicating copy to clipboard operation
box copied to clipboard

annotations: false still strips some annotations

Open danepowell opened this issue 4 years ago • 2 comments

Bug report

Question Answer
Box version 3.13.0
PHP version 7.4
Platform with version Ubuntu
Github Repo -

I'd like to prevent annotations from being stripped by the PHP compactor. Specifying "annotations": false works to a degree, but still strips parts of annotations.

Specifically:

class Foo {

  /**
   * A foo version.
   *
   * @var string
   *
   * @JMS\Type("string")
   */
  private $version;

Even with "annotations": false becomes compacted as:

class Foo {

/**
@var
@JMS\Type("string")



*/
private $version;

Notice that this preserves @var but still strips the data type, which unfortunately breaks things such as the JMS serializer (leading to errors like "You must define a type for $version").

danepowell avatar Sep 27 '21 22:09 danepowell

Hm there is something fishy there: if there is no annotation compacting then the phpdoc should be left alone, which doesn't appear to be the case here

theofidry avatar Sep 28 '21 20:09 theofidry

Fishy indeed, that's why I posted the bug report 😄

Here's a minimum failing example where you can see the same bad behavior: https://github.com/danepowell/box-566

danepowell avatar Sep 29 '21 15:09 danepowell