Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

Jubeki
Copy link
Contributor

@Jubeki Jubeki commented Jan 15, 2024

  • 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.

Copy link

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
8 checks passed
@Jubeki Jubeki deleted the update branch January 16, 2024 18:14
@eusonlito
Copy link

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

@Jubeki
Copy link
Contributor Author

Jubeki commented Jan 17, 2024

@eusonlito What exactly is your comment about?

@eusonlito
Copy link

eusonlito commented Jan 17, 2024

@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
Copy link

phh commented Jan 19, 2024

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
Copy link
Contributor Author

Jubeki commented Jan 19, 2024

@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
Copy link
Contributor Author

Jubeki commented Jan 19, 2024

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

@phh
Copy link

phh commented Jan 19, 2024

@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 added a commit to RadioRoster/backend that referenced this pull request 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
[laravel/pint#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
[laravel/pint#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
[laravel/pint#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.

None yet

4 participants