We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice if the methods inside the Filesystem class were all static, so you can call them without having to create an instance of that class.
Having to construct the class has no real benefit, it has no state inside the class
// Instead of this $fs = new Filesystem(); $fs->mkdir('foo'); // Or (new Filesystem)->mkdir('foo'); // do directly this Filesystem::mkdir('foo');
The text was updated successfully, but these errors were encountered:
One of the reason why we have the Filesystem component is enabling mocking. Static calls would defeat that.
Sorry, something went wrong.
Beyond the initial intention, there are many places where the Filesystem class is used without dependency injection.
Filesystem
Even in our Kernel and FrameworkExtension classes
Kernel
FrameworkExtension
symfony/src/Symfony/Component/HttpKernel/Kernel.php
Line 528 in db8e84d
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Line 3487 in db8e84d
Castor has the fs() function to access the Filesystem instance from it's global registry (its Container class)
fs()
Container
The filesystem could be handled the same way we work with the Clock: have a default global instance that can be replaced if necessary with a mock.
Clock
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Description
It would be nice if the methods inside the Filesystem class were all static, so you can call them without having to create an instance of that class.
Having to construct the class has no real benefit, it has no state inside the class
Example
The text was updated successfully, but these errors were encountered: