__DIR__ . '/../vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php', 'find' => [ '$class = $parameter->getClass();', ], 'replace' => [ '$class = $parameter->hasType() && $parameter->getType() && !$parameter->getType()->isBuiltin() ? new ReflectionClass($parameter->getType()->getName()) : null;', ], ], ]; // Apply replacements foreach ($replacements as $singleFile) { $data = file_get_contents($singleFile['file']); $data = str_replace($singleFile['find'], $singleFile['replace'], $data); file_put_contents($singleFile['file'], $data); }