Skip to content

Commit

Permalink
[Serializer] Fix CS. Uniformize PHPDoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Oct 2, 2014
1 parent 5cdda82 commit 4bbbad8
Show file tree
Hide file tree
Showing 20 changed files with 99 additions and 75 deletions.
1 change: 1 addition & 0 deletions Encoder/ChainDecoder.php
Expand Up @@ -58,6 +58,7 @@ public function supportsDecoding($format)
* @param string $format
*
* @return DecoderInterface
*
* @throws RuntimeException if no decoder is found
*/
private function getDecoder($format)
Expand Down
1 change: 1 addition & 0 deletions Encoder/ChainEncoder.php
Expand Up @@ -80,6 +80,7 @@ public function needsNormalization($format)
* @param string $format
*
* @return EncoderInterface
*
* @throws RuntimeException if no encoder is found
*/
private function getEncoder($format)
Expand Down
8 changes: 4 additions & 4 deletions Encoder/DecoderInterface.php
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

/**
* Defines the interface of decoders
* Defines the interface of decoders.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
Expand All @@ -23,9 +23,9 @@ interface DecoderInterface
/**
* Decodes a string into PHP data.
*
* @param scalar $data Data to decode
* @param string $format Format name
* @param array $context options that decoders have access to.
* @param scalar $data Data to decode
* @param string $format Format name
* @param array $context options that decoders have access to.
*
* The format parameter specifies which format the data is in; valid values
* depend on the specific implementation. Authors implementing this interface
Expand Down
10 changes: 5 additions & 5 deletions Encoder/EncoderInterface.php
Expand Up @@ -14,17 +14,17 @@
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

/**
* Defines the interface of encoders
* Defines the interface of encoders.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
interface EncoderInterface
{
/**
* Encodes data into the given format
* Encodes data into the given format.
*
* @param mixed $data Data to encode
* @param string $format Format name
* @param mixed $data Data to encode
* @param string $format Format name
* @param array $context options that normalizers/encoders have access to.
*
* @return scalar
Expand All @@ -34,7 +34,7 @@ interface EncoderInterface
public function encode($data, $format, array $context = array());

/**
* Checks whether the serializer can encode to given format
* Checks whether the serializer can encode to given format.
*
* @param string $format format name
*
Expand Down
4 changes: 2 additions & 2 deletions Encoder/JsonDecode.php
Expand Up @@ -41,8 +41,8 @@ class JsonDecode implements DecoderInterface
/**
* Constructs a new JsonDecode instance.
*
* @param bool $associative True to return the result associative array, false for a nested stdClass hierarchy
* @param int $depth Specifies the recursion depth
* @param bool $associative True to return the result associative array, false for a nested stdClass hierarchy
* @param int $depth Specifies the recursion depth
*/
public function __construct($associative = false, $depth = 512)
{
Expand Down
7 changes: 4 additions & 3 deletions Encoder/JsonEncode.php
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

/**
* Encodes JSON data
* Encodes JSON data.
*
* @author Sander Coolen <sander@jibber.nl>
*/
Expand Down Expand Up @@ -43,7 +43,7 @@ public function getLastError()
}

/**
* Encodes PHP data to a JSON string
* Encodes PHP data to a JSON string.
*
* {@inheritdoc}
*/
Expand Down Expand Up @@ -71,7 +71,8 @@ public function supportsEncoding($format)
/**
* Merge default json encode options with context.
*
* @param array $context
* @param array $context
*
* @return array
*/
private function resolveContext(array $context = array())
Expand Down
4 changes: 2 additions & 2 deletions Encoder/JsonEncoder.php
Expand Up @@ -37,7 +37,7 @@ public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodin
}

/**
* Returns the last encoding error (if any)
* Returns the last encoding error (if any).
*
* @return int
*
Expand All @@ -49,7 +49,7 @@ public function getLastEncodingError()
}

/**
* Returns the last decoding error (if any)
* Returns the last decoding error (if any).
*
* @return int
*
Expand Down
2 changes: 1 addition & 1 deletion Encoder/NormalizationAwareInterface.php
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Serializer\Encoder;

/**
* Defines the interface of encoders that will normalize data themselves
* Defines the interface of encoders that will normalize data themselves.
*
* Implementing this interface essentially just tells the Serializer that the
* data should not be pre-normalized before being passed to this Encoder.
Expand Down
2 changes: 1 addition & 1 deletion Encoder/SerializerAwareEncoder.php
Expand Up @@ -15,7 +15,7 @@
use Symfony\Component\Serializer\SerializerAwareInterface;

/**
* SerializerAware Encoder implementation
* SerializerAware Encoder implementation.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
Expand Down
21 changes: 13 additions & 8 deletions Encoder/XmlEncoder.php
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

/**
* Encodes XML data
* Encodes XML data.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
* @author John Wards <jwards@whiteoctober.co.uk>
Expand Down Expand Up @@ -146,7 +146,7 @@ public function supportsDecoding($format)
}

/**
* Sets the root node name
* Sets the root node name.
*
* @param string $name root node name
*/
Expand All @@ -156,7 +156,8 @@ public function setRootNodeName($name)
}

/**
* Returns the root node name
* Returns the root node name.
*
* @return string
*/
public function getRootNodeName()
Expand Down Expand Up @@ -229,7 +230,7 @@ final protected function appendDocumentFragment(\DOMNode $node, $fragment)
}

/**
* Checks the name is a valid xml element name
* Checks the name is a valid xml element name.
*
* @param string $name
*
Expand Down Expand Up @@ -279,7 +280,7 @@ private function parseXml(\DOMNode $node)
}

/**
* Parse the input DOMNode attributes into an array
* Parse the input DOMNode attributes into an array.
*
* @param \DOMNode $node xml to parse
*
Expand All @@ -305,7 +306,7 @@ private function parseXmlAttributes(\DOMNode $node)
}

/**
* Parse the input DOMNode value (content and children) into an array or a string
* Parse the input DOMNode value (content and children) into an array or a string.
*
* @param \DOMNode $node xml to parse
*
Expand Down Expand Up @@ -347,7 +348,7 @@ private function parseXmlValue(\DOMNode $node)
}

/**
* Parse the data and convert it to DOMElements
* Parse the data and convert it to DOMElements.
*
* @param \DOMNode $parentNode
* @param array|object $data
Expand Down Expand Up @@ -452,7 +453,7 @@ private function needsCdataWrapping($val)
}

/**
* Tests the value being passed and decide what sort of element to create
* Tests the value being passed and decide what sort of element to create.
*
* @param \DOMNode $node
* @param mixed $val
Expand Down Expand Up @@ -488,6 +489,10 @@ private function selectNodeType(\DOMNode $node, $val)

/**
* Get real XML root node name, taking serializer options into account.
*
* @param array $context
*
* @return string
*/
private function resolveXmlRootName(array $context = array())
{
Expand Down
12 changes: 6 additions & 6 deletions Normalizer/DenormalizableInterface.php
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Component\Serializer\Normalizer;

/**
* Defines the most basic interface a class must implement to be denormalizable
* Defines the most basic interface a class must implement to be denormalizable.
*
* If a denormalizer is registered for the class and it doesn't implement
* the Denormalizable interfaces, the normalizer will be used instead
Expand All @@ -28,11 +28,11 @@ interface DenormalizableInterface
* recursively all child objects of the implementor.
*
* @param DenormalizerInterface $denormalizer The denormalizer is given so that you
* can use it to denormalize objects contained within this object.
* @param array|scalar $data The data from which to re-create the object.
* @param string|null $format The format is optionally given to be able to denormalize differently
* based on different input formats.
* @param array $context options for denormalizing
* can use it to denormalize objects contained within this object.
* @param array|scalar $data The data from which to re-create the object.
* @param string|null $format The format is optionally given to be able to denormalize differently
* based on different input formats.
* @param array $context options for denormalizing.
*/
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
}
10 changes: 5 additions & 5 deletions Normalizer/DenormalizerInterface.php
Expand Up @@ -19,19 +19,19 @@
interface DenormalizerInterface
{
/**
* Denormalizes data back into an object of the given class
* Denormalizes data back into an object of the given class.
*
* @param mixed $data data to restore
* @param string $class the expected class to instantiate
* @param string $format format the given data was extracted from
* @param mixed $data data to restore
* @param string $class the expected class to instantiate
* @param string $format format the given data was extracted from
* @param array $context options available to the denormalizer
*
* @return object
*/
public function denormalize($data, $class, $format = null, array $context = array());

/**
* Checks whether the given class is supported for denormalization by this normalizer
* Checks whether the given class is supported for denormalization by this normalizer.
*
* @param mixed $data Data to denormalize from.
* @param string $type The class to which the data should be denormalized.
Expand Down
15 changes: 8 additions & 7 deletions Normalizer/GetSetMethodNormalizer.php
Expand Up @@ -47,7 +47,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer implements Normal
*
* @throws InvalidArgumentException if a non-callable callback is set
*
* @return GetSetMethodNormalizer
* @return self
*/
public function setCallbacks(array $callbacks)
{
Expand All @@ -62,11 +62,11 @@ public function setCallbacks(array $callbacks)
}

/**
* Set ignored attributes for normalization
* Set ignored attributes for normalization.
*
* @param array $ignoredAttributes
*
* @return GetSetMethodNormalizer
* @return self
*/
public function setIgnoredAttributes(array $ignoredAttributes)
{
Expand All @@ -76,11 +76,11 @@ public function setIgnoredAttributes(array $ignoredAttributes)
}

/**
* Set attributes to be camelized on denormalize
* Set attributes to be camelized on denormalize.
*
* @param array $camelizedAttributes
*
* @return GetSetMethodNormalizer
* @return self
*/
public function setCamelizedAttributes(array $camelizedAttributes)
{
Expand Down Expand Up @@ -185,9 +185,10 @@ public function denormalize($data, $class, $format = null, array $context = arra
/**
* Format attribute name to access parameters or methods
* As option, if attribute name is found on camelizedAttributes array
* returns attribute name in camelcase format
* returns attribute name in camelcase format.
*
* @param string $attributeName
*
* @param string $attributeName
* @return string
*/
protected function formatAttribute($attributeName)
Expand Down
12 changes: 6 additions & 6 deletions Normalizer/NormalizableInterface.php
Expand Up @@ -12,10 +12,10 @@
namespace Symfony\Component\Serializer\Normalizer;

/**
* Defines the most basic interface a class must implement to be normalizable
* Defines the most basic interface a class must implement to be normalizable.
*
* If a normalizer is registered for the class and it doesn't implement
* the Normalizable interfaces, the normalizer will be used instead
* the Normalizable interfaces, the normalizer will be used instead.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
Expand All @@ -28,10 +28,10 @@ interface NormalizableInterface
* recursively all child objects of the implementor.
*
* @param NormalizerInterface $normalizer The normalizer is given so that you
* can use it to normalize objects contained within this object.
* @param string|null $format The format is optionally given to be able to normalize differently
* based on different output formats.
* @param array $context Options for normalizing this object
* can use it to normalize objects contained within this object.
* @param string|null $format The format is optionally given to be able to normalize differently
* based on different output formats.
* @param array $context Options for normalizing this object
*
* @return array|scalar
*/
Expand Down
10 changes: 5 additions & 5 deletions Normalizer/NormalizerInterface.php
Expand Up @@ -19,18 +19,18 @@
interface NormalizerInterface
{
/**
* Normalizes an object into a set of arrays/scalars
* Normalizes an object into a set of arrays/scalars.
*
* @param object $object object to normalize
* @param string $format format the normalization result will be encoded as
* @param array $context Context options for the normalizer
* @param object $object object to normalize
* @param string $format format the normalization result will be encoded as
* @param array $context Context options for the normalizer
*
* @return array|scalar
*/
public function normalize($object, $format = null, array $context = array());

/**
* Checks whether the given class is supported for normalization by this normalizer
* Checks whether the given class is supported for normalization by this normalizer.
*
* @param mixed $data Data to normalize.
* @param string $format The format being (de-)serialized from or into.
Expand Down
4 changes: 2 additions & 2 deletions Normalizer/PropertyNormalizer.php
Expand Up @@ -57,7 +57,7 @@ public function setCallbacks(array $callbacks)
}

/**
* Set ignored attributes for normalization
* Set ignored attributes for normalization.
*
* @param array $ignoredAttributes
*/
Expand Down Expand Up @@ -180,7 +180,7 @@ public function supportsDenormalization($data, $type, $format = null)
/**
* Format an attribute name, for example to convert a snake_case name to camelCase.
*
* @param string $attributeName
* @param string $attributeName
* @return string
*/
protected function formatAttribute($attributeName)
Expand Down

0 comments on commit 4bbbad8

Please sign in to comment.