@@ -29,8 +29,7 @@ |
||
29 | 29 | $property->containsTarget() && |
30 | 30 | $property->getDeclaringType()->IsOrInheritsFrom($property->ToEntityType()) && |
31 | 31 | !$property->Multiplicity()->isZeroOrOne() |
32 | - ) |
|
33 | - { |
|
32 | + ) { |
|
34 | 33 | $context->AddError( |
35 | 34 | $property->Location(), |
36 | 35 | EdmErrorCode::NavigationPropertyWithRecursiveContainmentSourceMustBeFromZeroOrOne(), |
@@ -24,8 +24,7 @@ |
||
24 | 24 | assert($property instanceof INavigationProperty); |
25 | 25 | if ($property->containsTarget() && |
26 | 26 | !$property->getDeclaringType()->IsOrInheritsFrom($property->ToEntityType()) && |
27 | - !$property->Multiplicity()->isOne()) |
|
28 | - { |
|
27 | + !$property->Multiplicity()->isOne()) { |
|
29 | 28 | $context->AddError( |
30 | 29 | $property->Location(), |
31 | 30 | EdmErrorCode::NavigationPropertyWithNonRecursiveContainmentSourceMustBeFromOne(), |
@@ -24,10 +24,8 @@ |
||
24 | 24 | { |
25 | 25 | assert($property instanceof INavigationProperty); |
26 | 26 | if ($property->containsTarget() && |
27 | - !$property->getDeclaringType()->IsOrInheritsFrom($property->ToEntityType())) |
|
28 | - { |
|
29 | - if (ValidationHelper::TypeIndirectlyContainsTarget($property->ToEntityType(), $property->DeclaringEntityType(), new SplObjectStorage()/*new HashSetInternal()*/, $context->getModel())) |
|
30 | - { |
|
27 | + !$property->getDeclaringType()->IsOrInheritsFrom($property->ToEntityType())) { |
|
28 | + if (ValidationHelper::TypeIndirectlyContainsTarget($property->ToEntityType(), $property->DeclaringEntityType(), new SplObjectStorage()/*new HashSetInternal()*/, $context->getModel())) { |
|
31 | 29 | $context->AddError( |
32 | 30 | $property->Location(), |
33 | 31 | EdmErrorCode::NavigationPropertyEntityMustNotIndirectlyContainItself(), |
@@ -26,8 +26,7 @@ |
||
26 | 26 | assert($property instanceof INavigationProperty); |
27 | 27 | if ($property->containsTarget() && |
28 | 28 | $property->getDeclaringType()->IsOrInheritsFrom($property->ToEntityType()) && |
29 | - !($property->getType()->IsCollection() || $property->getType()->getNullable())) |
|
30 | - { |
|
29 | + !($property->getType()->IsCollection() || $property->getType()->getNullable())) { |
|
31 | 30 | $context->AddError( |
32 | 31 | $property->Location(), |
33 | 32 | EdmErrorCode::NavigationPropertyWithRecursiveContainmentTargetMustBeOptional(), |
@@ -26,23 +26,18 @@ |
||
26 | 26 | { |
27 | 27 | assert($navigationProperty instanceof INavigationProperty); |
28 | 28 | $dependentProperties = $navigationProperty->getDependentProperties(); |
29 | - if ($dependentProperties != null) |
|
30 | - { |
|
31 | - if (ValidationHelper::PropertySetsAreEquivalent($navigationProperty->DeclaringEntityType()->Key(), $dependentProperties)) |
|
32 | - { |
|
29 | + if ($dependentProperties != null) { |
|
30 | + if (ValidationHelper::PropertySetsAreEquivalent($navigationProperty->DeclaringEntityType()->Key(), $dependentProperties)) { |
|
33 | 31 | if ( |
34 | 32 | !$navigationProperty->Multiplicity()->isZeroOrOne() && |
35 | 33 | !$navigationProperty->Multiplicity()->isOne() |
36 | - ) |
|
37 | - { |
|
34 | + ) { |
|
38 | 35 | $context->AddError( |
39 | 36 | $navigationProperty->Location(), |
40 | 37 | EdmErrorCode::InvalidMultiplicityOfDependentEnd(), |
41 | 38 | StringConst::EdmModel_Validator_Semantic_InvalidMultiplicityOfDependentEndMustBeZeroOneOrOne($navigationProperty->getName())); |
42 | 39 | } |
43 | - } |
|
44 | - else if ($navigationProperty->Multiplicity()->isMany()) |
|
45 | - { |
|
40 | + } else if ($navigationProperty->Multiplicity()->isMany()) { |
|
46 | 41 | $context->AddError( |
47 | 42 | $navigationProperty->Location(), |
48 | 43 | EdmErrorCode::InvalidMultiplicityOfDependentEnd(), |
@@ -23,8 +23,7 @@ |
||
23 | 23 | if ( |
24 | 24 | $end->Multiplicity()->isMany() && |
25 | 25 | !$end->getOnDelete()->isNone() |
26 | - ) |
|
27 | - { |
|
26 | + ) { |
|
28 | 27 | $context->AddError( |
29 | 28 | $end->Location(), |
30 | 29 | EdmErrorCode::EndWithManyMultiplicityCannotHaveOperationsSpecified(), |
@@ -21,8 +21,7 @@ |
||
21 | 21 | public function __invoke(ValidationContext $context, ?IEdmElement $property) |
22 | 22 | { |
23 | 23 | assert($property instanceof INavigationProperty); |
24 | - if ($property->containsTarget() != CsdlConstants::Default_ContainsTarget) |
|
25 | - { |
|
24 | + if ($property->containsTarget() != CsdlConstants::Default_ContainsTarget) { |
|
26 | 25 | $context->AddError( |
27 | 26 | $property->Location(), |
28 | 27 | EdmErrorCode::NavigationPropertyContainsTargetNotSupportedBeforeV3(), |
@@ -24,31 +24,24 @@ discard block |
||
24 | 24 | assert($property instanceof INavigationProperty); |
25 | 25 | $isBad = false; |
26 | 26 | |
27 | - if ($property->ToEntityType() !== $property->getPartner()->DeclaringEntityType()) |
|
28 | - { |
|
27 | + if ($property->ToEntityType() !== $property->getPartner()->DeclaringEntityType()) { |
|
29 | 28 | $isBad = true; |
30 | - } |
|
31 | - else |
|
32 | - { |
|
33 | - switch ($property->getPartner()->Multiplicity()) |
|
34 | - { |
|
29 | + } else { |
|
30 | + switch ($property->getPartner()->Multiplicity()) { |
|
35 | 31 | case Multiplicity::Many(): |
36 | - if (!$property->getType()->IsCollection()) |
|
37 | - { |
|
32 | + if (!$property->getType()->IsCollection()) { |
|
38 | 33 | $isBad = true; |
39 | 34 | } |
40 | 35 | |
41 | 36 | break; |
42 | 37 | case Multiplicity::ZeroOrOne(): |
43 | - if ($property->getType()->IsCollection() || !$property->getType()->getNullable()) |
|
44 | - { |
|
38 | + if ($property->getType()->IsCollection() || !$property->getType()->getNullable()) { |
|
45 | 39 | $isBad = true; |
46 | 40 | } |
47 | 41 | |
48 | 42 | break; |
49 | 43 | case Multiplicity::One(): |
50 | - if ($property->getType()->IsCollection() || $property->getType()->getNullable()) |
|
51 | - { |
|
44 | + if ($property->getType()->IsCollection() || $property->getType()->getNullable()) { |
|
52 | 45 | $isBad = true; |
53 | 46 | } |
54 | 47 | |
@@ -56,8 +49,7 @@ discard block |
||
56 | 49 | } |
57 | 50 | } |
58 | 51 | |
59 | - if ($isBad) |
|
60 | - { |
|
52 | + if ($isBad) { |
|
61 | 53 | $context->AddError( |
62 | 54 | $property->Location(), |
63 | 55 | EdmErrorCode::InvalidNavigationPropertyType(), |
@@ -40,31 +40,23 @@ |
||
40 | 40 | if ($dependentProperties === null) { |
41 | 41 | return; |
42 | 42 | } |
43 | - if (ValidationHelper::AllPropertiesAreNullable($dependentProperties)) |
|
44 | - { |
|
45 | - if (!$navigationProperty->getPartner()->Multiplicity()->isZeroOrOne()) |
|
46 | - { |
|
43 | + if (ValidationHelper::AllPropertiesAreNullable($dependentProperties)) { |
|
44 | + if (!$navigationProperty->getPartner()->Multiplicity()->isZeroOrOne()) { |
|
47 | 45 | $context->AddError( |
48 | 46 | $navigationProperty->getPartner()->Location(), |
49 | 47 | EdmErrorCode::InvalidMultiplicityOfPrincipalEnd(), |
50 | 48 | StringConst::EdmModel_Validator_Semantic_InvalidMultiplicityOfPrincipalEndDependentPropertiesAllNullable($navigationProperty->getPartner()->getName(), $navigationProperty->getName())); |
51 | 49 | } |
52 | - } |
|
53 | - else if (!ValidationHelper::HasNullableProperty($dependentProperties)) |
|
54 | - { |
|
55 | - if (!$navigationProperty->getPartner()->Multiplicity()->isOne()) |
|
56 | - { |
|
50 | + } else if (!ValidationHelper::HasNullableProperty($dependentProperties)) { |
|
51 | + if (!$navigationProperty->getPartner()->Multiplicity()->isOne()) { |
|
57 | 52 | $context->AddError( |
58 | 53 | $navigationProperty->getPartner()->Location(), |
59 | 54 | EdmErrorCode::InvalidMultiplicityOfPrincipalEnd(), |
60 | 55 | StringConst::EdmModel_Validator_Semantic_InvalidMultiplicityOfPrincipalEndDependentPropertiesAllNonnullable($navigationProperty->getPartner()->getName(), $navigationProperty->getName())); |
61 | 56 | } |
62 | - } |
|
63 | - else |
|
64 | - { |
|
57 | + } else { |
|
65 | 58 | if (!$navigationProperty->getPartner()->Multiplicity()->isOne() && |
66 | - !$navigationProperty->getPartner()->Multiplicity()->isZeroOrOne()) |
|
67 | - { |
|
59 | + !$navigationProperty->getPartner()->Multiplicity()->isZeroOrOne()) { |
|
68 | 60 | $context->AddError( |
69 | 61 | $navigationProperty->getPartner()->Location(), |
70 | 62 | EdmErrorCode::InvalidMultiplicityOfPrincipalEnd(), |