Skip to content

docs: update PHPDoc in Entity #6462

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

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions system/Entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use CodeIgniter\Entity\Cast\URICast;
use CodeIgniter\Entity\Exceptions\CastException;
use CodeIgniter\I18n\Time;
use DateTime;
use Exception;
use JsonSerializable;
use ReturnTypeWillChange;
Expand Down Expand Up @@ -147,7 +148,7 @@ public function fill(?array $data = null)
*
* @param bool $onlyChanged If true, only return values that have changed since object creation
* @param bool $cast If true, properties will be cast.
* @param bool $recursive If true, inner entities will be casted as array as well.
* @param bool $recursive If true, inner entities will be cast as array as well.
*/
public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recursive = false): array
{
Expand Down Expand Up @@ -189,7 +190,7 @@ public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recu
* Returns the raw values of the current attributes.
*
* @param bool $onlyChanged If true, only return values that have changed since object creation
* @param bool $recursive If true, inner entities will be casted as array as well.
* @param bool $recursive If true, inner entities will be cast as array as well.
*/
public function toRawArray(bool $onlyChanged = false, bool $recursive = false): array
{
Expand Down Expand Up @@ -247,7 +248,7 @@ public function syncOriginal()
* was created. Or, without a parameter, checks if any
* properties have changed.
*
* @param string $key
* @param string|null $key class property
*/
public function hasChanged(?string $key = null): bool
{
Expand Down Expand Up @@ -308,11 +309,11 @@ protected function mapProperty(string $key)
* Converts the given string|timestamp|DateTime|Time instance
* into the "CodeIgniter\I18n\Time" object.
*
* @param mixed $value
* @param DateTime|float|int|string|Time $value
*
* @throws Exception
*
* @return mixed|Time
* @return Time
*/
protected function mutateDate($value)
{
Expand All @@ -324,13 +325,13 @@ protected function mutateDate($value)
* Add ? at the beginning of $type (i.e. ?string) to get NULL
* instead of casting $value if $value === null
*
* @param mixed $value Attribute value
* @param string $attribute Attribute name
* @param string $method Allowed to "get" and "set"
* @param bool|float|int|string|null $value Attribute value
* @param string $attribute Attribute name
* @param string $method Allowed to "get" and "set"
*
* @throws CastException
*
* @return mixed
* @return array|bool|float|int|object|string|null
*/
protected function castAs($value, string $attribute, string $method = 'get')
{
Expand Down Expand Up @@ -424,7 +425,7 @@ public function cast(?bool $cast = null)
* $this->my_property = $p;
* $this->setMyProperty() = $p;
*
* @param mixed|null $value
* @param array|bool|float|int|object|string|null $value
*
* @throws Exception
*
Expand Down Expand Up @@ -470,8 +471,9 @@ public function __set(string $key, $value = null)
* $p = $this->getMyProperty()
*
* @throws Exception
* @params string $key class property
*
* @return mixed
* @return array|bool|float|int|object|string|null
*/
public function __get(string $key)
{
Expand Down