Skip to content

Simplify git attributes#682

Open
fadrian06 wants to merge 2 commits intomasterfrom
simplify-git-attributes
Open

Simplify git attributes#682
fadrian06 wants to merge 2 commits intomasterfrom
simplify-git-attributes

Conversation

@fadrian06
Copy link
Contributor

This pull request introduces several improvements to the project's configuration files, primarily to standardize and modernize the handling of code quality tools and test configuration. The main changes include adding new default configuration files for PHPStan and PHPUnit, updating .gitattributes to better manage exported files, and enhancing the Composer scripts to ensure necessary config files are available after installation.

Configuration management improvements:

  • Added phpstan.dist.neon as the new default PHPStan configuration file, specifying analysis level, included paths, and exclusions.
  • Added phpunit.xml.dist as the new default PHPUnit configuration file, defining test suites, coverage options, and strictness settings.
  • Updated Composer scripts in composer.json to automatically copy phpstan.dist.neon to phpstan.neon and phpunit.xml.dist to phpunit.xml if they do not exist, ensuring consistent local configuration for developers.

Export and distribution adjustments:

  • Updated .gitattributes to exclude new configuration files (phpstan.dist.neon, phpunit.xml.dist, etc.) and other files from package exports, while removing obsolete or renamed entries.

- phpstan.dist.neon (shared options) -> phpstan.neon (local options)
- phpunit.xml.dist (shared options) -> phpunit.xml (local options)
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Standardizes project tooling configuration and distribution behavior by introducing default PHPUnit/PHPStan config templates and adjusting Composer scripts and export rules.

Changes:

  • Add default config templates: phpunit.xml.dist and phpstan.dist.neon.
  • Update Composer scripts to auto-copy *.dist configs into local phpunit.xml/phpstan.neon when missing, and adjust the PHPStan lint command.
  • Update .gitignore and .gitattributes to reflect the new config strategy and exported package contents.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
phpunit.xml.dist Adds default PHPUnit configuration (bootstrap, suites, coverage, strictness).
phpstan.dist.neon Adds default PHPStan configuration (level, paths, exclusions, baseline include).
composer.json Updates lint command and adds post-install copying of local config files.
.gitignore Ignores local (non-dist) PHPStan/PHPUnit config files.
.gitattributes Adjusts export-ignore rules for packaging/distribution.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Collaborator

@n0nag0n n0nag0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sure why you like setting up .dist files and then copying them over as the real file and ignoring it. I understand that you CAN do it, not sure why it needs to be done or what real benefit it has besides just adding some more complexity to things. Maybe I just need to ask @copilot and he'll explain it to me haha

@fadrian06
Copy link
Contributor Author

ok, I'll tell you my real usage of .dist files, not theory unusable...

I'm working on a project with phpstan.dist.neon file, that means that all contributors must follow that phpstan restrictions, mentioned in the dist file (distributed file)...

but, because project has a dist file, I can copy it to a local phpstan.neon file and add more restrictions, more rules, to have a cleaner code than other contributors por example, that's the real usage.

@fadrian06
Copy link
Contributor Author

the most useful use case is for the phpunit.xml.dist

in phpunit configuration file, you can set environment variables for testing, instead of using .env files, so in the .dist file, you can set placeholder or common values for database connection, or configuration or something else.

but the advantage of that is that now I can create a local phpunit.xml (not dist) to customize that environment variables or customize phpunit a little different of the others contributors.

@n0nag0n
Copy link
Collaborator

n0nag0n commented Mar 16, 2026

ok, I actually can get behind that! The one change I would ask then is if you could change the name to phpstan.neon.dist instead. Looks like that's more standard around projects (similar to how you have it for phpunit.xml.dist). Then I can merge this guy.

@fadrian06
Copy link
Contributor Author

ok, I actually can get behind that! The one change I would ask then is if you could change the name to phpstan.neon.dist instead. Looks like that's more standard around projects (similar to how you have it for phpunit.xml.dist). Then I can merge this guy.

I use phpstan.dist.neon because my code editor highlight neon syntax
image

If I use phpstan.neon.dist, my editor can't infer that file as a neon file, if I force that, SublimeText will highlight phpunit.xml.dist as a neon file as well instead of a xml file
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants