Ordinal numbers exercise#351
Conversation
neenjaw
left a comment
There was a problem hiding this comment.
Hey @codedge!!
Thanks for contributing to the PHP track! 💙 This exercise is a great addition to the track. I left some review comments to be addressed and then we'll get it merged in.
The website is in code-freeze right now, so it will not appear until v3 of Exercism is released (April-ish timeline at present). If you have any questions about my feedback, please ask here or in our slack.
Again, thanks for contributing! @djjohnsongeek and I are looking for active contributors to build out PHP for v3 too if your interested in doing more.
|
|
||
| function ordinalNumber(int $number): string | ||
| { | ||
| // |
There was a problem hiding this comment.
This may break with other exercises, but what do you think about this throwing an exception? eg:
throw new \BadFunctionCallException("Implement the ordinalNumber function");There was a problem hiding this comment.
I like the idea but I would also love to suggest using proper type hinting. With giving an example like function toOrdinal(int $number): string the user can visually see the type hint. Additionally I suggest using strict_types.
<?php
declare(strict_types=1);
function ordinalNumber(int $number): string {
// Your code goes here
}Any idea how to point to proper type hints in a different way?
There was a problem hiding this comment.
One more point:
If I do not suggest the name of the function, against which method do I test in the test class?
Does exercism enfore a particular name per exercise, like Write a function `toOrdinal` ... ?
There was a problem hiding this comment.
Suggesting the function name is good! Sorry if that was unclear. The file would look like:
<?php
function toOrdinal(int $number): string {
throw new \BadFunctionCallException("Implement the toOrdinal function");
}There was a problem hiding this comment.
As far as strict types, I'm not opposed to this idea, but I think we should establish a convention that add it to the whole track for consistency.
Would you be willing to open an issue and tag @petemcfarlane, @djjohnsongeek, @arueckauer, and myself to it?
There was a problem hiding this comment.
No problem. I opened a new issue - #352
The BadFunctionCallException is added.
|
@neenjaw I'd love to contribute more. I got some more exercises in the pipe 😉 Of course I can also help with improving the existing exercises. I am currently doing the php exercises on the platform itself to get a complete overview. |
|
3 things left then let's get this merged!! |
Provide excercise for ordinal numbers.
https://en.wikipedia.org/wiki/Ordinal_numeral