@@ -21,8 +21,7 @@ |
||
21 | 21 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
22 | 22 | { |
23 | 23 | assert($functionImport instanceof IFunctionImport); |
24 | - if ($functionImport->isBindable() && count($functionImport->getParameters()) === 0) |
|
25 | - { |
|
24 | + if ($functionImport->isBindable() && count($functionImport->getParameters()) === 0) { |
|
26 | 25 | $context->AddError( |
27 | 26 | $functionImport->Location(), |
28 | 27 | EdmErrorCode::BindableFunctionImportMustHaveParameters(), |
@@ -22,8 +22,7 @@ |
||
22 | 22 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
23 | 23 | { |
24 | 24 | assert($functionImport instanceof IFunctionImport); |
25 | - if ($functionImport->isComposable() != CsdlConstants::Default_IsComposable) |
|
26 | - { |
|
25 | + if ($functionImport->isComposable() != CsdlConstants::Default_IsComposable) { |
|
27 | 26 | $context->AddError( |
28 | 27 | $functionImport->Location(), |
29 | 28 | EdmErrorCode::FunctionImportComposableNotSupportedBeforeV3(), |
@@ -24,8 +24,7 @@ |
||
24 | 24 | if ($functionImport->getReturnType() != null) |
25 | 25 | { |
26 | 26 | $elementType = $functionImport->getReturnType()->IsCollection() ? |
27 | - $functionImport->getReturnType()->AsCollection()->ElementType() : |
|
28 | - $functionImport->getReturnType(); |
|
27 | + $functionImport->getReturnType()->AsCollection()->ElementType() : $functionImport->getReturnType(); |
|
29 | 28 | if ( |
30 | 29 | !$elementType->IsPrimitive() && |
31 | 30 | !$elementType->IsEntity() && |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
22 | 22 | { |
23 | 23 | assert($functionImport instanceof IFunctionImport); |
24 | - if ($functionImport->getReturnType() != null) |
|
25 | - { |
|
24 | + if ($functionImport->getReturnType() != null) { |
|
26 | 25 | $elementType = $functionImport->getReturnType()->IsCollection() ? |
27 | 26 | $functionImport->getReturnType()->AsCollection()->ElementType() : |
28 | 27 | $functionImport->getReturnType(); |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | !$elementType->IsComplex() && |
33 | 32 | !$elementType->IsEnum() && |
34 | 33 | !$context->checkIsBad($elementType->getDefinition()) |
35 | - ) |
|
36 | - { |
|
34 | + ) { |
|
37 | 35 | $context->AddError( |
38 | 36 | $functionImport->Location(), |
39 | 37 | EdmErrorCode::FunctionImportUnsupportedReturnType(), |
@@ -20,8 +20,7 @@ |
||
20 | 20 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
21 | 21 | { |
22 | 22 | assert($functionImport instanceof IFunctionImport); |
23 | - if ($functionImport->IsComposable() && $functionImport->getReturnType() == null) |
|
24 | - { |
|
23 | + if ($functionImport->IsComposable() && $functionImport->getReturnType() == null) { |
|
25 | 24 | $context->AddError( |
26 | 25 | $functionImport->Location(), |
27 | 26 | EdmErrorCode::ComposableFunctionImportMustHaveReturnType(), |
@@ -24,13 +24,11 @@ discard block |
||
24 | 24 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
25 | 25 | { |
26 | 26 | assert($functionImport instanceof IFunctionImport); |
27 | - if ($functionImport->getEntitySet() != null) |
|
28 | - { |
|
27 | + if ($functionImport->getEntitySet() != null) { |
|
29 | 28 | if ( |
30 | 29 | !$functionImport->getEntitySet()->getExpressionKind()->isEntitySetReference() && |
31 | 30 | !$functionImport->getEntitySet()->getExpressionKind()->isPath() |
32 | - ) |
|
33 | - { |
|
31 | + ) { |
|
34 | 32 | $context->AddError( |
35 | 33 | $functionImport->Location(), |
36 | 34 | EdmErrorCode::FunctionImportEntitySetExpressionIsInvalid(), |
@@ -38,9 +36,7 @@ discard block |
||
38 | 36 | $functionImport->getName(), |
39 | 37 | $functionImport->getEntitySet()->getExpressionKind()->getKey()) |
40 | 38 | ); |
41 | - } |
|
42 | - else |
|
43 | - { |
|
39 | + } else { |
|
44 | 40 | /** |
45 | 41 | * @var IEntitySet $entitySet; |
46 | 42 | */ |
@@ -56,8 +52,7 @@ discard block |
||
56 | 52 | if ( |
57 | 53 | !$functionImport->TryGetStaticEntitySet($entitySet) && |
58 | 54 | !$functionImport->TryGetRelativeEntitySetPath($context->getModel(), $parameter, $path) |
59 | - ) |
|
60 | - { |
|
55 | + ) { |
|
61 | 56 | $context->AddError( |
62 | 57 | $functionImport->Location(), |
63 | 58 | EdmErrorCode::FunctionImportEntitySetExpressionIsInvalid(), |
@@ -22,8 +22,7 @@ |
||
22 | 22 | public function __invoke(ValidationContext $context, ?IEdmElement $functionImport) |
23 | 23 | { |
24 | 24 | assert($functionImport instanceof IFunctionImport); |
25 | - if ($functionImport->isSideEffecting() != CsdlConstants::Default_IsSideEffecting) |
|
26 | - { |
|
25 | + if ($functionImport->isSideEffecting() != CsdlConstants::Default_IsSideEffecting) { |
|
27 | 26 | $context->AddError( |
28 | 27 | $functionImport->Location(), |
29 | 28 | EdmErrorCode::FunctionImportSideEffectingNotSupportedBeforeV3(), |
@@ -22,11 +22,9 @@ |
||
22 | 22 | public function __invoke(ValidationContext $context, ?IEdmElement $function) |
23 | 23 | { |
24 | 24 | assert($function instanceof IFunction); |
25 | - foreach ($function->getParameters() as $parameter) |
|
26 | - { |
|
25 | + foreach ($function->getParameters() as $parameter) { |
|
27 | 26 | assert($parameter instanceof IFunctionParameter); |
28 | - if (!$parameter->getMode()->isIn()) |
|
29 | - { |
|
27 | + if (!$parameter->getMode()->isIn()) { |
|
30 | 28 | $context->AddError( |
31 | 29 | $parameter->Location(), |
32 | 30 | EdmErrorCode::OnlyInputParametersAllowedInFunctions(), |
@@ -27,13 +27,10 @@ discard block |
||
27 | 27 | assert($entityContainer instanceof IEntityContainer); |
28 | 28 | $nonFunctionNameList = new HashSetInternal(); |
29 | 29 | $functionDictionary = []; |
30 | - foreach ($entityContainer->getElements() as $item) |
|
31 | - { |
|
32 | - if ($item instanceof IFunctionImport) |
|
33 | - { |
|
30 | + foreach ($entityContainer->getElements() as $item) { |
|
31 | + if ($item instanceof IFunctionImport) { |
|
34 | 32 | $function = $item; |
35 | - if ($nonFunctionNameList->contains($item->getName())) |
|
36 | - { |
|
33 | + if ($nonFunctionNameList->contains($item->getName())) { |
|
37 | 34 | $context->AddError( |
38 | 35 | $item->Location(), |
39 | 36 | EdmErrorCode::DuplicateEntityContainerMemberName(), |
@@ -41,16 +38,13 @@ discard block |
||
41 | 38 | } |
42 | 39 | |
43 | 40 | $functionList = null; |
44 | - if (isset($functionDictionary[$function->getName()])) |
|
45 | - { |
|
41 | + if (isset($functionDictionary[$function->getName()])) { |
|
46 | 42 | $functionList = $functionDictionary[$function->getName()]; |
47 | 43 | /** |
48 | 44 | * @var IFunctionImport $existingFunction |
49 | 45 | */ |
50 | - foreach ($functionList as $existingFunction) |
|
51 | - { |
|
52 | - if (EdmElementComparer::isFunctionSignatureEquivalentTo($function, $existingFunction)) |
|
53 | - { |
|
46 | + foreach ($functionList as $existingFunction) { |
|
47 | + if (EdmElementComparer::isFunctionSignatureEquivalentTo($function, $existingFunction)) { |
|
54 | 48 | $context->AddError( |
55 | 49 | $item->Location(), |
56 | 50 | EdmErrorCode::DuplicateEntityContainerMemberName(), |
@@ -58,27 +52,21 @@ discard block |
||
58 | 52 | break; |
59 | 53 | } |
60 | 54 | } |
61 | - } |
|
62 | - else |
|
63 | - { |
|
55 | + } else { |
|
64 | 56 | $functionList = []; |
65 | 57 | } |
66 | 58 | |
67 | 59 | $functionList[] = $function; |
68 | 60 | $functionDictionary[$function->getName()] = $functionList; |
69 | - } |
|
70 | - else |
|
71 | - { |
|
61 | + } else { |
|
72 | 62 | if (ValidationHelper::AddMemberNameToHashSet( |
73 | 63 | $item, |
74 | 64 | $nonFunctionNameList, |
75 | 65 | $context, |
76 | 66 | EdmErrorCode::DuplicateEntityContainerMemberName(), |
77 | 67 | StringConst::EdmModel_Validator_Semantic_DuplicateEntityContainerMemberName($item->getName()), |
78 | - false)) |
|
79 | - { |
|
80 | - if (isset($functionDictionary[$item->getName()])) |
|
81 | - { |
|
68 | + false)) { |
|
69 | + if (isset($functionDictionary[$item->getName()])) { |
|
82 | 70 | $context->AddError( |
83 | 71 | $item->Location(), |
84 | 72 | EdmErrorCode::DuplicateEntityContainerMemberName(), |
@@ -24,15 +24,15 @@ |
||
24 | 24 | { |
25 | 25 | assert($enumMember instanceof IEnumMember); |
26 | 26 | $discoveredErrors = []; |
27 | - if ( |
|
28 | - !$context->checkIsBad($enumMember->getDeclaringType()) && |
|
27 | + if ( |
|
28 | + !$context->checkIsBad($enumMember->getDeclaringType()) && |
|
29 | 29 | !$context->checkIsBad($enumMember->getDeclaringType()->getUnderlyingType()) && |
30 | 30 | !ExpressionTypeChecker::TryAssertPrimitiveAsType($enumMember->getValue(), |
31 | - EdmTypeSemantics::GetPrimitiveTypeReference($enumMember->getDeclaringType()->getUnderlyingType(), false), $discoveredErrors)) |
|
32 | - { |
|
33 | - $context->AddError( |
|
34 | - $enumMember->Location(), |
|
35 | - EdmErrorCode::EnumMemberTypeMustMatchEnumUnderlyingType(), |
|
36 | - StringConst::EdmModel_Validator_Semantic_EnumMemberTypeMustMatchEnumUnderlyingType($enumMember->getName())); |
|
37 | - } } |
|
31 | + EdmTypeSemantics::GetPrimitiveTypeReference($enumMember->getDeclaringType()->getUnderlyingType(), false), $discoveredErrors)) |
|
32 | + { |
|
33 | + $context->AddError( |
|
34 | + $enumMember->Location(), |
|
35 | + EdmErrorCode::EnumMemberTypeMustMatchEnumUnderlyingType(), |
|
36 | + StringConst::EdmModel_Validator_Semantic_EnumMemberTypeMustMatchEnumUnderlyingType($enumMember->getName())); |
|
37 | + } } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -28,8 +28,7 @@ |
||
28 | 28 | !$context->checkIsBad($enumMember->getDeclaringType()) && |
29 | 29 | !$context->checkIsBad($enumMember->getDeclaringType()->getUnderlyingType()) && |
30 | 30 | !ExpressionTypeChecker::TryAssertPrimitiveAsType($enumMember->getValue(), |
31 | - EdmTypeSemantics::GetPrimitiveTypeReference($enumMember->getDeclaringType()->getUnderlyingType(), false), $discoveredErrors)) |
|
32 | - { |
|
31 | + EdmTypeSemantics::GetPrimitiveTypeReference($enumMember->getDeclaringType()->getUnderlyingType(), false), $discoveredErrors)) { |
|
33 | 32 | $context->AddError( |
34 | 33 | $enumMember->Location(), |
35 | 34 | EdmErrorCode::EnumMemberTypeMustMatchEnumUnderlyingType(), |