Skip to content

Commit

Permalink
fix: compatibility with magento coding standard v33
Browse files Browse the repository at this point in the history
Magento coding standard starting with version 33 uses their own
php compatibility fork.

fixes: #9
piotrkwiecinski committed Jul 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 48f5808 commit e7e17dc
Showing 2 changed files with 24 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/install_coding_standard.bash
Original file line number Diff line number Diff line change
@@ -7,6 +7,14 @@ composer global require --no-interaction ${CODING_STANDARD}:${INPUT_CODING_STAND

# Fixme: find a better way to handle adding standards
if [ "${CODING_STANDARD}" = "magento/magento-coding-standard" ] ; then
composer global -- exec phpcs --config-set installed_paths \
../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility
INSTALL_PATHS="../../magento/magento-coding-standard/"
if composer global show magento/php-compatibility-fork > /dev/null 2>&1; then
INSTALL_PATHS="${INSTALL_PATHS},../../magento/php-compatibility-fork"
fi

if composer global show phpcompatibility/php-compatibility > /dev/null 2>&1; then
INSTALL_PATHS="${INSTALL_PATHS},../../phpcompatibility/php-compatibility"
fi

composer global -- exec phpcs --config-set installed_paths "$INSTALL_PATHS"
fi
14 changes: 14 additions & 0 deletions tests/install_magento_coding_standard.bats
Original file line number Diff line number Diff line change
@@ -33,6 +33,20 @@ teardown() {
run install_coding_standard.bash
run composer global info
[[ "$output" =~ "magento/magento-coding-standard"\ *30 ]]
run composer global -- exec "phpcs --config-show"
[[ "$output" =~ "phpcompatibility/php-compatibility" ]]
}

@test "Coding standard is installed with version 33" {
if ! command -v composer > /dev/null ; then
skip "Composer is not installed."
fi
export INPUT_CODING_STANDARD_VERSION=33
run install_coding_standard.bash
run composer global info
[[ "$output" =~ "magento/magento-coding-standard"\ *33 ]]
run composer global -- exec "phpcs --config-show"
[[ "$output" =~ "magento/php-compatibility-fork" ]]
}

@test "Coding standard package is installed" {

0 comments on commit e7e17dc

Please sign in to comment.