@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $normalized = \array_values(\array_unique(\array_merge( |
| 41 | 41 | $normalized, |
| 42 | 42 | \array_map( |
| 43 | - static function ($shortcode) { |
|
| 43 | + static function($shortcode) { |
|
| 44 | 44 | return \preg_replace('/[^a-z0-9-]/', '-', \strtolower(\trim($shortcode, ':(){}[]'))); |
| 45 | 45 | }, |
| 46 | 46 | (array) $shortcodes |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | \preg_match(self::REGEX, $type, $matches, PREG_UNMATCHED_AS_NULL); |
| 37 | 37 | $this->callback = $matches['callback'] ?? null; |
| 38 | 38 | $this->customType = $matches['customType'] ?? null; |
| 39 | - $this->emptyNullable = ! ! ($matches['emptyNullable'] ?? false); |
|
| 40 | - $this->iterable = ! ! ($matches['iterable'] ?? false); |
|
| 41 | - $this->nullable = ! ! ($this->emptyNullable || ($matches['nullable'] ?? false)); |
|
| 39 | + $this->emptyNullable = !!($matches['emptyNullable'] ?? false); |
|
| 40 | + $this->iterable = !!($matches['iterable'] ?? false); |
|
| 41 | + $this->nullable = !!($this->emptyNullable || ($matches['nullable'] ?? false)); |
|
| 42 | 42 | $this->type = $matches['type'] ?? 'mixed'; |
| 43 | 43 | $this->isPhpType = \in_array($this->type, self::TYPES, true); |
| 44 | 44 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | break; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return $this->emptyNullable && ! $value ? null : $value; |
|
| 126 | + return $this->emptyNullable && !$value ? null : $value; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function castValue($value) |
| 135 | 135 | { |
| 136 | 136 | // Immediately return if nullable or empty. |
| 137 | - if (($this->nullable && $value === null) || ($this->emptyNullable && ! $value)) { |
|
| 137 | + if (($this->nullable && $value === null) || ($this->emptyNullable && !$value)) { |
|
| 138 | 138 | return null; |
| 139 | 139 | } |
| 140 | 140 | |