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

Enhanced contracts PHPDoc #463

Merged
merged 97 commits into from
Feb 13, 2025
Merged

Enhanced contracts PHPDoc #463

merged 97 commits into from
Feb 13, 2025

Conversation

adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Dec 12, 2024

🎫 Issue IBX-XXXXX

Related PRs:

Description:

  • Add missing summaries (discovered during Enhance PHP API REF metadata documentation-developer#2575). A summary is the first line of a docblock. It can't have advanced formatting as it won't be rendered. Fix several not-rendered inline {@see tags
  • Type array keys to avoid generic array<string|int, rendering.
  • Type array values
    • It fixes several "no value type specified in iterable type array" so PHPStan file is updated.
  • Use triple-backticks to have code blocks instead of <code> rendered as a single line.
  • Fix some @see syntax to have a working link.
  • Use class name instead of self to have a link (to the current page, debatable, it could also be $this).
  • Reword some descriptions.
  • 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
    • Before has code examples on one line, and with old school array() syntax.
    • After has code examples in blocks with preserved new lines, and with a more modern [] syntax.
  • Ibexa\Contracts\Core\FieldType\Generic\Type
    • Before has code examples on one line, checkValueType() makes a not-clickable reference to acceptValue().
    • After has code example blocks with preserved new lines, and checkValueType() a working link to acceptValue().
  • Ibexa\Contracts\Core\FieldType\Generic\ValidationError\ConstraintViolationAdapter
    • Before has not rendered @see tags in its introduction and <meta name="description" because the summary line can't have advanced format.
    • After has a simple summary then a short description with @see rendered as links to references.
  • Ibexa\Contracts\Core\Limitation\Target\Builder\VersionBuilder
    • Before has not rendered @see tags in its introduction, and some string|int untyped array keys.
    • After has more links, and typed array keys.
  • Ibexa\Contracts\Core\Limitation\Type
    • Before has a description for ACCESS_GRANTED which, in fact, is a description for the three ACCESS_ constants (grouped docblock doesn't exist and because of alphabetic order, the description ends after what it introduces), about the same for VALUE_SCHEMA_ constants, a not-rendered @see, and a not typed array key.
    • After has a description for each constants, links, and typed array keys.
  • Ibexa\Contracts\Core\Repository\LocationService
    • Before has a not-rendered @see, and untyped array keys.
    • After has a new summary for count(), a working link in its description, typed keys on several arrays.
  • Ibexa\Contracts\Core\Repository\SearchService
    • Before has several not-rendered @see.
    • After has a more readable description CAPABILITY_CUSTOM_FIELDS, new summaries, and more links.
  • Ibexa\Contracts\Core\Repository\Values\Content\Location
    • Before has some @deprecated not rendered because wrongly nested.
      • Nota bene: This happens in other classes. It's on my todo list for another PR.
    • After has the read-only properties' summaries rewritten. Nota bene: The way a property is declared being both protected and magically publicly read-only (@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
    • Before, has a not-rendered @see, misses links to properties and constants, and has an example rendered as a single line.
    • After has links and a proper code block.
  • Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\DateMetadata
    • Before has an example rendered as a single line.
    • After has well rendered example, more readable descriptions, a link from DateMetadata::TRASHED to TrashService::findTrashItems(), and more links in general.
  • Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserMetadata
    • Before has two one-line examples, a typo in a quoted constant, a lack of links.
    • After has code blocks, enhanced descriptions, more links.
  • Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Operator\Specifications
    • Before's description quotes Criterion::getSpecifications() without a link.
    • After: description is reworded, a link to Criterion::getSpecifications() is added with an inline tag instead of a separated tag below.
  • Ibexa\Contracts\Core\Repository\Values\ValueObject
  • Ibexa\Contracts\Core\Search\Capable
    • Before has a not rendered @see in its summary.
    • After has a new summary, the link is in its description, and a link to SearchService helps to see the CAPABILITY_ constants.

For QA:

Documentation:

@adamwojs
Copy link
Member

@adriendupuis Rebase is needed here

@adriendupuis adriendupuis marked this pull request as ready for review February 6, 2025 08:20
@adriendupuis adriendupuis requested a review from a team February 6, 2025 08:29
@alongosz alongosz changed the title Enhance PHPDoc Enhanced contracts PHPDoc Feb 11, 2025
@alongosz alongosz merged commit 242b25a into 4.6 Feb 13, 2025
22 checks passed
@alongosz alongosz deleted the enh-phpdoc branch February 13, 2025 14:55
adriendupuis added a commit that referenced this pull request Feb 13, 2025
For more details see #463

Key changes:

* Enhance `DateMetadata::TRASHED` phpdoc

* Enhance `Criterion::getSpecifications()` phpdoc

* Enhance `Specifications` phpdoc

* Capable.php: Fix phpdoc summary

* VersionBuilder.php: Fix phpdoc summary, arrays and self usages

* ConstraintViolationAdapter's PHPDoc: Add a summary, reword description

* Enhance `Criterion::getSpecifications()` phpdoc

* Enhance `DateMetadata::TRASHED` phpdoc

* Enhance `DateMetadata` phpdoc

* Enhance `UserMetadata` phpdoc

* Enhance `DateMetadata` phpdoc

* Enhance `Capable` phpdoc

* Enhance `Criterion` phpdoc

* Enhance `UserMetadata` phpdoc (fix typo)

* Enhance `UserMetadata` phpdoc

* Enhance `FieldType\Generic\Type` phpdoc

* Enhance `Limitation\Type` phpdoc

* LocationService: Fix count() phpdoc

* Enhance `LocationService` phpdoc

* Enhance `Location` phpdoc

* Enhance `Location` phpdoc: @deprecated can't be nested nor used inline.

* Enhance `Location` phpdoc: Add an internal link

* Enhance `ValueObject` phpdoc

* Enhance `FieldType\Generic\Type` phpdoc: Fix internal links

* Enhance `FieldType\FieldType` phpdoc: Fix code blocks

* `Limitation\Type`: type array keys

* ValueObject: Format desc
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.

9 participants