You are here

public function ScaffoldFileCollection::checkUnchanged in Drupal 8

Same name and namespace in other branches
  1. 9 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkUnchanged()

Returns the list of files that have not changed since they were scaffolded.

Note that there are two reasons a file may have changed:

  • The user modified it after it was scaffolded.
  • The package the file came to was updated, and the file is different in the new version.

With the current scaffold code, we cannot tell the difference between the two.

Return value

string[] List of relative paths to unchanged files on disk.

See also

https://www.drupal.org/project/drupal/issues/3092563

File

composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php, line 186

Class

ScaffoldFileCollection
Collection of scaffold files.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

public function checkUnchanged() {
  $results = [];
  foreach ($this as $project_name => $scaffold_files) {
    foreach ($scaffold_files as $scaffold_file) {
      if (!$scaffold_file
        ->hasChanged()) {
        $results[] = $scaffold_file
          ->destination()
          ->relativePath();
      }
    }
  }
  return $results;
}