Skip to content
Snippets Groups Projects
Unverified Commit a0659bfd authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

chore(phpstan): Add phpstan to composer.json and make workaround for PHP 7.0 (#3104477)

parent 406d2395
Branches
Tags
No related merge requests found
......@@ -28,6 +28,9 @@ before_install:
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
before_script:
# We have a dedicated composer.json file for PHP 7.0 that does not have
# PHPStan because it requires >= PHP 7.1.
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then cp composer-php-7-0.json composer.json; fi
# Running composer install without a lock file will also update cached
# dependencies in vendor.
- composer install
......@@ -42,5 +45,6 @@ script:
# Ensure that the DrupalPractice standard can be invoked standalone and the
# auto-loading of abstract classes works.
- ./vendor/bin/phpcs -p --standard=coder_sniffer/DrupalPractice coder_sniffer/DrupalPractice/Test/good/ --ignore=coder_sniffer/DrupalPractice/Test/good/GoodUnitTest.php
# We cannot add PHPStan to composer.json because it cannot be installed in PHP 7.0.
- if [[ $PHPSTAN == "1" ]]; then composer require --dev phpstan/phpstan && ./vendor/bin/phpstan analyse; fi
# Only run PHPStan on the latest PHP version, no need to run it multiple
# times.
- if [[ $PHPSTAN == "1" ]]; then ./vendor/bin/phpstan analyse; fi
{
"name": "drupal/coder",
"type": "phpcodesniffer-standard",
"description": "Coder is a library to review Drupal code.",
"homepage": "https://www.drupal.org/project/coder",
"support": {
"issues": "https://www.drupal.org/project/issues/coder",
"source": "https://www.drupal.org/project/coder"
},
"keywords": [
"phpcs",
"standards",
"code review"
],
"license": "GPL-2.0+",
"require": {
"php": ">=7.0.8",
"ext-mbstring": "*",
"squizlabs/php_codesniffer": "^3.4.1",
"symfony/yaml": ">=2.0.5"
},
"autoload": {
"psr-4": {
"Drupal\\": "coder_sniffer/Drupal/",
"DrupalPractice\\": "coder_sniffer/DrupalPractice/"
}
},
"require-dev": {
"phpunit/phpunit": "^6.0 || ^7.0"
}
}
......@@ -26,6 +26,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^6.0 || ^7.0"
"phpunit/phpunit": "^6.0 || ^7.0",
"phpstan/phpstan": "^0.12.4"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment