Skip to content

[1.x] Replace custom phpdoc_align rule with php-cs-fixer option#242

Merged
taylorotwell merged 3 commits into
laravel:mainfrom
Jubeki:update
Jan 15, 2024
Merged

[1.x] Replace custom phpdoc_align rule with php-cs-fixer option#242
taylorotwell merged 3 commits into
laravel:mainfrom
Jubeki:update

Conversation

@Jubeki

@Jubeki Jubeki commented Jan 15, 2024

Copy link
Copy Markdown
Contributor
  • Replaces custom phpdoc_align rule with php-cs-fixer option
  • This also adds an additional test case
  • Fixes tests, the output for check style is now different:
<checkstyle version="PHP CS Fixer 3.47.0 Big Changes by Fabien Potencier, Dariusz Ruminski and contributors.">
  <file name="/Users/kiekbjul/Home/opensource/laravel-pint/tests/Fixtures/with-fixable-issues/file.php">
    <error severity="warning" source="PHP-CS-Fixer.new_with_parentheses" message="Found violation(s) of type: new_with_parentheses"/>
  </file>
</checkstyle>
  • format code with the new pint version.

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@Jubeki Jubeki marked this pull request as ready for review January 15, 2024 16:23
@taylorotwell taylorotwell merged commit 07494e2 into laravel:main Jan 15, 2024
@Jubeki Jubeki deleted the update branch January 16, 2024 18:14
@eusonlito

Copy link
Copy Markdown

php-cs-fixer phpdoc_align docs: https://cs.symfony.com/doc/rules/phpdoc/phpdoc_align.html

@Jubeki

Jubeki commented Jan 17, 2024

Copy link
Copy Markdown
Contributor Author

@eusonlito What exactly is your comment about?

@eusonlito

eusonlito commented Jan 17, 2024

Copy link
Copy Markdown

@Jubeki after updating to the latest release I got an error The rules contain unknown fixers: "Laravel/laravel_phpdoc_aligment".

I had this rule as false so I leave the link to the php-cs-fixer rule as reference if anyone wants information on how to customize it.

@phh

phh commented Jan 19, 2024

Copy link
Copy Markdown

Well, since updating from 1.13.8 to 1.13.9 I've been having issues with pint no being able to fix my issues.

sail pint app/Models/ -v

.....!.............!..!.........!.......

  ! app/Models/A.php                                                                      syntax error, unexpected token ">"
  ! app/Models/B.php                                                                       syntax error, unexpected token ">"
  ! app/Models/C.php                                                                      syntax error, unexpected token ">"
  ! app/Models/D.php                                                 syntax error, unexpected token "=", expecting "=>"

An error from one of the files are:

 ! app/Models/A.php                                                                      syntax error, unexpected token ">"
     85▕             get: function () {
     86▕                 $disk = Storage::disk('images');
     87▕
     88▕                 return [
  ➜  89▕                     'logo'     => isset($this->images['logo']) ? $disk->url($this->images['logo']) : null,

Only change I did to my files was to remove the "Laravel/laravel_phpdoc_alignment": false rule from pint.json, since after this PR it no longer exists.

Other who has issues with this?

@Jubeki

Jubeki commented Jan 19, 2024

Copy link
Copy Markdown
Contributor Author

@phh probably something with another php-cs-fixer rule. I will send another PR, which bumps the php-cs-fixer version to the patch which was released.

@Jubeki

Jubeki commented Jan 19, 2024

Copy link
Copy Markdown
Contributor Author

@phh can you send a code snippet, so that I can confirm if the new patch version would work?

@phh

phh commented Jan 19, 2024

Copy link
Copy Markdown

@Jubeki Could reproduce on a fresh laravel app with:

pint.json:

{
  "preset": "laravel",
  "rules": {
    "binary_operator_spaces": {
      "default": "align_single_space_minimal"
    }
  }
}

app/Models/TestModel.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;

class TestModel extends Model
{
    public function imageUrls()
    {
        $disk = Storage::disk('test');

        return [
            'a' => $disk->url($this->images['a']),
            'aa' => $disk->url($this->images['aa']),
        ];
    }

    protected function someMethod($items = []): void
    {
        if (count($items) > 0) {}
    }
}

@Jubeki Jubeki mentioned this pull request Jan 19, 2024
renovate Bot referenced this pull request in RadioRoster/backend Feb 10, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [laravel/pint](https://laravel.com)
([source](https://togithub.com/laravel/pint)) | `1.13.7` -> `1.13.10` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/laravel%2fpint/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/laravel%2fpint/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/laravel%2fpint/1.13.7/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/laravel%2fpint/1.13.7/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>laravel/pint (laravel/pint)</summary>

###
[`v1.13.10`](https://togithub.com/laravel/pint/blob/HEAD/CHANGELOG.md#v11310---2024-01-22)

[Compare
Source](https://togithub.com/laravel/pint/compare/v1.13.9...v1.13.10)

- Bump Dependencies and fix spacing issue by
[@&#8203;Jubeki](https://togithub.com/Jubeki) in
[https://github.com/laravel/pint/pull/244](https://togithub.com/laravel/pint/pull/244)

###
[`v1.13.9`](https://togithub.com/laravel/pint/blob/HEAD/CHANGELOG.md#v1139---2024-01-16)

[Compare
Source](https://togithub.com/laravel/pint/compare/v1.13.8...v1.13.9)

- \[1.x] Replace custom phpdoc_align rule with php-cs-fixer option by
[@&#8203;Jubeki](https://togithub.com/Jubeki) in
[https://github.com/laravel/pint/pull/242](https://togithub.com/laravel/pint/pull/242)

###
[`v1.13.8`](https://togithub.com/laravel/pint/blob/HEAD/CHANGELOG.md#v1138---2024-01-09)

[Compare
Source](https://togithub.com/laravel/pint/compare/v1.13.7...v1.13.8)

- \[1.x] Bump Dependencies and run Tests on skeleton by
[@&#8203;Jubeki](https://togithub.com/Jubeki) in
[https://github.com/laravel/pint/pull/240](https://togithub.com/laravel/pint/pull/240)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/RadioRoster/backend).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMjcuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

4 participants