@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Tdn\PhpTypes\Type; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Tdn\PhpTypes\Type; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Tdn\PhpTypes\Type; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Tdn\PhpTypes\Type; |
| 5 | 5 | |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if ($this instanceof TransmutableTypeInterface) { |
| 119 | - return $this(Type::ARRAY); |
|
| 119 | + return $this(Type::array); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | throw $this->createInvalidTransformationException('array'); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | const BOOL = 1; |
| 12 | 12 | const INT = 2; |
| 13 | 13 | const FLOAT = 3; |
| 14 | - const ARRAY = 4; |
|
| 14 | + const array = 4; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @return mixed |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | Type::BOOL => 'bool', |
| 140 | 140 | Type::INT => 'int', |
| 141 | 141 | Type::FLOAT => 'float', |
| 142 | - Type::ARRAY => 'array', |
|
| 142 | + Type::array => 'array', |
|
| 143 | 143 | ]; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Tdn\PhpTypes\Type\Traits; |
| 6 | 6 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if ($pointer !== null) { |
| 40 | 40 | throw new \LogicException( |
| 41 | 41 | sprintf( |
| 42 | - 'The identifier of type %s is defined more than once. '. |
|
| 42 | + 'The identifier of type %s is defined more than once. ' . |
|
| 43 | 43 | 'First argument of %s() must be null or undefined.', |
| 44 | 44 | gettype($pointer), |
| 45 | 45 | __METHOD__ |
@@ -98,8 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | self::$collection[$address] = &$pointer; |
| 101 | - self::$lastAddress = $address; |
|
| 102 | - ++self::$entriesCount; |
|
| 101 | + self::$lastAddress = $address;++self::$entriesCount; |
|
| 103 | 102 | } |
| 104 | 103 | |
| 105 | 104 | /** |
@@ -119,8 +118,7 @@ discard block |
||
| 119 | 118 | } |
| 120 | 119 | |
| 121 | 120 | $address = self::createAddress(); |
| 122 | - self::$collection[$address] = &$pointer; |
|
| 123 | - ++self::$entriesCount; |
|
| 121 | + self::$collection[$address] = &$pointer;++self::$entriesCount; |
|
| 124 | 122 | |
| 125 | 123 | return $address; |
| 126 | 124 | } |
@@ -154,8 +152,7 @@ discard block |
||
| 154 | 152 | return false; |
| 155 | 153 | } |
| 156 | 154 | |
| 157 | - unset(self::$collection[$address]); |
|
| 158 | - --self::$entriesCount; |
|
| 155 | + unset(self::$collection[$address]);--self::$entriesCount; |
|
| 159 | 156 | |
| 160 | 157 | return true; |
| 161 | 158 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | break; |
| 60 | - case Type::ARRAY: |
|
| 60 | + case Type::array: |
|
| 61 | 61 | if ($this->contains(',')) { |
| 62 | 62 | return $this->explode(',')->toArray(); |
| 63 | 63 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Tdn\PhpTypes\Type; |
| 6 | 6 | |
@@ -146,8 +146,7 @@ discard block |
||
| 146 | 146 | public function strpos(string $subStr, int $offset = 0, bool $caseSensitive = false): IntType |
| 147 | 147 | { |
| 148 | 148 | $res = ($caseSensitive) ? |
| 149 | - mb_strpos($this->str, $subStr, $offset, $this->encoding) : |
|
| 150 | - mb_stripos($this->str, $subStr, $offset, $this->encoding); |
|
| 149 | + mb_strpos($this->str, $subStr, $offset, $this->encoding) : mb_stripos($this->str, $subStr, $offset, $this->encoding); |
|
| 151 | 150 | |
| 152 | 151 | return new IntType($res); |
| 153 | 152 | } |
@@ -164,8 +163,7 @@ discard block |
||
| 164 | 163 | public function strrpos(string $subStr, int $offset = 0, bool $caseSensitive = false): IntType |
| 165 | 164 | { |
| 166 | 165 | $res = ($caseSensitive) ? |
| 167 | - mb_strrpos($this->str, $subStr, $offset, $this->encoding) : |
|
| 168 | - mb_strripos($this->str, $subStr, $offset, $this->encoding); |
|
| 166 | + mb_strrpos($this->str, $subStr, $offset, $this->encoding) : mb_strripos($this->str, $subStr, $offset, $this->encoding); |
|
| 169 | 167 | |
| 170 | 168 | return new IntType($res); |
| 171 | 169 | } |
@@ -287,7 +285,7 @@ discard block |
||
| 287 | 285 | if (!empty($toSubStr) && $str->contains($toSubStr)) { |
| 288 | 286 | $toIndex = $this->strpos($toSubStr, $fromIndex, $caseSensitive)->get(); |
| 289 | 287 | $toIndex = ($excludeToSubStr) ? |
| 290 | - $toIndex - $fromIndex : ($toIndex - $fromIndex) + mb_strlen($toSubStr, $this->encoding); |
|
| 288 | + $toIndex - $fromIndex : ($toIndex - $fromIndex) + mb_strlen($toSubStr, $this->encoding); |
|
| 291 | 289 | } |
| 292 | 290 | } |
| 293 | 291 | |
@@ -28,12 +28,12 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @return string|array|int |
| 30 | 30 | */ |
| 31 | - public function __invoke(int $toType = Type::ARRAY) |
|
| 31 | + public function __invoke(int $toType = Type::array) |
|
| 32 | 32 | { |
| 33 | 33 | switch ($toType) { |
| 34 | 34 | case Type::INT: |
| 35 | 35 | return $this->count(); |
| 36 | - case Type::ARRAY: |
|
| 36 | + case Type::array: |
|
| 37 | 37 | return $this->toArray(); |
| 38 | 38 | case Type::STRING: |
| 39 | 39 | try { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function __construct(array $elements = array(), string $type = null) |
| 45 | 45 | { |
| 46 | 46 | $this->type = $type; |
| 47 | - $this->elements = array_map(function ($element) { |
|
| 47 | + $this->elements = array_map(function($element) { |
|
| 48 | 48 | return $this->getRealValue($element); |
| 49 | 49 | }, $elements); |
| 50 | 50 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function unique() |
| 369 | 369 | { |
| 370 | - $closure = function ($key, $value) { |
|
| 370 | + $closure = function($key, $value) { |
|
| 371 | 371 | return is_string($value); |
| 372 | 372 | }; |
| 373 | 373 | |