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

DeclareStrictTypes to comply with PSR12.Files.FileHeader.IncorrectOrder #1685

Open
Morgy93 opened this issue May 30, 2024 · 2 comments
Open

Comments

@Morgy93
Copy link

Morgy93 commented May 30, 2024

Hello,

is it possible for SlevomatCodingStandard.TypeHints.DeclareStrictTypes to set the declare() below the file docblock to comply with PSR12.Files.FileHeader.IncorrectOrder?

So, instead of:

<?php

declare(strict_types=1);

/**
 * This file contains an example of coding styles.
 */

It needs to be:

<?php

/**
 * This file contains an example of coding styles.
 */

declare(strict_types=1);

Otherwise, it throws The file-level docblock must follow the opening PHP tag in the file header (PSR12.Files.FileHeader.IncorrectOrder).

Any idea?

@christianlerch
Copy link

We've got the same problem. Would be nice to be able to configure that.

@Morgy93
Copy link
Author

Morgy93 commented Aug 12, 2024

I tried to come up with a solution, but I struggled to distinguish between:

<?php

/**
 * This one
 */

namespace ..

use ...

class ...

and

<?php

namespace ..

use ...

/**
 * This one
 */
class ...

Any suggestions would be greatly appreciated. 😊

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