vendor/nelmio/api-doc-bundle/PropertyDescriber/FloatPropertyDescriber.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the NelmioApiDocBundle package.
  4. *
  5. * (c) Nelmio
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Nelmio\ApiDocBundle\PropertyDescriber;
  11. use OpenApi\Annotations as OA;
  12. use Symfony\Component\PropertyInfo\Type;
  13. class FloatPropertyDescriber implements PropertyDescriberInterface
  14. {
  15. use NullablePropertyTrait;
  16. public function describe(array $types, OA\Schema $property, array $groups = null)
  17. {
  18. $property->type = 'number';
  19. $property->format = 'float';
  20. $this->setNullableProperty($types[0], $property);
  21. }
  22. public function supports(array $types): bool
  23. {
  24. return 1 === count($types) && Type::BUILTIN_TYPE_FLOAT === $types[0]->getBuiltinType();
  25. }
  26. }