Skip to content

Commit

Permalink
chore: replace template with variable in Preg class (#7882)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored Mar 13, 2024
1 parent 47530e1 commit 32866fc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"mi-schi/phpmd-extension": "^4.3.0",
"phpmd/phpmd": "^2.15.0",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.60",
"phpstan/phpstan": "^1.10.62",
"phpstan/phpstan-phpunit": "^1.3.16",
"phpstan/phpstan-strict-rules": "^1.5.2"
},
Expand Down
10 changes: 5 additions & 5 deletions dev-tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 14 additions & 22 deletions src/Preg.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@
final class Preg
{
/**
* @todo replace template with variable when https://github.com/phpstan/phpstan/issues/10699 is done
* @param array<array-key, mixed> $matches
* @param int-mask<PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL> $flags
*
* @template TFlags as int-mask<PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>
*
* @param array<array-key, mixed> $matches
* @param TFlags $flags
*
* @param-out (TFlags is PREG_OFFSET_CAPTURE
* @param-out ($flags is PREG_OFFSET_CAPTURE
* ? array<array-key, array{string, 0|positive-int}|array{'', -1}>
* : (TFlags is PREG_UNMATCHED_AS_NULL
* : ($flags is PREG_UNMATCHED_AS_NULL
* ? array<array-key, string|null>
* : (TFlags is int-mask<PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>&768
* : ($flags is int-mask<PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>&768
* ? array<array-key, array{string, 0|positive-int}|array{null, -1}>
* : array<array-key, string>
* )
Expand All @@ -61,26 +57,22 @@ public static function match(string $pattern, string $subject, ?array &$matches
}

/**
* @todo replace template with variable when https://github.com/phpstan/phpstan/issues/10699 is done
*
* @template TFlags as int-mask<PREG_PATTERN_ORDER, PREG_SET_ORDER, PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>
*
* @param array<array-key, mixed> $matches
* @param TFlags $flags
* @param array<array-key, mixed> $matches
* @param int-mask<PREG_PATTERN_ORDER, PREG_SET_ORDER, PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL> $flags
*
* @param-out (TFlags is PREG_PATTERN_ORDER
* @param-out ($flags is PREG_PATTERN_ORDER
* ? array<list<string>>
* : (TFlags is PREG_SET_ORDER
* : ($flags is PREG_SET_ORDER
* ? list<array<string>>
* : (TFlags is int-mask<PREG_PATTERN_ORDER, PREG_OFFSET_CAPTURE>&(256|257)
* : ($flags is int-mask<PREG_PATTERN_ORDER, PREG_OFFSET_CAPTURE>&(256|257)
* ? array<list<array{string, int}>>
* : (TFlags is int-mask<PREG_SET_ORDER, PREG_OFFSET_CAPTURE>&258
* : ($flags is int-mask<PREG_SET_ORDER, PREG_OFFSET_CAPTURE>&258
* ? list<array<array{string, int}>>
* : (TFlags is int-mask<PREG_PATTERN_ORDER, PREG_UNMATCHED_AS_NULL>&(512|513)
* : ($flags is int-mask<PREG_PATTERN_ORDER, PREG_UNMATCHED_AS_NULL>&(512|513)
* ? array<list<?string>>
* : (TFlags is int-mask<PREG_SET_ORDER, PREG_UNMATCHED_AS_NULL>&514
* : ($flags is int-mask<PREG_SET_ORDER, PREG_UNMATCHED_AS_NULL>&514
* ? list<array<?string>>
* : (TFlags is int-mask<PREG_SET_ORDER, PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>&770
* : ($flags is int-mask<PREG_SET_ORDER, PREG_OFFSET_CAPTURE, PREG_UNMATCHED_AS_NULL>&770
* ? list<array<array{?string, int}>>
* : array
* )
Expand Down

0 comments on commit 32866fc

Please sign in to comment.