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

When using in package mode, phpcompatibility/php-compatibility version used is 9.3.5 #52

Open
1 task done
pabamato opened this issue Dec 19, 2023 · 2 comments
Open
1 task done

Comments

@pabamato
Copy link
Contributor

Describe the bug

If you clone the project and run composer install, it installs phpcompatibility/php-compatibility dev-develop which has the latest PHP sniffs.
image

But when is installed via package in a project, is still using phpcompatibility/php-compatibility 9.3.5:
image

As a temp fix I added, the alias to my project:
composer require --dev phpcompatibility/php-compatibility:"dev-develop as 9.99.99"

image

Steps to Reproduce

#create composer project
composer init

#create a file for testing
testphpcs 2023-12-19 16-44-33
2.

# require latest phpcs-composer
composer require --dev 10up/phpcs-composer:"^3.0"
# show current insalled version
composer show --tree phpcompatibility/php-compatibility
# run phpcs in a very basic file -> no deprecation found for PHP 8.2
./vendor/bin/phpcs test_php_8_2.php  --standard="10up-Default"
# require the develop branch of phpcompatibility/php-compatibility as an alias in your project
composer require --dev phpcompatibility/php-compatibility:"dev-develop as 9.99.99"
# show current insalled version
# should be phpcompatibility/php-compatibility dev-develop
composer show --tree phpcompatibility/php-compatibility
# run phpcs again -> should flag about utf8_encode()
./vendor/bin/phpcs test_php_8_2.php  --standard="10up-Default"
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 8 | WARNING | Function utf8_encode() is deprecated since PHP 8.2; Use mb_convert_encoding(), UConverter::transcode() or iconv instead
---------------------------------------------------------------------------------------------------------------------------------------

Screenshots, screen recording, code snippet

testphpcs 2023-12-19 16-55-03
testphpcs 2023-12-19 16-55-35

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@darylldoyle
Copy link
Collaborator

Thanks for flagging this @pabamato!

I've managed to replicate this issue, but can't seem to find a way to resolve it 🤔
Do you have any thoughts here? The other option is that we add the following to the installation instructions until v10 of PHPCompatibility and V3 of PHPCompatibilityWP are released, which would resolve this issue.

composer require --dev phpcompatibility/php-compatibility:"dev-develop as 9.99.99"

@pabamato
Copy link
Contributor Author

Hi @darylldoyle, thanks for checking. I'm not sure we can resolve the issue without requiring the package at the project level. The proposed solution works for me.

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

2 participants