From 6a91636d0ca63f395e359d297864b98da2d62dfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kucha=C5=99?= <honza.kuchar@grifart.cz>
Date: Mon, 1 May 2017 22:16:12 +0200
Subject: [PATCH] CI: add phpstan

---
 .gitlab-ci.yml | 29 ++++++++++++++++++++++++++---
 composer.json  |  3 ++-
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a99bf0c..ff115a3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,17 +1,40 @@
 stages:
+- build
 - tests
 
+dependencies.install:
+  stage: build
+  tags: ["grifart/php7.1-with-gulp-and-all-php-modules"]
+  image: grifart/php7.1-with-gulp-and-all-php-modules
+
+  script:
+    - composer install --ansi --no-interaction
+  artifacts:
+    expire_in: 30 minutes
+    paths:
+      - vendor
+
 tests-php7.1:
   stage: tests
   tags: ["grifart/php7.1-with-gulp-and-all-php-modules"]
   image: grifart/php7.1-with-gulp-and-all-php-modules
-  
-  before_script:
-    - composer install --ansi --no-interaction
+
   script:
     - vendor/bin/tester -c tests/php.ini tests
+
   artifacts:
     expire_in: 30 minutes
     paths:
       - tests
     when: on_failure
+
+phpstan:
+  stage: tests
+  tags: ["grifart/php7.1-with-gulp-and-all-php-modules"]
+  image: grifart/php7.1-with-gulp-and-all-php-modules
+
+  # Now in require-dev in composer.json
+  # before_script:
+  #   - composer require --dev phpstan/phpstan --ansi --no-interaction
+  script:
+    - vendor/bin/phpstan analyse src -l 5 --ansi --no-progress --no-interaction
diff --git a/composer.json b/composer.json
index 01c991a..a7f4d1f 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,8 @@
 	},
 
 	"require-dev": {
-		"nette/tester": "~1.7.1"
+		"nette/tester": "~1.7.1",
+		"phpstan/phpstan": "^0.6.4"
 	},
 
 	"autoload": {
-- 
GitLab