Type hiearchy for property types and enums#256
Conversation
ostrolucky
left a comment
There was a problem hiding this comment.
I like this overall, good job! Couple comments that need to be addressed
237fac5 to
eef01ed
Compare
Ocramius
left a comment
There was a problem hiding this comment.
Overall good improvement, but some confusion between types and values (mostly a question of naming and documentation).
If we think of the definition of "type" as a "set" of possible values, then it makes sense to have IntegerType as a set of all possible int passing Type#validate(), but for ConstantType (a type that is represented by only one possible value, as far as I can see), having ConstantType#getValue() is confusing to me, and I couldn't really find usages.
The reason is that a type type doesn't "have" a value: it is logically always a set, sometimes with only ever one item, or no possible type at all, such as BottomType (impossible).
| */ | ||
| interface Type | ||
| { | ||
| public function describe() : string; |
There was a problem hiding this comment.
A description of the intent of this method is needed. What is the "description" you will get from this? Human-readable? Machine-friendly? An identifier? The type FQN?
Technically |
That's what I'm mostly sniping at |
Dropped. 🤞 |
|
Nice work! 👍 |
This PR introduces a type hiearchy for annotation properties - types and enums.
Summary:
describe()uses phpDoc-friendly format (plus intersections and constant values);I didn't put much effort into DocParser changes as it's eventually going to disappear.
Future scope:
@varto properly support unions and unqualified names.Coverage in Type namespace is 100%. 😃