function ScaffoldFileCollection::checkUnchanged

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkUnchanged()
  2. 8.9.x composer/Plugin/Scaffold/Operations/ScaffoldFileCollection.php \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection::checkUnchanged()
  3. 11.x 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 187

Class

ScaffoldFileCollection
Collection of scaffold files.

Namespace

Drupal\Composer\Plugin\Scaffold\Operations

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.