-
Notifications
You must be signed in to change notification settings - Fork 14
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
Enhanced contracts PHPDoc #463
base: 4.6
Are you sure you want to change the base?
Conversation
@@ -53,12 +55,12 @@ class DateMetadata extends Criterion implements TrashCriterion, FilteringCriteri | |||
]; | |||
|
|||
/** | |||
* Creates a new DateMetadata criterion on $metadata. | |||
* Creates a new DateMetadata criterion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find such property in the contracts namespace. (I may haven't look well enough in the namespace.) It might not be in this contracts namespace, and hidden by abstraction. If no link can be made to it, it probably don't worth being mentioned.
931b98e
to
6482ce2
Compare
@adriendupuis Rebase is needed here |
Don't use advanced format in summary, it won't be rendered.
Don't use advanced format in summary, it won't be rendered. Define array key type, or it will be rendered as array<string|int, …> phpDocumentor don't seem to understand self.
One docblock per constant.
- Describes a bit more `getProperties` - Details `getProperties` param type and returned type - Hides link to internal function - Uses `@internal` as a short for "@ignore This method is for internal use" - Fixes internal links
…internal" This reverts commit 44aede1.
Revert 1799d56 changes on src/lib/Limitation/ as this is out of contracts scope.
Too difficult to solve in this PR
"return type has no value type specified in iterable type iterable"
4aaeeea
to
5f681f9
Compare
|
* allow you on some search criteria to specify this custom field to rather query on that instead of the default | ||
* field generated by the system. | ||
* Custom fields is the capability for search engines to: | ||
* - Allow you to extend the search index via plugins to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* - Allow you to extend the search index via plugins to | |
* - allow you to extend the search index via plugins to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
* - Allow you to extend the search index via plugins to * - allow you to extend the search index via plugins to
Doesn't that depend on how we finish the sentence in bullet point? Meaning, if it ends with:
- Dot = capital letters for bullet points.
- Comma = small letters.
But don't quote me on that, maybe English grammar rules are different?
* Custom fields is the capability for search engines to: | ||
* - Allow you to extend the search index via plugins to | ||
* generate custom fields, like a different representation (format, ...) of an existing field or similar. | ||
* - Allow you on some search criteria to specify this custom field to rather query on that instead of the default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* - Allow you on some search criteria to specify this custom field to rather query on that instead of the default | |
* - allow you on some search criteria to specify this custom field to rather query on that instead of the default |
* @property-read int $depth @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getDepth()} instead. | ||
* @property-read string $remoteId A global unique ID of the content object | ||
* @property-read int $parentLocationId The ID of the parent location | ||
* @property-read string $pathString Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getPathString()} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't @deprecated
tag be left untouched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't
@deprecated
tag be left untouched?
This is actually quite significant issue. We need the ability to mark those as deprecated @adriendupuis
*/ | ||
public function getPathString(): string | ||
{ | ||
return $this->pathString; | ||
} | ||
|
||
/** | ||
* Same as {@see Location::getPathString()} but as array, e.g.: <code>[ '1', '2', '4', '23' ]</code>. | ||
* The list of ancestor Locations' IDs, ordered in increasing depths, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The list of ancestor Locations' IDs, ordered in increasing depths, | |
* The list of ancestor locations' IDs, ordered by increasing depth, |
* | ||
* @var string | ||
*/ | ||
protected $pathString; | ||
|
||
/** | ||
* Same as {@see Location::$pathString} but as array, e.g.: <code>[ '1', '2', '4', '23' ]</code>. | ||
* The list of ancestor Locations' IDs, ordered in increasing depths, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The list of ancestor Locations' IDs, ordered in increasing depths, | |
* The list of ancestor locations' IDs, ordered by increasing depth, |
* ``` | ||
* [ | ||
* 'stringLength' => [ | ||
* 'minStringLength' => [ | ||
* 'type' => 'int', | ||
* 'default' => 0, | ||
* ], | ||
* 'maxStringLength' => [ | ||
* 'type' => 'int' | ||
* 'default' => null, | ||
* ], | ||
* ], | ||
* ]; | ||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind it much, maybe even simpler and it renders well in PHPStorm, but don't you think we need a bit of consistency? There's 249 occurrences of <code>
in this repository. Wouldn't it be better to handle it separately in another PR? Meaning: just replace <code>
with ```?
* | ||
* Note: In future version constant values might change to 1, 0 and -1 as used in Symfony. | ||
* | ||
* @since 5.3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need to drop these as it references eZ Publish and there's version number mismatch.
* allow you on some search criteria to specify this custom field to rather query on that instead of the default | ||
* field generated by the system. | ||
* Custom fields is the capability for search engines to: | ||
* - Allow you to extend the search index via plugins to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
* - Allow you to extend the search index via plugins to * - allow you to extend the search index via plugins to
Doesn't that depend on how we finish the sentence in bullet point? Meaning, if it ends with:
- Dot = capital letters for bullet points.
- Comma = small letters.
But don't quote me on that, maybe English grammar rules are different?
* - `['languages' => [<language_code_string>,…], 'useAlwaysAvailable' => <bool>]` | ||
* - `[<language_code_string>,…]` where `useAlwaysAvailable` defaults to `true` to avoid exceptions on missing translations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @property-read \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo calls getContentInfo() | ||
* @property-read int $contentId @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getContentId()} instead. | ||
* @property-read int $id @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getId()} instead. | ||
* @property-read \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo Calls {@see Location::getContentInfo()} | ||
* @property-read int $contentId Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getContentId()} instead. | ||
* @property-read int $id Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getId()} instead. | ||
* @property-read int $priority Position of the Location among its siblings when sorted using priority | ||
* @property-read bool $hidden @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::isHidden()} instead. | ||
* @property-read bool $invisible @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::isInvisible()} instead. | ||
* @property-read bool $hidden Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::isHidden()} instead. | ||
* @property-read bool $invisible Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::isInvisible()} instead. | ||
* @property-read bool $explicitlyHidden Indicates that the Location entity has been explicitly marked as hidden. | ||
* @property-read string $remoteId a global unique id of the content object | ||
* @property-read int $parentLocationId the id of the parent location | ||
* @property-read string $pathString @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getPathString()} instead. | ||
* @property-read array $path @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getPath()} instead. | ||
* @property-read int $depth @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getDepth()} instead. | ||
* @property-read string $remoteId A global unique ID of the content object | ||
* @property-read int $parentLocationId The ID of the parent location | ||
* @property-read string $pathString Since 4.6.7, accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see Location::getPathString()} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting more detailed overview now, this is entirely incorrect, sorry.
This is deprecated since 4.6.7, using "since" alone indicates that it's available since then.
/** | ||
* Location ID. | ||
* | ||
* @var int Location ID. | ||
* @var int | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is Location object, it could be even as simple as:
/** @var int */
as this code block doesn't carry any extra information that can't be inferred (I mean Location::$id
is a Location ID).
* @var string[] | ||
* Same as {@see Location::$pathString} but as array, e.g.: `['1', '2', '4', '23']`. | ||
* | ||
* @var array <int, string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS
* @var array <int, string> | |
* @var array<int, string> |
Related PRs:
Description:
{@see
tagsarray<string|int,
rendering.<code>
rendered as a single line.@see
syntax to have a working link.self
to have a link (to the current page, debatable, it could also be$this
).ValueObject
: Replace@ignore This method is for internal use
with the dedicated@internal
, fix some@uses
tags.Preview
Preview is build on top of ibexa/documentation-developer#2584.
But the following comparisons focus on the improvements brought by the packages' PRs.
Ibexa\Contracts\Core\FieldType\FieldType
array()
syntax.[]
syntax.Ibexa\Contracts\Core\FieldType\Generic\Type
checkValueType()
makes a not-clickable reference toacceptValue()
.checkValueType()
a working link toacceptValue()
.Ibexa\Contracts\Core\FieldType\Generic\ValidationError\ConstraintViolationAdapter
@see
tags in its introduction and<meta name="description"
because the summary line can't have advanced format.@see
rendered as links to references.Ibexa\Contracts\Core\Limitation\Target\Builder\VersionBuilder
@see
tags in its introduction, and somestring|int
untyped array keys.Ibexa\Contracts\Core\Limitation\Type
ACCESS_GRANTED
which, in fact, is a description for the threeACCESS_
constants (grouped docblock doesn't exist and because of alphabetic order, the description ends after what it introduces), about the same forVALUE_SCHEMA_
constants, a not-rendered@see
, and a not typed array key.Ibexa\Contracts\Core\Repository\LocationService
@see
, and untyped array keys.count()
, a working link in its description, typed keys on several arrays.Ibexa\Contracts\Core\Repository\SearchService
@see
.CAPABILITY_CUSTOM_FIELDS
, new summaries, and more links.Ibexa\Contracts\Core\Repository\Values\Content\Location
@deprecated
not rendered because wrongly nested.@property-read
) creates duplicates: it's declared twice in the PHP code, and documented twice in the reference. This is an issue I'll come back to later.Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion
@see
, misses links to properties and constants, and has an example rendered as a single line.Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\DateMetadata
DateMetadata::TRASHED
toTrashService::findTrashItems()
, and more links in general.Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserMetadata
Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator\Specifications
Criterion::getSpecifications()
without a link.Criterion::getSpecifications()
is added with an inline tag instead of a separated tag below.Ibexa\Contracts\Core\Repository\Values\ValueObject
ValueObject::attributes()
, has not-typed array keys,Ibexa\Contracts\Core\Search\Capable
@see
in its summary.SearchService
helps to see theCAPABILITY_
constants.For QA:
Documentation: