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

Weird change on "format" that causes syntax error in PHP #130

Open
Spriz opened this issue Aug 30, 2024 · 4 comments
Open

Weird change on "format" that causes syntax error in PHP #130

Spriz opened this issue Aug 30, 2024 · 4 comments

Comments

@Spriz
Copy link

Spriz commented Aug 30, 2024

When formatting code with this extension it changes this line here: https://github.com/spawnia/sailor/blob/master/src/Codegen/ObjectLikeBuilder.php#L91

to:

        $this->converters->addBody                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       /** @lang PHP */ '];');

(it adds a bunch of whitespaces)

Running phpcbf from terminal doesn't do this

the phpcs error it's showing is from this rule

    <rule ref="Generic.WhiteSpace.ScopeIndent">
        <properties>
            <property name="indent" value="4" />
            <property name="exact" value="true" />
        </properties>
    </rule>
@jonathanbossenger
Copy link
Collaborator

Hi @Spriz, I'd like to try and replicate your environment to test this.

Could I confirm with you, is this a package you are developing for, or including as a dependency?

What coding style standard are you applying to phpcs/phpcbf

@Spriz
Copy link
Author

Spriz commented Sep 16, 2024

@jonathanbossenger It's just a dependency I had opened to make a 1-line PR, but I'm actually worried that it might have been my VSCode setup using an extension that should auto format with phpcbf. It caused other issues for me the past few days, and I ended up uninstalling it.

@jonathanbossenger
Copy link
Collaborator

OK, thanks anyway for the feedback.

@Spriz
Copy link
Author

Spriz commented Sep 16, 2024

Sorry it's not very specific. These are the phpcs settings I use FWIW: https://gist.github.com/Spriz/f5517701dafbe9c1c077458012559a0e

Feel free to close if you don't see any easy reproducible thing here ✌️

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

No branches or pull requests

2 participants