Skip to content
New issue

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

Stuck formating with php 7.4 from xampp stack #69

Open
arcanisgk opened this issue May 21, 2020 · 6 comments
Open

Stuck formating with php 7.4 from xampp stack #69

arcanisgk opened this issue May 21, 2020 · 6 comments

Comments

@arcanisgk
Copy link

arcanisgk commented May 21, 2020

i have updated version of xampp Stack in my Dev PC
old version is php 7.2
and actual php 7.4.6 version
when i try to formating with php 7.4.6 from xampp stack Sublime Text 3 is Stuck
i cant find any information in my PC to check around this stuck.

{
	"enable_auto_align": true,
	"format_on_save": false,
	"indent_with_space": 4,
	"php_bin": "C:/xampp/php/php.exe",
	"psr1": false,
	"psr2": false,
	"version": 4
}
@yoriadiatma
Copy link

Same here, I also have the same problem after installing php 7.4.6.
Solution for a while installing a standalone PHP 7.2 in a separate directory and ensure php_bin parameter is pointed to this standalone installation.

@driade
Copy link

driade commented Jun 12, 2020

I can't too make it work properly when formatting

...
public array $ar = [];
...

in php 7.4. I get this with psr2 = true

arrayprotected $fillable = [

so it breaks the code

@driade
Copy link

driade commented Jun 12, 2020

I can't too make it work properly when formatting

...
public array $ar = [];
...

in php 7.4. I get this with psr2 = true

arrayprotected $fillable = [

so it breaks the code

For if someones gets here with the same problem, add

"excludes": [
        "PSR2ModifierVisibilityStaticOrder"
],

to your phpfmt.sublime-settings and you're done. This rule is the one that will make you get into this error.

@arcanisgk
Copy link
Author

not work for me

@arcanisgk
Copy link
Author

i solve it downloading older version of php from:

https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.2.31/

xampp-portable-windows-x64-7.2.31-1-VC15.zip

Extranting only the php folder and renaming Like this:

image

and configure like this:

{
	"enable_auto_align": true,
	"format_on_save": false,
	"indent_with_space": 4,
	"php_bin": "C:/xampp/php72/php.exe",
	"psr0": true,
	"psr1": false,
	"psr2": true,
	"psr4": true,
	"version": 4
}

image

And if you whant to run diferent Version of php; my recomendation:

you must edit your apache httpd-xampp.conf; and add this to the end for every non-pre-installed version

ScriptAlias /php72 "C:/xampp/php72"
Action application/x-httpd-php72-cgi /php72/php-cgi.exe
<Directory "C:/xampp/php72">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

Additional you must create Virtual Host, must edit httpd-vhosts.conf; and add at the end the new folder or path of the host; and the right settings:

<VirtualHost *:80>
	ServerAdmin [email protected]
	DocumentRoot "\xampp\htdocs\new\path"
	ServerName test.url
	ServerAlias *.test.url
	<Directory "\xampp\htdocs\new\path">
		Options Indexes	
		AllowOverride All
		Require all granted
		Allow from all
	</Directory>
	<FilesMatch "\.php$">
        SetHandler application/x-httpd-php72-cgi
    </FilesMatch>
</VirtualHost>

Remember that if you do not have a registered domain you will also have to edit the file host and add it if it is local.

C:\Windows\System32\drivers\etc

127.0.0.1	www.test.url
127.0.0.1	test.url

I am writing code in 3 different projects:
By default php 7.4.6 is used without having to add SetHandler configurations on virtual host and for the other two that if needed use php 5.6.36 and 7.2.31

@WhereJuly
Copy link

WhereJuly commented Feb 13, 2021

I had an issue with phpfmt removing my PHP 7.4 typed properties visibility modifiers.

Before formatting it was private Collection $topLevelCategories;. After: Collection $topLevelCategories; which is definitely not a correct PHP code. Thanks to @driade ansver above the fix he gave worked great in my case too.

Namely add the following setting to your phpfmt.sublime-settings (Menu->Preferences->Package settings->phpfmt->Settings-User):

"excludes": [
        "PSR2ModifierVisibilityStaticOrder"
],

I could not find any dolution re this typed properties phpfmt issue so I just keep it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants