Skip to content

Commit 20f86c5

Browse files
committed
apply cs fixes
1 parent f0a4318 commit 20f86c5

28 files changed

+108
-74
lines changed

.php-cs-fixer.dist.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
PhpCsFixer\Finder::create()
99
->in([
1010
__DIR__,
11-
]),
11+
])
12+
->notPath('src/ModelParser/JMSParserLegacy.php')
1213
);
1314

1415
$config
@@ -56,6 +57,7 @@
5657

5758
// Not supported in PHP 7
5859
'get_class_to_class_keyword' => false,
60+
'modernize_strpos' => false,
5961
]
6062
)
6163
;

src/Annotation/Preferred.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* different versions with JMS serializer, and not specifying any version.
1212
*
1313
* @Annotation
14+
*
1415
* @Target({"METHOD", "PROPERTY"})
1516
*/
1617
final class Preferred

src/Metadata/AbstractPropertyMetadata.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class AbstractPropertyMetadata implements \JsonSerializable
4242
/**
4343
* @var int|null
4444
*/
45-
private $maxDepth = null;
45+
private $maxDepth;
4646

4747
/**
4848
* Hashmap of custom information about this property.
@@ -109,11 +109,11 @@ public function hasCustomInformation(string $key): bool
109109
/**
110110
* Get the value stored as custom information, if it exists.
111111
*
112-
* @throws \InvalidArgumentException if no such custom value is available for this property
113-
*
114112
* @return mixed The information in whatever format it has been set
113+
*
114+
* @throws \InvalidArgumentException if no such custom value is available for this property
115115
*/
116-
public function getCustomInformation(string $key)
116+
public function getCustomInformation(string $key): mixed
117117
{
118118
if (!\array_key_exists($key, $this->customInformation)) {
119119
throw new \InvalidArgumentException(sprintf('Property %s has no custom information %s', $this->name, $key));
@@ -206,7 +206,7 @@ protected function getMaxDepth(): ?int
206206
return $this->maxDepth;
207207
}
208208

209-
protected function setMaxDepth(?int $maxDepth)
209+
protected function setMaxDepth(?int $maxDepth): void
210210
{
211211
$this->maxDepth = $maxDepth;
212212
}

src/Metadata/PropertyAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getSetterMethod(): ?string
5454

5555
public function jsonSerialize(): array
5656
{
57-
return \array_filter([
57+
return array_filter([
5858
'getter_method' => $this->getterMethod,
5959
'setter_method' => $this->setterMethod,
6060
]);

src/Metadata/PropertyMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
array $groups = [],
3333
PropertyAccessor $accessor = null,
3434
array $customInformation = [],
35-
?int $maxDepth = null
35+
int $maxDepth = null
3636
) {
3737
parent::__construct($name, $readOnly, $public);
3838
$this->serializedName = $serializedName;

src/Metadata/PropertyTypeArray.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public function __construct(PropertyType $subType, bool $hashmap, bool $nullable
3535
public function __toString(): string
3636
{
3737
if ($this->subType instanceof PropertyTypeUnknown) {
38-
return 'array' . ($this->isCollection ? '|\\' . Collection::class : '');
38+
return 'array'.($this->isCollection ? '|\\'.Collection::class : '');
3939
}
4040

4141
$array = $this->isHashmap() ? '[string]' : '[]';
4242
if ($this->isCollection) {
4343
$collectionType = $this->isHashmap() ? ', string' : '';
44-
$array .= sprintf("|\\%s<%s%s>", Collection::class, $this->subType, $collectionType);
44+
$array .= sprintf('|\\%s<%s%s>', Collection::class, $this->subType, $collectionType);
4545
}
4646

4747
return ((string) $this->subType).$array.parent::__toString();
@@ -86,7 +86,7 @@ public function merge(PropertyType $other): PropertyType
8686
return new self($this->subType, $this->isHashmap(), $nullable);
8787
}
8888
if (!$other instanceof self) {
89-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', static::class, \get_class($other)));
89+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', self::class, \get_class($other)));
9090
}
9191

9292
/*
@@ -95,7 +95,7 @@ public function merge(PropertyType $other): PropertyType
9595
* PHPDoc has no clear definition for hashmaps with string indexes, but JMS Serializer annotations do.
9696
*/
9797
if ($this->isHashmap() && !$other->isHashmap()) {
98-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, can\'t change hashmap into plain array', static::class, \get_class($other)));
98+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, can\'t change hashmap into plain array', self::class, \get_class($other)));
9999
}
100100

101101
$hashmap = $this->isHashmap() || $other->isHashmap();

src/Metadata/PropertyTypeClass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public function merge(PropertyType $other): PropertyType
6868
return new self($this->className, $nullable);
6969
}
7070
if (!$other instanceof self) {
71-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', static::class, \get_class($other)));
71+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', self::class, \get_class($other)));
7272
}
7373
if ($this->getClassName() !== $other->getClassName()) {
74-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', static::class, \get_class($other)));
74+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', self::class, \get_class($other)));
7575
}
7676

7777
return new self($this->className, $nullable);

src/Metadata/PropertyTypeDateTime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public function merge(PropertyType $other): PropertyType
7575
return new self($this->immutable, $nullable, $this->dateTimeOptions);
7676
}
7777
if (!$other instanceof self) {
78-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', static::class, \get_class($other)));
78+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', self::class, \get_class($other)));
7979
}
8080
if ($this->isImmutable() !== $other->isImmutable()) {
81-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', static::class, \get_class($other)));
81+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', self::class, \get_class($other)));
8282
}
8383

8484
$options = $this->dateTimeOptions ?: $other->dateTimeOptions;

src/Metadata/PropertyTypePrimitive.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public function merge(PropertyType $other): PropertyType
5555
return new self($this->typeName, $nullable);
5656
}
5757
if (!$other instanceof self) {
58-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', static::class, \get_class($other)));
58+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same or unknown', self::class, \get_class($other)));
5959
}
6060
if ($this->getTypeName() !== $other->getTypeName()) {
61-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', static::class, \get_class($other)));
61+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be equal', self::class, \get_class($other)));
6262
}
6363

6464
return new self($this->typeName, $nullable);

src/Metadata/PropertyTypeUnknown.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __toString(): string
1919
public function merge(PropertyType $other): PropertyType
2020
{
2121
if (!$other instanceof self) {
22-
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same', static::class, \get_class($other)));
22+
throw new \UnexpectedValueException(sprintf('Can\'t merge type %s with %s, they must be the same', self::class, \get_class($other)));
2323
}
2424

2525
return new self($this->isNullable() && $other->isNullable());

0 commit comments

Comments
 (0)