Skip to content

Commit e6d0c1a

Browse files
committed
minor #19073 Update templating.rst from "Create your own Framework" (staatzstreich)
This PR was submitted for the 6.4 branch but it was merged into the 5.4 branch instead. Discussion ---------- Update templating.rst from "Create your own Framework" - parameter $year is typed with integer. date function returns string. Code works but casting to the right type feels better. - added missing import to fix TypeError "Argument 1 ($request) must be of type Request" <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 916a5c0 Update templating.rst
2 parents 8e56130 + 916a5c0 commit e6d0c1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

create_framework/templating.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ framework does not need to be modified in any way, create a new
142142
``app.php`` file::
143143

144144
// example.com/src/app.php
145+
use Symfony\Component\HttpFoundation\Request;
145146
use Symfony\Component\HttpFoundation\Response;
146147
use Symfony\Component\Routing;
147148

148149
function is_leap_year($year = null)
149150
{
150151
if (null === $year) {
151-
$year = date('Y');
152+
$year = (int)date('Y');
152153
}
153154

154155
return 0 === $year % 400 || (0 === $year % 4 && 0 !== $year % 100);

0 commit comments

Comments
 (0)