driade / phpfmt8

PHP formatter for Sublime Text 4, with PHP 8 support.
BSD 3-Clause "New" or "Revised" License
46 stars 2 forks source link

auto format stops working when using the following sintax #12

Closed mpmont closed 1 year ago

mpmont commented 1 year ago

Using typed functions where I want a fallback return or the params will have more than one type it does not work.

Example:

protected function allData(object|null $proposal): object|null
{
    return $proposal;
}

Basically it says that I have a syntax error and it does not run the auto format in this file.

My current local PHP version being used by FMT is the following:

php -v
PHP 8.2.2 (cli) (built: Feb  1 2023 08:33:04) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.2, Copyright (c) Zend Technologies
driade commented 1 year ago

Hi. I can't reproduce the issue. The message you're obtaining seems to comes from another plugin or place, if phpfmt hasn't changed your code (I've tried your sample with php 8.2 and it doesn't).

I cannot find the option "check php file on save" in phpfmt. I've it activated too somewhere in my own SublimeText...

driade commented 1 year ago

Please be aware that the phpbin option at the phpfmt config should be 8.2 in this case

mpmont commented 1 year ago

Yeah, let's close this one. I still had my config pointing to the php 7 that was used by the old plugin.