Skip to content

Commit e12f5e1

Browse files
authored
Fix Meetup exercise tests (#665)
1 parent a6d49a8 commit e12f5e1

File tree

2 files changed

+97
-141
lines changed

2 files changed

+97
-141
lines changed

exercises/practice/meetup/.meta/example.php

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
<?php
22

3-
/*
4-
* By adding type hints and enabling strict type checking, code can become
5-
* easier to read, self-documenting and reduce the number of potential bugs.
6-
* By default, type declarations are non-strict, which means they will attempt
7-
* to change the original type to match the type specified by the
8-
* type-declaration.
9-
*
10-
* In other words, if you pass a string to a function requiring a float,
11-
* it will attempt to convert the string value to a float.
12-
*
13-
* To enable strict mode, a single declare directive must be placed at the top
14-
* of the file.
15-
* This means that the strictness of typing is configured on a per-file basis.
16-
* This directive not only affects the type declarations of parameters, but also
17-
* a function's return type.
18-
*
19-
* For more info review the Concept on strict type checking in the PHP track
20-
* <link>.
21-
*
22-
* To disable strict typing, comment out the directive below.
23-
*/
24-
253
declare(strict_types=1);
264

27-
function meetup_day($year, $month, $which, $weekday)
5+
function meetup_day(int $year, int $month, string $which, string $weekday): DateTimeImmutable
286
{
29-
$monthName = DateTimeImmutable::createFromFormat("!m", $month)->format('F');
7+
$monthName = DateTimeImmutable::createFromFormat("!m", "$month")->format('F');
308
if ($which != "teenth") {
319
return new DateTimeImmutable("$which $weekday of $monthName $year");
3210
}

0 commit comments

Comments
 (0)