protected function updateSources(array $originalSources, array $filteredSources, array $updatedSources)
    {
        $sources = [];
        $filteredPath = [];

        foreach ($filteredSources as $filteredSource) {
            $filteredPath[] = $filteredSource->getPath();
        }
        // keep only the not filtered files
        foreach ($originalSources as $originalSource) {

            // if an original source is not used by the current filter, we keep it in the source list
            if (!in_array($originalSource->getPath(), $filteredPath)) {
                $sources[] = $originalSource;
            }
        }
        // check updated files
        foreach ($updatedSources as $index => $source) {
            if (is_string($source)) {
                $updatedSources[$index] = new SplFileInfo($source);
            } else if (!($source instanceof SplFileInfo)) {
                throw new Exception('Invalid source file type '.gettype($source));
            }
        }
        // merge with the new sources
        $sources = array_merge($sources, $updatedSources);

        return $sources;
    }