-
-
Save cursosdesarrolloweb/4f7a982a1c26bf509cfa06b18ba4429d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use JetBrains\PhpStorm\ArrayShape; | |
class Role { | |
protected string $role; | |
public function __construct(int $role) { | |
$this->role = $role; | |
} | |
public function getRole(): string { | |
return $this->role; | |
} | |
} | |
#[ArrayShape([ | |
"id" => "int", | |
"name" => "string", | |
"role" => Role::class, | |
])] | |
function user(): array { | |
return [ | |
"id" => 1, | |
"name" => "cursosdesarrolloweb", | |
"role" => new Role(1) | |
]; | |
} | |
$user = user(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment