Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Proper support for PHPStan 0.10.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Jul 3, 2018
1 parent 8f21ef1 commit 24f524f
Show file tree
Hide file tree
Showing 26 changed files with 464 additions and 585 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
/vendor/
/.php_cs.cache
/artifacts/
/vendor/
1 change: 0 additions & 1 deletion .php_cs
Expand Up @@ -58,7 +58,6 @@ return PhpCsFixer\Config::create()
'phpdoc_types' => true,
'pre_increment' => true,
'return_type_declaration' => true,
'self_accessor' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_quote' => true,
Expand Down
11 changes: 3 additions & 8 deletions .travis.yml
@@ -1,21 +1,16 @@
language: php

sudo: false
matrix:
include:
- php: 7.0
- php: 7.1
- php: 7.2
- php: nightly
fast_finish: true
allow_failures:
- php: nightly

before_install: phpenv config-rm xdebug.ini || true
install: composer install --prefer-dist --no-progress --no-interaction
script: make test

cache:
directories:
- $HOME/.composer/cache/files
install: make ci-install
script: make ci

sudo: false
10 changes: 9 additions & 1 deletion CHANGELOG.md
@@ -1,6 +1,14 @@
# Changelog

## 0.2.0 (2018-07-03)
## 0.3.0 (2018-07-04)

- **[BC BREAK]** Dropped support for PHP `7.0.x`.
- **[BC BREAK]** Dropped support for PHPStan `0.9.x`.
- **[NEW]** Support for PHPStan `0.10.x`.

## <del>0.2.0 (2018-07-03)</del>

Note: This release is broken. Do not use it.

- **[IMPROVED]** Support for PHPStan `0.10.x`.

Expand Down
81 changes: 75 additions & 6 deletions Makefile
@@ -1,17 +1,86 @@
SHELL := /bin/bash -o pipefail
.DEFAULT_GOAL := test

ifdef CI
_DEP_PREREQ += artifacts/logs/ci-install
endif

################################################################################
# Internal variables
################################################################################

# _SRC contains the paths to all PHP source files.
_SRC ?= $(shell find ./src -name '*.php' 2> /dev/null)

# _TEST_SRC contains the paths to all test files.
_TEST_SRC := $(shell find ./test -type f 2> /dev/null)

# This is used in lots of targets
_ALL_SRC := $(_SRC) $(_TEST_SRC)

################################################################################
# Commands (Phony Targets)
################################################################################

# Run all tests.
.PHONY: test
test: vendor
php --version
vendor/bin/kahlan

# Remove all files that match the patterns .gitignore.
.PHONY: clean-all
clean-all:: clean
rm -rf ./vendor

# Remove files that match the patterns .gitignore, excluding the vendor folder.
.PHONY: clean
clean::
@git check-ignore ./* | grep -v ^./vendor | xargs -t -n1 rm -rf

# Perform code linting, syntax formatting, etc.
.PHONY: lint
lint: vendor
vendor/bin/php-cs-fixer fix
vendor/bin/phpstan analyze --configuration test/phpstan.neon --level=7 .
lint: artifacts/logs/php-cs-fixer artifacts/logs/phpstan artifacts/logs/composer-validate

# Perform pre-commit checks.
.PHONY: prepare
prepare: lint test

vendor: composer.lock
# Install CI dependencies
.PHONY: ci-install
ci-install: vendor

# Run the CI build.
.PHONY: ci
ci: lint test

################################################################################
# File Targets
################################################################################

.DELETE_ON_ERROR:

vendor: $(_DEP_PREREQ) composer.lock
composer install
@touch $@

composer.lock: composer.json
composer update
@touch $@

composer.json:
composer init --no-interaction

artifacts/logs/php-cs-fixer: vendor $(_ALL_SRC)
@mkdir -p "$(@D)"
vendor/bin/php-cs-fixer fix | tee "$@"

artifacts/logs/phpstan: vendor $(_ALL_SRC)
@mkdir -p "$(@D)"
vendor/bin/phpstan analyze --configuration test/phpstan.neon --level=7 --no-progress . | tee "$@"

artifacts/logs/composer-validate: composer.json
@mkdir -p "$(@D)"
composer validate --no-check-publish | tee "$@"

artifacts/logs/ci-install:
@mkdir -p "$(@D)"
(phpenv config-rm xdebug.ini || true) | tee "$@"
17 changes: 8 additions & 9 deletions composer.json
Expand Up @@ -12,16 +12,15 @@
}
],
"require": {
"php": ">=7",
"phpstan/phpstan": "^0.9|^0.10"
"php": ">=7.1",
"phpstan/phpstan": "^0.10"
},
"require-dev": {
"eloquent/phony": "^2.0",
"eloquent/phony-kahlan": "^1.0",
"eloquent/phony-pho": "^2.0",
"eloquent/phony-phpunit": "^3.0",
"friendsofphp/php-cs-fixer": "^2.8",
"kahlan/kahlan": "^4.0"
"eloquent/phony": "^3",
"eloquent/phony-kahlan": "^2",
"eloquent/phony-phpunit": "^4",
"friendsofphp/php-cs-fixer": "^2.12",
"kahlan/kahlan": "^4.1"
},
"autoload": {
"psr-4": {
Expand All @@ -38,7 +37,7 @@
},
"config": {
"platform": {
"php": "7.0.99999"
"php": "7.1.99999"
}
}
}

0 comments on commit 24f524f

Please sign in to comment.