Closed yinsee closed 2 months ago
similarly,
function globaltest () {
print ''. PHP_EOL;
}
becomes
public function globaltest () {
print ''. PHP_EOL;
}
which also gives error when this is not a class method.
Hi, good morning. I can't reproduce with my config. Can you please share yours so I can see the transformers applied?
Thanks.
i am using phpfmt vscode extension v1.1.24
i only have this 2 turned on in settings
"phpfmt.smart_linebreak_after_curly": true,
"phpfmt.visibility_order": true,
I'm sorry I can't reproduce it. I'd suggest to remove the extension and reinstall it again, so we can be sure you've the latest version.
same problem v1.1.27 with default settings
php -v
PHP 8.2.12 (cli) (built: Oct 24 2023 19:22:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
May you please execute "phpfmt > Open Output", then format the file, and paste here the command executed? Something like
19:37:51.777 [INFO] Executing command: php "/Users/davidfernandez/.vscode/extensions/kokororin.vscode-phpfmt-1.1.24/node_modules/phpfmt/v2/fmt.stub.php" --indent_with_space=4 --visibility_order --smart_linebreak_after_curly "/var/folders/24/xvl5njxx7m1g94hsg7436knw0000gn/T/temp-qqfrym-a.php"
Its reproduced when file include class
<?php
namespace Test;
function F()
{
}
class A
{
}
Executing command: php "/home/d-enk/.vscode/extensions/kokororin.vscode-phpfmt-1.1.27/node_modules/phpfmt/v2/fmt.stub.php" --psr2 --indent_with_space=4 --exclude=DoubleToSingleQuote,OrderAndRemoveUseClauses "/tmp/temp-haezevt-test.php"
Thanks @d-enk I've been able to reproduce the bug with your latest example.
Hello again, this should be already fixed. Please update to the latest version and kindly tell me if you find it fixed.
Thanks!
@yinsee may you please close the issue? Thanks!
hello @driade It's not fixed yet. I am useing php 8.1 and phpfmt is latest v1.1.34
@hellohasan sorry I can't reproduce the issue. Would you please share your config? Thanks.
hello @driade
this is my settings:
@hellohasan thanks, would that be possible for you to paste it in text format?
@driade
"phpfmt.passes": [
"AlignDoubleArrow",
"AlignDoubleSlashComments",
"ShortArray",
"MergeElseIf",
"SpaceBetweenMethods",
"AutoSemicolon",
"GeneratePHPDoc",
"IndentTernaryConditions",
"ReplaceBooleanAndOr",
"ReindentSwitchBlocks",
"NewLineBeforeReturn",
"OrderAndRemoveUseClauses",
"SortUseNameSpace",
"RemoveUseLeadingSlash"
],
"phpfmt.exclude": [
"AllmanStyleBraces",
"StripNewlineWithinClassBody",
"NewLineBeforeReturn"
],
"phpfmt.psr2": true,
Thank you. I'm sorry, I'm unable to reproduce, here you've a video. May I suggest removing and installing the extension?
https://github.com/kokororin/vscode-phpfmt/assets/5692232/9717aabb-f921-4d50-8a3f-db700348147c
@yinsee Hello sir, How did you fix your issue, I am also facing the same type of issue in laravel route.php file
@driade
As in my previous reproducer, add class C {}
to file
<?php
function f()
{}
class C {}
f(function () {
});
Thank you @d-enk this should be already fixed in the latest release. May you please confirm?
@hellohasan did you finally got why it was failing?
Hi again @hellohasan I was able to reproduce the error. It should now be fixed in the latest release. May you please confirm?
gets formatted to
which causes syntax error.