php-stubs-generator icon indicating copy to clipboard operation
php-stubs-generator copied to clipboard

Error when appending a single file

Open kimhf opened this issue 5 years ago • 1 comments

I have issues when trying to add a single file to the finder like this:

return \StubsGenerator\Finder::create()->append(['dir/file.php']);

and get the following error:

Fatal error: Uncaught Error: Call to undefined method SplFileInfo::getContents() in ...\vendor\giacocorsiglia\stubs-generator\src\StubsGenerator.php:123
Stack trace:
#0 ...\vendor\giacocorsiglia\stubs-generator\src\GenerateStubsCommand.php(103): StubsGenerator\StubsGenerator->generate(Object(StubsGenerator\Finder))
#1 ...\vendor\symfony\console\Command\Command.php(255): StubsGenerator\GenerateStubsCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 ...\vendor\symfony\console\Application.php(934): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 ...\vendor\symfony\console\Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(StubsGenerator\GenerateStubsCommand), Object( in ...\vendor\giacocorsiglia\stubs-generator\src\StubsGenerator.php on line 123

kimhf avatar Oct 26 '19 16:10 kimhf

Thanks for reporting this! I've got to say this seems like a problem with the Symfony Finder class? This page suggests that the Finder should always return instances of Symfony's SplFileInfo subclass, but obviously that isn't happening here.

GiacoCorsiglia avatar Nov 13 '19 03:11 GiacoCorsiglia