source: src/router/php7/Zend/tests/generators/generator_with_type_check_2.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 537 bytes
Line 
1--TEST--
2Generator wit type check
3--FILE--
4<?php
5function gen(array $a) { yield; }
6try {
7        gen(42);
8} catch (TypeError $e) {
9        echo $e->getMessage()."\n";
10}
11
12try {
13        foreach (gen(42) as $val) {
14                var_dump($val);
15        }
16} catch (TypeError $e) {
17        echo $e->getMessage()."\n";
18}
19?>
20--EXPECTF--
21Argument 1 passed to gen() must be of the type array, integer given, called in %sgenerator_with_type_check_2.php on line 4
22Argument 1 passed to gen() must be of the type array, integer given, called in %sgenerator_with_type_check_2.php on line 10
Note: See TracBrowser for help on using the repository browser.