Skip to content

Commit d9bb124

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.4
Conflicts: system/Helpers/cookie_helper.php system/Session/Handlers/RedisHandler.php
2 parents a177c19 + 336ae3f commit d9bb124

23 files changed

Lines changed: 251 additions & 176 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -786,26 +786,6 @@
786786
'count' => 1,
787787
'path' => __DIR__ . '/system/Email/Email.php',
788788
];
789-
$ignoreErrors[] = [
790-
'message' => '#^Method CodeIgniter\\\\Encryption\\\\Handlers\\\\SodiumHandler\\:\\:parseParams\\(\\) has no return type specified\\.$#',
791-
'count' => 1,
792-
'path' => __DIR__ . '/system/Encryption/Handlers/SodiumHandler.php',
793-
];
794-
$ignoreErrors[] = [
795-
'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$casts has no type specified\\.$#',
796-
'count' => 1,
797-
'path' => __DIR__ . '/system/Entity/Entity.php',
798-
];
799-
$ignoreErrors[] = [
800-
'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$datamap has no type specified\\.$#',
801-
'count' => 1,
802-
'path' => __DIR__ . '/system/Entity/Entity.php',
803-
];
804-
$ignoreErrors[] = [
805-
'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$dates has no type specified\\.$#',
806-
'count' => 1,
807-
'path' => __DIR__ . '/system/Entity/Entity.php',
808-
];
809789
$ignoreErrors[] = [
810790
'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:on\\(\\) has parameter \\$callback with no signature specified for callable\\.$#',
811791
'count' => 1,
@@ -1126,56 +1106,6 @@
11261106
'count' => 1,
11271107
'path' => __DIR__ . '/system/Helpers/filesystem_helper.php',
11281108
];
1129-
$ignoreErrors[] = [
1130-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#',
1131-
'count' => 1,
1132-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1133-
];
1134-
$ignoreErrors[] = [
1135-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoNameField\\(\\) has no return type specified\\.$#',
1136-
'count' => 1,
1137-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1138-
];
1139-
$ignoreErrors[] = [
1140-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoTemplate\\(\\) has no return type specified\\.$#',
1141-
'count' => 1,
1142-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1143-
];
1144-
$ignoreErrors[] = [
1145-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:isBot\\(\\) has no return type specified\\.$#',
1146-
'count' => 1,
1147-
'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php',
1148-
];
1149-
$ignoreErrors[] = [
1150-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:attachHoneypot\\(\\) has no return type specified\\.$#',
1151-
'count' => 1,
1152-
'path' => __DIR__ . '/system/Honeypot/Honeypot.php',
1153-
];
1154-
$ignoreErrors[] = [
1155-
'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:hasContent\\(\\) has no return type specified\\.$#',
1156-
'count' => 1,
1157-
'path' => __DIR__ . '/system/Honeypot/Honeypot.php',
1158-
];
1159-
$ignoreErrors[] = [
1160-
'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:setTestNow\\(\\) has no return type specified\\.$#',
1161-
'count' => 1,
1162-
'path' => __DIR__ . '/system/I18n/Time.php',
1163-
];
1164-
$ignoreErrors[] = [
1165-
'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#',
1166-
'count' => 1,
1167-
'path' => __DIR__ . '/system/I18n/Time.php',
1168-
];
1169-
$ignoreErrors[] = [
1170-
'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:setTestNow\\(\\) has no return type specified\\.$#',
1171-
'count' => 1,
1172-
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
1173-
];
1174-
$ignoreErrors[] = [
1175-
'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#',
1176-
'count' => 1,
1177-
'path' => __DIR__ . '/system/I18n/TimeLegacy.php',
1178-
];
11791109
$ignoreErrors[] = [
11801110
'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#',
11811111
'count' => 1,
@@ -1446,26 +1376,6 @@
14461376
'count' => 1,
14471377
'path' => __DIR__ . '/system/Router/RouterInterface.php',
14481378
];
1449-
$ignoreErrors[] = [
1450-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forDisallowedAction\\(\\) has no return type specified\\.$#',
1451-
'count' => 1,
1452-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1453-
];
1454-
$ignoreErrors[] = [
1455-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidControlChars\\(\\) has no return type specified\\.$#',
1456-
'count' => 1,
1457-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1458-
];
1459-
$ignoreErrors[] = [
1460-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidSameSite\\(\\) has no return type specified\\.$#',
1461-
'count' => 1,
1462-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1463-
];
1464-
$ignoreErrors[] = [
1465-
'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidUTF8Chars\\(\\) has no return type specified\\.$#',
1466-
'count' => 1,
1467-
'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php',
1468-
];
14691379
$ignoreErrors[] = [
14701380
'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forEmptySavepath\\(\\) has no return type specified\\.$#',
14711381
'count' => 1,
@@ -2226,51 +2136,11 @@
22262136
'count' => 1,
22272137
'path' => __DIR__ . '/system/Throttle/Throttler.php',
22282138
];
2229-
$ignoreErrors[] = [
2230-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotArray\\(\\) has no return type specified\\.$#',
2231-
'count' => 1,
2232-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2233-
];
2234-
$ignoreErrors[] = [
2235-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotFound\\(\\) has no return type specified\\.$#',
2236-
'count' => 1,
2237-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2238-
];
2239-
$ignoreErrors[] = [
2240-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#',
2241-
'count' => 1,
2242-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2243-
];
2244-
$ignoreErrors[] = [
2245-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forNoRuleSets\\(\\) has no return type specified\\.$#',
2246-
'count' => 1,
2247-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2248-
];
2249-
$ignoreErrors[] = [
2250-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forRuleNotFound\\(\\) has no return type specified\\.$#',
2251-
'count' => 1,
2252-
'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php',
2253-
];
22542139
$ignoreErrors[] = [
22552140
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:isClosure\\(\\) has parameter \\$rule with no signature specified for Closure\\.$#',
22562141
'count' => 1,
22572142
'path' => __DIR__ . '/system/Validation/Validation.php',
22582143
];
2259-
$ignoreErrors[] = [
2260-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:loadRuleSets\\(\\) has no return type specified\\.$#',
2261-
'count' => 1,
2262-
'path' => __DIR__ . '/system/Validation/Validation.php',
2263-
];
2264-
$ignoreErrors[] = [
2265-
'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#',
2266-
'count' => 1,
2267-
'path' => __DIR__ . '/system/Validation/Validation.php',
2268-
];
2269-
$ignoreErrors[] = [
2270-
'message' => '#^Method CodeIgniter\\\\Validation\\\\ValidationInterface\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#',
2271-
'count' => 1,
2272-
'path' => __DIR__ . '/system/Validation/ValidationInterface.php',
2273-
];
22742144
$ignoreErrors[] = [
22752145
'message' => '#^Call to an undefined static method CodeIgniter\\\\Config\\\\Factories\\:\\:cells\\(\\)\\.$#',
22762146
'count' => 1,

system/BaseModel.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,9 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
979979
// properties representing the collection elements, we need to grab
980980
// them as an array.
981981
if (is_object($row) && ! $row instanceof stdClass) {
982-
$row = $this->objectToArray($row, true, true);
982+
// For updates the index field is needed even if it is not changed.
983+
// So set $onlyChanged to false.
984+
$row = $this->objectToArray($row, false, true);
983985
}
984986

985987
// If it's still a stdClass, go ahead and convert to
@@ -997,6 +999,13 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
997999
// Save updateIndex for later
9981000
$updateIndex = $row[$index] ?? null;
9991001

1002+
if ($updateIndex === null) {
1003+
throw new InvalidArgumentException(
1004+
'The index ("' . $index . '") for updateBatch() is missing in the data: '
1005+
. json_encode($row)
1006+
);
1007+
}
1008+
10001009
// Must be called first so we don't
10011010
// strip out updated_at values.
10021011
$row = $this->doProtectFields($row);

system/Cookie/Cookie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Cookie implements ArrayAccess, CloneableCookieInterface
5858
protected $value;
5959

6060
/**
61-
* @var int
61+
* @var int Unix timestamp
6262
*/
6363
protected $expires;
6464

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct()
7575
* The static method used during Events to collect
7676
* data.
7777
*
78-
* @internal param $ array \CodeIgniter\Database\Query
78+
* @internal
7979
*/
8080
public static function collect(Query $query)
8181
{

system/Encryption/Handlers/SodiumHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ public function decrypt($data, $params = null)
112112
*
113113
* @param array|string|null $params
114114
*
115+
* @return void
116+
*
115117
* @throws EncryptionException If key is empty
116118
*/
117119
protected function parseParams($params)

system/Entity/Entity.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ class Entity implements JsonSerializable
4545
* $datamap = [
4646
* 'class_property_name' => 'db_column_name'
4747
* ];
48+
*
49+
* @var array<string, string>
4850
*/
4951
protected $datamap = [];
5052

53+
/**
54+
* The date fields.
55+
*
56+
* @var array<int, string>
57+
* @phpstan-var list<string>
58+
*/
5159
protected $dates = [
5260
'created_at',
5361
'updated_at',
@@ -57,6 +65,8 @@ class Entity implements JsonSerializable
5765
/**
5866
* Array of field names and the type of value to cast them as when
5967
* they are accessed.
68+
*
69+
* @var array<string, string>
6070
*/
6171
protected $casts = [];
6272

system/Helpers/cookie_helper.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
* the LICENSE file that was distributed with this source code.
1010
*/
1111

12-
use Config\Cookie;
12+
use CodeIgniter\Cookie\Cookie;
13+
use Config\Cookie as CookieConfig;
1314
use Config\Services;
1415

1516
// =============================================================================
@@ -23,15 +24,15 @@
2324
* Accepts seven parameters, or you can submit an associative
2425
* array in the first parameter containing all the values.
2526
*
26-
* @param array|string $name Cookie name or array containing binds
27-
* @param string $value The value of the cookie
28-
* @param string $expire The number of seconds until expiration
29-
* @param string $domain For site-wide cookie. Usually: .yourdomain.com
30-
* @param string $path The cookie path
31-
* @param string $prefix The cookie prefix ('': the default prefix)
32-
* @param bool|null $secure True makes the cookie secure
33-
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
34-
* @param string|null $sameSite The cookie SameSite value
27+
* @param array|Cookie|string $name Cookie name / array containing binds / Cookie object
28+
* @param string $value The value of the cookie
29+
* @param string $expire The number of seconds until expiration
30+
* @param string $domain For site-wide cookie. Usually: .yourdomain.com
31+
* @param string $path The cookie path
32+
* @param string $prefix The cookie prefix ('': the default prefix)
33+
* @param bool|null $secure True makes the cookie secure
34+
* @param bool|null $httpOnly True makes the cookie accessible via http(s) only (no javascript)
35+
* @param string|null $sameSite The cookie SameSite value
3536
*
3637
* @return void
3738
*
@@ -69,7 +70,7 @@ function set_cookie(
6970
function get_cookie($index, bool $xssClean = false, ?string $prefix = '')
7071
{
7172
if ($prefix === '') {
72-
$cookie = config(Cookie::class);
73+
$cookie = config(CookieConfig::class);
7374

7475
$prefix = $cookie->prefix;
7576
}

system/Honeypot/Exceptions/HoneypotException.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,41 @@
1616

1717
class HoneypotException extends ConfigException implements ExceptionInterface
1818
{
19+
/**
20+
* Thrown when the template value of config is empty.
21+
*
22+
* @return static
23+
*/
1924
public static function forNoTemplate()
2025
{
2126
return new static(lang('Honeypot.noTemplate'));
2227
}
2328

29+
/**
30+
* Thrown when the name value of config is empty.
31+
*
32+
* @return static
33+
*/
2434
public static function forNoNameField()
2535
{
2636
return new static(lang('Honeypot.noNameField'));
2737
}
2838

39+
/**
40+
* Thrown when the hidden value of config is false.
41+
*
42+
* @return static
43+
*/
2944
public static function forNoHiddenValue()
3045
{
3146
return new static(lang('Honeypot.noHiddenValue'));
3247
}
3348

49+
/**
50+
* Thrown when there are no data in the request of honeypot field.
51+
*
52+
* @return static
53+
*/
3454
public static function isBot()
3555
{
3656
return new static(lang('Honeypot.theClientIsABot'));

system/Honeypot/Honeypot.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public function __construct(HoneypotConfig $config)
5959

6060
/**
6161
* Checks the request if honeypot field has data.
62+
*
63+
* @return bool
6264
*/
6365
public function hasContent(RequestInterface $request)
6466
{
@@ -69,6 +71,8 @@ public function hasContent(RequestInterface $request)
6971

7072
/**
7173
* Attaches Honeypot template to response.
74+
*
75+
* @return void
7276
*/
7377
public function attachHoneypot(ResponseInterface $response)
7478
{

system/I18n/TimeTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ public function toDateTime()
320320
* @param DateTimeInterface|self|string|null $datetime
321321
* @param DateTimeZone|string|null $timezone
322322
*
323+
* @return void
324+
*
323325
* @throws Exception
324326
*/
325327
public static function setTestNow($datetime = null, $timezone = null, ?string $locale = null)
@@ -845,6 +847,8 @@ public function subYears(int $years)
845847
/**
846848
* Returns the localized value of the date in the format 'Y-m-d H:i:s'
847849
*
850+
* @return false|string
851+
*
848852
* @throws Exception
849853
*/
850854
public function toDateTimeString()

0 commit comments

Comments
 (0)