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