From b48650a9e020d43ec5a3c0f4345714ef724344d7 Mon Sep 17 00:00:00 2001 From: William DURAND Date: Wed, 25 Jun 2014 08:46:01 +0200 Subject: [PATCH] Fix CS --- Annotation/ApiDoc.php | 14 +++++++------- Extractor/Handler/FosRestHandler.php | 8 +++++--- Formatter/FormatterInterface.php | 2 +- Parser/ValidationParser.php | 2 +- Tests/Extractor/Handler/FosRestHandlerTest.php | 2 +- Tests/Fixtures/Controller/TestController.php | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Annotation/ApiDoc.php b/Annotation/ApiDoc.php index 08dc2e8c1..5692171e7 100644 --- a/Annotation/ApiDoc.php +++ b/Annotation/ApiDoc.php @@ -228,15 +228,15 @@ public function __construct(array $data) $this->deprecated = $data['deprecated']; } - if (isset($data['tags'])) { - $tags = $data['tags']; + if (isset($data['tags'])) { + $tags = $data['tags']; - if (!is_array($tags)) { - $tags = array($tags); - } + if (!is_array($tags)) { + $tags = array($tags); + } - $this->tags = $tags; - } + $this->tags = $tags; + } if (isset($data['https'])) { $this->https = $data['https']; diff --git a/Extractor/Handler/FosRestHandler.php b/Extractor/Handler/FosRestHandler.php index b866df0a9..3165e205c 100644 --- a/Extractor/Handler/FosRestHandler.php +++ b/Extractor/Handler/FosRestHandler.php @@ -56,11 +56,11 @@ public function handle(ApiDoc $annotation, array $annotations, Route $route, \Re } } } - + /** * Handle FOSRestBundle requirements in order to return a string. * - * @param mixed $requirements + * @param mixed $requirements * @return string */ private function handleRequirements($requirements) @@ -70,8 +70,10 @@ private function handleRequirements($requirements) return $requirements->getHtmlPattern(); } $class = get_class($requirements); + return substr($class, strrpos($class, '\\')+1); } - return (string)$requirements; + + return (string) $requirements; } } diff --git a/Formatter/FormatterInterface.php b/Formatter/FormatterInterface.php index 95147c286..ccfced513 100644 --- a/Formatter/FormatterInterface.php +++ b/Formatter/FormatterInterface.php @@ -27,7 +27,7 @@ public function format(array $collection); * Format documentation data for one route. * * @param ApiDoc $annotation - * return string|array + * return string|array */ public function formatOne(ApiDoc $annotation); } diff --git a/Parser/ValidationParser.php b/Parser/ValidationParser.php index a7281e281..1d9e4b861 100644 --- a/Parser/ValidationParser.php +++ b/Parser/ValidationParser.php @@ -233,7 +233,7 @@ protected function parseConstraint(Constraint $constraint, $vparams, $className, /** * Return Choice constraint choices. * - * @param Constraint $constraint + * @param Constraint $constraint * @param $className * @return array * @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException diff --git a/Tests/Extractor/Handler/FosRestHandlerTest.php b/Tests/Extractor/Handler/FosRestHandlerTest.php index bcb0de964..147081938 100644 --- a/Tests/Extractor/Handler/FosRestHandlerTest.php +++ b/Tests/Extractor/Handler/FosRestHandlerTest.php @@ -86,7 +86,7 @@ public function testGetWithQueryParamNoDefault() $this->assertArrayNotHasKey('default', $filter); } - + public function testGetWithConstraintAsRequirements() { $container = $this->getContainer(); diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index dea356879..a299db012 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -130,7 +130,7 @@ public function zActionWithQueryParamAction() public function zActionWithQueryParamNoDefaultAction() { } - + /** * @ApiDoc() * @QueryParam(name="mail", requirements=@Email, description="Email of someone.")