@@ -36,7 +36,7 @@ function processDirectory(string $dir, Context $context): array {
3636 );
3737 foreach ($ it as $ file ) {
3838 $ pathName = $ file ->getPathName ();
39- if (preg_match ( ' /\ .stub\ .php$/ ' , $ pathName )) {
39+ if (str_ends_with ( $ pathName , ' .stub.php ' )) {
4040 $ pathNames [] = $ pathName ;
4141 }
4242 }
@@ -3323,12 +3323,12 @@ public function getType(): string {
33233323 $ matches = [];
33243324
33253325 if ($ this ->name === "param " ) {
3326- preg_match ('/^\s*([\w\| \\\\\[\]<>, ]+)\s*(?: [{(]|\$\w+).*$/ ' , $ value , $ matches );
3326+ preg_match ('/^\s*([\w\| \\\\\[\]<>, ]+)\s*(?<type> [{(]|(\.\.\.)? \$\w+).*$/ ' , $ value , $ matches );
33273327 } elseif ($ this ->name === "return " || $ this ->name === "var " ) {
3328- preg_match ('/^\s*([\w\| \\\\\[\]<>, ]+)/ ' , $ value , $ matches );
3328+ preg_match ('/^\s*(?<type> [\w\| \\\\\[\]<>, ]+)/ ' , $ value , $ matches );
33293329 }
33303330
3331- if (!isset ($ matches [1 ])) {
3331+ if (!isset ($ matches [" type " ])) {
33323332 throw new Exception ("@ $ this ->name doesn't contain a type or has an invalid format \"$ value \"" );
33333333 }
33343334
@@ -3337,15 +3337,15 @@ public function getType(): string {
33373337
33383338 public function getVariableName (): string {
33393339 $ value = $ this ->value ;
3340- if ($ value === null || strlen ( $ value) === 0 ) {
3340+ if ($ value === null || $ value === '' ) {
33413341 throw new Exception ("@ $ this ->name doesn't have any value " );
33423342 }
33433343
33443344 $ matches = [];
33453345
33463346 if ($ this ->name === "param " ) {
33473347 // Allow for parsing extended types like callable(string):mixed in docblocks
3348- preg_match ('/^\s*(?<type>[\w\| \\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*\$(?<name>\w+).*$/ ' , $ value , $ matches );
3348+ preg_match ('/^\s*(?<type>[\w\| \\\\]+(?<parens>\((?<inparens>(?:(?&parens)|[^(){}[\]]*+))++\)|\{(?&inparens)\}|\[(?&inparens)\])*+(?::(?&type))?)\s*(\.\.\.)? \$(?<name>\w+).*$/ ' , $ value , $ matches );
33493349 } elseif ($ this ->name === "prefer-ref " ) {
33503350 preg_match ('/^\s*\$(?<name>\w+).*$/ ' , $ value , $ matches );
33513351 }
0 commit comments