Skip to content

Commit e5d7a32

Browse files
committed
Fixup
1 parent 91dcc38 commit e5d7a32

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

guide/src/types/iterable.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ that implements the `Traversable` interface. This means that any value that can
1919
# use ext_php_rs::types::Iterable;
2020
#[php_function]
2121
pub fn test_iterable(mut iterable: Iterable) {
22-
for (k, v) in iterable.iter().expect("cannot get iterable") {
23-
println!("k: {} v: {}", k, v.string().unwrap());
22+
for (k, v) in iterable.iter().expect("cannot rewind iterator") {
23+
println!("k: {:?} v: {}", k, v.string().unwrap());
2424
}
2525
}
2626
# fn main() {}
@@ -35,6 +35,7 @@ $generator = function() {
3535
yield 'hello' => 'world';
3636
yield 'rust' => 'php';
3737
yield 'okk';
38+
yield new class {} => new class {};
3839
};
3940

4041
$array = [

guide/src/types/iterator.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ If you want a more universal `iterable` type that also supports arrays, see [Ite
2222
# use ext_php_rs::types::ZendIterator;
2323
#[php_function]
2424
pub fn test_iterator(iterator: &mut ZendIterator) {
25-
for (k, v) in iterator.iter().expect("cannot get iterator") {
26-
println!("k: {} v: {}", k, v.string().unwrap());
25+
for (k, v) in iterator.iter().expect("cannot rewind iterator") {
26+
println!("k: {:?} v: {}", k, v.string().unwrap());
2727
}
2828
}
2929
# fn main() {}
@@ -38,6 +38,7 @@ $generator = function() {
3838
yield 'hello' => 'world';
3939
yield 'rust' => 'php';
4040
yield 'okk';
41+
yield new class {} => new class {};
4142
};
4243

4344
test_iterator($generator());

src/flags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl Display for DataType {
395395
mod tests {
396396
use super::DataType;
397397
use crate::ffi::{
398-
IS_ARRAY, IS_ARRAY_EX, IS_CALLABLE, IS_CONSTANT_AST, IS_CONSTANT_AST_EX, IS_DOUBLE,
398+
IS_ARRAY, IS_ARRAY_EX, IS_CONSTANT_AST, IS_CONSTANT_AST_EX, IS_DOUBLE,
399399
IS_FALSE, IS_INDIRECT, IS_INTERNED_STRING_EX, IS_LONG, IS_NULL, IS_OBJECT, IS_OBJECT_EX,
400400
IS_PTR, IS_REFERENCE, IS_REFERENCE_EX, IS_RESOURCE, IS_RESOURCE_EX, IS_STRING,
401401
IS_STRING_EX, IS_TRUE, IS_UNDEF, IS_VOID,

src/types/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl ZendHashTable {
523523
///
524524
/// let mut ht = ZendHashTable::new();
525525
///
526-
/// for (key, val) in ht {
526+
/// for (key, val) in ht.iter() {
527527
/// // ^ Index if inserted at an index.
528528
/// // ^ Optional string key, if inserted like a hashtable.
529529
/// // ^ Inserted value.
@@ -648,7 +648,7 @@ impl<'a> IntoIterator for &'a ZendHashTable {
648648
///
649649
/// let mut ht = ZendHashTable::new();
650650
///
651-
/// for (key, val) in ht {
651+
/// for (key, val) in ht.iter() {
652652
/// // ^ Index if inserted at an index.
653653
/// // ^ Optional string key, if inserted like a hashtable.
654654
/// // ^ Inserted value.

src/types/iterator.test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function create_generator() {
44
yield 1;
55
yield 2;
66
yield 3;
7+
yield new class {};
78
}
89

910
class TestIterator implements \Iterator {
@@ -15,6 +16,7 @@ public function current()
1516
0 => 'foo',
1617
1 => 'bar',
1718
2 => 'baz',
19+
3 => new class {},
1820
default => null,
1921
};
2022
}
@@ -30,6 +32,7 @@ public function key()
3032
0 => 'key',
3133
1 => 10,
3234
2 => 2,
35+
3 => new class {},
3336
default => null,
3437
};
3538
}

0 commit comments

Comments
 (0)