Skip to content

Instantly share code, notes, and snippets.

@hrach
Last active April 11, 2017 10:35
Show Gist options
  • Save hrach/8919c9296e14e5455490 to your computer and use it in GitHub Desktop.
Save hrach/8919c9296e14e5455490 to your computer and use it in GitHub Desktop.
Dynamic Return Type

HowTo

  • nainstaluj plugin DynamicReturnType
  • do projektu přidej soubor dynamicReturnTypeMeta.json.
  • soubor bohužel musí být v projektu, proto doporučujeme složku .idea
  • zační používat a IDE začne napovídat.
$foo = Mockery::mock(Nette\Caching\IStorage::class);
$foo->... // napoví MockInterface i metody IStorage

$bar = $container->getByType(Nette\Caching\IStorage::class);
$bar->... // napoví metody IStorage
{
"methodCalls": [
{
"class": "\\Mockery",
"method": "mock",
"position": 0,
"mask": "%s|\\Mockery\\MockInterface"
},
{
"class": "\\Nette\\DI\\Container",
"method": "getByType",
"position": 0
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment