public function up()
{
$affectedFiles = array();
foreach (Files::getRecursiveDirectoryGenerator($this->targetPackageData['path'], null, true) as $pathAndFilename) {
if (substr($pathAndFilename, -13) !== 'Converter.php') {
continue;
}
$fileContents = file_get_contents($pathAndFilename);
if (preg_match('/public\\s+function\\s+canConvertFrom\\s*\\(/', $fileContents) === 1) {
$affectedFiles[] = substr($pathAndFilename, strlen($this->targetPackageData['path']) + 1);
}
}
if ($affectedFiles !== array()) {
$this->showWarning('Following TypeConverters implement the canConvertFrom() method. The element type of the $targetType argument is no longer cut off, so it might be "array<Some/Element/Type>" instead of just "array" for example. Make sure that this is not an issue or add' . PHP_EOL . ' $targetType = TypeHandling::truncateElementType($targetType);' . PHP_EOL . 'to the beginning of this method body if you\'re not sure:' . PHP_EOL . PHP_EOL . '* ' . implode(PHP_EOL . '* ', $affectedFiles));
}
}