Skip to content

Commit

Permalink
Merge pull request #3 from genkgo/upgrade
Browse files Browse the repository at this point in the history
strict types, property/return types, static analysis, php cs, php 8.0+
  • Loading branch information
frederikbosch authored Nov 30, 2022
2 parents aeaeb90 + 2c880ba commit 7de8757
Show file tree
Hide file tree
Showing 37 changed files with 3,710 additions and 1,022 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/code_checks.yaml
name: code check

on:
pull_request: null
push:
branches:
- master

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.0', '8.1']

name: PHP ${{ matrix.php }} tests
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, iconv, openssl
coverage: none

- name: Download dependencies
run: composer update --no-ansi --prefer-stable --prefer-dist --no-interaction --no-progress --no-suggest

- name: Run tests
run: ./vendor/bin/phpunit -c phpunit.xml
- name: Static analysis for source
run: ./vendor/bin/phpstan analyse -l max src
- name: Static analysis for tests
run: ./vendor/bin/phpstan analyse -l 5 test
- name: Code Style
run: ./vendor/bin/php-cs-fixer fix --dry-run --verbose --config .php-cs-fixer.dist.php ./src ./test
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.idea/
/.settings/
/vendor/
/tests/build/
.project
/test/build/
/.phpunit.result.cache
/.php-cs-fixer.cache
17 changes: 17 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'yoda_style' => false,
'native_function_invocation' => ['include' => ['@all']],
'phpdoc_no_package' => true,
'no_empty_phpdoc' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'class_attributes_separation' => ['elements' => ['property' => 'only_if_meta', 'const' => 'only_if_meta']],
])
->setRiskyAllowed(true);
10 changes: 0 additions & 10 deletions .scrutinizer.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

23 changes: 3 additions & 20 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# Genkgo.Migrations

Library to make migrations easy. If you are looking for a tool (not a library) that has database migrations integrated
and comes with a command line interface, please have a look at [robmorgan/phinx](https://github.com/robmorgan/phinx).
If you need a library without these tools, but can work with any database abstraction layer or other dependencies, this
library might be the correct choice.
Library to make migrations easy.

### Installation

Requires PHP 5.5 or later. There are no plans to support PHP 5.4 or PHP 5.3. In case this is an obstacle for you,
conversion should be no problem. The library is very small.

It is installable and autoloadable via Composer as [genkgo/migrations](https://packagist.org/packages/genkgo/migrations).
Requires PHP 8.0 or later. It is installable and autoloadable via Composer as [genkgo/migrations](https://packagist.org/packages/genkgo/migrations).

### Quality

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/genkgo/migrations/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/genkgo/migrations/)
[![Code Coverage](https://scrutinizer-ci.com/g/genkgo/migrations/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/genkgo/migrations/)
[![Build Status](https://travis-ci.org/genkgo/migrations.png?branch=master)](https://travis-ci.org/genkgo/migrations)
[![Dependency Status](https://www.versioneye.com/user/projects/54b3910d171cf95e6a0001d3/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54b3910d171cf95e6a0001d3)

To run the unit tests at the command line, issue `phpunit -c tests/`. [PHPUnit](http://phpunit.de/manual/) is required.
To run the unit tests at the command line, issue `vendor/bin/phpunit -c phpunit.xml`. [PHPUnit](http://phpunit.de/manual/) is required.

This library attempts to comply with [PSR-1][], [PSR-2][], and [PSR-4][]. If
you notice compliance oversights, please send a patch via pull request.
Expand Down Expand Up @@ -158,12 +147,6 @@ $list->migrate();
```


## Roadmap

- Add support for rolling back to a certain point in time
- Optimize the PDO adapter, too many queries now (one per migration). Should be one per namespace.
- ... no further plans yet

## Contributing

- Found a bug? Please try to solve it yourself first and issue a pull request. If you are not able to fix it, at least
Expand Down
30 changes: 22 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
{
"autoload" : {
"psr-4" : {
"Genkgo\\Migrations\\" : [
"src",
"tests"
]
"Genkgo\\Migrations\\" : ["src"]
}
},
"autoload-dev" : {
"psr-4" : {
"Genkgo\\TestMigrations\\" : ["test"]
}
},
"name" : "genkgo/migrations",
"require" : {
"php" : ">=5.5",
"mathiasverraes/classfunctions" : "1.1.0"
"php" : "~8.0.0 || ~8.1.0",
"ext-pdo": "*"
},
"require-dev" : {
"phpunit/phpunit" : "~4.0",
"phpunit/phpunit-mock-objects" : "2.3.0"
"phpunit/phpunit" : "^9.5.26",
"phpstan/phpstan": "^1.0",
"friendsofphp/php-cs-fixer": "^3.0"
},
"scripts": {
"test": [
"./vendor/bin/phpunit -c phpunit.xml",
"./vendor/bin/phpstan analyse -l max ./src/",
"./vendor/bin/phpstan analyse -l 5 ./test/",
"./vendor/bin/php-cs-fixer fix --dry-run --verbose --config .php-cs-fixer.dist.php ./src ./test"
],
"lint": [
"./vendor/bin/php-cs-fixer fix --verbose --config .php-cs-fixer.dist.php ./src ./test"
]
}
}
Loading

0 comments on commit 7de8757

Please sign in to comment.