PHP_CodeSniffer icon indicating copy to clipboard operation
PHP_CodeSniffer copied to clipboard

Allow phpcbf to use the cache

Open fredden opened this issue 2 months ago • 3 comments

Description

As part of the development process, I often find myself using phpcbf followed by phpcs in order to check that the code I've written complies with the configured coding standard for the codebase in question. I have recently also started using the --cache parameter on the command-line to speed up this process. This has a significant positive impact on the time taken for phpcs, however phpcbf seemed to take the same time as usual.

This pull request enables phpcbf to use the cache, just like phpcs does. In my use-case where I run phpcbf immediately followed by phpcs (with the same flags), the phpcs run is always very fast as it can use the cache and doesn't need to re-scan every file.

Suggested changelog entry

  • Allow phpcbf to use the cache

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation improvement

PR checklist

  • [x] I have checked there is no other PR open for the same change.
  • [x] I have read the Contribution Guidelines.
  • [x] I grant the project the right to include and distribute the code under the BSD-3-Clause license (and I have the right to grant these rights).
  • [ ] I have added tests to cover my changes.
  • [x] I have verified that the code complies with the projects coding standards.
  • [Required for new sniffs] I have added XML documentation for the sniff.

fredden avatar May 06 '24 19:05 fredden