Skip to content

Replace PHP-CS-Fixer for Pint - #20

Open
stefanius wants to merge 5 commits into
mainfrom
replac-php-cs-fixer
Open

stefanius wants to merge 5 commits into
mainfrom
replac-php-cs-fixer

Conversation

@stefanius

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The updated tests contain invalid instantiation (new $this->domainSearcher) and the CircleCI artifacts configuration still references removed php-cs-fixer logs, which will break execution/reporting.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR migrates the project’s PHP formatting workflow from PHP-CS-Fixer to Laravel Pint and applies Pint-driven formatting/docblock adjustments across the package source and test suite.

Changes:

  • Replace PHP-CS-Fixer tooling with Laravel Pint (new pint.json, updated composer.json, removed .php-cs-fixer.php).
  • Update CircleCI “code_analysis” job to run Pint and generate formatter reports.
  • Apply formatting/import ordering and PHPDoc cleanup updates across src/ and tests/.
File summaries
File Description
tests/WeightedSearchTest.php Import ordering, PHPDoc type aliasing, and setUp() visibility alignment.
tests/TestCase.php Import ordering and PHPDoc type aliasing.
tests/SearchQueryTest.php Import ordering, PHPDoc type aliasing, and setUp() visibility alignment.
tests/PrefixSearchTest.php Import ordering, PHPDoc type aliasing, and setUp() visibility alignment.
tests/PartialSearchTest.php Import ordering, PHPDoc type aliasing, and setUp() visibility alignment.
tests/Models/User.php Import ordering updates.
tests/Models/Ticket.php Import ordering updates.
tests/ExactSearchTest.php Import ordering, PHPDoc type aliasing, and setUp() visibility alignment.
tests/CustomSearchTest.php Formatting updates plus custom-search test wiring adjustments.
src/Weights.php Import ordering and PHPDoc cleanup.
src/Searchable.php Import ordering, minor instantiation style change, and PHPDoc cleanup.
src/Requests/SearchRequest.php Add exception import and simplify PHPDoc.
src/Contracts/Search.php Import ordering and PHPDoc simplification.
src/Concerns/ExtractsQuotedPhrases.php PHPDoc cleanup.
src/Aspects/SearchPrefix.php Import ordering, constructor formatting, and PHPDoc adjustments.
src/Aspects/SearchPartial.php Import ordering and PHPDoc adjustments.
src/Aspects/SearchJson.php Import ordering and PHPDoc adjustments.
src/Aspects/SearchExact.php Import ordering and PHPDoc adjustments.
src/Aspects/SearchAspect.php Constructor formatting and PHPDoc adjustments.
pint.json New Pint configuration (Laravel preset + rule tweaks).
database/factories/UserFactory.php Import ordering updates.
database/factories/TicketFactory.php Import ordering updates.
composer.json Remove friendsofphp/php-cs-fixer, add laravel/pint to require-dev.
.php-cs-fixer.php Remove PHP-CS-Fixer configuration file.
.circleci/config.yml Replace PHP-CS-Fixer job step with Pint execution/reporting.
Review details

Suppressed comments (5)

tests/CustomSearchTest.php:81

  • $this->domainSearcher is an object; new $this->domainSearcher is invalid PHP. Pass the Search instance directly.
            ->searchUsing([SearchAspect::custom('email', new $this->domainSearcher)])

src/Aspects/SearchAspect.php:28

  • The return PHPDoc references \\App\\Models\\Search\\SearchAspect, but the method signature returns self; the annotation should match.
    /**
     * @return \App\Models\Search\SearchAspect
     */

src/Aspects/SearchAspect.php:36

  • The return PHPDoc references \\App\\Models\\Search\\SearchAspect, but the method signature returns self; the annotation should match.
    /**
     * @return \App\Models\Search\SearchAspect
     */

src/Aspects/SearchAspect.php:44

  • The return PHPDoc references \\App\\Models\\Search\\SearchAspect, but the method signature returns self; the annotation should match.
    /**
     * @return \App\Models\Search\SearchAspect
     */

src/Aspects/SearchAspect.php:52

  • The return PHPDoc references \\App\\Models\\Search\\SearchAspect, but the method signature returns self; the annotation should match.
    /**
     * @return \App\Models\Search\SearchAspect
     */
  • Files reviewed: 26/26 changed files
  • Comments generated: 8
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// When
$results = User::query()
->searchUsing([SearchAspect::custom('email', new $this->domainSearcher())])
->searchUsing([SearchAspect::custom('email', new $this->domainSearcher)])
Comment thread .circleci/config.yml
Comment on lines 35 to +39
- run:
name: PHP CS Fixer
command: |
mkdir -p ./logs/phpcsfixer
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --dry-run --format=junit > logs/phpcsfixer/junit.xml
name: Pint
command: |
mkdir -p ./logs/pint
vendor/bin/pint --test --format=junit > logs/pint/junit.xml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@stefanius ⬆️ ?

Comment on lines 18 to 20
/**
* @param string $name
* @param int $weight
* @return \App\Models\Search\SearchAspect
*/
Comment thread src/Aspects/SearchExact.php
Comment on lines +23 to 27
* @param Builder<Model> $query
* @return mixed
*
* @throws \InvalidArgumentException
*
* @return mixed
*/
Comment on lines +26 to 30
* @param Builder<Model> $query
* @return mixed
*
* @throws \InvalidArgumentException
*
* @return mixed
*/
Comment on lines +28 to 32
* @param Builder<Model> $query
* @return mixed
*
* @throws \InvalidArgumentException
*
* @return mixed
*/
Comment thread src/Contracts/Search.php
Comment on lines 13 to 16
/**
* @param \Illuminate\Database\Eloquent\Builder<TModelClass> $query
* @param \TestMonitor\Searchable\Weights $weights
* @param string $property
* @param string $term
* @param int $weight
* @param Builder<TModelClass> $query
* @return mixed
*/
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@stefanius
stefanius requested a review from thijskok September 7, 2026 11:55
* @param \TestMonitor\Searchable\Contracts\Search $searchClass
* @param int $weight
*/
public function __construct(protected string $name, protected Search $searchClass, protected int $weight = 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We usually add a newline for each argument?

Comment thread phpcs.xml
<!--<file>app</file>-->

<exclude-pattern>*/Standards/*/Tests/*.(inc|css|js)</exclude-pattern>
<ruleset name="eloquent-revisable">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PHPCS is not in the title?

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