-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DeclareStrictTypesFixer split #2062
Comments
cc @Seldaek @SpacePossum discussion/help needed |
Hmmm.... Maybe we could take a diff route:
The new fixer can be configured to order the first parts of a PHP file;
Together with:
This will result in no more conflicts and should give everyone a way to configure what they want. (for example #1993 (comment) would be fixed as well) |
I like the idea. But it looks like a lot of work. |
Can we at least for now place the I'm facing a conflict between StyleCI and php-cs-fixer, because php-cs-fixer wants to keep it on the opening tag line, but StyleCI insists on placing it on it's own line. @GrahamCampbell is StyleCI using a custom fixer for this? because it should not give a different result. |
ping @GrahamCampbell is there a conflict between the current fixers or does StyleCI have a custom fixer which is in conflict? |
Is there any progress so far? I'd really like to make my files look like: |
@Arkemlar do you mean like DeclareAfterOpeningTagFixer? |
@Arkemlar , no, as ppl were not finding this important enough. Feel free to raise the PR proposal. @kubawerlos , if you have anything ready, I encourage to open a PR |
@keradus it only does half of point 2, so not really ready :) |
When making any changes to the way See note at https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict
|
@heiglandreas Thanks for the suggestion! I opened #6688 as it can be implemented separately. |
If someone needs just only feature of having Upd: just noticed @kubawerlos 's answer about that right after my previous message up there.😄 Awesome job with that fastidious rules for such a clean-code-paranoids like me! |
@heiglandreas can you help me a bit? I've seen that note you have copied from https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict:
and got surprised because I thought it is not how strict types are working. So I've tried to do it myself at https://github.com/werlos/php_strict_types_test and cannot make it work the way it is - at least with my understanding - described in the note. What am I doing wrong? |
Thanks for bringing that up. And I have no good explanation for that issue that you are scetching out. Perhaps that is something for the bugtracker of the php-src. The reason why I brought up that citation though was because the |
This comment was marked as outdated.
This comment was marked as outdated.
Just for the record: in #7053 we added ability to place namespace declaration in the same line as |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Since this issue has not had any activity within the last 90 days, I have marked it as stale. The purpose of this action is to enforce backlog review once in a while. This is mostly for maintainers and helps with keeping repository in good condition, because stale issues and PRs can accumulate over time and make it harder for others to find relevant information. It is also possible that some changes has been made to the repo already, and issue or PR became outdated, but wasn't closed for some reason. This action helps with periodic review and closing of such stale items in automated way. You may let maintainers handle this or verify current relevancy by yourself, to help with re-triage. Any activity will remove stale label so it won't be automatically closed at this point. I will close it if no further activity occurs within the next 30 days. |
The fact this was automatically closed doesn't mean that the idea got rejected - it simply didn't get any priority for way too long to keep it open. If you're still interested in this, please let as know, we can consider re-opening it. |
So far, we have a (risky) fixer that adds/relocate
declare(strict_types=1)
.I think we should split it.
declare
statement if missing (risky)We will be more generic and allow to have better user experience, like allowing to move declaration to same place for all files but not enforcing adding it to every single file. Or allow to place the declaration to place defined by
Extended Coding Style Guide
proposal.Also, a ref: https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md#3-declare-statements-namespace-and-use-declarations
The text was updated successfully, but these errors were encountered: