File tree 4 files changed +14
-14
lines changed
4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -108,11 +108,11 @@ public function setApiMeta(iterable $meta): void
108
108
public function setIncluded (ResourceObject ...$ resources ): void
109
109
{
110
110
if (null === $ this ->data ) {
111
- throw new \LogicException ('Document with no data cannot contain included resources ' );
111
+ throw new \DomainException ('Document with no data cannot contain included resources ' );
112
112
}
113
113
foreach ($ resources as $ resource ) {
114
114
if (isset ($ this ->included [(string ) $ resource ->toIdentifier ()])) {
115
- throw new \LogicException ("Resource {$ resource ->toIdentifier ()} is already included " );
115
+ throw new \DomainException ("Resource {$ resource ->toIdentifier ()} is already included " );
116
116
}
117
117
$ this ->included [(string ) $ resource ->toIdentifier ()] = $ resource ;
118
118
}
@@ -150,7 +150,7 @@ private function enforceFullLinkage(): void
150
150
continue 2 ;
151
151
}
152
152
}
153
- throw new \LogicException ("Full linkage is required for {$ included ->toIdentifier ()}" );
153
+ throw new \DomainException ("Full linkage is required for {$ included ->toIdentifier ()}" );
154
154
}
155
155
}
156
156
}
Original file line number Diff line number Diff line change @@ -40,27 +40,27 @@ public function setMeta(iterable $meta)
40
40
public function setAttribute (string $ name , $ value )
41
41
{
42
42
if ($ this ->isReservedName ($ name )) {
43
- throw new \InvalidArgumentException ("Can not use a reserved name ' $ name' " );
43
+ throw new \DomainException ("Can not use a reserved name ' $ name' " );
44
44
}
45
45
if (! isValidMemberName ($ name )) {
46
46
throw new \OutOfBoundsException ("Invalid member name ' $ name' " );
47
47
}
48
48
if (isset ($ this ->relationships [$ name ])) {
49
- throw new \LogicException ("Field ' $ name' already exists in relationships " );
49
+ throw new \DomainException ("Field ' $ name' already exists in relationships " );
50
50
}
51
51
$ this ->attributes [$ name ] = $ value ;
52
52
}
53
53
54
54
public function setRelationship (string $ name , Relationship $ relationship )
55
55
{
56
56
if ($ this ->isReservedName ($ name )) {
57
- throw new \InvalidArgumentException ("Can not use a reserved name ' $ name' " );
57
+ throw new \DomainException ("Can not use a reserved name ' $ name' " );
58
58
}
59
59
if (! isValidMemberName ($ name )) {
60
60
throw new \OutOfBoundsException ("Invalid member name ' $ name' " );
61
61
}
62
62
if (isset ($ this ->attributes [$ name ])) {
63
- throw new \LogicException ("Field ' $ name' already exists in attributes " );
63
+ throw new \DomainException ("Field ' $ name' already exists in attributes " );
64
64
}
65
65
$ this ->relationships [$ name ] = $ relationship ;
66
66
}
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ public function testOfficialDocsExample()
164
164
}
165
165
166
166
/**
167
- * @expectedException \LogicException
167
+ * @expectedException \DomainException
168
168
* @expectedExceptionMessage Full linkage is required for apples:1
169
169
* @dataProvider documentsWithoutFullLinkage
170
170
* @param Document $doc
@@ -269,7 +269,7 @@ public function testIncludedResourceMayBeIdentifiedByAnotherLinkedResource()
269
269
270
270
/**
271
271
* A compound document MUST NOT include more than one resource object for each type and id pair.
272
- * @expectedException \LogicException
272
+ * @expectedException \DomainException
273
273
* @expectedExceptionMessage Resource apples:1 is already included
274
274
*/
275
275
public function testCanNotBeManyIncludedResourcesWithEqualIdentifiers ()
@@ -283,7 +283,7 @@ public function testCanNotBeManyIncludedResourcesWithEqualIdentifiers()
283
283
284
284
/**
285
285
* If a document does not contain a top-level data key, the included member MUST NOT be present either.
286
- * @expectedException \LogicException
286
+ * @expectedException \DomainException
287
287
* @expectedExceptionMessage Document with no data cannot contain included resources
288
288
*/
289
289
public function testIncludedMustOnlyBePresentWithData ()
Original file line number Diff line number Diff line change 21
21
class ResourceFieldsTest extends TestCase
22
22
{
23
23
/**
24
- * @expectedException \LogicException
24
+ * @expectedException \DomainException
25
25
* @expectedExceptionMessage Field 'foo' already exists in attributes
26
26
*/
27
27
public function testCanNotSetRelationshipIfAttributeExists ()
@@ -32,7 +32,7 @@ public function testCanNotSetRelationshipIfAttributeExists()
32
32
}
33
33
34
34
/**
35
- * @expectedException \LogicException
35
+ * @expectedException \DomainException
36
36
* @expectedExceptionMessage Field 'foo' already exists in relationships
37
37
*/
38
38
public function testCanNotSetAttributeIfRelationshipExists ()
@@ -44,7 +44,7 @@ public function testCanNotSetAttributeIfRelationshipExists()
44
44
45
45
/**
46
46
* @param string $name
47
- * @expectedException \InvalidArgumentException
47
+ * @expectedException \DomainException
48
48
* @expectedExceptionMessage Can not use a reserved name
49
49
* @dataProvider reservedAttributeNames
50
50
*/
@@ -56,7 +56,7 @@ public function testAttributeCanNotHaveReservedNames(string $name)
56
56
57
57
/**
58
58
* @param string $name
59
- * @expectedException \InvalidArgumentException
59
+ * @expectedException \DomainException
60
60
* @expectedExceptionMessage Can not use a reserved name
61
61
* @dataProvider reservedAttributeNames
62
62
*/
You can’t perform that action at this time.
0 commit comments