Skip to content

Commit 235e1bc

Browse files
authored
Add type annotations to helper method signatures (#8183)
Updates signatures to include full type annotations matching CakePHP 5.x source: - FormHelper: text, password, end, unlockField - HtmlHelper: charset, link, setTemplates - UrlHelper: build
1 parent d520351 commit 235e1bc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

docs/en/views/helpers/form.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ however, this parameter is used primarily to specify HTML tag attributes
824824

825825
### Creating Text Inputs
826826

827-
`method` Cake\\View\\Helper\\FormHelper::**text**(string $name, array $options)
827+
`method` Cake\\View\\Helper\\FormHelper::**text**(string $fieldName, array $options = []): string
828828

829829
- `$name` - A field name in the form `'Modelname.fieldname'`.
830830
- `$options` - An optional array including any of the
@@ -846,7 +846,7 @@ Will output:
846846

847847
### Creating Password Inputs
848848

849-
`method` Cake\\View\\Helper\\FormHelper::**password**(string $fieldName, array $options)
849+
`method` Cake\\View\\Helper\\FormHelper::**password**(string $fieldName, array $options = []): string
850850

851851
- `$fieldName` - A field name in the form `'Modelname.fieldname'`.
852852
- `$options` - An optional array including any of the
@@ -2136,7 +2136,7 @@ echo $this->Form->button('<em>Submit Form</em>', [
21362136

21372137
## Closing the Form
21382138

2139-
`method` Cake\\View\\Helper\\FormHelper::**end**($secureAttributes = []): string
2139+
`method` Cake\\View\\Helper\\FormHelper::**end**(array $secureAttributes = []): string
21402140

21412141
- `$secureAttributes` - Optional. Allows you to provide secure attributes
21422142
which will be passed as HTML attributes into the hidden input elements
@@ -2771,7 +2771,7 @@ As mentioned previously when using FormProtectionComponent, you should always cl
27712771
your forms using `Cake\View\Helper\FormHelper::end()`. This will
27722772
ensure that the special `_Token` inputs are generated.
27732773

2774-
`method` Cake\\View\\Helper\\FormHelper::**unlockField**($name)
2774+
`method` Cake\\View\\Helper\\FormHelper::**unlockField**(string $name): $this
27752775

27762776
- `$name` - Optional. The dot-separated name for the field.
27772777

docs/en/views/helpers/html.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ methods of the HtmlHelper and how to use them.
2828

2929
### Creating Charset Tags
3030

31-
`method` Cake\\View\\Helper\\HtmlHelper::**charset**($charset=null): string
31+
`method` Cake\\View\\Helper\\HtmlHelper::**charset**(?string $charset = null): string
3232

3333
Used to create a meta tag specifying the document's character. The default value
3434
is UTF-8. An example use:
@@ -308,7 +308,7 @@ Will output:
308308

309309
### Creating Links
310310

311-
`method` Cake\\View\\Helper\\HtmlHelper::**link**($title, $url = null, array $options = []): string
311+
`method` Cake\\View\\Helper\\HtmlHelper::**link**(array|string $title, array|string|null $url = null, array $options = []): string
312312

313313
General purpose method for creating HTML links. Use `$options` to
314314
specify attributes for the element and whether or not the
@@ -895,7 +895,7 @@ Output:
895895

896896
## Changing the Tags Output by HtmlHelper
897897

898-
`method` Cake\\View\\Helper\\HtmlHelper::**setTemplates**(array $templates)
898+
`method` Cake\\View\\Helper\\HtmlHelper::**setTemplates**(array $templates): $this
899899

900900
Load an array of templates to add/replace templates:
901901

docs/en/views/helpers/url.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ overriding the core helper with an application one. See the
99

1010
## Generating URLs
1111

12-
`method` Cake\\View\\Helper\\UrlHelper::**build**($url = null, array $options = []): string
12+
`method` Cake\\View\\Helper\\UrlHelper::**build**(array|string|null $url = null, array $options = []): string
1313

1414
Returns a URL pointing to a combination of controller and action.
1515
If `$url` is empty, it returns the `REQUEST_URI`, otherwise it

0 commit comments

Comments
 (0)