Skip to content

Commit 7808f18

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.3
2 parents e551d33 + f781dc2 commit 7808f18

File tree

14 files changed

+69
-28
lines changed

14 files changed

+69
-28
lines changed

system/Database/Exceptions/DatabaseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ class DatabaseException extends Error implements ExceptionInterface
2020
*
2121
* @var int
2222
*/
23-
protected $code = 8;
23+
protected $code = EXIT_DATABASE;
2424
}

system/Entity/Cast/BaseCast.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ abstract class BaseCast implements CastInterface
1919
/**
2020
* Get
2121
*
22-
* @param mixed $value Data
23-
* @param array $params Additional param
22+
* @param array|bool|float|int|object|string|null $value Data
23+
* @param array $params Additional param
2424
*
25-
* @return mixed
25+
* @return array|bool|float|int|object|string|null
2626
*/
2727
public static function get($value, array $params = [])
2828
{
@@ -32,10 +32,10 @@ public static function get($value, array $params = [])
3232
/**
3333
* Set
3434
*
35-
* @param mixed $value Data
36-
* @param array $params Additional param
35+
* @param array|bool|float|int|object|string|null $value Data
36+
* @param array $params Additional param
3737
*
38-
* @return mixed
38+
* @return array|bool|float|int|object|string|null
3939
*/
4040
public static function set($value, array $params = [])
4141
{

system/Entity/Cast/CastInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ interface CastInterface
1919
/**
2020
* Get
2121
*
22-
* @param mixed $value Data
23-
* @param array $params Additional param
22+
* @param array|bool|float|int|object|string|null $value Data
23+
* @param array $params Additional param
2424
*
25-
* @return mixed
25+
* @return array|bool|float|int|object|string|null
2626
*/
2727
public static function get($value, array $params = []);
2828

2929
/**
3030
* Set
3131
*
32-
* @param mixed $value Data
33-
* @param array $params Additional param
32+
* @param array|bool|float|int|object|string|null $value Data
33+
* @param array $params Additional param
3434
*
35-
* @return mixed
35+
* @return array|bool|float|int|object|string|null
3636
*/
3737
public static function set($value, array $params = []);
3838
}

system/Entity/Cast/DatetimeCast.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class DatetimeCast extends BaseCast
2424
* {@inheritDoc}
2525
*
2626
* @throws Exception
27+
*
28+
* @return Time
2729
*/
2830
public static function get($value, array $params = [])
2931
{

system/Entity/Entity.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function fill(?array $data = null)
146146
* __get() magic method so will have any casts, etc applied to them.
147147
*
148148
* @param bool $onlyChanged If true, only return values that have changed since object creation
149-
* @param bool $cast If true, properties will be casted.
149+
* @param bool $cast If true, properties will be cast.
150150
* @param bool $recursive If true, inner entities will be casted as array as well.
151151
*/
152152
public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recursive = false): array
@@ -256,6 +256,8 @@ public function hasChanged(?string $key = null): bool
256256
return $this->original !== $this->attributes;
257257
}
258258

259+
$key = $this->mapProperty($key);
260+
259261
// Key doesn't exist in either
260262
if (! array_key_exists($key, $this->original) && ! array_key_exists($key, $this->attributes)) {
261263
return false;
@@ -287,7 +289,7 @@ public function setAttributes(array $data)
287289
* Checks the datamap to see if this property name is being mapped,
288290
* and returns the db column name, if any, or the original property name.
289291
*
290-
* @return string
292+
* @return string db column name
291293
*/
292294
protected function mapProperty(string $key)
293295
{
@@ -480,7 +482,7 @@ public function __get(string $key)
480482
// Convert to CamelCase for the method
481483
$method = 'get' . str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $key)));
482484

483-
// if a set* method exists for this key,
485+
// if a get* method exists for this key,
484486
// use that method to insert this value.
485487
if (method_exists($this, $method)) {
486488
$result = $this->{$method}();

system/Entity/Exceptions/CastException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
/**
1717
* CastException is thrown for invalid cast initialization and management.
18+
*
19+
* @TODO CodeIgniter\Exceptions\CastException is deprecated and this class is used.
20+
* CodeIgniter\Exceptions\CastException has the property $code = EXIT_CONFIG,
21+
* but this class does not have the code.
1822
*/
1923
class CastException extends FrameworkException
2024
{

system/Exceptions/CastException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class CastException extends CriticalError
2323
use DebugTraceableTrait;
2424

2525
/**
26-
* Error code
26+
* Exit status code
2727
*
2828
* @var int
2929
*/
30-
protected $code = 3;
30+
protected $code = EXIT_CONFIG;
3131

3232
public static function forInvalidJsonFormatException(int $error)
3333
{

system/Exceptions/ConfigException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class ConfigException extends CriticalError
1919
use DebugTraceableTrait;
2020

2121
/**
22-
* Error code
22+
* Exit status code
2323
*
2424
* @var int
2525
*/
26-
protected $code = 3;
26+
protected $code = EXIT_CONFIG;
2727

2828
public static function forDisabledMigrations()
2929
{

system/Exceptions/PageNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PageNotFoundException extends OutOfBoundsException implements ExceptionInt
1919
use DebugTraceableTrait;
2020

2121
/**
22-
* Error code
22+
* HTTP status code
2323
*
2424
* @var int
2525
*/

system/Router/Exceptions/RedirectException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class RedirectException extends Exception
2020
{
2121
/**
22-
* Status code for redirects
22+
* HTTP status code for redirects
2323
*
2424
* @var int
2525
*/

0 commit comments

Comments
 (0)