Skip to content

Commit

Permalink
Merge 1ce0410 into 8c66fc1
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed May 26, 2020
2 parents 8c66fc1 + 1ce0410 commit 186bd38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -43,6 +43,6 @@ public function denormalize($data, $class, $format = null, array $context = [])
*/
public function supportsDenormalization($data, $type, $format = null)
{
return is_a($type, UuidInterface::class, true);
return \is_string($data) && is_a($type, UuidInterface::class, true);
}
}
7 changes: 7 additions & 0 deletions tests/Bridge/RamseyUuid/Normalizer/UuidNormalizerTest.php
Expand Up @@ -44,4 +44,11 @@ public function testFailDenormalizeUuid()
$this->assertTrue($normalizer->supportsDenormalization($uuid, Uuid::class));
$normalizer->denormalize($uuid, Uuid::class);
}

public function testDoNotSupportNotString()
{
$uuid = Uuid::uuid4();
$normalizer = new UuidNormalizer();
$this->assertFalse($normalizer->supportsDenormalization($uuid, Uuid::class));
}
}

0 comments on commit 186bd38

Please sign in to comment.