Skip to content

Commit a1f292d

Browse files
authored
Merge pull request #6 from koriym/release
cleanup the code
2 parents d3aae8a + 0323d70 commit a1f292d

21 files changed

+24303
-95
lines changed

.php_cs

Lines changed: 129 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,131 @@
11
<?php
2-
$finder = Symfony\CS\Finder\DefaultFinder::create()
3-
->in(__DIR__);
42

5-
$config = Symfony\CS\Config\Config::create()
6-
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
7-
->finder($finder)
8-
->fixers(
9-
[
10-
'extra_empty_lines',
11-
'no_blank_lines_after_class_opening',
12-
'no_empty_lines_after_phpdocs',
13-
'operators_spaces',
14-
'duplicate_semicolon',
15-
'namespace_no_leading_whitespace',
16-
'phpdoc_indent',
17-
'phpdoc_no_empty_return',
18-
'phpdoc_no_package',
19-
'phpdoc_params',
20-
'phpdoc_separation',
21-
'phpdoc_to_comment',
22-
'phpdoc_trim',
23-
'phpdoc_var_without_name',
24-
'remove_leading_slash_use',
25-
'remove_lines_between_uses',
26-
'return',
27-
'single_array_no_trailing_comma',
28-
'single_quote',
29-
'spaces_before_semicolon',
30-
'spaces_cast',
31-
'standardize_not_equal',
32-
'ternary_spaces',
33-
'whitespacy_lines',
34-
'ordered_use',
35-
'short_array_syntax'
36-
]
37-
);
38-
return $config;
3+
$header = <<<'EOF'
4+
This file is part of the Koriym.Baracoa package.
5+
6+
@license http://opensource.org/licenses/MIT MIT
7+
EOF;
8+
9+
return \PhpCsFixer\Config::create()
10+
->setRiskyAllowed(true)
11+
->setRules(array(
12+
'@PSR2' => true,
13+
'header_comment' => ['header' => $header, 'commentType' => 'PHPDoc', 'separate' => 'none'],
14+
'array_syntax' => ['syntax' => 'short'],
15+
'binary_operator_spaces' => ['align_equals' => false, 'align_double_arrow' => false],
16+
'blank_line_after_opening_tag' => true,
17+
'blank_line_after_namespace' => false,
18+
'blank_line_before_return' => true,
19+
'cast_spaces' => true,
20+
// 'class_keyword_remove' => true,
21+
'combine_consecutive_unsets' => true,
22+
'concat_space' => ['spacing' => 'one'],
23+
'declare_equal_normalize' => true,
24+
'declare_strict_types' => false,
25+
'dir_constant' => true,
26+
'ereg_to_preg' => true,
27+
'function_typehint_space' => true,
28+
'general_phpdoc_annotation_remove' => true,
29+
'hash_to_slash_comment' => true,
30+
'heredoc_to_nowdoc' => true,
31+
'include' => true,
32+
'indentation_type' => true,
33+
'is_null' => ['use_yoda_style' => false],
34+
'linebreak_after_opening_tag' => true,
35+
'lowercase_cast' => true,
36+
// 'mb_str_functions' => true,
37+
'method_separation' => true,
38+
'modernize_types_casting' => true,
39+
'native_function_casing' => true,
40+
// 'native_function_invocation' => true,
41+
'new_with_braces' => false, //
42+
'no_alias_functions' => true,
43+
'no_blank_lines_after_class_opening' => true,
44+
'no_blank_lines_after_phpdoc' => true,
45+
'no_blank_lines_before_namespace' => true,
46+
'no_empty_comment' => true,
47+
'no_empty_phpdoc' => true,
48+
'no_empty_statement' => true,
49+
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'curly_brace_block', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'throw', 'use', 'useTrait'],
50+
'no_leading_import_slash' => true,
51+
'no_leading_namespace_whitespace' => true,
52+
'no_mixed_echo_print' => ['use' => 'echo'],
53+
'no_multiline_whitespace_around_double_arrow' => true,
54+
'no_multiline_whitespace_before_semicolons' => true,
55+
'no_php4_constructor' => false,
56+
'no_short_bool_cast' => true,
57+
'no_short_echo_tag' => false,
58+
'no_singleline_whitespace_before_semicolons' => true,
59+
'no_spaces_around_offset' => true,
60+
'no_trailing_comma_in_list_call' => true,
61+
'no_trailing_comma_in_singleline_array' => true,
62+
'no_trailing_whitespace' => true,
63+
'no_trailing_whitespace_in_comment' => true,
64+
'no_unneeded_control_parentheses' => true,
65+
'no_unreachable_default_argument_value' => true,
66+
'no_unused_imports' => true,
67+
'no_useless_else' => true,
68+
'no_useless_return' => true,
69+
'no_whitespace_before_comma_in_array' => true,
70+
'no_whitespace_in_blank_line' => true,
71+
'normalize_index_brace' => true,
72+
'not_operator_with_space' => false,
73+
'not_operator_with_successor_space' => true,
74+
'object_operator_without_whitespace' => true,
75+
'ordered_class_elements' => true,
76+
'ordered_imports' => true,
77+
'php_unit_construct' => true,
78+
'php_unit_dedicate_assert' => true,
79+
'php_unit_fqcn_annotation' => true,
80+
'php_unit_strict' => true,
81+
// 'phpdoc_add_missing_param_annotation' => true,
82+
'phpdoc_align' => true,
83+
'phpdoc_annotation_without_dot' => true,
84+
'phpdoc_indent' => true,
85+
'phpdoc_inline_tag' => true,
86+
'phpdoc_no_access' => true,
87+
'phpdoc_no_alias_tag' => ['property-read' => 'property', 'property-write' => 'property', 'type' => 'var'],
88+
'phpdoc_no_empty_return' => true,
89+
'phpdoc_no_package' => true,
90+
// 'phpdoc_no_useless_inheritdoc' => true,
91+
'phpdoc_order' => true,
92+
'phpdoc_return_self_reference' => true,
93+
'phpdoc_scalar' => true,
94+
'phpdoc_separation' => true,
95+
'phpdoc_single_line_var_spacing' => true,
96+
// 'phpdoc_summary' => true,
97+
'phpdoc_to_comment' => true,
98+
'phpdoc_trim' => true,
99+
'phpdoc_types' => true,
100+
'phpdoc_var_without_name' => true,
101+
'pow_to_exponentiation' => true,
102+
// 'pre_increment' => true,
103+
'protected_to_private' => true,
104+
'psr0' => true,
105+
'psr4' => true,
106+
'random_api_migration' => true,
107+
'return_type_declaration' => ['space_before' => 'one'],
108+
'self_accessor' => true,
109+
'short_scalar_cast' => true,
110+
// 'silenced_deprecation_error' => true,
111+
// 'simplified_null_return' => true,
112+
// 'single_blank_line_before_namespace' => true,
113+
'single_quote' => true,
114+
'space_after_semicolon' => true,
115+
'standardize_not_equals' => true,
116+
// 'strict_comparison' => true,
117+
'ternary_operator_spaces' => true,
118+
'strict_param' => true,
119+
'ternary_to_null_coalescing' => true,
120+
// 'trailing_comma_in_multiline_array' => true,
121+
'trim_array_spaces' => true,
122+
'unary_operator_spaces' => true,
123+
'whitespace_after_comma_in_array' => true
124+
))
125+
->setFinder(
126+
PhpCsFixer\Finder::create()
127+
->exclude('tests/Fake')
128+
->exclude('src-data')
129+
->in(__DIR__)
130+
)->setLineEnding("\n")
131+
->setUsingCache(false);

.scrutinizer.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
filter:
2+
paths: ["src/*"]
3+
tools:
4+
external_code_coverage: true
5+
php_code_coverage:
6+
timeout: 1200
7+
php_sim: true
8+
php_mess_detector: true
9+
php_pdepend: true
10+
php_analyzer: true
11+
php_cpd: true
12+
php_mess_detector:
13+
enabled: true
14+
config:
15+
ruleset: ./phpmd.xml
16+
php_code_sniffer:
17+
enabled: true
18+
config:
19+
ruleset: ./phpcs.xml

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
language: php
2+
sudo: required
3+
dist: trusty
4+
php:
5+
- 7.1
6+
env:
7+
- V8VER=5.2
8+
before_install:
9+
- make -f Makefile.travis before_install
10+
install:
11+
- make -f Makefile.travis install
12+
before_script:
13+
- composer self-update
14+
- composer update
15+
script:
16+
- ./vendor/bin/phpunit --coverage-clover=coverage.clover;
17+
- wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar && php php-cs-fixer-v2.phar fix --config=.php_cs -v --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE`
18+
after_script:
19+
- wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover

Makefile.travis

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Configure and build scripts for travis CI system
2+
V8VER ?= 5.1
3+
4+
export NO_INTERACTION=1
5+
export REPORT_EXIT_STATUS=1
6+
7+
before_install:
8+
sudo add-apt-repository ppa:pinepain/libv8-$(V8VER) -y
9+
sudo apt-get update -q
10+
install:
11+
sudo apt-get install -y libv8-$(V8VER)-dev
12+
git clone https://github.com/phpv8/v8js.git
13+
cd v8js && phpize && ./configure CXXFLAGS="-Wall -Wno-write-strings -Werror" && $(MAKE) -j3 && $(MAKE) install install && cd ..
14+
echo "extension=v8js.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Baracoa
22

3+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/koriym/Koriym.Baracoa/badges/quality-score.png?b=1.x)](https://scrutinizer-ci.com/g/koriym/Koriym.Baracoa/?branch=1.x)
4+
[![Code Coverage](https://scrutinizer-ci.com/g/koriym/Koriym.Baracoa/badges/coverage.png?b=1.x)](https://scrutinizer-ci.com/g/koriym/Koriym.Baracoa/?branch=1.x)
5+
[![Build Status](https://travis-ci.org/koriym/Koriym.Baracoa.svg?branch=1.x)](https://travis-ci.org/koriym/Koriym.Baracoa)
6+
7+
38
## A JavaScript server side rendering interface
49

510
**Bracoa** provides a simple interface for JavaScript server side rendering in PHP.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
},
2222
"require-dev": {
2323
"phpv8/v8js-stubs": "^1.2.0",
24-
"phpunit/phpunit": "~4.8 || ~5.7 || ~6.0",
24+
"phpunit/phpunit": "^6.1",
2525
"squizlabs/php_codesniffer": "^2.8.0",
2626
"phpmd/phpmd": "^2.6.0",
27-
"symfony/cache": "3.3.x-dev"
27+
"symfony/cache": "^v3.3.0-BETA1"
2828
},
2929
"autoload": {
3030
"psr-4": {

docs/example/handlesbar/public/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<?php
2+
/**
3+
* This file is part of the Koriym.Baracoa package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
27
require dirname(__DIR__, 4) . '/vendor/autoload.php';
38

4-
use Koriym\Baracoa\ExceptionHandler;
59
use Koriym\Baracoa\Baracoa;
10+
use Koriym\Baracoa\ExceptionHandler;
611

712
$jsBundleDir = __DIR__ . '/build';
813
$baracoa = new Baracoa($jsBundleDir, new ExceptionHandler());

docs/example/min/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<?php
2+
/**
3+
* This file is part of the Koriym.Baracoa package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
27
require dirname(__DIR__, 3) . '/vendor/autoload.php';
38

4-
use Koriym\Baracoa\ExceptionHandler;
59
use Koriym\Baracoa\Baracoa;
10+
use Koriym\Baracoa\ExceptionHandler;
611

712
$baracoa = new Baracoa(__DIR__, new ExceptionHandler());
813
$state = ['name' => 'World'];

0 commit comments

Comments
 (0)