-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Iterable return types should return empty array by default
- Loading branch information
1 parent
c3d9624
commit 73e9d2b
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...nd-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Iterable return types should return empty array by default | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
interface Foo | ||
{ | ||
public function forTraversable(): traversable; | ||
public function forGenerator(): Generator; | ||
public function forIterable(): iterable; | ||
} | ||
|
||
require __DIR__ . '/../../../../vendor/autoload.php'; | ||
|
||
$generator = new \PHPUnit\Framework\MockObject\Generator; | ||
|
||
$mock = $generator->getMock('Foo'); | ||
|
||
var_dump(iterator_to_array($mock->forTraversable())); | ||
var_dump(iterator_to_array($mock->forGenerator())); | ||
var_dump(iterator_to_array($mock->forIterable())); | ||
--EXPECTF-- | ||
array(0) { | ||
} | ||
array(0) { | ||
} | ||
array(0) { | ||
} |