Skip to content

Commit

Permalink
Enhance ValueObject phpdoc
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
adriendupuis committed Dec 16, 2024
1 parent ccbff09 commit ee31d5a
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/contracts/Repository/Values/ValueObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class ValueObject
* Readonly properties values must be set using $properties as they are not writable anymore
* after object has been created.
*
* @param array $properties
* @param array<string, mixed> $properties
*/
public function __construct(array $properties = [])
{
Expand All @@ -35,17 +35,18 @@ public function __construct(array $properties = [])
}

/**
* Function where list of properties are returned.
* Returns list of available properties' names.
*
* Used by {@see attributes()}, override to add dynamic properties
* {@internal Used by {@see ValueObject::attributes()}}
* Override to add dynamic properties.
*
* @uses ::__isset()
* @uses ValueObject::__isset()
*
* @todo Make object traversable and reuse this function there (hence why this is not exposed)
*
* @param array $dynamicProperties Additional dynamic properties exposed on the object
* @param array<int, string> $dynamicProperties Additional dynamic properties exposed on the object
*
* @return array
* @return array<int, string>
*/
protected function getProperties($dynamicProperties = [])
{
Expand All @@ -62,7 +63,7 @@ protected function getProperties($dynamicProperties = [])
/**
* Magic set function handling writes to non public properties.
*
* @ignore This method is for internal use
* @internal
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\PropertyNotFoundException When property does not exist
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\PropertyReadOnlyException When property is readonly (protected)
Expand All @@ -83,7 +84,7 @@ public function __set($property, $value)
*
* Returns value for all readonly (protected) properties.
*
* @ignore This method is for internal use
* @internal
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\PropertyNotFoundException exception on all reads to undefined properties so typos are not silently accepted.
*
Expand All @@ -104,7 +105,7 @@ public function __get($property)
*
* Returns true for all (public/)protected/private properties.
*
* @ignore This method is for internal use
* @internal
*
* @param string $property Name of the property
*
Expand All @@ -118,12 +119,12 @@ public function __isset($property)
/**
* Magic unset function handling unset() to non public properties.
*
* @ignore This method is for internal use
* @internal
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\PropertyNotFoundException exception on all writes to undefined properties so typos are not silently accepted and
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\PropertyReadOnlyException exception on readonly (protected) properties.
*
* @uses ::__set()
* @uses ValueObject::__set()
*
* @param string $property Name of the property
*
Expand All @@ -144,7 +145,7 @@ public function __unset($property)
* var_export() generates code, that calls this method when it
* is parsed with PHP.
*
* @ignore This method is for internal use
* @internal
*
* @param mixed[] $array
*
Expand All @@ -158,11 +159,11 @@ public static function __set_state(array $array)
/**
* Internal function for Legacy template engine compatibility to get property value.
*
* @ignore This method is for internal use
* @internal
*
* @deprecated Since 5.0, available purely for legacy eZTemplate compatibility
*
* @uses ::__get()
* @uses ValueObject::__get()
*
* @param string $property
*
Expand All @@ -176,11 +177,12 @@ final public function attribute($property)
/**
* Internal function for Legacy template engine compatibility to get properties.
*
* @ignore This method is for internal use
* @internal
*
* @deprecated Since 5.0, available purely for legacy eZTemplate compatibility
*
* @uses ::__isset()
* @uses ValueObject::getProperties()
* @uses ValueObject::__isset()
*
* @return array
*/
Expand All @@ -192,11 +194,11 @@ final public function attributes()
/**
* Internal function for Legacy template engine compatibility to check existence of property.
*
* @ignore This method is for internal use
* @internal
*
* @deprecated Since 5.0, available purely for legacy eZTemplate compatibility
*
* @uses ::__isset()
* @uses ValueObject::__isset()
*
* @param string $property
*
Expand Down

0 comments on commit ee31d5a

Please sign in to comment.