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

Refactor Format class #3563

Merged
merged 6 commits into from
Sep 1, 2020
Merged

Refactor Format class #3563

merged 6 commits into from
Sep 1, 2020

Conversation

paulbalandan
Copy link
Member

Description
Closes #3149 .

I tried to pull that PR and continuing from that but when I rebased to latest develop I got merge conflicts. I am not yet adept in solving merge conflicts, even IDE-aided, so I opted for the long road. This PR also adds tests for the new class addition and new inserted function to Services.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@mostafakhudair
Copy link
Contributor

Good job, my PR just missed tests, I asked for help with it but you know. ..

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! You should definitely learn how to resolve merge conflicts, a worthwhile skill. Read on using --theirs and --ours to keep whole files, then it's mostly just going through files manually and resolving the ======= lines. @samsonasik made a nice blog entry on it recently.

Couple notes on this. I'd like to get @lonnieezell 's opinion on the namespace formatting so we can commit to those globally.

@@ -1,54 +1,59 @@
<?php namespace Config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're currently all over the place on these. Let's see if @lonnieezell wants to make a call on the styling of namespaces before we change them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. Currently it's a mix, and we need a definitive style guide for this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference has always been on line 1, but it seems my IDE and lots of other programmers prefer it with a blank space after the opening php tag. I'm fine with either of those options. Not of fan of having the CI docblock above it, though. I think namespace should be the first item in the file.

So do either of you have preferences on first line vs third line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been doing it on first line but I think I picked that up from you ;) I don't use an IDE so I'm not sure how much work it is to fight against one. Are there any standards? Does our CS have options that might indicate a "default"?

Copy link
Member Author

@paulbalandan paulbalandan Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am following PSR-12.

When the opening <?php tag is on the first line of the file, it MUST be on its own line with no other statements unless it is a file containing markup outside of PHP opening and closing tags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with following the PSR on this. I had forgotten 12 got released, actually, so thanks for the reminder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's great! Yes we should definitely move towards that then. The consensus is third line for namespace then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Third line for namespace if no file-level doc block. Namespace after doc block if present. This is following PSR12.

I'll take note on this on my upcoming PR on php-cs-fixer fixes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bummer - namespace after file docblock is in PSR. Oh well. Can't have it all :)

@MGatner
Copy link
Member

MGatner commented Aug 31, 2020

@paulbalandan is this ready?

@paulbalandan
Copy link
Member Author

@paulbalandan is this ready?

I dunno. Is there more to add here? It's ready regardless. Sorry, I'm weak at colloquial English so I don't quite get what Lonnie last meant. 😂

@MGatner
Copy link
Member

MGatner commented Sep 1, 2020

I think it is good! That conversation resolved.


"Bummer" = that is unfortunate

"Can't have it all" = you cannot get everything you want

@MGatner MGatner merged commit 03beb30 into codeigniter4:develop Sep 1, 2020
@MGatner
Copy link
Member

MGatner commented Sep 1, 2020

Thanks to @paulbalandan and @mostafakhudair for this one!

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.

6 participants