Skip to content

Commit

Permalink
cs-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Zogg committed Nov 4, 2019
1 parent d09f5bc commit 56411a0
Show file tree
Hide file tree
Showing 70 changed files with 48 additions and 805 deletions.
3 changes: 2 additions & 1 deletion .php_cs
Expand Up @@ -24,12 +24,13 @@ return PhpCsFixer\Config::create()
'method_chaining_indentation' => false,
'no_php4_constructor' => true,
'ordered_interfaces' => true,
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_dedicate_assert' => true,
'php_unit_expectation' => true,
'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'single_line_throw' => false,
'ternary_to_null_coalescing' => true,
'void_return' => true,
])
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -17,15 +17,15 @@
"require-dev": {
"chubbyphp/chubbyphp-mock": "^1.4.2",
"doctrine/common": "^2.7",
"friendsofphp/php-cs-fixer": "^2.15.3",
"friendsofphp/php-cs-fixer": "^2.16",
"infection/infection": "^0.14.2",
"mavimo/phpstan-junit": "^0.2.3",
"nunomaduro/phpinsights": "^1.9",
"php-coveralls/php-coveralls": "^2.1",
"phploc/phploc": "^5.0",
"phpstan/extension-installer": "^1.0.3",
"phpstan/phpstan": "^0.11.19",
"phpunit/phpunit": "^8.4.1",
"phpunit/phpunit": "^8.4.2",
"pimple/pimple": "^3.2.3",
"psr/container": "^1.0",
"symfony/config": "^2.8|^3.4|^4.2",
Expand Down
3 changes: 0 additions & 3 deletions src/Accessor/MethodAccessor.php
Expand Up @@ -13,9 +13,6 @@ final class MethodAccessor implements AccessorInterface
*/
private $property;

/**
* @param string $property
*/
public function __construct(string $property)
{
$this->property = $property;
Expand Down
5 changes: 0 additions & 5 deletions src/Accessor/PropertyAccessor.php
Expand Up @@ -14,9 +14,6 @@ final class PropertyAccessor implements AccessorInterface
*/
private $property;

/**
* @param string $property
*/
public function __construct(string $property)
{
$this->property = $property;
Expand Down Expand Up @@ -71,8 +68,6 @@ function ($property) {

/**
* @param object $object
*
* @return string
*/
private function getClass($object): string
{
Expand Down
11 changes: 0 additions & 11 deletions src/Decoder/Decoder.php
Expand Up @@ -25,22 +25,14 @@ public function __construct(array $decoderTypes)
}
}

/**
* @return array
*/
public function getContentTypes(): array
{
return array_keys($this->decoderTypes);
}

/**
* @param string $data
* @param string $contentType
*
* @throws DeserializerLogicException
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data, string $contentType): array
{
Expand All @@ -51,9 +43,6 @@ public function decode(string $data, string $contentType): array
throw DeserializerLogicException::createMissingContentType($contentType);
}

/**
* @param TypeDecoderInterface $decoderType
*/
private function addTypeDecoder(TypeDecoderInterface $decoderType): void
{
$this->decoderTypes[$decoderType->getContentType()] = $decoderType;
Expand Down
5 changes: 0 additions & 5 deletions src/Decoder/DecoderInterface.php
Expand Up @@ -15,13 +15,8 @@ interface DecoderInterface
public function getContentTypes(): array;

/**
* @param string $data
* @param string $contentType
*
* @throws DeserializerLogicException
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data, string $contentType): array;
}
7 changes: 0 additions & 7 deletions src/Decoder/JsonTypeDecoder.php
Expand Up @@ -8,20 +8,13 @@

final class JsonTypeDecoder implements TypeDecoderInterface
{
/**
* @return string
*/
public function getContentType(): string
{
return 'application/json';
}

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array
{
Expand Down
34 changes: 0 additions & 34 deletions src/Decoder/JsonxTypeDecoder.php
Expand Up @@ -23,9 +23,6 @@ final class JsonxTypeDecoder implements TypeDecoderInterface
*/
private $contentType;

/**
* @param string $contentType
*/
public function __construct(string $contentType = 'application/x-jsonx')
{
if ('application/x-jsonx' === $contentType) {
Expand All @@ -38,20 +35,13 @@ public function __construct(string $contentType = 'application/x-jsonx')
$this->contentType = $contentType;
}

/**
* @return string
*/
public function getContentType(): string
{
return $this->contentType;
}

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array
{
Expand All @@ -65,8 +55,6 @@ public function decode(string $data): array
}

/**
* @param \DOMNode $node
*
* @return array|bool|string|int|float|null
*/
private function decodeNode(\DOMNode $node)
Expand Down Expand Up @@ -102,11 +90,6 @@ private function decodeNode(\DOMNode $node)
throw DeserializerRuntimeException::createNotParsable($this->getContentType());
}

/**
* @param \DOMNode $node
*
* @return array
*/
private function decodeObjectNode(\DOMNode $node): array
{
$data = [];
Expand All @@ -121,11 +104,6 @@ private function decodeObjectNode(\DOMNode $node): array
return $data;
}

/**
* @param \DOMNode $node
*
* @return array
*/
private function decodeArrayNode(\DOMNode $node): array
{
$data = [];
Expand All @@ -140,29 +118,17 @@ private function decodeArrayNode(\DOMNode $node): array
return $data;
}

/**
* @param \DOMNode $node
*
* @return bool
*/
private function decodeBooleanNode(\DOMNode $node): bool
{
return 'true' === $node->nodeValue;
}

/**
* @param \DOMNode $node
*
* @return string
*/
private function decodeStringNode(\DOMNode $node): string
{
return html_entity_decode($node->nodeValue, ENT_COMPAT | ENT_XML1, 'UTF-8');
}

/**
* @param \DOMNode $node
*
* @return int|float
*/
private function decodeNumberNode(\DOMNode $node)
Expand Down
7 changes: 0 additions & 7 deletions src/Decoder/TypeDecoderInterface.php
Expand Up @@ -8,17 +8,10 @@

interface TypeDecoderInterface
{
/**
* @return string
*/
public function getContentType(): string;

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array;
}
14 changes: 0 additions & 14 deletions src/Decoder/UrlEncodedTypeDecoder.php
Expand Up @@ -8,20 +8,13 @@

final class UrlEncodedTypeDecoder implements TypeDecoderInterface
{
/**
* @return string
*/
public function getContentType(): string
{
return 'application/x-www-form-urlencoded';
}

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array
{
Expand All @@ -35,11 +28,6 @@ public function decode(string $data): array
return $this->fixValues($rawData);
}

/**
* @param array $rawData
*
* @return array
*/
private function fixValues(array $rawData): array
{
$data = [];
Expand All @@ -55,8 +43,6 @@ private function fixValues(array $rawData): array
}

/**
* @param string $value
*
* @return mixed
*/
private function fixValue(string $value)
Expand Down
16 changes: 0 additions & 16 deletions src/Decoder/XmlTypeDecoder.php
Expand Up @@ -11,20 +11,13 @@
*/
final class XmlTypeDecoder implements TypeDecoderInterface
{
/**
* @return string
*/
public function getContentType(): string
{
return 'application/xml';
}

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array
{
Expand All @@ -37,11 +30,6 @@ public function decode(string $data): array
return $this->transformType($document->getElementsByTagName('object')->item(0));
}

/**
* @param \DOMElement $node
*
* @return array
*/
private function transformType(\DOMElement $node): array
{
$data = [];
Expand Down Expand Up @@ -84,8 +72,6 @@ private function transformType(\DOMElement $node): array
}

/**
* @param \DOMElement $node
*
* @return string|int
*/
private function getKey(\DOMElement $node)
Expand All @@ -103,8 +89,6 @@ private function getKey(\DOMElement $node)
}

/**
* @param \DOMElement $node
*
* @return bool|string
*/
private function getValue(\DOMElement $node)
Expand Down
7 changes: 0 additions & 7 deletions src/Decoder/YamlTypeDecoder.php
Expand Up @@ -10,20 +10,13 @@

final class YamlTypeDecoder implements TypeDecoderInterface
{
/**
* @return string
*/
public function getContentType(): string
{
return 'application/x-yaml';
}

/**
* @param string $data
*
* @throws DeserializerRuntimeException
*
* @return array
*/
public function decode(string $data): array
{
Expand Down
10 changes: 2 additions & 8 deletions src/Denormalizer/CallbackFieldDenormalizer.php
Expand Up @@ -13,20 +13,14 @@ final class CallbackFieldDenormalizer implements FieldDenormalizerInterface
*/
private $callback;

/**
* @param callable $callback
*/
public function __construct(callable $callback)
{
$this->callback = $callback;
}

/**
* @param string $path
* @param object $object
* @param mixed $value
* @param DenormalizerContextInterface $context
* @param DenormalizerInterface|null $denormalizer
* @param object $object
* @param mixed $value
*
* @throws DeserializerRuntimeException
*/
Expand Down

0 comments on commit 56411a0

Please sign in to comment.