docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

PhpStorm can't read a ruleset file for the PHP CS Fixer

Open szymongalecki opened this issue 1 year ago • 2 comments

Description I followed the tutorial and went with the automated one line setup. All of the described steps worked for me apart from properly setting up the PHP CS Fixer. I am using an M1 Macbook, Magento 2.4.7 and PHP 8.3.6.

Steps To Reproduce

  1. curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- magento.test 2.4.7 community
  2. bin/magento sampledata:deploy
  3. bin/magento setup:upgrade
  4. Successfully setup PHP CodeSniffer using steps described in tutorial
  5. Setup PHP CS Fixer using steps described in tutorial
  6. Selected path for the ruleset results in throwing an error <MyComputer>/Magento/src/.php-cs-fixer.dist.php

Expected Result PHP CS Fixer is properly setup and functional.

Actual Result PHP CS Fixer does not work, PhpStorm throws an error. I can see that there is a space in front of the dotfile but it is only visible in the error message but it is not present in the path for the ruleset : <MyComputer>/Magento/src/.php-cs-fixer.dist.php

PHP CS Fixer: PHP CS Fixer 3.64.0 Space Sets by Fabien Potencier, Dariusz Ruminski and contributors. 
PHP runtime: 8.3.6

In ConfigurationResolver.php line 554:  
[PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)] 
Cannot read config file "<MyComputer>/Magento/src/ .php-cs-fixer.dist.php".   

Exception trace: 
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:554 PhpCsFixer\Console\ConfigurationResolver->computeConfigFiles() 
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:252 PhpCsFixer\Console\ConfigurationResolver->getConfig() 
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:283 PhpCsFixer\Console\ConfigurationResolver->getParallelConfig() 
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php:264

szymongalecki avatar Oct 24 '24 10:10 szymongalecki

I have the same problem on a Macbook M4 Pro. Any updates?

PHP CS Fixer: PHP CS Fixer 3.65.0 Persian Successor by Fabien Potencier, Dariusz Ruminski, and contributors.  
PHP runtime: 8.3.14  

In ConfigurationResolver.php line 554:  

[PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]  
Cannot read config file  

Exception trace:  
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:554  
PhpCsFixer\Console\ConfigurationResolver->computeConfigFiles()  
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:252  
PhpCsFixer\Console\ConfigurationResolver->getConfig()  
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:283  
PhpCsFixer\Console\ConfigurationResolver->getParallelConfig()  
at /var/www/html/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php:262

PCodrin avatar Dec 27 '24 21:12 PCodrin

I'm going to create some new video lessons for setting things up in PhpStorm, as JetBrains has changed a ton of things with their UI over the last couple years.

I'll leave this ticket open until I do so, and will post links to the lessons as soon as they are up. I don't think much if anything has actually changed, but their UI updates make things really confusing.

markshust avatar Mar 25 '25 19:03 markshust