Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
87 / 87
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
CandidateProvider
100.00% covered (success)
100.00%
87 / 87
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 folders
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
1
 files
100.00% covered (success)
100.00%
63 / 63
100.00% covered (success)
100.00%
1 / 1
1
 all
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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\GitAttributes;
21
22/**
23 * Provides the canonical list of candidate paths for export-ignore rules.
24 *
25 * This class defines the baseline set of files and directories that should
26 * typically be excluded from Composer package archives. The list is organized
27 * into folders and files groups for deterministic ordering.
28 */
29 class CandidateProvider implements CandidateProviderInterface
30{
31    /**
32     * @return list<string> Folders that are candidates for export-ignore
33     */
34    public function folders(): array
35    {
36        return [
37            '/.changeset/',
38            '/.circleci/',
39            '/.devcontainer/',
40            '/.github/',
41            '/.gitlab/',
42            '/.idea/',
43            '/.php-cs-fixer.cache/',
44            '/.vscode/',
45            '/benchmarks/',
46            '/.dev-tools/',
47            '/coverage/',
48            '/docker/',
49            '/docs/',
50            '/examples/',
51            '/fixtures/',
52            '/migrations/',
53            '/scripts/',
54            '/src-dev/',
55            '/stubs/',
56            '/tests/',
57            '/tools/',
58        ];
59    }
60
61    /**
62     * @return list<string> Files that are candidates for export-ignore
63     */
64    public function files(): array
65    {
66        return [
67            '/.dockerignore',
68            '/.editorconfig',
69            '/.env',
70            '/.env.dist',
71            '/.env.example',
72            '/.gitattributes',
73            '/.gitignore',
74            '/.gitmodules',
75            '/.gitlab-ci.yml',
76            '/.php-cs-fixer.dist.php',
77            '/.php-cs-fixer.php',
78            '/.phpunit.result.cache',
79            '/.styleci.yml',
80            '/.travis.yml',
81            '/AGENTS.md',
82            '/CODE_OF_CONDUCT.md',
83            '/CONTRIBUTING.md',
84            '/Dockerfile',
85            '/GEMINI.md',
86            '/Governance.md',
87            '/Makefile',
88            '/README.md',
89            '/SECURITY.md',
90            '/SUPPORT.md',
91            '/UPGRADE.md',
92            '/UPGRADING.md',
93            '/Vagrantfile',
94            '/bitbucket-pipelines.yml',
95            '/codecov.yml',
96            '/composer-normalize.json',
97            '/composer-require-checker.json',
98            '/context7.json',
99            '/docker-compose.override.yml',
100            '/docker-compose.yaml',
101            '/docker-compose.yml',
102            '/docker-bake.hcl',
103            '/docker-stack.yml',
104            '/docker-stack.yaml',
105            '/ecs.php',
106            '/grumphp.yml',
107            '/grumphp.yml.dist',
108            '/infection.json',
109            '/infection.json.dist',
110            '/makefile',
111            '/phpbench.json',
112            '/phpbench.json.dist',
113            '/phpcs.xml',
114            '/phpcs.xml.dist',
115            '/phpmd.xml',
116            '/phpmd.xml.dist',
117            '/phpstan-baseline.neon',
118            '/phpstan-bootstrap.php',
119            '/phpstan.neon',
120            '/phpstan.neon.dist',
121            '/phpunit.xml.dist',
122            '/psalm-baseline.xml',
123            '/psalm.xml',
124            '/psalm.xml.dist',
125            '/rector.php',
126            '/renovate.json',
127            '/renovate.json5',
128        ];
129    }
130
131    /**
132     * Returns all candidates as a combined list with folders first, then files.
133     *
134     * @return list<string> All candidates in deterministic order
135     */
136    public function all(): array
137    {
138        return [...$this->folders(), ...$this->files()];
139    }
140}