Skip to content

Commit 5d6d0c2

Browse files
committed
minor #4436 remove semicolons in PHP templates (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- remove semicolons in PHP templates | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | Commits ------- 3d07e1a remove semicolons in PHP templates
2 parents 97c4b2e + 3d07e1a commit 5d6d0c2

16 files changed

+42
-42
lines changed

book/controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ the ``notice`` message:
736736
<div class="flash-notice">
737737
<?php echo "<div class='flash-error'>$message</div>" ?>
738738
</div>
739-
<?php endforeach; ?>
739+
<?php endforeach ?>
740740

741741
By design, flash messages are meant to live for exactly one request (they're
742742
"gone in a flash"). They're designed to be used across redirects exactly as

book/from_flat_php_to_symfony2.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ persisted to the database. Writing in flat PHP is quick and dirty:
4949
<?php echo $row['title'] ?>
5050
</a>
5151
</li>
52-
<?php endwhile; ?>
52+
<?php endwhile ?>
5353
</ul>
5454
</body>
5555
</html>
@@ -121,7 +121,7 @@ is primarily an HTML file that uses a template-like PHP syntax:
121121
<?php echo $post['title'] ?>
122122
</a>
123123
</li>
124-
<?php endforeach; ?>
124+
<?php endforeach ?>
125125
</ul>
126126
</body>
127127
</html>
@@ -238,7 +238,7 @@ the layout:
238238
<?php echo $post['title'] ?>
239239
</a>
240240
</li>
241-
<?php endforeach; ?>
241+
<?php endforeach ?>
242242
</ul>
243243
<?php $content = ob_get_clean() ?>
244244

@@ -603,7 +603,7 @@ database and the Templating component to render a template and return a
603603
<?php echo $post->getTitle() ?>
604604
</a>
605605
</li>
606-
<?php endforeach; ?>
606+
<?php endforeach ?>
607607
</ul>
608608

609609
The layout is nearly identical:

book/security.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ Finally, create the corresponding template:
512512
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
513513
<?php if ($error): ?>
514514
<div><?php echo $error->getMessage() ?></div>
515-
<?php endif; ?>
515+
<?php endif ?>
516516

517517
<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
518518
<label for="username">Username:</label>
@@ -1803,7 +1803,7 @@ the built-in helper function:
18031803

18041804
<?php if ($view['security']->isGranted('ROLE_ADMIN')): ?>
18051805
<a href="...">Delete</a>
1806-
<?php endif; ?>
1806+
<?php endif ?>
18071807

18081808
.. note::
18091809

book/templating.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ template - a text file parsed by PHP that contains a mix of text and PHP code:
4646
<?php echo $item->getCaption() ?>
4747
</a>
4848
</li>
49-
<?php endforeach; ?>
49+
<?php endforeach ?>
5050
</ul>
5151
</body>
5252
</html>
@@ -233,7 +233,7 @@ First, build a base layout file:
233233
<li><a href="/">Home</a></li>
234234
<li><a href="/blog">Blog</a></li>
235235
</ul>
236-
<?php endif; ?>
236+
<?php endif ?>
237237
</div>
238238

239239
<div id="content">
@@ -283,7 +283,7 @@ A child template might look like this:
283283
<?php foreach ($blog_entries as $entry): ?>
284284
<h2><?php echo $entry->getTitle() ?></h2>
285285
<p><?php echo $entry->getBody() ?></p>
286-
<?php endforeach; ?>
286+
<?php endforeach ?>
287287
<?php $view['slots']->stop() ?>
288288

289289
.. note::
@@ -637,7 +637,7 @@ The ``recentList`` template is perfectly straightforward:
637637
<a href="/article/<?php echo $article->getSlug() ?>">
638638
<?php echo $article->getTitle() ?>
639639
</a>
640-
<?php endforeach; ?>
640+
<?php endforeach ?>
641641

642642
.. note::
643643

@@ -967,7 +967,7 @@ correctly:
967967
)) ?>">
968968
<?php echo $article->getTitle() ?>
969969
</a>
970-
<?php endforeach; ?>
970+
<?php endforeach ?>
971971

972972
.. tip::
973973

@@ -1141,7 +1141,7 @@ automatically:
11411141
<?php if ($app->getDebug()): ?>
11421142
<p>Request method: <?php echo $app->getRequest()->getMethod() ?></p>
11431143
<p>Application Environment: <?php echo $app->getEnvironment() ?></p>
1144-
<?php endif; ?>
1144+
<?php endif ?>
11451145

11461146
.. tip::
11471147

book/validation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Inside the template, you can output the list of errors exactly as needed:
192192
<ul>
193193
<?php foreach ($errors as $error): ?>
194194
<li><?php echo $error->getMessage() ?></li>
195-
<?php endforeach; ?>
195+
<?php endforeach ?>
196196
</ul>
197197

198198
.. note::

cookbook/assetic/apply_to_option.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ templates:
7070
array('coffee')
7171
) as $url): ?>
7272
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
73-
<?php endforeach; ?>
73+
<?php endforeach ?>
7474

7575
This is all that's needed to compile this CoffeeScript file and serve it
7676
as the compiled JavaScript.
@@ -100,7 +100,7 @@ You can also combine multiple CoffeeScript files into a single output file:
100100
array('coffee')
101101
) as $url): ?>
102102
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
103-
<?php endforeach; ?>
103+
<?php endforeach ?>
104104

105105
Both the files will now be served up as a single file compiled into regular
106106
JavaScript.
@@ -186,4 +186,4 @@ being run through the CoffeeScript filter):
186186
)
187187
) as $url): ?>
188188
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
189-
<?php endforeach; ?>
189+
<?php endforeach ?>

cookbook/assetic/asset_management.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
6969
array('@AcmeFooBundle/Resources/public/js/*')
7070
) as $url): ?>
7171
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
72-
<?php endforeach; ?>
72+
<?php endforeach ?>
7373
7474
.. note::
7575

@@ -126,7 +126,7 @@ above, except with the ``stylesheets`` tag:
126126
array('cssrewrite')
127127
) as $url): ?>
128128
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
129-
<?php endforeach; ?>
129+
<?php endforeach ?>
130130
131131
.. note::
132132

@@ -178,7 +178,7 @@ To include an image you can use the ``image`` tag.
178178
array('@AcmeFooBundle/Resources/public/images/example.jpg')
179179
) as $url): ?>
180180
<img src="<?php echo $view->escape($url) ?>" alt="Example" />
181-
<?php endforeach; ?>
181+
<?php endforeach ?>
182182

183183
You can also use Assetic for image optimization. More information in
184184
:doc:`/cookbook/assetic/jpeg_optimize`.
@@ -231,7 +231,7 @@ but still serve them as a single file:
231231
)
232232
) as $url): ?>
233233
<script src="<?php echo $view->escape($url) ?>"></script>
234-
<?php endforeach; ?>
234+
<?php endforeach ?>
235235
236236
In the ``dev`` environment, each file is still served individually, so that
237237
you can debug problems more easily. However, in the ``prod`` environment
@@ -268,7 +268,7 @@ combine third party assets, such as jQuery, with your own into a single file:
268268
)
269269
) as $url): ?>
270270
<script src="<?php echo $view->escape($url) ?>"></script>
271-
<?php endforeach; ?>
271+
<?php endforeach ?>
272272
273273
Using Named Assets
274274
~~~~~~~~~~~~~~~~~~
@@ -341,7 +341,7 @@ with the ``@named_asset`` notation:
341341
)
342342
) as $url): ?>
343343
<script src="<?php echo $view->escape($url) ?>"></script>
344-
<?php endforeach; ?>
344+
<?php endforeach ?>
345345
346346
.. _cookbook-assetic-filters:
347347

@@ -417,7 +417,7 @@ into your template:
417417
array('uglifyjs2')
418418
) as $url): ?>
419419
<script src="<?php echo $view->escape($url) ?>"></script>
420-
<?php endforeach; ?>
420+
<?php endforeach ?>
421421
422422
A more detailed guide about configuring and using Assetic filters as well as
423423
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/uglifyjs`.
@@ -444,7 +444,7 @@ done from the template and is relative to the public document root:
444444
array('output' => 'js/compiled/main.js')
445445
) as $url): ?>
446446
<script src="<?php echo $view->escape($url) ?>"></script>
447-
<?php endforeach; ?>
447+
<?php endforeach ?>
448448
449449
.. note::
450450

@@ -567,4 +567,4 @@ some isolated directory (e.g. ``/js/compiled``), to keep things organized:
567567
array('output' => 'js/compiled/main.js')
568568
) as $url): ?>
569569
<script src="<?php echo $view->escape($url) ?>"></script>
570-
<?php endforeach; ?>
570+
<?php endforeach ?>

cookbook/assetic/jpeg_optimize.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ It can now be used from a template:
6969
array('jpegoptim')
7070
) as $url): ?>
7171
<img src="<?php echo $view->escape($url) ?>" alt="Example"/>
72-
<?php endforeach; ?>
72+
<?php endforeach ?>
7373

7474
Removing all EXIF Data
7575
~~~~~~~~~~~~~~~~~~~~~~

cookbook/assetic/uglifyjs.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ can configure its location using the ``node`` key:
133133
.. code-block:: xml
134134
135135
<!-- app/config/config.xml -->
136-
<assetic:config
136+
<assetic:config
137137
node="/usr/bin/nodejs" >
138138
<assetic:filter
139139
name="uglifyjs2"
@@ -172,7 +172,7 @@ your assets are a part of the view layer, this work is done in your templates:
172172
array('uglifyj2s')
173173
) as $url): ?>
174174
<script src="<?php echo $view->escape($url) ?>"></script>
175-
<?php endforeach; ?>
175+
<?php endforeach ?>
176176
177177
.. note::
178178

@@ -208,7 +208,7 @@ apply this filter when debug mode is off (e.g. ``app.php``):
208208
array('?uglifyjs2')
209209
) as $url): ?>
210210
<script src="<?php echo $view->escape($url) ?>"></script>
211-
<?php endforeach; ?>
211+
<?php endforeach ?>
212212
213213
To try this out, switch to your ``prod`` environment (``app.php``). But before
214214
you do, don't forget to :ref:`clear your cache <book-page-creation-prod-cache-clear>`
@@ -284,7 +284,7 @@ helper:
284284
array('cssrewrite')
285285
) as $url): ?>
286286
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
287-
<?php endforeach; ?>
287+
<?php endforeach ?>
288288
289289
Just like with the ``uglifyjs2`` filter, if you prefix the filter name with
290290
``?`` (i.e. ``?uglifycss``), the minification will only happen when you're

cookbook/assetic/yuicompressor.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ the view layer, this work is done in your templates:
102102
array('yui_js')
103103
) as $url): ?>
104104
<script src="<?php echo $view->escape($url) ?>"></script>
105-
<?php endforeach; ?>
105+
<?php endforeach ?>
106106
107107
.. note::
108108

@@ -130,7 +130,7 @@ can be repeated to minify your stylesheets.
130130
array('yui_css')
131131
) as $url): ?>
132132
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $view->escape($url) ?>" />
133-
<?php endforeach; ?>
133+
<?php endforeach ?>
134134
135135
Disable Minification in Debug Mode
136136
----------------------------------
@@ -156,7 +156,7 @@ apply this filter when debug mode is off.
156156
array('?yui_js')
157157
) as $url): ?>
158158
<script src="<?php echo $view->escape($url) ?>"></script>
159-
<?php endforeach; ?>
159+
<?php endforeach ?>
160160
161161
.. tip::
162162

cookbook/form/form_collections.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ zero tags when first created).
226226
<ul class="tags">
227227
<?php foreach($form['tags'] as $tag): ?>
228228
<li><?php echo $view['form']->row($tag['name']) ?></li>
229-
<?php endforeach; ?>
229+
<?php endforeach ?>
230230
</ul>
231231
<?php echo $view['form']->end($form) ?>
232232

cookbook/form/form_customization.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ and customize the ``form_errors`` fragment.
795795
<ul>
796796
<?php foreach ($errors as $error): ?>
797797
<li><?php echo $error->getMessage() ?></li>
798-
<?php endforeach; ?>
798+
<?php endforeach ?>
799799
</ul>
800800
<?php endif ?>
801801

@@ -860,11 +860,11 @@ fields (e.g. a whole form), and not just an individual field.
860860
<ul>
861861
<?php foreach ($errors as $error): ?>
862862
<li><?php echo $error->getMessage() ?></li>
863-
<?php endforeach; ?>
863+
<?php endforeach ?>
864864
</ul>
865865
<?php else: ?>
866866
<!-- ... render the errors for a single field -->
867-
<?php endif; ?>
867+
<?php endif ?>
868868
<?php endif ?>
869869

870870

cookbook/security/form_login.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ redirect to the URL defined by some ``account`` route, use the following:
213213
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
214214
<?php if ($error): ?>
215215
<div><?php echo $error->getMessage() ?></div>
216-
<?php endif; ?>
216+
<?php endif ?>
217217

218218
<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
219219
<label for="username">Username:</label>

cookbook/security/impersonating_user.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ to show a link to exit impersonation:
8484
>
8585
Exit impersonation
8686
</a>
87-
<?php endif; ?>
87+
<?php endif ?>
8888

8989
Of course, this feature needs to be made available to a small group of users.
9090
By default, access is restricted to users having the ``ROLE_ALLOWED_TO_SWITCH``

cookbook/security/remember_me.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ might ultimately looks like this:
9090
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
9191
<?php if ($error): ?>
9292
<div><?php echo $error->getMessage() ?></div>
93-
<?php endif; ?>
93+
<?php endif ?>
9494

9595
<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
9696
<label for="username">Username:</label>

reference/forms/types/collection.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ A much more flexible method would look like this:
101101
<?php echo $view['form']->errors($emailField) ?>
102102
<?php echo $view['form']->widget($emailField) ?>
103103
</li>
104-
<?php endforeach; ?>
104+
<?php endforeach ?>
105105
</ul>
106106

107107
In both cases, no input fields would render unless your ``emails`` data array

0 commit comments

Comments
 (0)