Skip to content

Commit c34a6ee

Browse files
committed
Merge branch 'hotfix/psr-4'
Close #17
2 parents b272c89 + bdcedce commit c34a6ee

32 files changed

+87
-14
lines changed

.php_cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
printf("Executing php_cs!!!\n\n");
3+
$finder = Symfony\CS\Finder\DefaultFinder::create()
4+
->in(__DIR__)
5+
->ignoreDotFiles(true)
6+
->filter(function (SplFileInfo $file) {
7+
$path = $file->getPathname();
8+
9+
switch (true) {
10+
case (strrpos($path, '/bin/')):
11+
return false;
12+
case (strrpos($path, '/test/Bootstrap.php')):
13+
return false;
14+
case (strrpos($path, '/vendor/')):
15+
return false;
16+
default:
17+
return true;
18+
}
19+
});
20+
21+
return Symfony\CS\Config\Config::create()
22+
->fixers(array(
23+
'controls_spaces',
24+
'braces',
25+
'elseif',
26+
'eof_ending',
27+
'function_declaration',
28+
'include',
29+
'indentation',
30+
'linefeed',
31+
'php_closing_tag',
32+
'psr0',
33+
'short_tag',
34+
'trailing_spaces',
35+
'unused_use',
36+
'visibility',
37+
))
38+
->finder($finder);

.travis.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
language: php
22

33
php:
4-
- "5.3"
5-
- "5.4"
6-
7-
before_install:
8-
- wget http://cs.sensiolabs.org/get/php-cs-fixer.phar
4+
- 5.3
5+
- 5.4
6+
- 5.5
97

108
before_script:
11-
- composer install --dev
9+
- composer self-update
10+
- composer install --dev --prefer-source
1211

1312
script:
14-
- (cd test ; ../vendor/bin/phpunit -c phpunit.xml)
15-
- output=$(php php-cs-fixer.phar fix -v --dry-run --level=psr2 .); if [[ $output ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;
13+
- ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
14+
- ./bin/check-cs.sh
15+
16+
after_script:
17+
- php ./vendor/bin/coveralls -v
18+
19+
notifications:
20+
irc: "irc.freenode.org#apigility-dev"
21+
email: false

Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getAutoloaderConfig()
2323
{
2424
return array(
2525
'Zend\Loader\StandardAutoloader' => array('namespaces' => array(
26-
__NAMESPACE__ => __DIR__ . '/src/ZF/ApiProblem/',
26+
__NAMESPACE__ => __DIR__ . '/src/',
2727
))
2828
);
2929
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Api-Problem: ZF2 Module for API-Problem representations
22
=======================================================
33

4+
[![Build Status](https://travis-ci.org/zfcampus/zf-api-problem.png)](https://travis-ci.org/zfcampus/zf-api-problem)
5+
[![Coverage Status](https://coveralls.io/repos/zfcampus/zf-api-problem/badge.png?branch=master)](https://coveralls.io/r/zfcampus/zf-api-problem)
6+
47
This module provides data structures and rendering for the API-Problem format.
58

69
- [Problem API](http://tools.ietf.org/html/draft-nottingham-http-problem-05),

bin/check-cs.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
FIXER_CONFIG="`dirname $0`/../.php_cs"
4+
FIXER_PATH="`dirname $0`/../vendor/fabpot/php-cs-fixer/php-cs-fixer"
5+
CS=""
6+
7+
(
8+
cd "`dirname $0`/../" ;
9+
CS=$(php vendor/fabpot/php-cs-fixer/php-cs-fixer fix -v --dry-run .)
10+
)
11+
12+
if [[ "$CS" ]];
13+
then
14+
echo -en '\E[31m'"$CS\033[1m\033[0m";
15+
printf "\n";
16+
echo -en '\E[31;47m'"\033[1mCoding standards check failed!\033[0m"
17+
printf "\n";
18+
exit 2;
19+
fi
20+
21+
echo -en '\E[32m'"\033[1mCoding standards check passed!\033[0m"
22+
printf "\n";
23+
24+
echo $CS

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@
3333
"zendframework/zend-view": "~2.3"
3434
},
3535
"require-dev": {
36+
"fabpot/php-cs-fixer": "*@dev",
3637
"phpunit/PHPUnit": "3.7.*",
38+
"satooshi/php-coveralls": ">=0.6.0",
3739
"zendframework/zend-console": "~2.3",
3840
"zendframework/zend-http": "~2.3",
3941
"zendframework/zend-loader": "~2.3"
4042
},
4143
"autoload": {
42-
"psr-0": {
44+
"psr-4": {
4345
"ZF\\ApiProblem\\": "src/",
4446
"ZFTest\\ApiProblem\\": "test/"
4547
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<phpunit bootstrap="./Bootstrap.php" colors="true">
1+
<phpunit bootstrap="./test/Bootstrap.php" colors="true">
22
<testsuites>
33
<testsuite name="ZFApiProblem Module Tests">
4-
<directory>./ZFTest</directory>
4+
<directory>./test</directory>
55
</testsuite>
66
</testsuites>
77
</phpunit>
File renamed without changes.

0 commit comments

Comments
 (0)