Closed rizrmd closed 7 years ago
+1
I recently took a look at the tests and found that sorting a string would be this easy:
I am guessing its exactly the same for header formatting, so may I suggest you take a look at the tests yourself? Logically it needs to be tested somehow so thats where I would go first.
closing as @matt-usurp already answered it properly :)
Maybe we should put it on docs, since this functionality will be used often.
On Sat, Nov 26, 2016 at 6:33 PM, Marc Morera notifications@github.com wrote:
closing as @matt-usurp https://github.com/matt-usurp already answered it properly :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mmoreram/php-formatter/issues/23#issuecomment-263058575, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHtXVjU1zwIEMwTWDtrosUasyzOtd5kks5rCBkMgaJpZM4JD2Ug .
-- Thanks, Rizky
The above link is dead. Would be nice to see examples.
This should be the link: https://github.com/mmoreram/php-formatter/blob/master/tests/PHPFormatter/Fixer/UseSortFixerTest.php
Thanks but it's hard to figure out how to use it.
$code = file_get_contents( __DIR__ .'/test-code.php' );
use Mmoreram\PHPFormatter\Fixer\UseSortFixer;
use Mmoreram\PHPFormatter\Fixer\StrictFixer;
$useSortFixer = new UseSortFixer();
print_r($useSortFixer->fix($code));
$strictFixer = new StrictFixer(true);
print_r($strictFixer->fix($code));
But this doesn't seem to fix anything, especially indents.
How do i format php code stored in string?