Run PHPCompatibility on PHP 7.2 and higher

Error message:

++ phpcs_to_use=vendor/bin/phpcs
++ vendor/bin/phpcs --version
PHP_CodeSniffer version 3.7.2 (stable) by Squiz (http://www.squiz.net)
++ vendor/bin/phpcs --extensions=php '--ignore=*/vendor/*' --standard=tests/ruleset.xml -p -s .
W...........................................................  60 / 116 (52%)
........................................................     116 / 116 (100%)

FILE: ...me/runner/work/php-curl-class/php-curl-class/examples/custom.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | WARNING | IMPORTANT: Please be advised that for the most
   |         | reliable PHPCompatibility results, PHP 7.2 or higher
   |         | should be used. Support for lower versions will be
   |         | dropped in the foreseeable future. You are currently
   |         | using PHP 7.0.33-65+ubuntu22.04.1+deb.sury.org+1.
   |         | Please upgrade your PHP installation to version 7.2 or
   |         | higher.
   |         |
   |         | To disable this notice, add
   |         | --exclude=PHPCompatibility.Upgrade.LowPHP to your
   |         | command or add <exclude
   |         | name="PHPCompatibility.Upgrade.LowPHP.BelowRecommended_7_2"/>
   |         | to your custom ruleset.
   |         |
   |         | Thank you for using PHPCompatibility!
   |         | (PHPCompatibility.Upgrade.LowPHP.BelowRecommended_7_2)
----------------------------------------------------------------------
This commit is contained in:
Zach Borboa
2023-05-20 10:41:23 -07:00
parent d5d3fd9f7b
commit 2a73070caf
+23 -17
View File
@@ -132,23 +132,29 @@ if [[ ! -z "${is_null}" ]]; then
errors+=("${result}")
fi
# Determine which phpcs to use.
if [[ -f "vendor/bin/phpcs" ]]; then
phpcs_to_use="vendor/bin/phpcs"
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then :
elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then :
else
phpcs_to_use="phpcs"
fi
# Detect coding standard violations.
"${phpcs_to_use}" --version
"${phpcs_to_use}" \
--extensions="php" \
--ignore="*/vendor/*" \
--standard="tests/ruleset.xml" \
-p \
-s \
.
if [[ "${?}" -ne 0 ]]; then
echo "Error: found coding standard violation(s)"
errors+=("found coding standard violation(s)")
# Determine which phpcs to use.
if [[ -f "vendor/bin/phpcs" ]]; then
phpcs_to_use="vendor/bin/phpcs"
else
phpcs_to_use="phpcs"
fi
# Detect coding standard violations.
"${phpcs_to_use}" --version
"${phpcs_to_use}" \
--extensions="php" \
--ignore="*/vendor/*" \
--standard="tests/ruleset.xml" \
-p \
-s \
.
if [[ "${?}" -ne 0 ]]; then
echo "Error: found coding standard violation(s)"
errors+=("found coding standard violation(s)")
fi
fi