Skip to content

Commit

Permalink
Set union types to class properties in the helpers and components exa…
Browse files Browse the repository at this point in the history
…mples (#7763)

* Update components.rst

Set union types to class properties in the component example

* Update helpers.rst

Set union types to class properties in the helpers examples
  • Loading branch information
Indianer3c authored Nov 10, 2023
1 parent 714bbe2 commit 816315c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion en/controllers/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ You can load other components by adding them to the `$components` property::
class CustomComponent extends Component
{
// The other component your component uses
protected $components = ['Existing'];
protected array $components = ['Existing'];

// Execute any other additional setup for your component.
public function initialize(array $config): void
Expand Down
6 changes: 3 additions & 3 deletions en/views/helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ your helper requires. For example::
/**
* @var array<string, mixed>
*/
protected $_defaultConfig = [
protected array $_defaultConfig = [
'errorClass' => 'error',
'templates' => [
'label' => '<label for="{{for}}">{{content}}</label>',
Expand Down Expand Up @@ -268,7 +268,7 @@ just as you would in a controller::

class LinkHelper extends Helper
{
protected $helpers = ['Html'];
protected array $helpers = ['Html'];

public function makeEdit($title, $url)
{
Expand Down Expand Up @@ -317,7 +317,7 @@ If you would like to access a View variable inside a helper, you can use

class AwesomeHelper extends Helper
{
public $helpers = ['Html'];
public array $helpers = ['Html'];

public function someMethod()
{
Expand Down

0 comments on commit 816315c

Please sign in to comment.