Skip to content

Commit 5b396db

Browse files
authored
Merge pull request #6462 from kenjis/fix-Entity-phpdoc
docs: update PHPDoc in Entity
2 parents a51b07c + 69c407b commit 5b396db

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

system/Entity/Entity.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use CodeIgniter\Entity\Cast\URICast;
2626
use CodeIgniter\Entity\Exceptions\CastException;
2727
use CodeIgniter\I18n\Time;
28+
use DateTime;
2829
use Exception;
2930
use JsonSerializable;
3031
use ReturnTypeWillChange;
@@ -147,7 +148,7 @@ public function fill(?array $data = null)
147148
*
148149
* @param bool $onlyChanged If true, only return values that have changed since object creation
149150
* @param bool $cast If true, properties will be cast.
150-
* @param bool $recursive If true, inner entities will be casted as array as well.
151+
* @param bool $recursive If true, inner entities will be cast as array as well.
151152
*/
152153
public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recursive = false): array
153154
{
@@ -189,7 +190,7 @@ public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recu
189190
* Returns the raw values of the current attributes.
190191
*
191192
* @param bool $onlyChanged If true, only return values that have changed since object creation
192-
* @param bool $recursive If true, inner entities will be casted as array as well.
193+
* @param bool $recursive If true, inner entities will be cast as array as well.
193194
*/
194195
public function toRawArray(bool $onlyChanged = false, bool $recursive = false): array
195196
{
@@ -247,7 +248,7 @@ public function syncOriginal()
247248
* was created. Or, without a parameter, checks if any
248249
* properties have changed.
249250
*
250-
* @param string $key
251+
* @param string|null $key class property
251252
*/
252253
public function hasChanged(?string $key = null): bool
253254
{
@@ -308,11 +309,11 @@ protected function mapProperty(string $key)
308309
* Converts the given string|timestamp|DateTime|Time instance
309310
* into the "CodeIgniter\I18n\Time" object.
310311
*
311-
* @param mixed $value
312+
* @param DateTime|float|int|string|Time $value
312313
*
313314
* @throws Exception
314315
*
315-
* @return mixed|Time
316+
* @return Time
316317
*/
317318
protected function mutateDate($value)
318319
{
@@ -324,13 +325,13 @@ protected function mutateDate($value)
324325
* Add ? at the beginning of $type (i.e. ?string) to get NULL
325326
* instead of casting $value if $value === null
326327
*
327-
* @param mixed $value Attribute value
328-
* @param string $attribute Attribute name
329-
* @param string $method Allowed to "get" and "set"
328+
* @param bool|float|int|string|null $value Attribute value
329+
* @param string $attribute Attribute name
330+
* @param string $method Allowed to "get" and "set"
330331
*
331332
* @throws CastException
332333
*
333-
* @return mixed
334+
* @return array|bool|float|int|object|string|null
334335
*/
335336
protected function castAs($value, string $attribute, string $method = 'get')
336337
{
@@ -424,7 +425,7 @@ public function cast(?bool $cast = null)
424425
* $this->my_property = $p;
425426
* $this->setMyProperty() = $p;
426427
*
427-
* @param mixed|null $value
428+
* @param array|bool|float|int|object|string|null $value
428429
*
429430
* @throws Exception
430431
*
@@ -470,8 +471,9 @@ public function __set(string $key, $value = null)
470471
* $p = $this->getMyProperty()
471472
*
472473
* @throws Exception
474+
* @params string $key class property
473475
*
474-
* @return mixed
476+
* @return array|bool|float|int|object|string|null
475477
*/
476478
public function __get(string $key)
477479
{

0 commit comments

Comments
 (0)