From 72c8c80d9c1393724afac90c76eaf630095bd36d Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Tue, 19 Dec 2017 23:14:57 +0100 Subject: [PATCH] adjust to feedback --- ModelDescriber/PhpdocPropertyAnnotationReader.php | 13 +++---------- README.md | 3 ++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ModelDescriber/PhpdocPropertyAnnotationReader.php b/ModelDescriber/PhpdocPropertyAnnotationReader.php index 9b97423..2f30700 100644 --- a/ModelDescriber/PhpdocPropertyAnnotationReader.php +++ b/ModelDescriber/PhpdocPropertyAnnotationReader.php @@ -52,7 +52,9 @@ class PhpdocPropertyAnnotationReader if (!$title = $docBlock->getSummary()) { /** @var Var_ $var */ foreach ($docBlock->getTagsByName('var') as $var) { - if (!$description = $var->getDescription()) continue; + if (!$description = $var->getDescription()) { + continue; + } $title = $description->render(); if ($title) break; } @@ -63,14 +65,5 @@ class PhpdocPropertyAnnotationReader if ($property->getDescription() === null && $docBlock->getDescription() && $docBlock->getDescription()->render()) { $property->setDescription($docBlock->getDescription()->render()); } - if ($property->getType() === null) { - /** @var Var_ $var */ - foreach ($docBlock->getTagsByName('var') as $var) { - if ($var->getType()) { - $property->setType($var->getType()); - break; - } - } - } } } diff --git a/README.md b/README.md index e6650b4..3066e29 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,8 @@ serialization groups when using the Symfony serializer. ### If you're using the JMS Serializer The metadata of the JMS serializer are used by default to describe your -models. Additional information is extracted from the PHP doc block comment. +models. Additional information is extracted from the PHP doc block comment, +but the property types must be specified in the JMS annotations. In case you prefer using the [Symfony PropertyInfo component](https://symfony.com/doc/current/components/property_info.html) (you won't be able to use JMS serialization groups), you can disable JMS serializer