detectConflicts() public method

If no tokens are passed, all tokens are checked. A conflict is returned for every token that is claimed by two modules that are not connected by an edge in the override graph. In other words, if two modules A and B claim the same token, an edge must exist from A to B (A is overridden by B) or from B to A (B is overridden by A). Otherwise a conflict is returned.
public detectConflicts ( array $tokens = null ) : Puli\Manager\Conflict\ModuleConflict[]
$tokens array The tokens to check. If `null`, all claimed tokens are checked for conflicts. You are advised to pass tokens if possible to improve the performance of the conflict detection.
return Puli\Manager\Conflict\ModuleConflict[] The detected conflicts.
Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if (!$this->repositoryPaths) {
         // Check all paths if none are passed
         $this->repositoryPaths = $this->conflicts->getRepositoryPaths();
     }
     // Mark all as resolved
     foreach ($this->repositoryPaths as $repositoryPath) {
         if ($this->conflicts->has($repositoryPath)) {
             $conflict = $this->conflicts->get($repositoryPath);
             $this->conflicts->remove($repositoryPath);
             $this->removedConflicts[$repositoryPath] = $conflict->getMappings();
             $conflict->resolve();
         }
     }
     $moduleConflicts = $this->conflictDetector->detectConflicts($this->repositoryPaths);
     $this->deduplicateModuleConflicts($moduleConflicts);
     foreach ($moduleConflicts as $moduleConflict) {
         $repositoryPath = $moduleConflict->getConflictingToken();
         $conflict = new PathConflict($repositoryPath);
         foreach ($moduleConflict->getModuleNames() as $moduleName) {
             $conflict->addMapping($this->mappingsByResource->get($repositoryPath, $moduleName));
         }
         $this->conflicts->add($conflict);
         $this->addedConflicts[] = $repositoryPath;
     }
 }