Skip to content
github-actions edited this page Apr 9, 2026 · 1 revision

Renders and persists normalized .gitignore content.

This writer SHALL transform a GitIgnoreInterface representation into the textual format expected by a .gitignore file and MUST persist that content to the target path exposed by the provided object. Implementations MUST write a trailing line feed to ensure consistent file formatting.


Methods

__construct

Creates a writer with the filesystem dependency used for persistence.

public __construct(\Symfony\Component\Filesystem\Filesystem $filesystem): mixed

The provided filesystem implementation MUST support writing file contents to the target path returned by a GitIgnoreInterface instance.

Parameters:

Parameter Type Description
$filesystem \Symfony\Component\Filesystem\Filesystem The filesystem service responsible for
writing the rendered .gitignore content.

write

Writes the normalized .gitignore entries to the target file path.

public write(\FastForward\DevTools\GitIgnore\GitIgnoreInterface $gitignore): void

The implementation SHALL join all entries using a Unix line feed and MUST append a final trailing line feed to the generated content. The resulting content MUST be written to the path returned by $gitignore->path().

Parameters:

Parameter Type Description
$gitignore \FastForward\DevTools\GitIgnore\GitIgnoreInterface The .gitignore representation whose
path and entries SHALL be written.

Clone this wiki locally