Skip to content

Commit

Permalink
Defining function return & argument types in PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
markshust committed Jul 13, 2022
1 parent 207ca64 commit 7f312d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.php
@@ -1,5 +1,5 @@
<?php
function getPosts()
function getPosts(): array
{
return [
[
Expand All @@ -17,7 +17,7 @@ function getPosts()
];
}

function getPostText($numPosts)
function getPostText(int $numPosts): string
{
return $numPosts === 1 ? 'post' : 'posts';
}
Expand Down

0 comments on commit 7f312d9

Please sign in to comment.