Skip to content

Commit a2f1d55

Browse files
committed
Adding serialization error exception class
1 parent 503931f commit a2f1d55

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Parameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function toHttpValue(): string
131131

132132
foreach ($this->elements as $key => $val) {
133133
if (!$val->parameters()->isEmpty()) {
134-
throw new SyntaxError('Parameters instances can not contain parameterized Items.');
134+
throw new SerializationError('Parameters instances can not contain parameterized Items.');
135135
}
136136

137137
$value = ';'.$key;

src/ParametersTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function it_can_merge_without_argument_and_not_throw(): void
184184
*/
185185
public function it_fails_if_internal_parameters_are_changed_illegally(): void
186186
{
187-
$this->expectException(SyntaxError::class);
187+
$this->expectException(SerializationError::class);
188188

189189
$fields = Item::from('/terms', ['rel' => 'copyright', 'anchor' => '#foo']);
190190
$fields->parameters()->getByKey('anchor')->parameters()->set('yolo', 42);

src/SerializationError.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Bakame\Http\StructuredFields;
4+
5+
use UnexpectedValueException;
6+
7+
final class SerializationError extends UnexpectedValueException implements StructuredFieldError
8+
{
9+
}

0 commit comments

Comments
 (0)