From 1cf7e18d614255d2de10601cc6dee1bf1311ead0 Mon Sep 17 00:00:00 2001 From: Evan Villemez Date: Wed, 8 Aug 2012 10:21:56 -0400 Subject: [PATCH] fixed README, other minor things --- DependencyInjection/RegisterJmsParserPass.php | 8 ++------ Parser/JmsMetadataParser.php | 3 ++- README.md | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/DependencyInjection/RegisterJmsParserPass.php b/DependencyInjection/RegisterJmsParserPass.php index 81af794..7c61460 100644 --- a/DependencyInjection/RegisterJmsParserPass.php +++ b/DependencyInjection/RegisterJmsParserPass.php @@ -14,12 +14,8 @@ class RegisterJmsParserPass implements CompilerPassInterface $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); //JMS may or may not be installed, if it is, load that config as well - try { - if ($serializer = $container->findDefinition('serializer')) { - $loader->load('services.jms.xml'); - } - } catch (\Exception $e) { + if ($container->hasDefinition('jms_serializer.serializer')) { + $loader->load('services.jms.xml'); } - } } diff --git a/Parser/JmsMetadataParser.php b/Parser/JmsMetadataParser.php index 996c8db..24594ec 100644 --- a/Parser/JmsMetadataParser.php +++ b/Parser/JmsMetadataParser.php @@ -46,7 +46,7 @@ class JmsMetadataParser implements ParserInterface { $meta = $this->factory->getMetadataForClass($input); - if (is_null($meta)) { + if (null === $meta) { throw new \InvalidArgumentException(sprintf("No metadata found for class %s", $input)); } @@ -78,6 +78,7 @@ class JmsMetadataParser implements ParserInterface //TODO: regex comment to get description - or move doc comment parsing functionality from `ApiDocExtractor` to a new location //in order to reuse it here + return $description; } diff --git a/README.md b/README.md index d011f4b..46f8dd4 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,8 @@ The following properties are available: * `filters`: an array of filters; -* `input`: the input type associated to the method, currently this Form Types, and classes with JMS Serializer metadata, useful for POST|PUT methods, either as FQCN or - as form type (if it is registered in the form factory in the container) +* `input`: the input type associated to the method, currently this supports Form Types, and classes with JMS Serializer + metadata, useful for POST|PUT methods, either as FQCN or as form type (if it is registered in the form factory in the container) Each _filter_ has to define a `name` parameter, but other parameters are free. Filters are often optional parameters, and you can document them as you want, but keep in mind to be consistent for the whole documentation.