Skip to content

Commit b352e31

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
2 parents 8e1271e + 2800673 commit b352e31

File tree

4 files changed

+42
-36
lines changed

4 files changed

+42
-36
lines changed

phpstan-baseline.php

-6
Original file line numberDiff line numberDiff line change
@@ -10327,12 +10327,6 @@
1032710327
'count' => 1,
1032810328
'path' => __DIR__ . '/system/Validation/Validation.php',
1032910329
];
10330-
$ignoreErrors[] = [
10331-
// identifier: missingType.iterableValue
10332-
'message' => '#^Property CodeIgniter\\\\Validation\\\\Validation\\:\\:\\$rules type has no value type specified in iterable type array\\.$#',
10333-
'count' => 1,
10334-
'path' => __DIR__ . '/system/Validation/Validation.php',
10335-
];
1033610330
$ignoreErrors[] = [
1033710331
// identifier: missingType.iterableValue
1033810332
'message' => '#^Property CodeIgniter\\\\Validation\\\\Validation\\:\\:\\$validated type has no value type specified in iterable type array\\.$#',

system/Validation/Validation.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Validation implements ValidationInterface
5050
/**
5151
* Stores the actual rules that should be run against $data.
5252
*
53-
* @var array
53+
* @var array<array-key, array{label?: string, rules: list<string>}>
5454
*
5555
* [
5656
* field1 => [
@@ -162,6 +162,9 @@ public function run(?array $data = null, ?string $group = null, $dbGroup = null)
162162
// Run through each rule. If we have any field set for
163163
// this rule, then we need to run them through!
164164
foreach ($this->rules as $field => $setup) {
165+
// An array key might be int.
166+
$field = (string) $field;
167+
165168
$rules = $setup['rules'];
166169

167170
if (is_string($rules)) {

tests/system/Validation/ValidationTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ public function testRunDoesTheBasics(): void
270270
$this->assertSame([], $this->validation->getValidated());
271271
}
272272

273+
public function testRunWithNumericFieldName(): void
274+
{
275+
// The array key will be int.
276+
$data = ['123' => 'notanumber'];
277+
$this->validation->setRules(['123' => 'is_numeric']);
278+
279+
$this->assertFalse($this->validation->run($data));
280+
$this->assertSame([], $this->validation->getValidated());
281+
}
282+
273283
public function testClosureRule(): void
274284
{
275285
$this->validation->setRules(

user_guide_src/source/helpers/html_helper.rst

+28-29
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
HTML Helper
33
###########
44

5-
The HTML Helper file contains functions that assist in working with
6-
HTML.
5+
The HTML Helper file contains functions that assist in working with HTML.
76

87
.. contents::
98
:local:
@@ -31,10 +30,10 @@ The following functions are available:
3130
:param string|array $src: Image source URI, or array of attributes and values
3231
:param bool $indexPage: Whether to treat ``$src`` as a routed URI string
3332
:param mixed $attributes: Additional HTML attributes
34-
:returns: HTML image tag
33+
:returns: HTML image element
3534
:rtype: string
3635

37-
Lets you create HTML ``<img />`` tags. The first parameter contains the
36+
Lets you create HTML ``<img>`` elements. The first parameter contains the
3837
image source. Example:
3938

4039
.. literalinclude:: html_helper/002.php
@@ -84,10 +83,10 @@ The following functions are available:
8483
:param string $media: Media type
8584
:param bool $indexPage: Whether to treat ``$src`` as a routed URI string
8685
:param string $hreflang: Hreflang type
87-
:returns: HTML link tag
86+
:returns: An HTML link element
8887
:rtype: string
8988

90-
Lets you create HTML ``<link />`` tags. This is useful for stylesheet links,
89+
Lets you create HTML ``<link>`` elements. This is useful for stylesheet links,
9190
as well as other links. The parameters are *href*, with optional *rel*,
9291
*type*, *title*, *media* and *indexPage*.
9392

@@ -111,10 +110,10 @@ The following functions are available:
111110
112111
:param array|string $src: The source name or URL of a JavaScript file, or an associative array specifying the attributes
113112
:param bool $indexPage: Whether to treat ``$src`` as a routed URI string
114-
:returns: HTML script tag
113+
:returns: An HTML script element
115114
:rtype: string
116115

117-
Lets you create HTML ``<script></script>`` tags. The parameters is *src*, with optional *indexPage*.
116+
Lets you create HTML ``<script>`` elements. The parameters are *src* and optional *indexPage*.
118117

119118
*indexPage* is a boolean value that specifies if the *src* should have
120119
the page specified by ``$config['indexPage']`` added to the address it creates.
@@ -132,11 +131,11 @@ The following functions are available:
132131
133132
:param array $list: List entries
134133
:param array $attributes: HTML attributes
135-
:returns: HTML-formatted unordered list
134+
:returns: An HTML unordered list element
136135
:rtype: string
137136

138-
Permits you to generate unordered HTML lists from simple or
139-
multi-dimensional arrays. Example:
137+
Permits you to generate an unordered HTML list from a simple or
138+
multi-dimensional array. Example:
140139

141140
.. literalinclude:: html_helper/012.php
142141

@@ -205,20 +204,20 @@ The following functions are available:
205204
206205
:param array $list: List entries
207206
:param array $attributes: HTML attributes
208-
:returns: HTML-formatted ordered list
207+
:returns: An HTML ordered list element
209208
:rtype: string
210209

211-
Identical to :php:func:`ul()`, only it produces the ``<ol>`` tag for
210+
Identical to :php:func:`ul()`, only it produces ``<ol>`` element for
212211
ordered lists instead of ``<ul>``.
213212

214213
.. php:function:: video($src[, $unsupportedMessage = ''[, $attributes = ''[, $tracks = [][, $indexPage = false]]]])
215214
216215
:param mixed $src: Either a source string or an array of sources. See :php:func:`source()` function
217-
:param string $unsupportedMessage: The message to display if the media tag is not supported by the browser
216+
:param string $unsupportedMessage: The message to display if the video element is not supported by the browser
218217
:param string $attributes: HTML attributes
219218
:param array $tracks: Use the track function inside an array. See :php:func:`track()` function
220219
:param bool $indexPage:
221-
:returns: HTML-formatted video element
220+
:returns: An HTML video element
222221
:rtype: string
223222

224223
Permits you to generate HTML video element from simple or
@@ -253,24 +252,24 @@ The following functions are available:
253252
.. php:function:: audio($src[, $unsupportedMessage = ''[, $attributes = ''[, $tracks = [][, $indexPage = false]]]])
254253
255254
:param mixed $src: Either a source string or an array of sources. See :php:func:`source()` function
256-
:param string $unsupportedMessage: The message to display if the media tag is not supported by the browser
255+
:param string $unsupportedMessage: The message to display if the audio element is not supported by the browser
257256
:param string $attributes:
258257
:param array $tracks: Use the track function inside an array. See :php:func:`track()` function
259258
:param bool $indexPage:
260-
:returns: HTML-formatted audio element
259+
:returns: An HTML audio element
261260
:rtype: string
262261

263-
Identical to :php:func:`video()`, only it produces the ``<audio>`` tag instead of ``<video>``.
262+
Identical to :php:func:`video()`, only it produces ``<audio>`` element instead of ``<video>``.
264263

265264
.. php:function:: source($src = ''[, $type = false[, $attributes = '']])
266265
267266
:param string $src: The path of the media resource
268267
:param bool $type: The MIME-type of the resource with optional codecs parameters
269268
:param array $attributes: HTML attributes
270-
:returns: HTML source tag
269+
:returns: An HTML source element
271270
:rtype: string
272271

273-
Lets you create HTML ``<source />`` tags. The first parameter contains the
272+
Lets you create HTML ``<source>`` elements. The first parameter contains the
274273
source source. Example:
275274

276275
.. literalinclude:: html_helper/015.php
@@ -281,10 +280,10 @@ The following functions are available:
281280
:param bool $type: MIME-type
282281
:param array $attributes: HTML attributes
283282
:param bool $indexPage:
284-
:returns: HTML embed tag
283+
:returns: An HTML embed element
285284
:rtype: string
286285

287-
Lets you create HTML ``<embed />`` tags. The first parameter contains the
286+
Lets you create HTML ``<embed>`` elements. The first parameter contains the
288287
embed source. Example:
289288

290289
.. literalinclude:: html_helper/016.php
@@ -295,10 +294,10 @@ The following functions are available:
295294
:param bool $type: Content-type of the resource
296295
:param array $attributes: HTML attributes
297296
:param array $params: Use the param function inside an array. See :php:func:`param()` function
298-
:returns: HTML object tag
297+
:returns: An HTML object element
299298
:rtype: string
300299

301-
Lets you create HTML ``<object />`` tags. The first parameter contains the
300+
Lets you create HTML ``<object>`` elements. The first parameter contains the
302301
object data. Example:
303302

304303
.. literalinclude:: html_helper/017.php
@@ -319,10 +318,10 @@ The following functions are available:
319318
:param string $name: The name of the parameter
320319
:param string $value: The value of the parameter
321320
:param array $attributes: HTML attributes
322-
:returns: HTML param tag
321+
:returns: An HTML param element
323322
:rtype: string
324323

325-
Lets you create HTML ``<param />`` tags. The first parameter contains the
324+
Lets you create HTML ``<param>`` elements. The first parameter contains the
326325
param source. Example:
327326

328327
.. literalinclude:: html_helper/018.php
@@ -332,7 +331,7 @@ The following functions are available:
332331
:param string $name: The name of the parameter
333332
:param string $value: The value of the parameter
334333
:param array $attributes: HTML attributes
335-
:returns: HTML track tag
334+
:returns: An HTML track element
336335
:rtype: string
337336

338337
Generates a track element to specify timed tracks. The tracks are
@@ -343,10 +342,10 @@ The following functions are available:
343342
.. php:function:: doctype([$type = 'html5'])
344343
345344
:param string $type: Doctype name
346-
:returns: HTML DocType tag
345+
:returns: An HTML DocType declaration
347346
:rtype: string
348347

349-
Helps you generate document type declarations, or DTD's. HTML 5
348+
Helps you generate document type declarations (DTD's). HTML 5
350349
is used by default, but many doctypes are available.
351350

352351
Example:

0 commit comments

Comments
 (0)