Skip to content
Snippets Groups Projects
Select Git revision
  • d3267b2d26b44d738afb911b6cece6ad456f5c38
  • master default
  • php8.2-docker-services
  • 6.x
  • laminas
  • bertrand.gauthier-master-patch-70311
  • bertrand.gauthier-master-patch-87168
  • laminas_migration
  • sqlite
  • 4.0.0
  • 3.2.1
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 1.0.1
  • 1.0.0
16 results

phpcs.sh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    phpcs.sh 928 B
    #!/usr/bin/env bash
    
    [[ -z $1 ]] && echo "Veuillez spécifier la version de PHP désirée (ex: 7.1)." && exit 1
    
    DIR=$(cd `dirname $0` && pwd)
    DIRNAME=$(basename ${DIR})
    
    cd ${DIR}/..
    
    version=$1
    
    # conversion de la version spécifiée au format PHP_VERSION_ID, ex: "7.2" devien "70200"
    a=(${version//./ })
    PHP_VERSION_ID=$((a[0]*10000+a[1]*100+a[2]))
    
    phpcs="./vendor/bin/phpcs"
    libdir="./vendor/unicaen"
    outdir="./${DIRNAME}/reports"
    
    mkdir -p ${outdir} #&& rm -rf ${outdir}/*
    
    for path in ${libdir}/*
    do
        dirname=$(basename -- "$path")
        reportpath="${outdir}/phpcs-unicaen-${dirname}-${version}.txt"
        echo "Processing '${path}' against PHP version ${version} (PHP_VERSION_ID=${PHP_VERSION_ID})"
        echo "=> reporting into '${reportpath}'"
        ${phpcs} \
            -p \
             --standard=ruleset.xml \
            --runtime-set php_version ${PHP_VERSION_ID} \
            --report-full=${reportpath} \
            ${path}
    done