diff --git a/Nelmio/Extractor/ApiDocExtractor.php b/Nelmio/Extractor/ApiDocExtractor.php index 79c74a3ecf0..cb10e8f4a86 100644 --- a/Nelmio/Extractor/ApiDocExtractor.php +++ b/Nelmio/Extractor/ApiDocExtractor.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Dunglas\ApiBundle\Nelmio\Extractor; use Doctrine\Common\Util\ClassUtils; diff --git a/Nelmio/Parser/ApiParser.php b/Nelmio/Parser/ApiParser.php index 3c8acfd9c70..f51f28274d0 100644 --- a/Nelmio/Parser/ApiParser.php +++ b/Nelmio/Parser/ApiParser.php @@ -30,12 +30,12 @@ class ApiParser implements ParserInterface const OUT_PREFIX = 'dunglas_api_out'; const IRI = 'IRI'; - private static $typeMap = array( + private static $typeMap = [ 'int' => DataTypes::INTEGER, 'bool' => DataTypes::BOOLEAN, 'string' => DataTypes::STRING, 'float' => DataTypes::FLOAT, - ); + ]; /** * @var ResourceCollectionInterface @@ -88,7 +88,7 @@ public function parse(array $item) * * @return array */ - private function parseClass(ResourceInterface $resource, $entityClass, $io, array $visited = array()) + private function parseClass(ResourceInterface $resource, $entityClass, $io, array $visited = []) { $visited[] = $entityClass; @@ -99,7 +99,7 @@ private function parseClass(ResourceInterface $resource, $entityClass, $io, arra $resource->getValidationGroups() ); - $data = array(); + $data = []; /** @var AttributeMetadataInterface $attributeMetadata */ foreach ($classMetadata->getAttributesMetadata() as $name => $attributeMetadata) { if ( @@ -124,14 +124,14 @@ private function parseClass(ResourceInterface $resource, $entityClass, $io, arra * * @return array */ - private function parseAttribute(ResourceInterface $resource, AttributeMetadataInterface $attributeMetadata, $io, Type $type = null, array $visited = array()) + private function parseAttribute(ResourceInterface $resource, AttributeMetadataInterface $attributeMetadata, $io, Type $type = null, array $visited = []) { - $data = array( + $data = [ 'dataType' => null, 'required' => $attributeMetadata->isRequired(), 'description' => $attributeMetadata->getDescription(), 'readonly' => !$attributeMetadata->isWritable(), - ); + ]; if (null == $type) { if (null === $attributeMetadata->getType()) {