Skip to content

Commit c104a79

Browse files
s1lvermspirkov
andauthored
Apply Yii2 coding standards, raise min version to PHP 7.4 (#281)
Co-authored-by: Maksim Spirkov <63721828+mspirkov@users.noreply.github.com>
1 parent 94f1974 commit c104a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1267
-265
lines changed

.gitattributes

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Ignore all test and documentation for archive
2-
/.github export-ignore
3-
/.editorconfig export-ignore
4-
/.gitattributes export-ignore
5-
/.gitignore export-ignore
6-
/.scrutinizer.yml export-ignore
7-
/.travis.yml export-ignore
8-
/phpunit.xml.dist export-ignore
2+
.* export-ignore
3+
*.dist export-ignore
4+
*.neon export-ignore
5+
*.yml export-ignore
96
/tests export-ignore
107
/docs export-ignore
8+
/Makefile export-ignore

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
on:
2-
pull_request:
3-
paths-ignore:
4-
- 'docs/**'
5-
- 'README.md'
6-
- 'CHANGELOG.md'
7-
- '.gitignore'
8-
- '.gitattributes'
1+
name: build
92

10-
push:
3+
on:
4+
pull_request: &ignore-paths
115
paths-ignore:
126
- 'docs/**'
7+
- '.github/CONTRIBUTING.md'
8+
- '.github/FUNDING.yml'
9+
- '.github/SECURITY.md'
1310
- 'README.md'
1411
- 'CHANGELOG.md'
12+
- 'LICENSE.md'
1513
- '.gitignore'
1614
- '.gitattributes'
15+
- '.editorconfig'
16+
- 'docker-compose.yml'
17+
- 'Makefile'
1718

18-
name: build
19+
push: *ignore-paths
1920

2021
jobs:
2122
phpunit:
22-
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
23-
with:
24-
os: >-
25-
['ubuntu-latest']
26-
php: >-
27-
['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
23+
uses: yiisoft/yii2-actions/.github/workflows/phpunit.yml@master
24+
secrets:
25+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/linter.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: linter
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request: &ignore-paths
8+
paths-ignore:
9+
- 'docs/**'
10+
- '.github/CONTRIBUTING.md'
11+
- '.github/FUNDING.yml'
12+
- '.github/SECURITY.md'
13+
- 'README.md'
14+
- 'CHANGELOG.md'
15+
- 'LICENSE.md'
16+
- '.gitignore'
17+
- '.gitattributes'
18+
- '.editorconfig'
19+
- 'docker-compose.yml'
20+
- 'Makefile'
21+
22+
push: *ignore-paths
23+
24+
jobs:
25+
phpcs:
26+
uses: yiisoft/yii2-actions/.github/workflows/linter.yml@master
27+
with:
28+
directories: src/ tests/

.github/workflows/static.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: static analysis
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request: &ignore-paths
8+
paths-ignore:
9+
- 'docs/**'
10+
- '.github/CONTRIBUTING.md'
11+
- '.github/FUNDING.yml'
12+
- '.github/SECURITY.md'
13+
- 'README.md'
14+
- 'CHANGELOG.md'
15+
- 'LICENSE.md'
16+
- '.gitignore'
17+
- '.gitattributes'
18+
- '.editorconfig'
19+
- 'docker-compose.yml'
20+
- 'Makefile'
21+
22+
push: *ignore-paths
23+
24+
jobs:
25+
phpstan:
26+
uses: yiisoft/yii2-actions/.github/workflows/phpstan.yml@master

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ composer.phar
2424
phpunit.phar
2525
# local phpunit config
2626
/phpunit.xml
27+
.phpunit.result.cache
28+
coverage.xml
2729

2830
/tests/runtime
29-
/tests/data/config.local.php
30-
/tests/docker
31-
/tests/dockerids
32-

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
Yii Framework 2 bootstrap extension Change Log
22
==============================================
33

4-
2.0.12 under development
4+
3.0.0 under development
55
------------------------
66

7-
- no changes in this release.
7+
- Enh #281: Applying Yii2 coding standards (@s1lver)
8+
- Enh #281: Raise min version to PHP 7.4 (@s1lver)
89

910

1011
2.0.11 August 09, 2021

Makefile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1+
help: ## Display help information.
2+
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
13

2-
# default versions to test against
3-
# these can be overridden by setting the environment variables in the shell
4-
PHP_VERSION=php-5.6.8
5-
YII_VERSION=dev-master
4+
start: ## Start services
5+
docker compose up -d
66

7-
# ensure all the configuration variables above are in environment of the shell commands below
8-
export
7+
test: ## Run tests. Params: {{ v=8.1 }}.
8+
PHP_VERSION=$(filter-out $@,$(v)) docker compose up -d --build
9+
docker exec yii2-bootstrap-php-1 sh -c "php -v && composer update && vendor/bin/phpunit --coverage-clover=coverage.xml"
10+
make down
911

10-
help:
11-
@echo "make test - run phpunit tests using a docker environment"
12-
# @echo "make clean - stop docker and remove container"
12+
build: ## Build an image from a docker-compose file. Params: {{ v=8.1 }}.
13+
PHP_VERSION=$(filter-out $@,$(v)) docker compose up -d --build
1314

14-
test: docker-php
15-
composer require "yiisoft/yii2:${YII_VERSION}" --prefer-dist
16-
composer install --prefer-dist
17-
docker run --rm=true -v $(shell pwd):/opt/test yiitest/php:${PHP_VERSION} phpunit --verbose --color
15+
down: ## Stop and remove containers, networks
16+
docker compose down
1817

19-
docker-php: dockerfiles
20-
cd tests/docker/php && sh build.sh
21-
22-
dockerfiles:
23-
test -d tests/docker || git clone https://github.com/cebe/jenkins-test-docker tests/docker
24-
cd tests/docker && git checkout -- . && git pull
25-
mkdir -p tests/dockerids
18+
sh: ## Enter the container with the application
19+
docker exec -it yii2-bootstrap-php-1 bash
2620

21+
static-analysis: ## Run code static analyze. Params: {{ v=8.1 }}.
22+
make build v=$(filter-out $@,$(v))
23+
docker exec yii2-bootstrap-php-1 sh -c "php -v && composer update && vendor/bin/phpstan analyse --memory-limit 512M"
24+
make down

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md).
1717
[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-bootstrap/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap)
1818
[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-bootstrap/downloads.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap)
1919
[![Build Status](https://github.com/yiisoft/yii2-bootstrap/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-bootstrap/actions)
20+
[![codecov](https://codecov.io/gh/yiisoft/yii2-bootstrap/graph/badge.svg)](https://codecov.io/gh/yiisoft/yii2-bootstrap)
2021

2122

2223
Installation
2324
------------
2425

26+
> [!IMPORTANT]
27+
> - The minimum required [PHP](https://www.php.net/) version is PHP `7.4`.
28+
> - It works best with PHP `8`.
29+
2530
The preferred way to install this extension is through [composer](https://getcomposer.org/download/).
2631

2732
Either run

0 commit comments

Comments
 (0)