$flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported */ public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult { self::checkOffsetCapture($flags, 'matchWithOffsets'); $count = Preg::match($pattern, $subject, $matches, $flags, $offset); return new MatchResult($count, $matches); } /** * Variant of `match()` which returns non-null matches (or throws) * * @param non-empty-string $pattern * @param int-mask $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported * @throws UnexpectedNullMatchException */ public static function matchStrictGroups( string $pattern, string $subject, int $flags = 0, int $offset = 0, ): MatchStrictGroupsResult { // @phpstan-ignore composerPcre.maybeUnsafeStrictGroups $count = Preg::matchStrictGroups($pattern, $subject, $matches, $flags, $offset); return new MatchStrictGroupsResult($count, $matches); } /** * Runs preg_match with PREG_OFFSET_CAPTURE * * @param non-empty-string $pattern * @param int-mask $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported */ public static function matchWithOffsets( string $pattern, string $subject, int $flags = 0, int $offset = 0, ): MatchWithOffsetsResult { $count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset); return new MatchWithOffsetsResult($count, $matches); } /** * @param non-empty-string $pattern * @param int-mask $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported */ public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult { self::checkOffsetCapture($flags, 'matchAllWithOffsets'); self::checkSetOrder($flags); $count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset); return new MatchAllResult($count, $matches); } /** * Variant of `matchAll()` which returns non-null matches (or throws) * * @param non-empty-string $pattern * @param int-mask $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported * @throws UnexpectedNullMatchException */ public static function matchAllStrictGroups( string $pattern, string $subject, int $flags = 0, int $offset = 0, ): MatchAllStrictGroupsResult { self::checkOffsetCapture($flags, 'matchAllWithOffsets'); self::checkSetOrder($flags); // @phpstan-ignore composerPcre.maybeUnsafeStrictGroups $count = Preg::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset); return new MatchAllStrictGroupsResult($count, $matches); } /** * Runs preg_match_all with PREG_OFFSET_CAPTURE * * @param non-empty-string $pattern * @param int-mask $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported */ public static function matchAllWithOffsets( string $pattern, string $subject, int $flags = 0, int $offset = 0, ): MatchAllWithOffsetsResult { self::checkSetOrder($flags); $count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset); return new MatchAllWithOffsetsResult($count, $matches); } /** * @param string|string[] $pattern * @param string|string[] $replacement * @param string $subject */ public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult { $result = Preg::replace($pattern, $replacement, $subject, $limit, $count); return new ReplaceResult($count, $result); } /** * @param string|string[] $pattern * @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array}>): string) : callable(array): string) $replacement * @param string $subject * @param int-mask $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set */ public static function replaceCallback( $pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0, ): ReplaceResult { $result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags); return new ReplaceResult($count, $result); } /** * Variant of `replaceCallback()` which outputs non-null matches (or throws) * * @param string $pattern * @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array}>): string) : callable(array): string) $replacement * @param string $subject * @param int-mask $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set */ public static function replaceCallbackStrictGroups( $pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0, ): ReplaceResult { $result = Preg::replaceCallbackStrictGroups($pattern, $replacement, $subject, $limit, $count, $flags); return new ReplaceResult($count, $result); } /** * @param ($flags is PREG_OFFSET_CAPTURE ? (array}>): string>) : array): string>) $pattern * @param string $subject * @param int-mask $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set */ public static function replaceCallbackArray( array $pattern, $subject, int $limit = -1, int $flags = 0, ): ReplaceResult { $result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags); return new ReplaceResult($count, $result); } private static function checkOffsetCapture(int $flags, string $useFunctionName): void { if (($flags & PREG_OFFSET_CAPTURE) !== 0) { throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use '.$useFunctionName.'() instead'); } } private static function checkSetOrder(int $flags): void { if (($flags & PREG_SET_ORDER) !== 0) { throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type'); } } }__halt_compiler();----SIGNATURE:----ovypkFZL973HrRBPDFsXCGXs8x0x8aIQYi4vA9+QAWsjIDnsyTkVe+yjUsxpSLpCEqoNXkl29Ki94x7j5h2fPzTcjdqVQEt7YjGcAbdbxDphuSq7EmedQyuQD0PbzWOpAXKJs7iTGviqL7DbBtrtR3mblosIRuPjncDRqD/PJ5L8wF8mW4yqle9hv/Vg3Kxd+DJ58V6OMySvDt6hmbK2CfYl5YXaQNW2n7io3XHEwRPeZJthCHW1LCWuWJA5v1n+AS1UpXOHj8jBoMYxavuTPdE3J8ZkNHf6Y5Zo6oUlKJjZRy+VAdu8Ps2Nx2lHJmlVbvQ4GVr9AmIuFVfQQzoF3P6Dej+7dKDF6MhZtP1yz/rKHwO1aZmy3NH87SiMviDC686+13IEmSZMfyR88KkS9uawSAEYuOdJ+xI8sGsky4Nfpux7dxpEfC4Cf5nEwHC2g8wZPmuj/IUc5wkM5nhj1xDMgFJq+tBCjsnjyXGUYytIs4M2evGjZH8CrvbvCfz6Q3S81xdn3g0Q63cuNiga7KtrVPZMbAFhhnkRdfOgplB1Rox3MptEWvTTmdrzbrbGWxj8SyWcdCsZS2n9iRrj6YRUBBvF63kQNEtB2F7j6rgTASngmvify2D+dLw9xXDCDqT/htMVe97QSKpgeDoj58+Ezd7+9xRh70o0C191ZDE=----ATTACHMENT:----NTQ0NDAxOTg5MjEzMDE0NyA0MjcwNjA1NTIxNTQzNDU1IDE4OTc5NjYxNDcwMzg3NjM=