diff --git a/core/tests/Drupal/Tests/TestFileCreationTrait.php b/core/tests/Drupal/Tests/TestFileCreationTrait.php
index f7445584add3a41d426ffdc20e675a22a4110aaf..eaf25d07736f8a195027704feaed11217ce3f1ee 100644
--- a/core/tests/Drupal/Tests/TestFileCreationTrait.php
+++ b/core/tests/Drupal/Tests/TestFileCreationTrait.php
@@ -147,7 +147,7 @@ protected function compareFiles($file1, $file2) {
    * @return string
    *   The name of the file, including the path.
    */
-  public static function generateFile($filename, $width, $lines, $type = 'binary-text') {
+  protected static function generateFile($filename, $width, $lines, $type = 'binary-text') {
     $text = '';
     for ($i = 0; $i < $lines; $i++) {
       // Generate $width - 1 characters to leave space for the "\n" character.