-
Notifications
You must be signed in to change notification settings - Fork 146
Add support for PHP 8. #375
base: main
Are you sure you want to change the base?
Conversation
Hi @whyisjake! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Add support for PHP 8.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
PHP 8.1 generates a deprecation notice: > strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated This changes the `null` to an empty string if it hasn't been set.
Fix strpos() deprecation notice
PHP 8.2 generates a deprecation notice: > mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead So this removes the use of the function and uses the existing fallback, albeit with use of htmlentities() as well.
Remove mb_convert_encoding() for HTML entities
PHP 8.2 generates a deprecation notice: > mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead This applies the correct fix, as per the suggestion at https://php.watch/versions/8.2/mbstring-qprint-base64-uuencode-html-entities-deprecated#html
Revert and fix transformation
With it in `require`, any consuming package running `composer i --no-dev` will still get all of the PHPCS-related packages installed.
Move the dev dependency to require-dev
This restores the original code that caused the PHP 8.2 deprecation notice, because the other native functions all tend to do something slightly different.
Passing null to parameter #2 ($string) of type string is deprecated.
Let's do it live.