Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\GitIgnore;
21
22/**
23 * Defines the contract for merging .gitignore entries.
24 *
25 * This service SHALL combine canonical and project-specific .gitignore
26 * definitions into a single normalized result. The resulting entry list MUST
27 * exclude blank lines and comment lines from the merged output, MUST remove
28 * duplicate entries, and MUST group directory entries before file entries.
29 * Directory and file groups SHALL be sorted independently in ascending string
30 * order to provide deterministic output.
31 */
32interface MergerInterface
33{
34    /**
35     * Merges two GitIgnore instances, removing duplicates and sorting entries.
36     *
37     * Directories are placed before files in the resulting list.
38     * The path from $project is used in the returned instance.
39     *
40     * @param GitIgnoreInterface $canonical the canonical .gitignore from dev-tools
41     * @param GitIgnoreInterface $project the project-specific .gitignore
42     *
43     * @return GitIgnoreInterface a new GitIgnore instance with merged entries
44     */
45    public function merge(GitIgnoreInterface $canonical, GitIgnoreInterface $project): GitIgnoreInterface;
46}