Reputation: 2828
I am writing a PHP command line app which generates some PHP code and wants to pass it thought the code style fixer before storing it to a file.
Is it possible to use php-cs-fixer as a library and call it from the code ?
If no, is there any other solution to ensure that the generated code respects the PSR-2 standard ?
Thanks,
Upvotes: 2
Views: 1199
Reputation: 410
I think the easiest way is to:
Application::
setAutoExit(false).Application:run()
with ArrayInput
and BufferedOutput
and check return value (should be zero).Or just shell_exec
a whole command with its arguments.
Upvotes: 1