Merges ordered .gitignore rules with canonical defaults before consumer overrides.
Description
Existing patterns MUST retain their order, whitespace and repeated occurrences.
Interfaces
Properties
Methods
Retains the classifier constructor parameter for compatibility with consumers.
Prepends canonical defaults once, allowing later consumer rules to override them.
Removes only blank lines and comments, never normalizing pattern whitespace.
private
ClassifierInterface
$classifier
=
new Classifier()
Retains the classifier constructor parameter for compatibility with consumers.
public
__construct([ClassifierInterface
$classifier = new Classifier()]) : mixed
Parameters
Prepends canonical defaults once, allowing later consumer rules to override them.
public
merge(GitIgnoreInterface
$canonical, GitIgnoreInterface
$project) : GitIgnoreInterface
Parameters
Description
the canonical baseline
Description
the consumer rules and destination path
Return values
Description
a new GitIgnore instance with merged entries
Removes only blank lines and comments, never normalizing pattern whitespace.
private
patterns(
array<int, string>
$entries) : array<int, string>
Parameters
$entries
:
array<int, string>
Description
the raw rules