@@ -22,6 +22,7 @@ |
||
| 22 | 22 | * Flushes the type dictionary currently in use, leading to loading a fresh new type dictionary. |
| 23 | 23 | * |
| 24 | 24 | * Useful when the data types change during the script execution in such a way Ivory is unable to detect it. |
| 25 | + * @return void |
|
| 25 | 26 | */ |
| 26 | 27 | function flushTypeDictionary(): void; |
| 27 | 28 | } |
@@ -116,6 +116,10 @@ |
||
| 116 | 116 | return new $exClass($resultHandler, $query); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | + /** |
|
| 120 | + * @param resource $resultHandler |
|
| 121 | + * @param StatementExceptionFactory $fallbackFactory |
|
| 122 | + */ |
|
| 119 | 123 | private function inferExceptionClass($resultHandler, ?StatementExceptionFactory $fallbackFactory = null): string |
| 120 | 124 | { |
| 121 | 125 | if ($this->bySqlStateCodeAndMessage || $this->bySqlStateCode || $this->bySqlStateClass) { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Exception; |
| 5 | 5 | |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | $resultHandler, |
| 111 | 111 | string $query, |
| 112 | 112 | ?StatementExceptionFactory $fallbackFactory = null |
| 113 | - ): StatementException { |
|
| 113 | + ) : StatementException { |
|
| 114 | 114 | $exClass = $this->inferExceptionClass($resultHandler, $fallbackFactory); |
| 115 | 115 | assert(is_a($exClass, StatementException::class, true)); |
| 116 | 116 | return new $exClass($resultHandler, $query); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - private function inferExceptionClass($resultHandler, ?StatementExceptionFactory $fallbackFactory = null): string |
|
| 119 | + private function inferExceptionClass($resultHandler, ?StatementExceptionFactory $fallbackFactory = null) : string |
|
| 120 | 120 | { |
| 121 | 121 | if ($this->bySqlStateCodeAndMessage || $this->bySqlStateCode || $this->bySqlStateClass) { |
| 122 | 122 | $sqlStateCode = pg_result_error_field($resultHandler, PGSQL_DIAG_SQLSTATE); |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * @param IConnection|string $conn (name of) connection to use as the default connection |
|
| 207 | + * @param IConnection $conn (name of) connection to use as the default connection |
|
| 208 | 208 | * @throws \RuntimeException if the requested connection is not defined |
| 209 | 209 | */ |
| 210 | 210 | public static function useConnectionAsDefault($conn): void |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory; |
| 5 | 5 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param CacheItemPoolInterface|null $cacheItemPool the cache implementation to use for connections which do not |
| 119 | 119 | * set their own cache, or <tt>null</tt> for no default cache |
| 120 | 120 | */ |
| 121 | - public static function setDefaultCacheImpl(?CacheItemPoolInterface $cacheItemPool): void |
|
| 121 | + public static function setDefaultCacheImpl(?CacheItemPoolInterface $cacheItemPool) : void |
|
| 122 | 122 | { |
| 123 | 123 | self::$defaultCacheImpl = $cacheItemPool; |
| 124 | 124 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @throws ConnectionException if connection name is explicitly specified but a connection with the same name |
| 150 | 150 | * already exists |
| 151 | 151 | */ |
| 152 | - public static function setupNewConnection($params, ?string $connName = null): IConnection |
|
| 152 | + public static function setupNewConnection($params, ?string $connName = null) : IConnection |
|
| 153 | 153 | { |
| 154 | 154 | if (!$params instanceof ConnectionParameters) { |
| 155 | 155 | $params = ConnectionParameters::create($params); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @throws \RuntimeException if the default connection is requested but no connection has been setup yet, or if the |
| 187 | 187 | * requested connection is not defined |
| 188 | 188 | */ |
| 189 | - public static function getConnection(?string $connName = null): IConnection |
|
| 189 | + public static function getConnection(?string $connName = null) : IConnection |
|
| 190 | 190 | { |
| 191 | 191 | if ($connName === null) { |
| 192 | 192 | if (self::$defaultConn) { |
@@ -51,10 +51,16 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function getValueSerializer(string $name): ?IValueSerializer; |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param \Ivory\Connection\anonymous//src/Ivory/Connection/TypeControl.php$0 $undefinedTypeHandler |
|
| 56 | + * |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 54 | 59 | function setUndefinedTypeHandler(?ITypeDictionaryUndefinedHandler $undefinedTypeHandler); |
| 55 | 60 | |
| 56 | 61 | /** |
| 57 | 62 | * @param string[] $schemaList |
| 63 | + * @return void |
|
| 58 | 64 | */ |
| 59 | 65 | function setTypeSearchPath(array $schemaList): void; |
| 60 | 66 | |
@@ -62,6 +68,7 @@ discard block |
||
| 62 | 68 | * Attach connection-dependent objects in this dictionary to a connection. |
| 63 | 69 | * |
| 64 | 70 | * @param IConnection $connection connection to attach the dictionary to |
| 71 | + * @return void |
|
| 65 | 72 | */ |
| 66 | 73 | function attachToConnection(IConnection $connection): void; |
| 67 | 74 | |
@@ -69,6 +76,7 @@ discard block |
||
| 69 | 76 | * Detach any objects in this dictionary from the database connection. |
| 70 | 77 | * |
| 71 | 78 | * After this operation, the dictionary must be safe for serialization. |
| 79 | + * @return void |
|
| 72 | 80 | */ |
| 73 | 81 | function detachFromConnection(): void; |
| 74 | 82 | } |
@@ -151,6 +151,10 @@ |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | + /** |
|
| 155 | + * @param boolean|null $aIsInc |
|
| 156 | + * @param boolean|null $bIsInc |
|
| 157 | + */ |
|
| 154 | 158 | private function compareBounds(int $sgn, $aVal, ?bool $aIsInc, $bVal, ?bool $bIsInc): int |
| 155 | 159 | { |
| 156 | 160 | if ($aVal === null && $bVal === null) { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Type\Postgresql; |
| 5 | 5 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private function compareBounds(int $sgn, $aVal, ?bool $aIsInc, $bVal, ?bool $bIsInc): int |
|
| 154 | + private function compareBounds(int $sgn, $aVal, ?bool $aIsInc, $bVal, ?bool $bIsInc) : int |
|
| 155 | 155 | { |
| 156 | 156 | if ($aVal === null && $bVal === null) { |
| 157 | 157 | return 0; |
@@ -306,6 +306,9 @@ |
||
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | + /** |
|
| 310 | + * @param IType $item |
|
| 311 | + */ |
|
| 309 | 312 | private static function removeAll(array &$array, $item): void |
| 310 | 313 | { |
| 311 | 314 | while (($key = array_search($item, $array, true)) !== false) { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Type; |
| 5 | 5 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | throw new UndefinedTypeException("There is no type defined for converting value of type \"$typeName\""); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - private function recognizeType($value, $ruleSet): ?array |
|
| 111 | + private function recognizeType($value, $ruleSet): ? array |
|
| 112 | 112 | { |
| 113 | 113 | static $gettypeMap = [ |
| 114 | 114 | 'boolean' => 'bool', |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - private function recognizeObjectType($value, $ruleSet): ?array |
|
| 139 | + private function recognizeObjectType($value, $ruleSet): ? array |
|
| 140 | 140 | { |
| 141 | 141 | $valueClass = new \ReflectionClass($value); |
| 142 | 142 | $class = $valueClass; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return null; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - private function recognizeArrayType($value, $ruleSet): ?array |
|
| 159 | + private function recognizeArrayType($value, $ruleSet): ? array |
|
| 160 | 160 | { |
| 161 | 161 | $element = $this->findFirstSignificantElement($value); |
| 162 | 162 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | //region content management |
| 245 | 245 | |
| 246 | - public function defineType(IType $type, ?int $oid = null): void |
|
| 246 | + public function defineType(IType $type, ?int $oid = null) : void |
|
| 247 | 247 | { |
| 248 | 248 | if ($oid !== null) { |
| 249 | 249 | $this->oidTypeMap[$oid] = $type; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // necessary for the forward reference to be valid once the aliased type finally appears in the type map |
| 325 | 325 | $this->qualNameTypeMap[$schemaName] = []; |
| 326 | 326 | } |
| 327 | - $this->typeAliases[$alias] =& $this->qualNameTypeMap[$schemaName][$typeName]; |
|
| 327 | + $this->typeAliases[$alias] = & $this->qualNameTypeMap[$schemaName][$typeName]; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | foreach ($this->typeSearchPath as $schemaName) { |
| 342 | 342 | foreach (($this->qualNameTypeMap[$schemaName] ?? []) as $typeName => $type) { |
| 343 | 343 | if (!isset($this->searchedNameCache[$typeName])) { |
| 344 | - $this->searchedNameCache[$typeName] =& $this->qualNameTypeMap[$schemaName][$typeName]; |
|
| 344 | + $this->searchedNameCache[$typeName] = & $this->qualNameTypeMap[$schemaName][$typeName]; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * which might or might not be desired. Such a difference only arises in the trailing fractional zero digits, |
| 257 | 257 | * though. |
| 258 | 258 | * |
| 259 | - * @param string|int|float|Decimal|object $number number to compare this number with |
|
| 259 | + * @param Decimal $number number to compare this number with |
|
| 260 | 260 | * @return bool|null whether this number numerically equals to <tt>$number</tt>; |
| 261 | 261 | * <tt>null</tt> for <tt>null</tt> input |
| 262 | 262 | */ |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * @param string|int|float|Decimal|object $number |
|
| 281 | + * @param Decimal $number |
|
| 282 | 282 | * @return bool <tt>true</tt> iff this number is numerically greater than <tt>$number</tt> |
| 283 | 283 | */ |
| 284 | 284 | public function greaterThan($number): bool |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | - * @param string|int|float|Decimal|object $augend |
|
| 366 | + * @param integer $augend |
|
| 367 | 367 | * @return Decimal a new decimal number, representing the result of sum of this and the given number |
| 368 | 368 | */ |
| 369 | 369 | public function add($augend): Decimal |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | - * @param string|int|float|Decimal|object $subtrahend |
|
| 383 | + * @param Decimal $subtrahend |
|
| 384 | 384 | * @return Decimal a new decimal number, representing the result of subtraction of this and the given number |
| 385 | 385 | */ |
| 386 | 386 | public function subtract($subtrahend): Decimal |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
| 400 | - * @param string|int|float|Decimal|object $multiplicand |
|
| 400 | + * @param Decimal $multiplicand |
|
| 401 | 401 | * @return Decimal a new decimal number, representing the result of multiplication of this and the given number |
| 402 | 402 | */ |
| 403 | 403 | public function multiply($multiplicand): Decimal |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
| 417 | - * @param string|int|float|Decimal|object $divisor |
|
| 417 | + * @param Decimal $divisor |
|
| 418 | 418 | * @return Decimal a new decimal number, representing the result of division of this number with the given number |
| 419 | 419 | * @throws \RuntimeException if <tt>$divisor</tt> is zero |
| 420 | 420 | */ |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Value; |
| 5 | 5 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * if not given, it is computed from <tt>$decimalNumber</tt> automatically |
| 64 | 64 | * @return Decimal |
| 65 | 65 | */ |
| 66 | - public static function fromNumber($decimalNumber, ?int $scale = null): Decimal |
|
| 66 | + public static function fromNumber($decimalNumber, ?int $scale = null) : Decimal |
|
| 67 | 67 | { |
| 68 | 68 | if ($decimalNumber === null) { |
| 69 | 69 | throw new \InvalidArgumentException('decimalNumber'); |
@@ -99,6 +99,10 @@ |
||
| 99 | 99 | return new Quantity($val, $unit); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | + /** |
|
| 103 | + * @param string $value |
|
| 104 | + * @param string $unit |
|
| 105 | + */ |
|
| 102 | 106 | public static function fromValue($value, ?string $unit = null): Quantity |
| 103 | 107 | { |
| 104 | 108 | if (!is_numeric($value)) { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Value; |
| 5 | 5 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | return new Quantity($val, $unit); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public static function fromValue($value, ?string $unit = null): Quantity |
|
| 102 | + public static function fromValue($value, ?string $unit = null) : Quantity |
|
| 103 | 103 | { |
| 104 | 104 | if (!is_numeric($value)) { |
| 105 | 105 | throw new \InvalidArgumentException('$value'); |
@@ -168,6 +168,9 @@ discard block |
||
| 168 | 168 | return new Range($subtype, null, true, null, null, null, null); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | + /** |
|
| 172 | + * @param boolean $upperInc |
|
| 173 | + */ |
|
| 171 | 174 | private static function processBoundSpec($boundsOrLowerInc = '[)', ?bool $upperInc = null) |
| 172 | 175 | { |
| 173 | 176 | if (is_string($boundsOrLowerInc)) { |
@@ -194,6 +197,9 @@ discard block |
||
| 194 | 197 | } |
| 195 | 198 | |
| 196 | 199 | |
| 200 | + /** |
|
| 201 | + * @param IRangeCanonicalFunc|null $canonicalFunc |
|
| 202 | + */ |
|
| 197 | 203 | private function __construct( |
| 198 | 204 | ITotallyOrderedType $subtype, |
| 199 | 205 | ?IRangeCanonicalFunc $canonicalFunc, |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ivory\Value; |
| 5 | 5 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $upper, |
| 108 | 108 | $boundsOrLowerInc = '[)', |
| 109 | 109 | ?bool $upperInc = null |
| 110 | - ): Range { |
|
| 110 | + ) : Range { |
|
| 111 | 111 | list($loInc, $upInc) = self::processBoundSpec($boundsOrLowerInc, $upperInc); |
| 112 | 112 | |
| 113 | 113 | if ($lower !== null && $upper !== null) { |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @return array|null pair of the lower and upper bound, or <tt>null</tt> if the range is empty |
| 321 | 321 | * @throws UnsupportedException if the range subtype is not an {@link IDiscreteType} |
| 322 | 322 | */ |
| 323 | - public function toBounds($boundsOrLowerInc, ?bool $upperInc = null): ?array |
|
| 323 | + public function toBounds($boundsOrLowerInc, ?bool $upperInc = null) : ? array |
|
| 324 | 324 | { |
| 325 | 325 | if (!$this->subtype instanceof IDiscreteType) { |
| 326 | 326 | throw new UnsupportedException('Range subtype is not ' . IDiscreteType::class . ', cannot convert bounds'); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * an empty range is considered to be contained in any range, even an empty one; |
| 456 | 456 | * <tt>null</tt> on <tt>null</tt> input |
| 457 | 457 | */ |
| 458 | - public function containsRange(?Range $other): ?bool |
|
| 458 | + public function containsRange(?Range $other) : ?bool |
|
| 459 | 459 | { |
| 460 | 460 | if ($other === null) { |
| 461 | 461 | return null; |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | * an empty range is considered to be contained in any range, even an empty one; |
| 499 | 499 | * <tt>null</tt> on <tt>null</tt> input |
| 500 | 500 | */ |
| 501 | - public function containedInRange(?Range $other): ?bool |
|
| 501 | + public function containedInRange(?Range $other) : ?bool |
|
| 502 | 502 | { |
| 503 | 503 | if ($other === null) { |
| 504 | 504 | return null; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * @return bool|null whether this and the other range overlap, i.e., have a non-empty intersection; |
| 512 | 512 | * <tt>null</tt> on <tt>null</tt> input |
| 513 | 513 | */ |
| 514 | - public function overlaps(?Range $other): ?bool |
|
| 514 | + public function overlaps(?Range $other) : ?bool |
|
| 515 | 515 | { |
| 516 | 516 | if ($other === null) { |
| 517 | 517 | return null; |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | * @return Range|null intersection of this and the other range |
| 543 | 543 | * <tt>null</tt> on <tt>null</tt> input |
| 544 | 544 | */ |
| 545 | - public function intersect(?Range $other): ?Range |
|
| 545 | + public function intersect(?Range $other) : ?Range |
|
| 546 | 546 | { |
| 547 | 547 | if ($other === null) { |
| 548 | 548 | return null; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | * <tt>false</tt> otherwise, especially if either range is empty; |
| 614 | 614 | * <tt>null</tt> on <tt>null</tt> input |
| 615 | 615 | */ |
| 616 | - public function strictlyLeftOf(?Range $other): ?bool |
|
| 616 | + public function strictlyLeftOf(?Range $other) : ?bool |
|
| 617 | 617 | { |
| 618 | 618 | if ($other === null) { |
| 619 | 619 | return null; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | * <tt>false</tt> otherwise, especially if either range is empty;; |
| 637 | 637 | * <tt>null</tt> on <tt>null</tt> input |
| 638 | 638 | */ |
| 639 | - public function strictlyRightOf(?Range $other): ?bool |
|
| 639 | + public function strictlyRightOf(?Range $other) : ?bool |
|
| 640 | 640 | { |
| 641 | 641 | if ($other === null) { |
| 642 | 642 | return null; |