Skip to content

Commit 6bff58e

Browse files
committed
[CS] Replace easy occurences of ?: with ??
1 parent d69fa8f commit 6bff58e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Encoder/JsonEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class JsonEncoder implements EncoderInterface, DecoderInterface
2525

2626
public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodingImpl = null)
2727
{
28-
$this->encodingImpl = $encodingImpl ?: new JsonEncode();
29-
$this->decodingImpl = $decodingImpl ?: new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
28+
$this->encodingImpl = $encodingImpl ?? new JsonEncode();
29+
$this->decodingImpl = $decodingImpl ?? new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
3030
}
3131

3232
/**

Encoder/YamlEncoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function __construct(Dumper $dumper = null, Parser $parser = null, array
3838
throw new RuntimeException('The YamlEncoder class requires the "Yaml" component. Install "symfony/yaml" to use it.');
3939
}
4040

41-
$this->dumper = $dumper ?: new Dumper();
42-
$this->parser = $parser ?: new Parser();
41+
$this->dumper = $dumper ?? new Dumper();
42+
$this->parser = $parser ?? new Parser();
4343
$this->defaultContext = array_merge($this->defaultContext, $defaultContext);
4444
}
4545

Normalizer/CustomNormalizer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function normalize($object, $format = null, array $context = [])
3535
*/
3636
public function denormalize($data, $type, $format = null, array $context = [])
3737
{
38-
$object = $this->extractObjectToPopulate($type, $context) ?: new $type();
38+
$object = $this->extractObjectToPopulate($type, $context) ?? new $type();
3939
$object->denormalize($this->serializer, $data, $format, $context);
4040

4141
return $object;

0 commit comments

Comments
 (0)