Added phpstan

- Added phpstan/phpstan
- Added bootstrap file
- Added phpstan config
- Added ci file
- Added to CI matrix

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2018-06-02 22:37:32 +02:00
parent 482c7bc3ca
commit 7b13da98cd
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
6 changed files with 42 additions and 1 deletions

View File

@ -66,6 +66,8 @@ matrix:
env: CI_MODE=docs
- php: "7.1"
env: CI_MODE=apidocs
- php: "7.2"
env: CI_MODE=phpstan
- os: osx
language: generic
env: CI_MODE=test
@ -80,6 +82,8 @@ matrix:
allow_failures:
- php: "nightly"
env: CI_MODE=test
- php: "7.2"
env: CI_MODE=phpstan
cache:
pip: true

View File

@ -87,7 +87,8 @@
"pragmarx/google2fa": "^3.0",
"bacon/bacon-qr-code": "^1.0",
"samyoul/u2f-php-server": "^1.1",
"phpmyadmin/coding-standard": "^0.3"
"phpmyadmin/coding-standard": "^0.3",
"phpstan/phpstan": "^0.9.2"
},
"extra": {
"branch-alias": {

7
phpstan.neon Normal file
View File

@ -0,0 +1,7 @@
parameters:
bootstrap: %rootDir%/../../../test/bootstrap-phpstan.php
ignoreErrors:
- '#Unexpected token "&", expected TOKEN_VARIABLE at offset#'
excludes_analyse:
- %rootDir%/../../../tmp/*
- %rootDir%/../../../vendor/*

View File

@ -0,0 +1,19 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Bootstrap file for phpstan
*
* @package PhpMyAdmin-test
*/
declare(strict_types=1);
define('PHPMYADMIN', true);
define('TESTSUITE', true);
require_once 'libraries/config.default.php';
$GLOBALS['cfg'] = $cfg;
$GLOBALS['server'] = 0;
\PhpMyAdmin\MoTranslator\Loader::loadFunctions();
\PhpMyAdmin\DatabaseInterface::load();

3
test/ci-install-phpstan Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
composer install --no-interaction

7
test/ci-phpstan Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
cd $(dirname $0)/../
echo "Running in : $(pwd)"
# 1G is a litte high, should use < 512M (less ram + a lot of code = bigger risk of crash)
./vendor/bin/phpstan analyse ./ --configuration=phpstan.neon --level=0 --memory-limit=1G