Форматирование работает только для файлов PHP в корне моего проекта. Но форматирование для всех других файлов PHP не работает при сохранении, показывая эту ошибку: Не удалось прочитать файл «composer.json».
- Я установил friendsofphp/php-cs-fixer через Composer
- Я установил расширение VSCode
- Я настроил VSCode:
"editor.defaultFormatter": "junstyle.php-cs-fixer"
},
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
"php-cs-fixer.onsave": true,
- Я создал файл .php-cs-fixer.dist.php
Команда выполнения:
runAsync: spawn /Users/gaylord/Sites/Wololofit/vendor/bin/php-cs-fixer [ "fix", "--using-cache=no", "--format=json", "--config=/Users/gaylord/Sites/Wololofit/.php-cs-fixer.dist.php", "--path-mode=override", "/var/folders/63/0zb3ydl94019ltb0j8nvgh1m0000gn/T/pcf-tmp0.12240732959634248/Forum.php" ] { "cwd": "/Users/gaylord/Sites/Wololofit/src/Entity", "shell": false }
Сведения об ошибке:
runAsync: error {
"exitCode": 1,
"stdout": null,
"stderr": "Unable to determine minimum PHP version supported by your project from composer.json: Failed to read file \"composer.json\".\nIf you need help while solving warnings, ask at https://github.com/PHP-CS-Fixer/PHP-CS- ... scussions/, we will help you!\n\nPHP CS Fixer 3.92.2 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors.\nPHP runtime: 8.5.0\nLoaded config default from \"/Users/gaylord/Sites/Wololofit/.php-cs-fixer.dist.php\".\nRunning analysis on 11 cores with 10 files per process.\nParallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!\nPaths from configuration have been overridden by paths provided as command arguments.\n\nIn ComposerJsonReader.php line 69:\n \n Failed to read file \"composer.json\". \n \n\nfix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--allow-unsupported-php-version ALLOW-UNSUPPORTED-PHP-VERSION] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [...]\n\n"
}
Сообщение об отказе от обещания:
runAsync: reject promise Unable to determine minimum PHP version supported by your project from composer.json: Failed to read file "composer.json". If you need help while solving warnings, ask at https://github.com/PHP-CS-Fixer/PHP-CS- ... scussions/, we will help you!
PHP CS Fixer 3.92.2 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors. PHP runtime: 8.5.0 Loaded config default from "/Users/gaylord/Sites/Wololofit/.php-cs-fixer.dist.php". Running analysis on 11 cores with 10 files per process. Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated! Paths from configuration have been overridden by paths provided as command arguments.
In ComposerJsonReader.php line 69:
Failed to read file "composer.json".
fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--allow-unsupported-php-version ALLOW-UNSUPPORTED-PHP-VERSION] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [...]
Подробнее здесь: https://stackoverflow.com/questions/798 ... composer-j
Мобильная версия