Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 9, 2025

This PR migrates the code formatting tool from friendsofphp/php-cs-fixer to laravel/pint as requested in the issue.

Changes

Dependencies

  • Replaced friendsofphp/php-cs-fixer with laravel/pint in composer.json require-dev
  • Laravel Pint uses PHP CS Fixer under the hood but provides a simpler, more streamlined interface

Configuration

  • Removed .php-cs-fixer.dist.php configuration file
  • Added pint.json with Laravel preset to apply Laravel coding standards
  • Updated .gitignore to include .pint.cache

Composer Scripts

Updated the following composer scripts to use Pint:

  • check-style: Now runs pint --test (checks for style issues without fixing)
  • fix-style: Now runs pint (fixes all style issues)
  • fix: New command added as requested - runs pint to format code

Code Formatting

Ran Pint to format all existing code according to the Laravel preset. Formatting changes were applied to 87 files with 86 style issues fixed:

  • Not operator spacing (!isset()! isset())
  • PHPDoc alignment
  • Yoda style adjustments
  • Test method casing standardization
  • Array alignment improvements
  • Other Laravel-specific formatting conventions

Benefits

  • Simpler configuration: Single preset instead of complex rule definitions
  • Better performance: Optimized for speed
  • Easier to use: More intuitive command-line interface
  • Laravel standards: Uses Laravel coding conventions that are widely adopted
  • Added convenience: New composer fix command for quick formatting

Testing

All existing functionality has been verified:

  • ✅ All 89 PHPUnit tests pass
  • ✅ Code style checks pass on all 95 files
  • ✅ All three formatting commands work correctly

Usage

# Check code style without fixing
composer check-style

# Fix code style issues
composer fix-style
# or use the new shorter command
composer fix

Fixes the requirement to use Laravel Pint as the code formatting tool and add a composer fix command.

Original prompt

改用 laravel pint 作为代码格式化工具,并添加 composer fix 命令用于格式化


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 9, 2025 09:09
Co-authored-by: overtrue <1472352+overtrue@users.noreply.github.com>
Co-authored-by: overtrue <1472352+overtrue@users.noreply.github.com>
pint.json Outdated
@@ -0,0 +1,3 @@
{
"preset": "symfony"
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot laravel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to Laravel preset in commit 8adf754. All 95 files reformatted with Laravel coding standards.

Copilot AI changed the title [WIP] Add Laravel Pint as code formatter Replace PHP CS Fixer with Laravel Pint for code formatting Oct 9, 2025
Copilot AI requested a review from overtrue October 9, 2025 09:15
Co-authored-by: overtrue <1472352+overtrue@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 9, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/JetBrains/phpstorm-attributes/zipball/64de815a4509c29e00d5e3474087fd24c171afc2
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/giggsey/Locale/zipball/1cd8b3ad2d43e04f4c2c6a240495af44780f809b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/6d0853d6cf4c7ea85dd6715c2742e2ab16210f32
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/hamcrest/hamcrest-php/zipball/f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/laravel/pint/zipball/5016e263f95d97670d71b9a987bd8996ade6d8d9
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/bRi1vz /usr/bin/composer install --no-interaction (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@overtrue overtrue marked this pull request as ready for review October 9, 2025 09:35
@overtrue overtrue merged commit 044f0b2 into master Oct 9, 2025
3 checks passed
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.

2 participants