VOOZH about

URL: https://deepwiki.com/invokable/laravel-boost-copilot-cli/6.4-code-quality-and-formatting

⇱ Code Quality and Formatting | invokable/laravel-boost-copilot-cli | DeepWiki


Loading...
Last indexed: 7 March 2026 (397730)
Menu

Code Quality and Formatting

This document covers the code quality and formatting standards enforced by the package through Laravel Pint. It explains the Pint configuration rules, the automated linting workflow, and how to run formatting checks locally.

Purpose and Scope

The laravel-boost-copilot-cli package enforces strict code quality standards through Laravel Pint, a zero-dependency PHP code style fixer built on PHP-CS-Fixer. This system ensures consistent code formatting and enforces critical quality rules such as strict type declarations and strict comparisons across the entire codebase.


Laravel Pint Configuration

The package uses Laravel Pint with a custom configuration defined in pint.json1-8

Configuration Structure


Sources: pint.json1-8

Preset: Laravel

The configuration uses the laravel preset pint.json2 which applies Laravel's coding standards based on PSR-12. This preset provides sensible defaults for:

  • Indentation (4 spaces)
  • Line length
  • Bracing style
  • Import ordering
  • Method visibility declarations

Custom Rules

The package overrides three specific rules from the Laravel preset:

RuleValuePurpose
no_unused_importsfalseAllows unused imports without triggering errors, providing flexibility during development
strict_comparisontrueEnforces strict comparison operators (===, !==) instead of loose comparisons (==, !=)
declare_strict_typestrueRequires declare(strict_types=1); at the top of every PHP file

Sources: pint.json3-7 </old_str> <new_str>

Custom Rules

The package overrides three specific rules from the Laravel preset:

RuleValuePurpose
no_unused_importsfalseAllows unused imports without triggering errors, providing flexibility during development
strict_comparisontrueEnforces strict comparison operators (===, !==) instead of loose comparisons (==, !=)
declare_strict_typestrueRequires declare(strict_types=1); at the top of every PHP file

Sources: pint.json3-7


Strict Type Declarations

All PHP files in the package must include a strict type declaration at the top. This is enforced by the declare_strict_types rule in Pint configuration.

Implementation

All PHP source files in the package begin with declare(strict_types=1);. For example, CopilotCliServiceProvider opens at src/CopilotCliServiceProvider.php1-5 with the declaration immediately after the PHP opening tag and before the namespace declaration. Pint enforces this structure automatically via the declare_strict_types rule.

Sources: src/CopilotCliServiceProvider.php1-5 pint.json6


Automated Linting Workflow

The package includes a GitHub Actions workflow that automatically runs Laravel Pint on every push to the main branch.

Workflow Configuration

Diagram: lint.yml Workflow — Trigger to Pint Execution


Sources: .github/workflows/lint.yml1-37

Workflow Details

PropertyValueSource
Namelinter.github/workflows/lint.yml1
TriggerPush to main branch.github/workflows/lint.yml3-5
PHP Version8.5.github/workflows/lint.yml20
EnvironmentTesting.github/workflows/lint.yml13
Permissionscontents: write.github/workflows/lint.yml7-8
Lint commandcomposer lint.github/workflows/lint.yml27

Sources: .github/workflows/lint.yml1-28

Diagram: lint.yml Steps


Sources: .github/workflows/lint.yml14-37

Disabled Auto-Commit

The workflow includes commented-out code at .github/workflows/lint.yml29-36 for automatically committing Pint fixes using stefanzweifel/git-auto-commit-action@v5. This is currently disabled, meaning:

  • composer lint in CI validates style but does not auto-fix and commit.
  • Developers are expected to run composer lint locally before pushing to main.

Sources: .github/workflows/lint.yml29-36


Running Linting Locally

The package provides two composer scripts for code style checking:

ScriptCommandBehavior
composer lintvendor/bin/pintApplies formatting fixes in-place
composer test:lintvendor/bin/pint --testChecks style only; exits non-zero if issues found; does not modify files

composer lint is the command used by both local development and the lint.yml CI workflow. composer test:lint is used in the test matrix (via tests.yml) to validate code style without modifying files.

Diagram: pint.jsoncomposer scripts → CI/CD integration


Sources: pint.json1-8 .github/workflows/lint.yml27


Integration with Code Quality Systems

Relationship to Other Quality Mechanisms

Diagram: Code quality enforcement — files, scripts, and workflows


Sources: pint.json1-8 composer.json53-61 .github/workflows/lint.yml1-37

Complementary Standards

Laravel Pint handles formatting and style, while the test suite validates functional correctness:

MechanismFileEnforcesValidated By
Laravel Pintpint.jsonCode formatting, declare_strict_types, strict_comparisoncomposer lint, composer test:lint
Feature Teststests/Feature/Functional correctness of CopilotCli, ServiceProvider, Guidelinescomposer test
Unit Teststests/Component behavior validationcomposer test

Sources: pint.json1-8 composer.json54-55


Summary

The package enforces code quality through:

  1. Laravel Pint Configuration (pint.json1-8): Laravel preset with strict type declarations and strict comparisons enabled
  2. Automated Workflow (.github/workflows/lint.yml1-37): Runs on every push to main branch using PHP 8.5
  3. Local Linting (composer lint): Developers can run Pint locally before pushing
  4. Strict Type Declaration (src/CopilotCliServiceProvider.php3): Required at the top of every PHP file
  5. Validation-Only Mode: Auto-commit is disabled; developers must fix issues locally

This system ensures consistent code style and enforces critical type safety standards across the entire codebase.

Sources: pint.json1-8 .github/workflows/lint.yml1-37 src/CopilotCliServiceProvider.php1-5