Skip to content

Commit fd90697

Browse files
authored
[Sync-En] foreach: objects do not have to be Traversable (#3463)
Translation of php/doc-en#4535 (commit 0d9947f): any object can be iterated, so the intro no longer restricts foreach to Traversable objects, the operand is a value rather than an iterable, and a sentence states that an object is traversed over its visible properties by default. EN-Revision updated.
1 parent ae13566 commit fd90697

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

language/control-structures/foreach.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- EN-Revision: e674990649cd2b111b8dd1175a7a1befcc621635 Maintainer: lacatoire Status: ready -->
2+
<!-- EN-Revision: 0d9947f2b1f0997cd8ddf80227b632dd5d3f2f92 Maintainer: lacatoire Status: ready -->
33

44
<sect1 xml:id="control-structures.foreach" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<title>foreach</title>
66
<?phpdoc print-version-for="foreach"?>
77
<para>
88
La structure de langage <literal>foreach</literal> fournit une façon simple de
9-
parcourir des <type>array</type> et objets <interfacename>Traversable</interfacename>.
9+
parcourir des <type>array</type> et des objets.
1010
<literal>foreach</literal> générera une erreur lorsqu'il est utilisé avec
1111
une variable contenant un type de données différent ou avec une variable non initialisée.
1212
<informalexample>
@@ -27,7 +27,7 @@ foreach (iterable_expression as $key => $value) {
2727
</informalexample>
2828
</para>
2929
<simpara>
30-
La première forme passe en revue le tableau
30+
La première forme parcourt la valeur donnée par
3131
<literal>iterable_expression</literal>. À chaque itération, la valeur de
3232
l'élément courant est assignée à <literal>$value</literal>.
3333
</simpara>
@@ -41,7 +41,9 @@ foreach (iterable_expression as $key => $value) {
4141
<function>current</function> et <function>key</function>.
4242
</simpara>
4343
<simpara>
44-
Il est possible de personnaliser
44+
Par défaut, un objet est parcouru sur ses propriétés
45+
<link linkend="language.oop5.visibility">visibles</link> depuis la portée
46+
courante. Il est possible de personnaliser
4547
<link linkend="language.oop5.iterations">l'itération sur des objets</link>.
4648
</simpara>
4749

0 commit comments

Comments
 (0)