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

npx prettier . --check doesn't check php files #2253

Closed
martijngastkemper opened this issue Oct 4, 2023 · 3 comments
Closed

npx prettier . --check doesn't check php files #2253

martijngastkemper opened this issue Oct 4, 2023 · 3 comments

Comments

@martijngastkemper
Copy link

martijngastkemper commented Oct 4, 2023

Prettier 3.0.3

PHP Plugin 0.20.1

Input:

npx prettier . --check

Output:

All matched files use Prettier code style!

Expected behavior:

An error about a PHP file. I've added a PHP file that doesn't match the code style:

<?php $bar = function(string $foo) { return $foo; }; echo $bar('bla'); 

When I run npx prettier **/* --check it does give a warning about this test file. . --check does work for javascript, CSS, and other files. I can't find anything in the Prettier 3 release notes and the plugin-php documentation about this changed behavior since Prettier 2.

Does anyone know what I'm doing wrong?

@skyeewers
Copy link

skyeewers commented Nov 7, 2023

Seeing the same issue with a fresh install of prettier and prettier-php here!
If I point npx prettier --check ./sites/templates (templates being a directory that only contains PHP files) I'm getting a warning that the directory contains no files the could be checked with prettier.

This appears to be a new behavior since the prettier 3 upgrade. If I drop my version requirements in my package.json to the following the plugin behaves as intended.

{ "prettier": "^2.8.4", "@prettier/plugin-php": "^0.19.7", }

Halp? 🥺

@czosel
Copy link
Collaborator

czosel commented Nov 7, 2023

The reason for this is most likely that you're either missing the PHP plugin, or you're not specifying that it should be used explicitly (the "plugin search" feature has been removed in Prettier v3, see #2215 for details).

@fisker fisker closed this as completed Nov 27, 2023
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