Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Comptoir Comptoir
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 30
    • Issues 30
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ComptoirComptoir
  • ComptoirComptoir
  • Issues
  • #28
Closed
Open
Issue created Mar 02, 2020 by Fabrice Gangler@fgangler🎨Owner

QA - Add PHP Compatibility (adds rules to phpcs)

php-compatibility is a set of sniffs for PHP_CodeSniffer that checks for PHP version compatibility. It will allow you to analyse your code for compatibility with higher and lower versions of PHP.

documentation:

  • https://phpqa.io/projects/php-compatibility.html
  • https://github.com/PHPCompatibility/PHPCompatibility
# install
composer require --dev "phpcompatibility/php-compatibility"
vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility
     # (1) this last command line must be added in the "post-install-cmd" and "post-update-cmd" of composer.json file.

# Show rules and coding standards
vendor/bin/phpcs --standard=PHPCompatibility <dir>/<file>

vendor/bin/phpcs src/ -p --standard=PHPCompatibility --runtime-set testVersion 7.2-7.4
vendor/bin/phpcs src/ -p --standard=PHPCompatibility --runtime-set testVersion 7.0-

(1) this last command line must be added in the X and y scripts of composer.json

     "scripts": {
+        "install-codestandards": [
+            "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
+        ],
         "auto-scripts": {
             "cache:clear": "symfony-cmd",
             "assets:install %PUBLIC_DIR%": "symfony-cmd"
         },
         "post-install-cmd": [
+            "@install-codestandards"
         ],
         "post-update-cmd": [
+            "@install-codestandards"
         ]
     },

need #27 (closed)

Edited Mar 02, 2020 by Fabrice Gangler
Assignee
Assign to
Time tracking