@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!isset(static::$methodArgs[$name])) { |
| 45 | - throw new \BadMethodCallException($name . ' is not a valid method'); |
|
| 45 | + throw new \BadMethodCallException($name.' is not a valid method'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $numArgs = \count($arguments); |
@@ -111,11 +111,11 @@ |
||
| 111 | 111 | |
| 112 | 112 | // resource |
| 113 | 113 | if (\is_resource($value)) { |
| 114 | - return \get_resource_type($value) . ' resource #' . (int) $value; |
|
| 114 | + return \get_resource_type($value).' resource #'.(int) $value; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if (\is_object($value)) { |
| 118 | - return \get_class($value) . ' Object'; |
|
| 118 | + return \get_class($value).' Object'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return ''; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 28 | 28 | { |
| 29 | - throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `" . \print_r($value, true) . "` with type {{$type}}."); |
|
| 29 | + throw new \TypeError("Invalid type: expected to be of type {{$expectedTypes}}, instead got value `".\print_r($value, true)."` with type {{$type}}."); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | -require __DIR__ . '/vendor/autoload.php'; |
|
| 3 | +require __DIR__.'/../vendor/autoload.php'; |
|
| 4 | +require __DIR__.'/vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
| 7 | - __DIR__ . '/../src/Arrayy.php', |
|
| 8 | - __DIR__ . '/docs/base.md' |
|
| 7 | + __DIR__.'/../src/Arrayy.php', |
|
| 8 | + __DIR__.'/docs/base.md' |
|
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
| 11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |
|
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Arrayy\tests; |
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 5 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * @property string $type |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if (!\is_object($object)) { |
| 74 | 74 | throw new \InvalidArgumentException( |
| 75 | - 'JsonMapper::map() requires second argument to be an object, ' . \gettype($object) . ' given.' |
|
| 75 | + 'JsonMapper::map() requires second argument to be an object, '.\gettype($object).' given.' |
|
| 76 | 76 | ); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $type = $this->removeNullable($type); |
| 122 | 122 | } elseif ($jsonValue === null) { |
| 123 | 123 | throw new \InvalidArgumentException( |
| 124 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" must not be NULL' |
|
| 124 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" must not be NULL' |
|
| 125 | 125 | ); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($this->isSimpleType($type)) { |
| 149 | 149 | if ($type === 'string' && \is_object($jsonValue)) { |
| 150 | 150 | throw new \InvalidArgumentException( |
| 151 | - 'JSON property "' . $key . '" in class "' . $strClassName . '" is an object and cannot be converted to a string' |
|
| 151 | + 'JSON property "'.$key.'" in class "'.$strClassName.'" is an object and cannot be converted to a string' |
|
| 152 | 152 | ); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | if ($type === '') { |
| 171 | 171 | throw new \InvalidArgumentException( |
| 172 | - 'Empty type at property "' . $strClassName . '::$' . $key . '"' |
|
| 172 | + 'Empty type at property "'.$strClassName.'::$'.$key.'"' |
|
| 173 | 173 | ); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->isScalarType(\gettype($jsonValue)) |
| 204 | 204 | ) { |
| 205 | 205 | throw new \InvalidArgumentException( |
| 206 | - 'JSON property "' . $key . '" must be an array, ' . \gettype($jsonValue) . ' given' |
|
| 206 | + 'JSON property "'.$key.'" must be an array, '.\gettype($jsonValue).' given' |
|
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | } elseif ($this->isScalarType($class)) { |
| 305 | 305 | throw new \InvalidArgumentException( |
| 306 | - 'JSON property "' . ($parent_key ?: '?') . '" is an array of type "' . $class . '" but contained a value of type "' . \gettype($jsonValue) . '"' |
|
| 306 | + 'JSON property "'.($parent_key ?: '?').'" is an array of type "'.$class.'" but contained a value of type "'.\gettype($jsonValue).'"' |
|
| 307 | 307 | ); |
| 308 | 308 | } elseif (\is_a($class, \ArrayObject::class, true)) { |
| 309 | 309 | /** @noinspection PhpSillyAssignmentInspection - phpstan helper */ |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | //create a full qualified namespace |
| 362 | - return '\\' . $strNs . '\\' . $type; |
|
| 362 | + return '\\'.$strNs.'\\'.$type; |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | private function isNullable($type): bool |
| 665 | 665 | { |
| 666 | - return \stripos('|' . $type . '|', '|null|') !== false; |
|
| 666 | + return \stripos('|'.$type.'|', '|null|') !== false; |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | /** |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | return \substr( |
| 683 | - \str_ireplace('|null|', '|', '|' . $type . '|'), |
|
| 683 | + \str_ireplace('|null|', '|', '|'.$type.'|'), |
|
| 684 | 684 | 1, |
| 685 | 685 | -1 |
| 686 | 686 | ); |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $constructor->getNumberOfRequiredParameters() > 0 |
| 729 | 729 | ) { |
| 730 | 730 | /** @phpstan-var TClass $return */ |
| 731 | - $return = $reflectClass->newInstanceWithoutConstructor(); |
|
| 731 | + $return = $reflectClass->newInstanceWithoutConstructor(); |
|
| 732 | 732 | } else { |
| 733 | 733 | /** @phpstan-var TClass $return */ |
| 734 | 734 | $return = $reflectClass->newInstance(); |
@@ -67,6 +67,6 @@ |
||
| 67 | 67 | */ |
| 68 | 68 | public function throwException($expectedTypes, $value, $type): \Throwable |
| 69 | 69 | { |
| 70 | - throw new \TypeError('Invalid type: callable failed, got value `' . \print_r($value, true) . "` with type {{$type}}."); |
|
| 70 | + throw new \TypeError('Invalid type: callable failed, got value `'.\print_r($value, true)."` with type {{$type}}."); |
|
| 71 | 71 | } |
| 72 | 72 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $return = TypeCheckArray::create( |
| 25 | 25 | [ |
| 26 | 26 | Arrayy::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES => new TypeCheckCallback( |
| 27 | - static function ($value) { |
|
| 27 | + static function($value) { |
|
| 28 | 28 | return \is_string($value) && \is_numeric($value); |
| 29 | 29 | } |
| 30 | 30 | ), |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | $return = TypeCheckArray::create( |
| 25 | 25 | [ |
| 26 | 26 | Arrayy::ARRAYY_HELPER_TYPES_FOR_ALL_PROPERTIES => new TypeCheckCallback( |
| 27 | - static function ($value) { |
|
| 27 | + static function($value) { |
|
| 28 | 28 | return \is_numeric($value); |
| 29 | 29 | } |
| 30 | 30 | ), |