Closed
Description
Symfony version(s) affected
^5.0
Description
The type-hints that were added in 5.x for the methods in Filesystem prevent us from passing resources because the file
-parameter is now type-hinted as string. It used to deal with resources before this change and even the phpdoc for the methods still mention the possibility to pass resources.
Support for resources was added in #29661
How to reproduce
$fs = new Filesystem();
$fs->appendToFile(
fopen('php://stderr', 'w'),
"We're logging an error!" . \PHP_EOL,
false,
);
Possible Solution
No response
Additional Context
My initial goal was to 'appendToFile' to file php://stderr
, but on Windows that breaks on the call to mkdir().
As an alternative I tried to pass fopen('php://stderr', 'w')
as a file, but then I hit the typehint restriction.
It's basically two different issues:
- Stuff breaking when file is
php://stderr
. I should probably be able to pass this as a file. - Typehints preventing us from passing resources