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: Add RandomDecimal generator class #378

Merged

Conversation

tienvx
Copy link
Contributor

@tienvx tienvx commented Dec 11, 2023

Comment on lines +10 to +26
class RandomDecimal implements GeneratorInterface
{
public function __construct(private int $digits = 10)
{
}

/**
* @return array<string, string|int>
*/
public function jsonSerialize(): array
{
return [
'digits' => $this->digits,
'pact:generator:type' => 'RandomDecimal',
];
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm interested by this. It feels like an abstract class, as it does not contain the generation of a random decimal. While "clean", I feel like that could lead to user surprise.

Didn't the UUID manage reading or generating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 feel like that could lead to user surprise.

I also agree that the naming of these classes is not good, as we call them generators, but they doesn't generate any value.

Any suggestions would be great.

@tienvx tienvx merged commit 52b62a3 into pact-foundation:ffi Dec 13, 2023
26 checks passed
@tienvx tienvx deleted the add-random-decimal-generator-class branch December 13, 2023 03:57
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.

None yet

2 participants