RC2: speed-ups and CS changes
Merge pull request #371 from terrafrost/rc2

RC2: speed-ups and CS changes

* terrafrost/rc2:
  RC2: speed-ups and CS changes
Merge branch 'master' into php5

* master:
  RC2: speed-ups and CS changes
Change constructors from class name to __construct().

This has been produced as follows:

<?php
$replace = $files = [];
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]));
foreach ($it as $fileinfo) {
	if ($fileinfo->getExtension() === 'php') {
		$file = $fileinfo->getPathname();
		$content = file_get_contents($file);
		$files[$file] = $content;
		$tokens = token_get_all($content);
		foreach ($tokens as $key => $value) {
			if ($value[0] === T_CLASS) {
				$class = $tokens[$key + 2][1];
				$replace += array(
					"$class::$class(" => "$class::__construct(",
					"parent::$class(" => "parent::__construct(",
					"function $class(" => "function __construct(",
				);
			}
		}
	}
}
foreach ($files as $file => $content) {
	file_put_contents(
		$file,
		str_replace(
			array_keys($replace),
			array_values($replace),
			$content
		)
	);
}