@@ -46,8 +46,7 @@ |
||
46 | 46 | ?bool $isFixedLength = null, |
47 | 47 | ?bool $isUnicode = null, |
48 | 48 | ?string $collation = null |
49 | - ) |
|
50 | - { |
|
49 | + ) { |
|
51 | 50 | parent::__construct($definition, $isNullable); |
52 | 51 | if ($isUnbounded && $maxLength !== null) { |
53 | 52 | throw new InvalidOperationException(StringConst::EdmModel_Validator_Semantic_IsUnboundedCannotBeTrueWhileMaxLengthIsNotNull()); |
@@ -48,8 +48,7 @@ |
||
48 | 48 | ?array $dependentProperties, |
49 | 49 | ?bool $containsTarget, |
50 | 50 | ?OnDeleteAction $onDelete |
51 | - ) |
|
52 | - { |
|
51 | + ) { |
|
53 | 52 | parent::__construct($declaringType, $name, $type); |
54 | 53 | $this->dependentProperties = $dependentProperties; |
55 | 54 | $this->containsTarget = $containsTarget ?? CsdlConstants::Default_ContainsTarget; |
@@ -12,24 +12,25 @@ |
||
12 | 12 | |
13 | 13 | public function __construct(iterable $wrappedDictionary = null) |
14 | 14 | { |
15 | - if(null !== $wrappedDictionary){ |
|
15 | + if(null !== $wrappedDictionary) { |
|
16 | 16 | $wrappedDictionary = []; |
17 | - foreach($wrappedDictionary as $item){ |
|
17 | + foreach($wrappedDictionary as $item) { |
|
18 | 18 | $this->wrappedDictionary[] = $item; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function add($value): bool{ |
24 | - if(in_array($value, $this->wrappedDictionary)){ |
|
24 | + if(in_array($value, $this->wrappedDictionary)) { |
|
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | $this->wrappedDictionary[] = $value; |
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
31 | - public function tryGetValue($key, &$output){ |
|
32 | - if(isset($this->wrappedDictionary[$key])){ |
|
31 | + public function tryGetValue($key, &$output) |
|
32 | + { |
|
33 | + if(isset($this->wrappedDictionary[$key])) { |
|
33 | 34 | $output = &$this->wrappedDictionary[$key]; |
34 | 35 | return true; |
35 | 36 | } |
@@ -44,8 +44,7 @@ |
||
44 | 44 | array $valueTermDictionary, |
45 | 45 | array $functionGroupDictionary, |
46 | 46 | array $containerDictionary |
47 | - ) |
|
48 | - { |
|
47 | + ) { |
|
49 | 48 | $qualifiedName = $element->FullName(); |
50 | 49 | switch ($element->getSchemaElementKind()) { |
51 | 50 | case SchemaElementKind::Function(): |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function assertSignatureMatches(callable $expected, callable $actual, string $callablePropName): bool |
21 | 21 | { |
22 | - if(!self::performAsserts()){ |
|
22 | + if(!self::performAsserts()) { |
|
23 | 23 | return true; |
24 | 24 | } |
25 | 25 | $expectedReflection = self::getReflection($expected); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $expectedReflection->getNumberOfRequiredParameters() === $actualReflection->getNumberOfRequiredParameters(), |
38 | 38 | $messageBuilder('Incorrect Parameter Count') |
39 | 39 | ); |
40 | - if($expectedReflection->hasReturnType()){ |
|
40 | + if($expectedReflection->hasReturnType()) { |
|
41 | 41 | assert( |
42 | 42 | $actualReflection->hasReturnType(), |
43 | 43 | $messageBuilder('Missing Return Type') |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $expectedReflection->getReturnType()->getName() === $actualReflection->getReturnType()->getName(), |
48 | 48 | $messageBuilder('IncorrectOrInvalid ReturnType') |
49 | 49 | ); |
50 | - if(!$expectedReflection->getReturnType()->allowsNull()){ |
|
50 | + if(!$expectedReflection->getReturnType()->allowsNull()) { |
|
51 | 51 | assert( |
52 | 52 | !$actualReflection->getReturnType()->allowsNull(), |
53 | 53 | $messageBuilder('Nullable ReturnType Not allowed') |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - for($i = 0; $i < $expectedReflection->getNumberOfParameters(); $i++){ |
|
59 | - if($expectedReflection->getParameters()[$i]->hasType()){ |
|
58 | + for($i = 0; $i < $expectedReflection->getNumberOfParameters(); $i++) { |
|
59 | + if($expectedReflection->getParameters()[$i]->hasType()) { |
|
60 | 60 | assert( |
61 | 61 | $actualReflection->getParameters()[$i]->hasType(), |
62 | 62 | $messageBuilder(sprintf('Parameter %s Is missing TypeHint', $i)) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $expectedReflection->getParameters()[$i]->getType()->getName() === $actualReflection->getParameters()[$i]->getType()->getName(), |
67 | 67 | $messageBuilder(sprintf('Parameter %s has Incorrect Type', $i)) |
68 | 68 | ); |
69 | - if(!$expectedReflection->getParameters()[$i]->allowsNull()){ |
|
69 | + if(!$expectedReflection->getParameters()[$i]->allowsNull()) { |
|
70 | 70 | assert( |
71 | 71 | !$actualReflection->getParameters()[$i]->allowsNull(), |
72 | 72 | $messageBuilder(sprintf('Parameter %s should disallow Nulls', $i)) |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $parameters = []; |
83 | 83 | foreach($reflection->getParameters() as $parameter) { |
84 | 84 | $parameterString = ''; |
85 | - if($parameter->hasType()){ |
|
85 | + if($parameter->hasType()) { |
|
86 | 86 | $parameterString .= $parameter->getType()->allowsNull() ? '?' : ''; |
87 | 87 | $parameterString .=$parameter->getType()->getName() . ' '; |
88 | 88 | } |
89 | 89 | $parameterString .= $parameter->isVariadic() ? '...$' : '$'; |
90 | 90 | $parameterString .= $parameter->getName(); |
91 | - if($parameter->isOptional()){ |
|
91 | + if($parameter->isOptional()) { |
|
92 | 92 | try { |
93 | 93 | $parameterString .= ' = ' . strval($parameter->getDefaultValue()); |
94 | 94 | } catch (ReflectionException $e) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $parameters[] = $parameterString; |
98 | 98 | } |
99 | 99 | $return = ''; |
100 | - if($reflection->hasReturnType()){ |
|
100 | + if($reflection->hasReturnType()) { |
|
101 | 101 | $return .= ': ' . $reflection->getReturnType()->getName(); |
102 | 102 | } |
103 | 103 | return sprintf('function(%s)%s', implode(',', $parameters), $return); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function getIterator() |
29 | 29 | { |
30 | 30 | rewind($this->memoryStream); |
31 | - while(false !== $char = fgetc($this->memoryStream)){ |
|
31 | + while(false !== $char = fgetc($this->memoryStream)) { |
|
32 | 32 | yield ord($char); |
33 | 33 | } |
34 | 34 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function offsetGet($offset) |
48 | 48 | { |
49 | - if(!$this->offsetExists($offset)){ |
|
49 | + if(!$this->offsetExists($offset)) { |
|
50 | 50 | throw new ArgumentException(sprintf('%s is out of range', $offset)); |
51 | 51 | } |
52 | 52 | fseek($this->memoryStream, $offset); |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function offsetSet($offset, $value) |
60 | 60 | { |
61 | - if(!is_int($value) || $value <0 || $value > 255){ |
|
61 | + if(!is_int($value) || $value <0 || $value > 255) { |
|
62 | 62 | throw new \InvalidArgumentException(sprintf('%s is an invalid value for a ByteArray', $value)); |
63 | 63 | } |
64 | - if($this->readonly){ |
|
64 | + if($this->readonly) { |
|
65 | 65 | throw new InvalidOperationException('attempt to write to read only array'); |
66 | 66 | } |
67 | - if($offset !== null || $offset < 0 || $offset > $this->length ){ |
|
67 | + if($offset !== null || $offset < 0 || $offset > $this->length ) { |
|
68 | 68 | throw new \InvalidArgumentException('allowable offsets are between 0 and full legnth or null'); |
69 | 69 | } |
70 | - if(null === $offset){ |
|
70 | + if(null === $offset) { |
|
71 | 71 | fseek($this->memoryStream, 0, SEEK_END); |
72 | - }else { |
|
72 | + } else { |
|
73 | 73 | fseek($this->memoryStream, $offset); |
74 | 74 | } |
75 | 75 | fwrite($this->memoryStream, chr($value)); |
@@ -55,9 +55,8 @@ |
||
55 | 55 | |
56 | 56 | public static function VerifyNCName(string $name): bool{ |
57 | 57 | $length = strlen($name); |
58 | - for( $i = 1; $i < $length; $i++) |
|
59 | - { |
|
60 | - if(!self::IsNCNameChar($name[$i])){ |
|
58 | + for( $i = 1; $i < $length; $i++) { |
|
59 | + if(!self::IsNCNameChar($name[$i])) { |
|
61 | 60 | return false; |
62 | 61 | } |
63 | 62 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | if (self::$m_CharProperties != null) { |
306 | 306 | return; |
307 | 307 | } |
308 | - if(file_exists('XmlCharType.bin')){ |
|
308 | + if(file_exists('XmlCharType.bin')) { |
|
309 | 309 | $file = fopen('XmlCharType.bin', 'rb'); |
310 | 310 | self::$m_CharProperties = fopen('php://memory', 'w+b'); |
311 | 311 | stream_copy_to_stream($file,self::$m_CharProperties); |
@@ -329,28 +329,27 @@ discard block |
||
329 | 329 | private static function SetProperties(string $ranges, int $value): void |
330 | 330 | { |
331 | 331 | assert(mb_strlen($ranges, 'UTF-8') % 2 === 0); |
332 | - for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2) |
|
333 | - { |
|
332 | + for ($p = 0; $p < mb_strlen($ranges, 'UTF-8'); $p +=2) { |
|
334 | 333 | $str1 = mb_substr($ranges,$p,1,'UTF-8'); |
335 | 334 | $str2 = mb_substr($ranges,$p+1,1,'UTF-8'); |
336 | 335 | for ($i = mb_ord($str1), |
337 | - $last = mb_ord($str2); $i <= $last; $i++) |
|
338 | - { |
|
339 | - if(!isset(self::$s_CharProperties[$i])){ |
|
336 | + $last = mb_ord($str2); $i <= $last; $i++) { |
|
337 | + if(!isset(self::$s_CharProperties[$i])) { |
|
340 | 338 | self::$s_CharProperties[$i] = $value; |
341 | 339 | } |
342 | 340 | self::$s_CharProperties[$i] |= $value; |
343 | 341 | } |
344 | 342 | } |
345 | 343 | } |
346 | - protected static function generateFile(){ |
|
344 | + protected static function generateFile() |
|
345 | + { |
|
347 | 346 | $fileArray = []; |
348 | - for($i = 0; $i < 65536; $i++){ |
|
347 | + for($i = 0; $i < 65536; $i++) { |
|
349 | 348 | $fileArray[$i] = XmlCharType::$s_CharProperties[$i] ?? 0; |
350 | 349 | } |
351 | 350 | $bin = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'XmlCharType.bin', 'w+b'); |
352 | 351 | self::$m_CharProperties = fopen('php://memory', 'w+b'); |
353 | - foreach($fileArray as $enum){ |
|
352 | + foreach($fileArray as $enum) { |
|
354 | 353 | fwrite($bin, chr($enum)); |
355 | 354 | fwrite(self::$m_CharProperties, chr($enum)); |
356 | 355 | } |
@@ -359,7 +358,8 @@ discard block |
||
359 | 358 | #endregion |
360 | 359 | |
361 | 360 | private static $instance = null; |
362 | - public static function Instance(){ |
|
361 | + public static function Instance() |
|
362 | + { |
|
363 | 363 | self::InitInstance(); |
364 | 364 | $umArray = new UnmanagedByteArray(self::$m_CharProperties); |
365 | 365 | return self::$instance ?? self::$instance = new self($umArray); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public static function getEdmModelRuleSet(Version $version): self |
161 | 161 | { |
162 | - switch ($version){ |
|
162 | + switch ($version) { |
|
163 | 163 | case Version::v1(): |
164 | 164 | return self::getV1RuleSet(); |
165 | 165 | case Version::v1_1(): |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | private function AddRule(ValidationRule $rule):void |
188 | 188 | { |
189 | 189 | $typeName = $rule->getValidatedType(); |
190 | - if(!isset($this->rules[$typeName])){ |
|
190 | + if(!isset($this->rules[$typeName])) { |
|
191 | 191 | $this->rules[$typeName] = []; |
192 | 192 | } |
193 | - if(in_array($rule, $this->rules[$typeName])){ |
|
193 | + if(in_array($rule, $this->rules[$typeName])) { |
|
194 | 194 | throw new InvalidOperationException(StringConst::RuleSet_DuplicateRulesExistInRuleSet()); |
195 | 195 | } |
196 | 196 | $this->rules[$typeName][] = $rule; |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | |
323 | 323 | private static function getV1_1RuleSet(): self{ |
324 | 324 | $filteredBase = []; |
325 | - foreach(self::getBaseRuleSet() as $baseRule){ |
|
325 | + foreach(self::getBaseRuleSet() as $baseRule) { |
|
326 | 326 | if( |
327 | 327 | $baseRule instanceof ComplexTypeInvalidAbstractComplexType || |
328 | 328 | $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType |
329 | - ){ |
|
329 | + ) { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | $filteredBase[] = $baseRule; |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | private static function getV1_2RuleSet(): self |
358 | 358 | { |
359 | 359 | $filteredBase = []; |
360 | - foreach(self::getBaseRuleSet() as $baseRule){ |
|
360 | + foreach(self::getBaseRuleSet() as $baseRule) { |
|
361 | 361 | if( |
362 | 362 | $baseRule instanceof ComplexTypeInvalidAbstractComplexType || |
363 | 363 | $baseRule instanceof ComplexTypeInvalidPolymorphicComplexType |
364 | - ){ |
|
364 | + ) { |
|
365 | 365 | continue; |
366 | 366 | } |
367 | 367 | $filteredBase[] = $baseRule; |
@@ -425,10 +425,8 @@ discard block |
||
425 | 425 | */ |
426 | 426 | public function getIterator(): Traversable |
427 | 427 | { |
428 | - foreach ($this->rules as $ruleList) |
|
429 | - { |
|
430 | - foreach ($ruleList as $rule) |
|
431 | - { |
|
428 | + foreach ($this->rules as $ruleList) { |
|
429 | + foreach ($ruleList as $rule) { |
|
432 | 430 | assert($rule instanceof ValidationRule); |
433 | 431 | yield $rule; |
434 | 432 | } |