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
private functions in rules may be better as protected #655
Comments
I believe that everything is private until there is a reason to make it public or protected. Since the However, as I see, |
I'm closing issues that are too old, and I'm not really looking at them all. If this is still relevant, please comment here and I will reopen this issue. Thanks for reporting! 🐼 |
testing needs more access Just upgraded to v2 and now try to figure out how to deal with the accessibility changes ... :-) I need some inspection possibilities to auto-generate test fixtures. For example, I generate a more complex object graph: obj1:type1
- [obj3:type2, obj3:type2]
- obj4:type3 I make sure that all of these objects are valid using code like this: $rules = $obj3->validator->getRules();
foreach ($rules as $rule) {
if ($rule instanceof Length) {
if ($rule->minValue && $rule->minValue > 1) {
$min = $rule->minValue;
}
}
}
$obj3->title = $this->fakeWord($min); Any idea how to accomplish such an inspection now ... without using reflection? |
Is there a reason, or have you considered using protected functions in rules instead of private ones. The reason I ask is that I would to create a child classed based on KeySet called NonStrictKeySet that allowed to specify a set of keys that should exist, but also allow anything else to exist too.
The problem is that when overloading the
hasValidStructure
function, because it is private the child classes overloaded function is not seen by the parent class. Having the function as protected would have allowed this and meant that I would not have needed to duplicate the entire code of KeySet aside 1 line.The text was updated successfully, but these errors were encountered: