function Preg::replaceCallback
@param-out int<0, max> $count
Parameters
string|string[] $pattern:
($flags is PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string|null, int<-1, max>}>): string) : callable(array<int|string, string|null>): string) $replacement:
string $subject:
int $count Set by method:
int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set:
17 calls to Preg::replaceCallback()
- AutoloadGenerator::parseAutoloadsType in vendor/
composer/ composer/ src/ Composer/ Autoload/ AutoloadGenerator.php - BufferIO::getOutput in vendor/
composer/ composer/ src/ Composer/ IO/ BufferIO.php - ClassMapGenerator::normalizePath in vendor/
composer/ class-map-generator/ src/ ClassMapGenerator.php - Normalize a path. This replaces backslashes with slashes, removes ending slash and collapses redundant separators and up-level references.
- Config::process in vendor/
composer/ composer/ src/ Composer/ Config.php - Replaces {$refs} inside a config string
- EventDispatcher::doDispatch in vendor/
composer/ composer/ src/ Composer/ EventDispatcher/ EventDispatcher.php - Triggers the listeners of an event.
File
-
vendor/
composer/ pcre/ src/ Preg.php, line 177
Class
Namespace
Composer\PcreCode
public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, ?int &$count = null, int $flags = 0) : string {
if (!is_scalar($subject)) {
if (is_array($subject)) {
throw new \InvalidArgumentException(static::ARRAY_MSG);
}
throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
}
$result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags | PREG_UNMATCHED_AS_NULL);
if ($result === null) {
throw PcreException::fromFunction('preg_replace_callback', $pattern);
}
return $result;
}