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 Ssn to implement IsoCodeInterface #73

Merged
merged 1 commit into from
Dec 27, 2015

Conversation

enumag
Copy link
Contributor

@enumag enumag commented Oct 3, 2015

Alternative to #34.

@soullivaneuh
Copy link
Contributor

Well, indeed it's even more simple.

But I think it's BC break because user won't be able to instantiate Ssn class without be warned.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

@soullivaneuh Nope, there is no warning. I believe it's not a BC break. https://3v4l.org/sFWY3

EDIT: Of course it is be BC break for those who were extending the Ssn class but that's probably rare.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

We might want to consider using static:: and protected instead of self:: and private for extendability.

@soullivaneuh
Copy link
Contributor

Nope, there is no warning. I believe it's not a BC break. https://3v4l.org/sFWY3

Maybe add a BC test for this would be great.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

Done. There is something wrong with the Ssn tests though. They fail on my computer but it's not related to my patch. Thay fail on the current master branch as well. I'm NOT going to debug that.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

The author should add .travis.yml and setup running tests by travis to prevent that in the future.

@soullivaneuh
Copy link
Contributor

I don't understand. Travis is set up and is actually green here: https://travis-ci.org/ronanguilloux/IsoCodes/builds/83485286

@soullivaneuh
Copy link
Contributor

Oh you mean deprecations error.

Yeah, I submitted PR #57 for Travis improve.

I'll propose something better to manage deprecations after that. 👍

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

No I don't mean deprecation errors. I mean actual asserts in SsnTest and CreditCardTest. Maybe it's windows-specific or something.

I'm sorry I missed the travis somehow.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

fails

@soullivaneuh
Copy link
Contributor

Hmm, that's strange.

Unfortunately, we can't reproduce it on Travis, Windows is not available.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

As for SsnTest the errors disappear if I switch the Ssn.php file from CRLF to LF. That should be considered a bug though...

Dunno what's the problem with CreditCard.

@soullivaneuh
Copy link
Contributor

the errors disappear if I switch the Ssn.php file from CRLF to LF.

Could you please open a separate issue with more details about this?

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

I've opened #74 and #75 with details.

@enumag
Copy link
Contributor Author

enumag commented Oct 3, 2015

@soullivaneuh Anyway since the failing tests are not related let's get back to the topic. Do you consider this solution to be better than #34? If not, why? In my opinion we should decide which is better and close the other one.

@soullivaneuh
Copy link
Contributor

Your solution is more simple and cleaner IMO.

But, even if Ssn class could be instantiated with that, there is no deprecation warning thrown about that.

This is my objective opinion. I let @ronanguilloux get the last decision. :-)

@enumag
Copy link
Contributor Author

enumag commented Oct 4, 2015

Well adding a deprecation warning to __construct is trivial. ;-)

@soullivaneuh
Copy link
Contributor

Well adding a deprecation warning to __construct is trivial. ;-)

Indeed. Let's do it so! :-)

@enumag enumag force-pushed the patch-1 branch 3 times, most recently from 1c4cc1c to 514bb28 Compare October 6, 2015 09:06
@enumag
Copy link
Contributor Author

enumag commented Oct 6, 2015

@soullivaneuh Done.


public function __construct()
{
trigger_error('Instantiating Ssn validator is deprecated since version 1.3. Use Ssn::validate($ssn) instead.', E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Deprecated error should be silenced (@).
  • Use FQN for Ssn class name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was using the existing deprecated errors for reference - https://github.com/ronanguilloux/IsoCodes/blob/master/src/IsoCodes/Isbn10.php. There is no @ and FQN is not used. You can implement such changes in separate PR if you wish.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah. This was made before phpunit-bridge requires deprecated errors to be silenced.

I'll do a PR but please correct it on this one.

Ok for non-FQN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to add a @ to the test right? Putting it here would suppress the warning for users.

I've read the recommendation in phpunit-bridge readme. I understand now.

@soullivaneuh
Copy link
Contributor

Coverage decreased. Could you please take a look?

@enumag
Copy link
Contributor Author

enumag commented Oct 6, 2015

I think that's because of the non-silenced deprecated errors. There is no way for this commit to really decrease code coverage.

@soullivaneuh
Copy link
Contributor

@ronanguilloux https://coveralls.io/builds/3761491/source?filename=IsoCodes%2FSsn.php

The file "IsoCodes/Ssn.php" isn't available on github. Either it's been removed, or the repo root directory needs to be updated.

Could you fix that? Just have to put src as root path on coveralls configuration.

ronanguilloux added a commit that referenced this pull request Dec 27, 2015
Refactor Ssn to implement IsoCodeInterface
@ronanguilloux ronanguilloux merged commit b8b3a4c into ronanguilloux:master Dec 27, 2015
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.

3 participants