diff --git a/.github/workflows/codeigniter.yml b/.github/workflows/codeigniter.yml index 57c6dbaf3..50623c5c1 100644 --- a/.github/workflows/codeigniter.yml +++ b/.github/workflows/codeigniter.yml @@ -10,11 +10,51 @@ on: pull_request: branches: [ master, devel ] jobs: + required_php_versions: + name: Get PHP versions to test + runs-on: ubuntu-latest + outputs: + php_versions: ${{ steps.php_ver_step.outputs.PHP_VERSIONS }} + php_versions_matrix: ${{ steps.php_ver_step.outputs.PHP_VERSIONS_matrix }} + steps: + - name: Install required packages + run: | + if ! command -v jq; then sudo apt-get update && sudo apt-get install -y jq; fi + - name: Build PHP_VERSIONS array & PHP_VERSIONS_matrix + id: php_ver_step + run: | + set -x + + # Set array that will store the PHP versions for which we create a package. + PHP_VERSIONS=() + + # Get all released php versions above 5.6 (in the format X.Y) + for upstream_ver in $(curl https://www.php.net/releases/?json | jq -r '.[].version' | cut -f -2 -d .); do + major=$(cut -f 1 -d . <<< "$upstream_ver") + for minor in {0..20}; do + if dpkg --compare-versions ${major}.$minor le $upstream_ver && dpkg --compare-versions ${major}.$minor ge 5.6; then + PHP_VERSIONS+=("${major}.$minor") + fi + done + done + + PHP_VERSIONS_matrix=$(sed 's/\ /", "/g' <<< [\"${PHP_VERSIONS[*]}\"]) + + echo "PHP_VERSIONS=${PHP_VERSIONS[*]}" >> "$GITHUB_OUTPUT" + echo "PHP_VERSIONS_matrix=$PHP_VERSIONS_matrix" >> "$GITHUB_OUTPUT" + + echo "PHP_VERSIONS=${PHP_VERSIONS[*]}" + echo "PHP_VERSIONS_matrix=$PHP_VERSIONS_matrix" + test: + continue-on-error: false + needs: [ required_php_versions ] strategy: + fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['7.2'] + #php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ${{fromJson(needs.required_php_versions.outputs.php_versions_matrix)}} runs-on: ${{ matrix.operating-system }} steps: - name: Checkout @@ -59,6 +99,43 @@ jobs: args: -O gammu.sql https://raw.githubusercontent.com/gammu/gammu/master/docs/sql/mysql.sql - name: Import Gammu DB Schema run: mysql -h"127.0.0.1" -P"3306" -uroot -ppassword kalkun < gammu.sql + - name: Install/Update ci-phpunit-test + run: | + php vendor/kenjis/ci-phpunit-test/install.php --from-composer + # Workaround a bug in phpunit < 7 where the absence of application/tests/_ci_phpunit_test/ makes it fail + # with strpos(): Empty needle in vendor/phpunit/php-file-iterator/src/Iterator.php + if ! vendor/bin/phpunit --atleast-version 7; then + mkdir -vp application/tests/_ci_phpunit_test + # Below the alternative is to remove the culprit line from phpunit.xml + #sed -i -e "/.\/_ci_phpunit_test\/<\/exclude>/ d" application/tests/phpunit.xml + fi + + # Uncomment the monkey patcher function. This will search the line matching "Enabling Monkey Patching" + # then search the next "/*", delete that line, search the next "*/" and delete the line, write, and quit. + ed -s application/tests/Bootstrap.php <../views/errors|../views|' application/tests/phpunit.xml + + # the void return type of setUp() methods in phpunit (required since phpunit8) isn't supported + # with phpunit <= 6. For these, we remove the ": void" part of the tests + if [ $(composer show phpunit/phpunit | grep "^versions : " | rev | cut -d " " -f 1 | rev | cut -d . -f 1) -le 6 ]; then + sed -i "/public function setUp()/ s/ : void$//" application/tests/controllers/Install_test.php + fi + - name: Test with phpunit run: vendor/bin/phpunit --coverage-text -c application/tests check-code: @@ -89,8 +166,8 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install dependencies run: | - composer update - composer install --no-progress --prefer-dist --optimize-autoloader + composer update --working-dir=utils + composer install --working-dir=utils --no-progress --prefer-dist --optimize-autoloader sudo apt-get update # html-beautify from the debian package doesn't work for some reason # sudo apt-get install -y node-js-beautify @@ -101,14 +178,14 @@ jobs: - id: check_strict_comparison name: Check that strict comparison operators are used everywhere run: | - git checkout composer.lock + #git checkout utils/composer.lock git status utils/fix_code_style.sh strict - id: check_style name: Check that code follows Guidelines if: always() run: | - git checkout composer.lock + #git checkout utils/composer.lock git status utils/fix_code_style.sh git-diff - name: Archive artifacts diff --git a/.gitignore b/.gitignore index 09424aaf2..eabe2c399 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ application/config/database.php /dist /utils/launchpad/dput.cf + +/utils/composer.lock +/utils/vendor/ diff --git a/application/tests/Bootstrap.php b/application/tests/Bootstrap.php index 67473768d..450a8db2c 100644 --- a/application/tests/Bootstrap.php +++ b/application/tests/Bootstrap.php @@ -359,9 +359,9 @@ // All patchers you use. 'patcher_list' => [ 'ExitPatcher', - // 'FunctionPatcher', - // 'MethodPatcher', - // 'ConstantPatcher', + 'FunctionPatcher', + 'MethodPatcher', + 'ConstantPatcher', ], // Additional functions to patch 'functions_to_patch' => [ diff --git a/application/tests/controllers/Install_test.php b/application/tests/controllers/Install_test.php index bc6115682..1b40b42d5 100644 --- a/application/tests/controllers/Install_test.php +++ b/application/tests/controllers/Install_test.php @@ -10,10 +10,21 @@ class Install_test extends TestCase { + private $realAssertStringContainsString; + + public function setUp() : void + { + // Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9 + // Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead. + $this->realAssertStringContainsString = method_exists($this, 'assertStringContainsString') + ? 'assertStringContainsString' + : 'assertContains'; + } + public function test_index() { $output = $this->request('GET', 'install'); - $this->assertContains('Kalkun › Installation', $output); + call_user_func_array(array($this, $this->realAssertStringContainsString), array('Kalkun › Installation', $output)); } public function test_method_404() diff --git a/application/third_party/MX/Controller.php b/application/third_party/MX/Controller.php index 064199ef5..c228243ff 100644 --- a/application/third_party/MX/Controller.php +++ b/application/third_party/MX/Controller.php @@ -39,10 +39,11 @@ class MX_Controller { public $autoload = array(); + private $load; public function __construct() { - $class = str_replace(CI::$APP->config->item('controller_suffix'), '', get_class($this)); + $class = str_replace(strval(CI::$APP->config->item('controller_suffix')), '', get_class($this)); log_message('debug', $class." MX_Controller Initialized"); Modules::$registry[strtolower($class)] = $this; @@ -58,4 +59,4 @@ public function __get($class) { return CI::$APP->$class; } -} \ No newline at end of file +} diff --git a/application/third_party/MX/Loader.php b/application/third_party/MX/Loader.php index 3b67d4fb8..c88d47050 100644 --- a/application/third_party/MX/Loader.php +++ b/application/third_party/MX/Loader.php @@ -37,6 +37,7 @@ class MX_Loader extends CI_Loader { protected $_module; + private $controller; public $_ci_plugins = array(); public $_ci_cached_vars = array(); diff --git a/composer.json b/composer.json index 2874ba47c..ca4383edf 100644 --- a/composer.json +++ b/composer.json @@ -12,25 +12,39 @@ "ext-json": "*", "ext-mbstring": "*", "ext-session": "*", - "codeigniter/framework": ">=3.1.13 <3.2", + "codeigniter/framework": "=3.1.13", "paragonie/random_compat": ">=2", "giggsey/libphonenumber-for-php": "^8.12", "league/csv": "^8.2 || ^9.5", "datto/json-rpc-http": "^4.0 || ^5.0", "kissifrot/php-ixr": "1.8.*", + "cweagans/composer-patches": "~1.0", "econea/nusoap": "^0.9.5.1" }, "require-dev": { - "phpunit/phpunit": "^7", - "kenjis/ci-phpunit-test": "^0.17.3", - "squizlabs/php_codesniffer": "^3.6", - "friendsofphp/php-cs-fixer": "^3.3", - "ise/php-codingstandards-codeigniter": "^1.0" + "phpunit/phpunit": ">=4", + "kenjis/ci-phpunit-test": ">=1" }, "suggest": { "ext-ldap": "For phonebook_ldap plugin", "ext-mysqli": "To connect to a MySQL database", "ext-pgsql": "To connect to a PostgreSQL database", "ext-sqlite3": "To connect to a SQLite3 database" + }, + "extra": { + "patches": { + "codeigniter/framework": { + "Add support for PHP 8.2 (part1)": "patches/Codeigniter_Framework/v3.1.13/10-php82_support.patch", + "Add support for PHP 8.2 (part2)": "patches/Codeigniter_Framework/v3.1.13/10-php82_support-part2.patch" + }, + "kenjis/ci-phpunit-test": { + "Add support for PHP 8.2": "patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch" + } + } + }, + "config": { + "allow-plugins": { + "cweagans/composer-patches": true + } } } diff --git a/patches/Codeigniter_Framework/v3.1.13/10-php82_support-part2.patch b/patches/Codeigniter_Framework/v3.1.13/10-php82_support-part2.patch new file mode 100644 index 000000000..5b4ff0cdf --- /dev/null +++ b/patches/Codeigniter_Framework/v3.1.13/10-php82_support-part2.patch @@ -0,0 +1,20 @@ +From 2fc2d480d0d3fc778a46ded0e093fef7a0d84257 Mon Sep 17 00:00:00 2001 +From: George Petculescu +Date: Fri, 3 Nov 2023 11:59:40 +0200 +Subject: [PATCH] Fixes the usage of `_create_table_if` in Postgres forge class + +--- + system/database/drivers/postgre/postgre_forge.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/system/database/drivers/postgre/postgre_forge.php ++++ b/system/database/drivers/postgre/postgre_forge.php +@@ -87,7 +87,7 @@ + + if (version_compare($this->db->version(), '9.0', '>')) + { +- $this->create_table_if = 'CREATE TABLE IF NOT EXISTS'; ++ $this->_create_table_if = 'CREATE TABLE IF NOT EXISTS'; + } + } + diff --git a/patches/Codeigniter_Framework/v3.1.13/10-php82_support.patch b/patches/Codeigniter_Framework/v3.1.13/10-php82_support.patch new file mode 100644 index 000000000..4457280ac --- /dev/null +++ b/patches/Codeigniter_Framework/v3.1.13/10-php82_support.patch @@ -0,0 +1,123 @@ +From fb1256a5b009b6264fbc85be44e0d97654d3fcd9 Mon Sep 17 00:00:00 2001 +From: George Petculescu +Date: Sun, 6 Nov 2022 16:13:43 +0200 +Subject: [PATCH] Adding PHP 8.2 support + +--- + .github/workflows/test-phpunit.yml | 20 +++++++++++++++++++- + system/core/Loader.php | 1 + + system/core/URI.php | 7 +++++++ + system/database/DB_driver.php | 1 + + system/libraries/Driver.php | 1 + + system/libraries/Table.php | 4 ++-- + tests/codeigniter/core/Loader_test.php | 2 +- + tests/codeigniter/libraries/Upload_test.php | 7 ++++--- + tests/mocks/ci_testcase.php | 1 + + 9 files changed, 37 insertions(+), 7 deletions(-) + +--- a/system/core/Loader.php ++++ b/system/core/Loader.php +@@ -49,6 +49,7 @@ + * @author EllisLab Dev Team + * @link https://codeigniter.com/userguide3/libraries/loader.html + */ ++#[AllowDynamicProperties] + class CI_Loader { + + // All these are set automatically. Don't mess with them. +--- a/system/core/URI.php ++++ b/system/core/URI.php +@@ -52,6 +52,13 @@ + class CI_URI { + + /** ++ * CI_Config instance ++ * ++ * @var CI_Config ++ */ ++ public $config; ++ ++ /** + * List of cached URI segments + * + * @var array +--- a/system/database/DB_driver.php ++++ b/system/database/DB_driver.php +@@ -51,6 +51,7 @@ + * @author EllisLab Dev Team + * @link https://codeigniter.com/userguide3/database/ + */ ++#[AllowDynamicProperties] + abstract class CI_DB_driver { + + /** +--- a/system/libraries/Driver.php ++++ b/system/libraries/Driver.php +@@ -50,6 +50,7 @@ + * @author EllisLab Dev Team + * @link + */ ++#[AllowDynamicProperties] + class CI_Driver_Library { + + /** +--- a/system/libraries/Table.php ++++ b/system/libraries/Table.php +@@ -489,12 +489,12 @@ + return; + } + +- $this->temp = $this->_default_template(); ++ $temp = $this->_default_template(); + foreach (array('table_open', 'thead_open', 'thead_close', 'heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'tbody_open', 'tbody_close', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val) + { + if ( ! isset($this->template[$val])) + { +- $this->template[$val] = $this->temp[$val]; ++ $this->template[$val] = $temp[$val]; + } + } + } +--- a/system/core/Controller.php ++++ b/system/core/Controller.php +@@ -50,6 +50,7 @@ + * @author EllisLab Dev Team + * @link https://codeigniter.com/userguide3/general/controllers.html + */ ++#[AllowDynamicProperties] + class CI_Controller { + + /** +--- a/system/core/Router.php ++++ b/system/core/Router.php +@@ -59,6 +59,13 @@ + public $config; + + /** ++ * CI_URI class object ++ * ++ * @var object ++ */ ++ public $uri; ++ ++ /** + * List of routes + * + * @var array +--- a/system/libraries/Image_lib.php ++++ b/system/libraries/Image_lib.php +@@ -85,6 +85,14 @@ + */ + public $new_image = ''; + ++ ++ /** ++ * Path to destination image ++ * ++ * @var string ++ */ ++ public $dest_image = ''; ++ + /** + * Image width + * diff --git a/patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch b/patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch new file mode 100644 index 000000000..4e75bfdf0 --- /dev/null +++ b/patches/Kenjis_CiPhpunitTest/v3.0.4/support_php-8.2.patch @@ -0,0 +1,10 @@ +--- a/application/tests/_ci_phpunit_test/CIPHPUnitTestCase.php ++++ b/application/tests/_ci_phpunit_test/CIPHPUnitTestCase.php +@@ -21,6 +21,7 @@ + * @property CIPHPUnitTestDouble $double + * @property CIPHPUnitTestReflection $reflection + */ ++#[AllowDynamicProperties] + class CIPHPUnitTestCase extends TestCase + { + protected $_error_reporting = -1; diff --git a/utils/composer.json b/utils/composer.json new file mode 100644 index 000000000..1f421e9a5 --- /dev/null +++ b/utils/composer.json @@ -0,0 +1,7 @@ +{ + "require-dev": { + "friendsofphp/php-cs-fixer": "3.3.*", + "ise/php-codingstandards-codeigniter": "^1.0", + "squizlabs/php_codesniffer": "3.*" + } +} diff --git a/utils/fix_code_style.sh b/utils/fix_code_style.sh index 76d57dfef..0cabd6002 100755 --- a/utils/fix_code_style.sh +++ b/utils/fix_code_style.sh @@ -25,6 +25,8 @@ # # +VENDOR_DIR="utils/vendor" + if [[ "$1" == "git-co" ]]; then DO_GIT_COMMIT=1 DO_GIT_DIFF=0 @@ -57,7 +59,7 @@ fi ############### Check for strict STRICT_COMPARISON operator ######### if [[ "$STRICT_COMPARISON" == "1" ]]; then - vendor/bin/php-cs-fixer fix -v --show-progress=dots --allow-risky=yes --dry-run --diff --config "$CS_FIXER_CONF_DIR/php-cs-fixer-5-strict_comparison.php" > "$DIFF_OUTPUT_DIR/code_style_check-strict_comparison.diff" + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --allow-risky=yes --dry-run --diff --config "$CS_FIXER_CONF_DIR/php-cs-fixer-5-strict_comparison.php" > "$DIFF_OUTPUT_DIR/code_style_check-strict_comparison.diff" EXIT_CODE=$? if [ $EXIT_CODE -eq 8 ] || [ $EXIT_CODE -eq 4 ]; then # 4 - Some files have invalid syntax (only in dry-run mode). @@ -133,7 +135,7 @@ fi # Configure phpcs (add CodeIgniter standard to phpcs) -vendor/bin/phpcs --config-set installed_paths vendor/ise/php-codingstandards-codeigniter/CodeIgniter +${VENDOR_DIR}/bin/phpcs --config-set installed_paths ${VENDOR_DIR}/ise/php-codingstandards-codeigniter/CodeIgniter ############ Various change to harmonize code ######### @@ -156,9 +158,9 @@ fi # https://codeigniter.com/userguide3/general/security.html?highlight=index%20html#hide-your-files # CodeIgniter will have an index.html file in all of its directories in an attempt # to hide some of this data, but have it in mind that this is not enough to prevent a serious attacker. -#find application/ -type d -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; -find application/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; && -find media/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a vendor/codeigniter/framework/application/index.html '{}' \; && +#find application/ -type d -exec cp -a ${VENDOR_DIR}/codeigniter/framework/application/index.html '{}' \; +find application/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a ${VENDOR_DIR}/codeigniter/framework/application/index.html '{}' \; && +find media/ -type d '!' -exec test -e "{}/index.html" ';' -exec cp -a ${VENDOR_DIR}/codeigniter/framework/application/index.html '{}' \; && if [ $DO_GIT_COMMIT -eq 1 ]; then git add "application/**index.html" && git add "media/**index.html" && @@ -187,7 +189,7 @@ unset OLD_CI_HEADER if [ $DO_GIT_DIFF -eq 0 ]; then # Correct spaces, end of line, tabs, indentation... - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-0-spaces.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-0-spaces.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] spaces... @@ -207,23 +209,23 @@ no_spaces_around_offset" fi # linebreak_after_opening_tag - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-9-linebreak_after_opening_tag.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-9-linebreak_after_opening_tag.php" && # no_closing_tag - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-8-no_closing_tag.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-8-no_closing_tag.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] no_closing_tag, linebreak_after_opening_tag" fi # single_quote - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-1-single_quote.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-1-single_quote.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] single_quote" fi # method_argument_space - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-6-method_argument_space.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-6-method_argument_space.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] method_argument_space @@ -232,14 +234,14 @@ no_spaces_around_offset" fi # explicit_string_variable - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-7-explicit_string_variable.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-7-explicit_string_variable.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] explicit_string_variable" fi # operator spacing (except some config files) - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-11-operator.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-11-operator.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] operator & parenthesis spacing @@ -258,7 +260,7 @@ no_spaces_around_offset" fi # constant_case TRUE, FALSE - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-3-constant_case.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-3-constant_case.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] constant_case @@ -267,19 +269,19 @@ no_spaces_around_offset" fi # single_line_comment_style - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-10-single_line_comment_style.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-10-single_line_comment_style.php" && if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] single_line_comment_style" fi # no_alternative_syntax (EXCEPT views) - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-12-no_alternative_syntax.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-12-no_alternative_syntax.php" && # braces & control_structure_continuation_position & no_alternative_syntax - vendor/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-4-braces.php" && + ${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots --config "$CS_FIXER_CONF_DIR/php-cs-fixer-4-braces.php" && # Run phpcs immediately with sniffs=Generic.Classes.OpeningBraceSameLine to fix # php-cs-fixer not inline with what we want - vendor/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine + ${VENDOR_DIR}/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] braces, no_alt_syntax and related... @@ -297,8 +299,8 @@ fi # Rerun php-cs-fixer with all fixes + the fix on classes opening braces -vendor/bin/php-cs-fixer fix -v --show-progress=dots && -vendor/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine +${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots && +${VENDOR_DIR}/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: PHP-CS-Fixer] EMPTY?" @@ -306,8 +308,8 @@ fi # Process also the scripts directory -vendor/bin/php-cs-fixer fix -v --show-progress=dots scripts && -vendor/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine scripts +${VENDOR_DIR}/bin/php-cs-fixer fix -v --show-progress=dots scripts && +${VENDOR_DIR}/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" --sniffs=Generic.Classes.OpeningBraceSameLine scripts if [ $DO_GIT_COMMIT -eq 1 ]; then git add scripts && git commit -m "[AUTO: PHP-CS-Fixer] scripts directory" @@ -316,9 +318,9 @@ fi ############# PHP_CodeSniffer ############# # First we check the errors -vendor/bin/phpcs -p -s --standard="$CS_RULESSET_DIR/ruleset.xml" 2>&1 | tee "$TMPDIR/phpcs.log" && +${VENDOR_DIR}/bin/phpcs -p -s --standard="$CS_RULESSET_DIR/ruleset.xml" 2>&1 | tee "$TMPDIR/phpcs.log" && # Then we fix them -vendor/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" 2>&1 | tee "$TMPDIR/phpcbf.log" +${VENDOR_DIR}/bin/phpcbf -p --standard="$CS_RULESSET_DIR/ruleset.xml" 2>&1 | tee "$TMPDIR/phpcbf.log" if [ $DO_GIT_COMMIT -eq 1 ]; then git add application && git commit -m "[AUTO: CodeSniffer] Fixes to fit to to CI3 coding style" @@ -356,7 +358,7 @@ fi # Check the views for any errors # Disabled for now -#vendor/bin/phpcs -p -s --standard="$CS_RULESSET_DIR/ruleset-views.xml" 2>&1 | tee "$TMPDIR/phpcs-views.log" +#${VENDOR_DIR}/bin/phpcs -p -s --standard="$CS_RULESSET_DIR/ruleset-views.xml" 2>&1 | tee "$TMPDIR/phpcs-views.log" #grep "| ERROR" phpcs-views.log | cut -d '|' -f 3- | sort | uniq -c #grep "| WARNING" phpcs-views.log | cut -d '|' -f 3- | sort | uniq -c #