@@ -36,8 +36,8 @@ |
||
36 | 36 | { |
37 | 37 | |
38 | 38 | // Note: this check can be done without the try/catch block, but we need XmlConvert.IsStartNCNameChar and XmlConvert.IsNCNameChar, which are not available in 3.5. |
39 | - if(!XmlConvert::VerifyNCName($annotation->getName())){ |
|
40 | - $value = $annotation->getValue() ; |
|
39 | + if (!XmlConvert::VerifyNCName($annotation->getName())) { |
|
40 | + $value = $annotation->getValue(); |
|
41 | 41 | $errorLocation = ($value === null || !($value instanceof IValue)) ? null : $value->Location(); |
42 | 42 | $context->AddRawError(new EdmError($errorLocation, EdmErrorCode::InvalidName(), StringConst::EdmModel_Validator_Syntactic_EdmModel_NameIsNotAllowed($annotation->getName()))); |
43 | 43 | } |
@@ -32,11 +32,10 @@ |
||
32 | 32 | !EdmUtil::IsNullOrWhiteSpaceInternal($name) && |
33 | 33 | strlen($name) <= CsdlConstants::Max_NameLength && |
34 | 34 | strlen($name) > 0 |
35 | - ) |
|
36 | - { |
|
35 | + ) { |
|
37 | 36 | |
38 | 37 | // Note: this check can be done without the try/catch block, but we need XmlConvert.IsStartNCNameChar and XmlConvert.IsNCNameChar, which are not available in 3.5. |
39 | - if(!XmlConvert::VerifyNCName($annotation->getName())){ |
|
38 | + if(!XmlConvert::VerifyNCName($annotation->getName())) { |
|
40 | 39 | $value = $annotation->getValue() ; |
41 | 40 | $errorLocation = ($value === null || !($value instanceof IValue)) ? null : $value->Location(); |
42 | 41 | $context->AddRawError(new EdmError($errorLocation, EdmErrorCode::InvalidName(), StringConst::EdmModel_Validator_Syntactic_EdmModel_NameIsNotAllowed($annotation->getName()))); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $stringValue = $annotation->getValue(); |
26 | 26 | if ($stringValue != null && $stringValue instanceof IStringValue) |
27 | 27 | { |
28 | - if ( boolval( |
|
28 | + if (boolval( |
|
29 | 29 | $context |
30 | 30 | ->getModel() |
31 | 31 | ->getDirectValueAnnotationsManager() |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | )) |
38 | 38 | { |
39 | 39 | $error = null; |
40 | - if (! |
|
41 | - ValidationHelper::ValidateValueCanBeWrittenAsXmlElementAnnotation( |
|
40 | + if (!ValidationHelper::ValidateValueCanBeWrittenAsXmlElementAnnotation( |
|
42 | 41 | $stringValue, |
43 | 42 | $annotation->getNamespaceUri(), |
44 | 43 | $annotation->getName(), |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | assert($annotation instanceof IDirectValueAnnotation); |
25 | 25 | $stringValue = $annotation->getValue(); |
26 | - if ($stringValue != null && $stringValue instanceof IStringValue) |
|
27 | - { |
|
26 | + if ($stringValue != null && $stringValue instanceof IStringValue) { |
|
28 | 27 | if ( boolval( |
29 | 28 | $context |
30 | 29 | ->getModel() |
@@ -34,8 +33,7 @@ discard block |
||
34 | 33 | EdmConstants::InternalUri, |
35 | 34 | CsdlConstants::IsSerializedAsElementAnnotation |
36 | 35 | ) ?? false |
37 | - )) |
|
38 | - { |
|
36 | + )) { |
|
39 | 37 | $error = null; |
40 | 38 | if (! |
41 | 39 | ValidationHelper::ValidateValueCanBeWrittenAsXmlElementAnnotation( |
@@ -43,8 +41,7 @@ discard block |
||
43 | 41 | $annotation->getNamespaceUri(), |
44 | 42 | $annotation->getName(), |
45 | 43 | $error) |
46 | - ) |
|
47 | - { |
|
44 | + ) { |
|
48 | 45 | $context->AddRawError($error); |
49 | 46 | } |
50 | 47 | } |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | assert($annotation instanceof IDirectValueAnnotation); |
27 | 27 | $stringValue = $annotation->getValue(); |
28 | - if ($stringValue != null && $stringValue instanceof IStringValue) |
|
29 | - { |
|
28 | + if ($stringValue != null && $stringValue instanceof IStringValue) { |
|
30 | 29 | if ( |
31 | 30 | boolval( |
32 | 31 | $context |
@@ -38,13 +37,11 @@ discard block |
||
38 | 37 | CsdlConstants::IsSerializedAsElementAnnotation |
39 | 38 | ) ?? false |
40 | 39 | ) |
41 | - ) |
|
42 | - { |
|
40 | + ) { |
|
43 | 41 | if ( |
44 | 42 | EdmUtil::IsNullOrWhiteSpaceInternal($annotation->getNamespaceUri()) || |
45 | 43 | EdmUtil::IsNullOrWhiteSpaceInternal($annotation->getName()) |
46 | - ) |
|
47 | - { |
|
44 | + ) { |
|
48 | 45 | $context->AddError( |
49 | 46 | $annotation->Location(), |
50 | 47 | EdmErrorCode::InvalidElementAnnotation(), |
@@ -23,10 +23,8 @@ |
||
23 | 23 | $errors = null; |
24 | 24 | if (!ExpressionTypeChecker::tryAssertType( |
25 | 25 | $expression->getTestExpression(), |
26 | - EdmCoreModel::getInstance()->GetBoolean(false), $errors)) |
|
27 | - { |
|
28 | - foreach ($errors as $error) |
|
29 | - { |
|
26 | + EdmCoreModel::getInstance()->GetBoolean(false), $errors)) { |
|
27 | + foreach ($errors as $error) { |
|
30 | 28 | $context->AddRawError($error); |
31 | 29 | } |
32 | 30 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | foreach ($parameters as $parameter) |
48 | 48 | { |
49 | 49 | $recursiveErrors = null; |
50 | - if (!ExpressionTypeChecker::tryAssertType(current($arguments),$parameter->getType(), $recursiveErrors)) |
|
50 | + if (!ExpressionTypeChecker::tryAssertType(current($arguments), $parameter->getType(), $recursiveErrors)) |
|
51 | 51 | { |
52 | 52 | foreach ($recursiveErrors as $error) |
53 | 53 | { |
@@ -26,11 +26,9 @@ discard block |
||
26 | 26 | assert($functionReference instanceof IFunctionReferenceExpression); |
27 | 27 | if ( |
28 | 28 | $functionReference->getReferencedFunction() != null && |
29 | - !$context->checkIsBad($functionReference->getReferencedFunction())) |
|
30 | - { |
|
29 | + !$context->checkIsBad($functionReference->getReferencedFunction())) { |
|
31 | 30 | if ( |
32 | - count($functionReference->getReferencedFunction()->getParameters()) != count($expression->getArguments())) |
|
33 | - { |
|
31 | + count($functionReference->getReferencedFunction()->getParameters()) != count($expression->getArguments())) { |
|
34 | 32 | $context->AddError( |
35 | 33 | $expression->Location(), |
36 | 34 | EdmErrorCode::IncorrectNumberOfArguments(), |
@@ -44,13 +42,10 @@ discard block |
||
44 | 42 | $parameters = $functionReference->getReferencedFunction()->getParameters(); |
45 | 43 | $arguments = $expression->getArguments(); |
46 | 44 | reset($arguments); |
47 | - foreach ($parameters as $parameter) |
|
48 | - { |
|
45 | + foreach ($parameters as $parameter) { |
|
49 | 46 | $recursiveErrors = null; |
50 | - if (!ExpressionTypeChecker::tryAssertType(current($arguments),$parameter->getType(), $recursiveErrors)) |
|
51 | - { |
|
52 | - foreach ($recursiveErrors as $error) |
|
53 | - { |
|
47 | + if (!ExpressionTypeChecker::tryAssertType(current($arguments),$parameter->getType(), $recursiveErrors)) { |
|
48 | + foreach ($recursiveErrors as $error) { |
|
54 | 49 | $context->AddRawError($error); |
55 | 50 | } |
56 | 51 | } |
@@ -21,8 +21,7 @@ |
||
21 | 21 | public function __invoke(ValidationContext $context, ?IEdmElement $element) |
22 | 22 | { |
23 | 23 | assert($element instanceof IEntityContainerElement); |
24 | - if ($element->getContainerElementKind()->isNone() && !$context->checkIsBad($element)) |
|
25 | - { |
|
24 | + if ($element->getContainerElementKind()->isNone() && !$context->checkIsBad($element)) { |
|
26 | 25 | $context->AddError( |
27 | 26 | $element->Location(), |
28 | 27 | EdmErrorCode::EntityContainerElementMustNotHaveKindOfNone(), |
@@ -21,8 +21,7 @@ |
||
21 | 21 | public function __invoke(ValidationContext $context, ?IEdmElement $type) |
22 | 22 | { |
23 | 23 | assert($type instanceof IDecimalTypeReference); |
24 | - if ($type->getScale() > $type->getPrecision() || $type->getScale() < 0) |
|
25 | - { |
|
24 | + if ($type->getScale() > $type->getPrecision() || $type->getScale() < 0) { |
|
26 | 25 | $context->AddError( |
27 | 26 | $type->Location(), |
28 | 27 | EdmErrorCode::ScaleOutOfRange(), |
@@ -22,8 +22,7 @@ |
||
22 | 22 | public function __invoke(ValidationContext $context, ?IEdmElement $type) |
23 | 23 | { |
24 | 24 | assert($type instanceof IDecimalTypeReference); |
25 | - if ($type->getPrecision() > EdmConstants::Max_Precision || $type->getPrecision() < EdmConstants::Min_Precision) |
|
26 | - { |
|
25 | + if ($type->getPrecision() > EdmConstants::Max_Precision || $type->getPrecision() < EdmConstants::Min_Precision) { |
|
27 | 26 | $context->AddError( |
28 | 27 | $type->Location(), |
29 | 28 | EdmErrorCode::PrecisionOutOfRange(), |
@@ -32,7 +32,7 @@ |
||
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | - if (! EdmUtil::IsNullOrWhiteSpaceInternal($item->getName()) && strlen($item->getName()) <= CsdlConstants::Max_NameLength && strlen($item->getName()) > 0) |
|
35 | + if (!EdmUtil::IsNullOrWhiteSpaceInternal($item->getName()) && strlen($item->getName()) <= CsdlConstants::Max_NameLength && strlen($item->getName()) > 0) |
|
36 | 36 | { |
37 | 37 | if (!EdmUtil::IsValidUndottedName($item->getName())) |
38 | 38 | { |
@@ -27,15 +27,12 @@ |
||
27 | 27 | // Don't run this rule for IDirectValueAnnotation, |
28 | 28 | // We validate the name of IEdmDirectionValueAnnotation in a separate validation rule, |
29 | 29 | // DirectValueAnnotationHasXmlSerializableName. |
30 | - if ($item instanceof IDirectValueAnnotation) |
|
31 | - { |
|
30 | + if ($item instanceof IDirectValueAnnotation) { |
|
32 | 31 | return; |
33 | 32 | } |
34 | 33 | |
35 | - if (! EdmUtil::IsNullOrWhiteSpaceInternal($item->getName()) && strlen($item->getName()) <= CsdlConstants::Max_NameLength && strlen($item->getName()) > 0) |
|
36 | - { |
|
37 | - if (!EdmUtil::IsValidUndottedName($item->getName())) |
|
38 | - { |
|
34 | + if (! EdmUtil::IsNullOrWhiteSpaceInternal($item->getName()) && strlen($item->getName()) <= CsdlConstants::Max_NameLength && strlen($item->getName()) > 0) { |
|
35 | + if (!EdmUtil::IsValidUndottedName($item->getName())) { |
|
39 | 36 | $context->AddError( |
40 | 37 | $item->Location(), |
41 | 38 | EdmErrorCode::InvalidName(), |