Skip to content

Commit ee71743

Browse files
michalbundyraTom H Anderson
authored and
Tom H Anderson
committed
General code fixes
- updated PHP CodeSniffer to version 2.7 - added phpcs.xml with defined CS rules - fixed code to pass all CS checks - short array syntax in docs - composer scripts to run unit and cs checks - updated travis configuration to use composer scripts
1 parent 155f525 commit ee71743

32 files changed

+557
-520
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ install:
7777
- composer show
7878

7979
script:
80-
- if [[ $TEST_COVERAGE == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover ./build/clover.xml ; else ./vendor/bin/phpunit ; fi
80+
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
8181
- if [[ $TEST_COVERAGE == 'true' ]]; then php build/coverage-checker.php build/clover.xml 70 ; fi
82-
- if [[ $CHECK_CS == 'true' ]]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/ ./config/ ; fi
82+
- if [[ $CHECK_CS == 'true' ]]; then composer cs-check ; fi
8383

8484
after_script:
8585
- if [[ $TEST_COVERAGE == 'true' ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Doctrine 2 ORM Module for Zend Framework 2
1+
# Doctrine 2 ORM Module for Zend Framework
22

33
[![Master branch build status](https://secure.travis-ci.org/doctrine/DoctrineORMModule.png?branch=master)](http://travis-ci.org/doctrine/DoctrineORMModule) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/doctrine/DoctrineORMModule/badges/quality-score.png?s=1e2a047fb1bb0f66937bcbc3a61f960c8089c835)](https://scrutinizer-ci.com/g/doctrine/DoctrineORMModule/) [![Code Coverage](https://scrutinizer-ci.com/g/doctrine/DoctrineORMModule/badges/coverage.png?s=377656ded5ffaaf4635acfb26729caa212fb5d76)](https://scrutinizer-ci.com/g/doctrine/DoctrineORMModule/) [![Latest Stable Version](https://poser.pugx.org/doctrine/doctrine-orm-module/v/stable.png)](https://packagist.org/packages/doctrine/doctrine-orm-module) [![Total Downloads](https://poser.pugx.org/doctrine/doctrine-orm-module/downloads.png)](https://packagist.org/packages/doctrine/doctrine-orm-module)
44

5-
DoctrineORMModule integrates Doctrine 2 ORM with Zend Framework 2 quickly and easily.
5+
DoctrineORMModule integrates Doctrine 2 ORM with Zend Framework quickly and easily.
66

77
- Doctrine 2 ORM support
88
- Multiple ORM entity managers
@@ -15,7 +15,7 @@ Installation of this module uses composer. For composer documentation, please re
1515
[getcomposer.org](http://getcomposer.org/).
1616

1717
```sh
18-
php composer.phar require doctrine/doctrine-orm-module
18+
composer require doctrine/doctrine-orm-module
1919
```
2020

2121
Then add `DoctrineModule` and `DoctrineORMModule` to your `config/application.config.php` and create directory
@@ -31,30 +31,30 @@ configuration for each of your entities namespaces:
3131

3232
```php
3333
<?php
34-
return array(
35-
'doctrine' => array(
36-
'driver' => array(
34+
return [
35+
'doctrine' => [
36+
'driver' => [
3737
// defines an annotation driver with two paths, and names it `my_annotation_driver`
38-
'my_annotation_driver' => array(
38+
'my_annotation_driver' => [
3939
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
4040
'cache' => 'array',
41-
'paths' => array(
41+
'paths' => [
4242
'path/to/my/entities',
43-
'another/path'
44-
),
45-
),
43+
'another/path',
44+
],
45+
],
4646

4747
// default metadata driver, aggregates all other drivers into a single one.
4848
// Override `orm_default` only if you know what you're doing
49-
'orm_default' => array(
50-
'drivers' => array(
49+
'orm_default' => [
50+
'drivers' => [
5151
// register `my_annotation_driver` for any entity under namespace `My\Namespace`
52-
'My\Namespace' => 'my_annotation_driver'
53-
)
54-
)
55-
)
56-
)
57-
);
52+
'My\Namespace' => 'my_annotation_driver',
53+
],
54+
],
55+
],
56+
],
57+
];
5858
```
5959

6060
## Connection settings
@@ -63,23 +63,23 @@ Connection parameters can be defined in the application configuration:
6363

6464
```php
6565
<?php
66-
return array(
67-
'doctrine' => array(
68-
'connection' => array(
66+
return [
67+
'doctrine' => [
68+
'connection' => [
6969
// default connection name
70-
'orm_default' => array(
70+
'orm_default' => [
7171
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
72-
'params' => array(
72+
'params' => [
7373
'host' => 'localhost',
7474
'port' => '3306',
7575
'user' => 'username',
7676
'password' => 'password',
7777
'dbname' => 'database',
78-
)
79-
)
80-
)
81-
),
82-
);
78+
],
79+
],
80+
],
81+
],
82+
];
8383
```
8484

8585
#### Full configuration options

composer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"require-dev": {
5151
"phpunit/phpunit": "^5.6.0",
52-
"squizlabs/php_codesniffer": "^2.6.2",
52+
"squizlabs/php_codesniffer": "^2.7",
5353
"doctrine/data-fixtures": "^1.2.1",
5454
"doctrine/migrations": "^1.4.1",
5555
"zendframework/zend-console": "^2.6",
@@ -73,5 +73,15 @@
7373
"psr-0": {
7474
"DoctrineORMModuleTest\\": "tests/"
7575
}
76+
},
77+
"scripts": {
78+
"check": [
79+
"@cs-check",
80+
"@test"
81+
],
82+
"cs-check": "phpcs",
83+
"cs-fix": "phpcbf",
84+
"test": "phpunit --colors=always",
85+
"test-coverage": "phpunit --coverage-clover build/clover.xml"
7686
}
7787
}

0 commit comments

Comments
 (0)