apply code static analysis check with phpstan

This commit is contained in:
Abdul Malik Ikhsan 2020-08-13 17:15:33 +07:00
parent f69812d1af
commit 3e98c88d7e
No known key found for this signature in database
GPG Key ID: 23FCCC74D1442CAE
4 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,33 @@
name: "Static Analysis Check"
on:
pull_request:
push:
branches:
- 'master'
paths:
- 'app'
- 'system'
jobs:
build:
name: PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4']
steps:
- name: Setup PHP Action
uses: shivammathur/setup-php@1.8.2
with:
extensions: intl
php-version: "${{ matrix.php-versions }}"
- name: Checkout
uses: actions/checkout@v2
- name: "Install dependencies"
run: "composer install"
- name: "CS Check app"
run: "vendor/bin/phpstan analyze --level=0 app"
- name: "CS Check app"
run: "vendor/bin/phpstan analyze --level=0 system"

View File

@ -20,7 +20,8 @@
"mikey179/vfsstream": "1.6.*",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"squizlabs/php_codesniffer": "^3.3"
"squizlabs/php_codesniffer": "^3.3",
"phpstan/phpstan": "^0.12.37"
},
"autoload": {
"psr-4": {

12
phpstan.neon Normal file
View File

@ -0,0 +1,12 @@
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
bootstrapFiles:
- qa-bootstrap.php
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: false
excludes_analyse:
- app/Config/*
- app/Database/*
- app/Views/*

5
qa-bootstrap.php Normal file
View File

@ -0,0 +1,5 @@
<?php
require 'app/Config/Paths.php';
$paths = new Config\Paths();
require_once 'system/bootstrap.php';