Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

Commit 8673f09

Browse files
committed
Merge pull request #11 from mfn/array-without-types-tests
tests: type information removed from typed arrays
2 parents 7f7bed4 + 398cf7a commit 8673f09

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/Fixtures/array_no_types.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
# Typed arrays get simply converted to array
3+
/**
4+
* @param int[] $ints
5+
* @param string[] $strings
6+
* @param Foo[] $someClasses
7+
* @return float[]
8+
*/
9+
function array_no_types($ints, $strings, $someClasses) {
10+
}

tests/test.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,24 @@ function param_no_type($noType)
237237
, $converter->convert($project, $file));
238238
}
239239

240+
$projectFactory = ProjectFactory::createInstance();
241+
$project = $projectFactory->create('paramNoType', [__DIR__.'/Fixtures/array_no_types.php']);
242+
243+
foreach ($project->getFiles() as $path => $file) {
244+
$expected = <<<'PHP'
245+
<?php
246+
# Typed arrays get simply converted to array
247+
/**
248+
* @param int[] $ints
249+
* @param string[] $strings
250+
* @param Foo[] $someClasses
251+
* @return float[]
252+
*/
253+
function array_no_types(array $ints, array $strings, array $someClasses) : array{
254+
}
255+
256+
PHP;
257+
same($expected, $converter->convert($project, $file));
258+
}
259+
240260
echo 'Good job! Everything is fine.'.PHP_EOL;

0 commit comments

Comments
 (0)