@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | /** |
535 | 535 | * Assert that value is not equal to a provided value (using == ). |
536 | 536 | * |
537 | - * @param mixed $value2 |
|
537 | + * @param string $value2 |
|
538 | 538 | * @param string $message |
539 | 539 | * @param string $fieldName |
540 | 540 | * @return Assert |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | /** |
1409 | 1409 | * Alias of {@see choice()} |
1410 | 1410 | * |
1411 | - * @param array $choices |
|
1411 | + * @param integer[] $choices |
|
1412 | 1412 | * @param string $message |
1413 | 1413 | * @param string $fieldName |
1414 | 1414 | * @return Assert |
@@ -1585,7 +1585,7 @@ discard block |
||
1585 | 1585 | /** |
1586 | 1586 | * Assert that key exists in the values array. |
1587 | 1587 | * |
1588 | - * @param string|integer $key |
|
1588 | + * @param string $key |
|
1589 | 1589 | * @param string $message |
1590 | 1590 | * @param string $fieldName |
1591 | 1591 | * @return Assert |
@@ -2728,7 +2728,7 @@ discard block |
||
2728 | 2728 | } |
2729 | 2729 | |
2730 | 2730 | /** |
2731 | - * @param $func |
|
2731 | + * @param string $func |
|
2732 | 2732 | * @param $args |
2733 | 2733 | * @return bool |
2734 | 2734 | * @throws AssertionFailedException |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Terah\Assert; |
4 | 4 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $level |
42 | 42 | * @param string $propertyPath |
43 | 43 | */ |
44 | - public function __construct(string $message, int $code, string $fieldName='', $value='', array $constraints=[], string $level='critical', string $propertyPath='') |
|
44 | + public function __construct(string $message, int $code, string $fieldName = '', $value = '', array $constraints = [ ], string $level = 'critical', string $propertyPath = '') |
|
45 | 45 | { |
46 | 46 | parent::__construct($message, $code); |
47 | 47 | $this->fieldName = $fieldName; |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | $this->constraints = $constraints; |
50 | 50 | $this->level = $level; |
51 | 51 | $this->propertyPath = $propertyPath; |
52 | - foreach ( $this->getTrace() as $point ) |
|
52 | + foreach ($this->getTrace() as $point) |
|
53 | 53 | { |
54 | - $class = $point['class'] ??0?: ''; |
|
55 | - if ( $class !== Assert::class ) |
|
54 | + $class = $point[ 'class' ] ??0 ?: ''; |
|
55 | + if ($class !== Assert::class) |
|
56 | 56 | { |
57 | 57 | $this->location = (object)$point; |
58 | 58 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getPropertyPathAndCallingLocation() : string |
124 | 124 | { |
125 | - return $this->getPropertyPath() . ' in ' . $this->getCallingFileAndLine(); |
|
125 | + return $this->getPropertyPath().' in '.$this->getCallingFileAndLine(); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function getCallingFileAndLine() : string |
135 | 135 | { |
136 | - foreach ( $this->getTrace() as $trace ) |
|
136 | + foreach ($this->getTrace() as $trace) |
|
137 | 137 | { |
138 | 138 | $trace = (object)$trace; |
139 | - if ( empty($trace->file) ) |
|
139 | + if (empty($trace->file)) |
|
140 | 140 | { |
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | $file = static::beforeLast('.php', static::afterLast('/', $trace->file)); |
144 | - if ( in_array($file, ['AssertionChain', 'Assertion']) ) |
|
144 | + if (in_array($file, [ 'AssertionChain', 'Assertion' ])) |
|
145 | 145 | { |
146 | 146 | continue; |
147 | 147 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | * @param bool $returnOriginal |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public static function afterLast(string $needle, string $haystack, bool $returnOriginal=false) : string |
|
171 | + public static function afterLast(string $needle, string $haystack, bool $returnOriginal = false) : string |
|
172 | 172 | { |
173 | - if ( static::strrevpos($haystack, $needle) !== -1 ) |
|
173 | + if (static::strrevpos($haystack, $needle) !== -1) |
|
174 | 174 | { |
175 | 175 | return mb_substr($haystack, static::strrevpos($haystack, $needle) + mb_strlen($needle)); |
176 | 176 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public static function beforeLast(string $needle, string $haystack) : string |
199 | 199 | { |
200 | - $position = static::strrevpos($haystack, $needle); |
|
200 | + $position = static::strrevpos($haystack, $needle); |
|
201 | 201 | |
202 | 202 | return $position === -1 ? '' : mb_substr($haystack, 0, static::strrevpos($haystack, $needle)); |
203 | 203 | } |