removed usage of preg_match with the 'e' modifier

This commit is contained in:
Fabien Potencier 2011-07-05 19:12:11 +02:00
parent f96baa7e0a
commit 9fbffcc650
3 changed files with 3 additions and 3 deletions

View File

@ -403,7 +403,7 @@ class Container implements ContainerInterface
*/
static public function camelize($id)
{
return preg_replace(array('/(?:^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\1')", "'_'.strtoupper('\\1')"), $id);
return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id);
}
/**

View File

@ -366,6 +366,6 @@ class PropertyPath implements \IteratorAggregate
protected function camelize($property)
{
return preg_replace(array('/(^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $property);
return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $property);
}
}

View File

@ -49,7 +49,7 @@ class HeaderBag
}
$beautifier = function ($name) {
return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", ucfirst($name));
return preg_replace_callback('/\-(.)/', function ($match) { return '-'.strtoupper($match[1]); }, ucfirst($name));
};
$max = max(array_map('strlen', array_keys($this->headers))) + 1;