Project

General

Profile

Task #61788

Updated by Xavier Perseguers about 10 years ago

Since PHP 5.5 is a requirement, calls to GeneralUtility::makeInstance should use the ::class construct instead of a string. 

 h2. rewrite.php 

 
 <pre> 
 <?php 
 $fileName = $argv[1]; 
 $contents = file_get_contents($fileName); 

 $contents = preg_replace_callback( 
	 "/::makeInstance\\('([^']+)'/", 
	 function ($matches) { 
		 return '::makeInstance(\\' . str_replace('\\\\', '\\', $matches[1]) . '::class'; 
	 }, 
	 $contents 
 ); 

 file_put_contents($fileName, $contents); 
 </pre> 

 h2. Command 

 <pre> 
 $ for f in $(grep -sr "::makeInstance(" * | cut -d: -f1 | egrep ".php$" | grep -v "rewrite.php" | sort -u); do php rewrite.php $f; done 
 </pre>

Back