Skip to content

Commit b9ca0b4

Browse files
committed
Helpers: uses Validator::isTypeDeclaration()
1 parent 43d6101 commit b9ca0b4

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"require": {
1818
"php": ">=8.0 <8.3",
19-
"nette/utils": "^3.2.7 || ^4.0"
19+
"nette/utils": "^3.2.9 || ^4.0"
2020
},
2121
"require-dev": {
2222
"nette/tester": "^2.4",

src/PhpGenerator/Helpers.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,7 @@ public static function validateType(?string $type, bool &$nullable): ?string
169169
{
170170
if ($type === '' || $type === null) {
171171
return null;
172-
}
173-
174-
if (!preg_match(<<<'XX'
175-
~(?n)
176-
(
177-
\?? (?<type> [\w\\]+)|
178-
(?<intersection> (?&type) (& (?&type))+ )|
179-
(?<upart> (?&type) | \( (?&intersection) \) ) (\| (?&upart) )+
180-
)$~xAD
181-
XX, $type)) {
172+
} elseif (!Nette\Utils\Validators::isTypeDeclaration($type)) {
182173
throw new Nette\InvalidArgumentException("Value '$type' is not valid type.");
183174
}
184175

0 commit comments

Comments
 (0)