@@ -364,9 +364,10 @@ A Type has the following [ABNF][RFC5234] definition:
364
364
365
365
When a "Type" is used, the user will expect a value, or set of values, as detailed below.
366
366
367
- When the "Type" consists of multiple types, then these MUST be separated with either
368
- the vertical bar sign (|) for union type or the ampersand (&) for intersection type.
369
- Any interpreter supporting this specification MUST recognize this and split the "Type" before evaluating.
367
+ When the "Type" consists of multiple types, then these MUST be separated with
368
+ either the vertical bar (|) for union type or the ampersand (&) for intersection
369
+ type. Any interpreter supporting this specification MUST recognize this and
370
+ split the "Type" before evaluating.
370
371
371
372
Union type example:
372
373
> ` @return int|null `
@@ -376,50 +377,45 @@ Intersection type example:
376
377
377
378
#### Arrays
378
379
379
- The value represented by "Type" can be an array. The type MUST be defined following the format of one of the
380
- following options:
380
+ The value represented by "Type" can be an array. The type MUST be defined
381
+ following one of the following options:
381
382
382
- 1 . unspecified: no definition of the contents of the represented array is given.
383
+ 1 . unspecified: no definition of the contents of the array is given.
383
384
Example: ` @return array `
384
385
385
- 2 . specified containing a single type: the Type definition informs the reader of the type of each array value. Only one
386
- type is then expected for each value in a given array.
387
-
386
+ 2 . specified as a specific type: each member of the array is the same one type.
388
387
Example: ` @return int[] `
389
388
390
- Please note that _ mixed _ is also a single type and with this keyword it is possible to indicate that each array
391
- value contains any possible type.
389
+ Note that ` mixed ` is also a single type and thus can explicitly indicate that
390
+ each member is any possible type.
392
391
393
- 3 . specified as containing multiple types: the Type definition informs the reader of the type of each array value.
394
- Each value can be of any of the given types.
392
+ 3 . specified as containing multiple explicit types: each member can be of any
393
+ of the given types.
395
394
Example: ` @return (int|string)[] `
396
395
397
396
### Valid Class Name
398
397
399
- A valid class name is seen based on the context where this type is mentioned. Thus
400
- this may be either a Fully Qualified Class Name (FQCN) or a local name if present in a
398
+ A valid class name is based on the context where this type is mentioned. This
399
+ may be a Fully Qualified Class Name (FQCN) or a local name if present in a
401
400
namespace.
402
401
403
402
The element to which this type applies is either an instance of this class
404
- or an instance of a class that is a ( sub-) child to the given class.
403
+ or an instance of a class that is a sub/ child to the given class.
405
404
406
- > Due to the above nature, it is RECOMMENDED for applications that
407
- > collect and shape this information to show a list of child classes
408
- > with each representation of the class. This would make it obvious
409
- > for the user which classes are acceptable as type.
405
+ > It is RECOMMENDED for applications that collect and shape this information to
406
+ > show a list of child classes with each representation of the class. This makes
407
+ > it more obvious for the user which classes are acceptable as this type.
410
408
411
409
### Keyword
412
410
413
- A keyword defines the purpose of this type. Not every element is determined by a class but still worthy of
414
- classification to assist the developer in understanding the code covered by the DocBlock.
415
-
416
- ** Note:**
417
- > Most of these keywords are allowed as class names in PHP and can be hard to distinguish from real classes. As
418
- > such, the keywords MUST be lowercase, as most class names start with an uppercase first character, and you SHOULD NOT
419
- > use classes with these names in your code.
411
+ A keyword defines the purpose of this type. Not every element is determined by a
412
+ class, but it is still worthy of classification to assist the developer in
413
+ understanding the code covered by the DocBlock.
420
414
421
- > There are more reasons to not name classes with the names of these keywords, but that falls beyond the scope of this
422
- > specification.
415
+ > Some of these keywords are allowed as class names in PHP and can be difficult
416
+ > to distinguish from real classes. As such, the keywords MUST be lowercase, as
417
+ > most class names start with an uppercase first character... it is RECOMMENDED
418
+ > that you not use classes with these names in your code.
423
419
424
420
The following keywords are recognized by this PSR:
425
421
0 commit comments