Skip to content

Commit 9972d0f

Browse files
authored
Merge pull request #20 from koriym/ver
Abandon foa/filter-input-bundle package
2 parents 46060d5 + b95132b commit 9972d0f

Some content is hidden

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

45 files changed

+345
-178
lines changed

.php_cs

Lines changed: 130 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,132 @@
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 Ray.WebFormModule 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+
->exclude('src-deprecated')
130+
->in(__DIR__)
131+
)->setLineEnding("\n")
132+
->setUsingCache(false);

.travis.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
language: php
2-
2+
sudo: false
33
php:
4-
- 5.5
54
- 5.6
6-
- hhvm
75
- 7
8-
9-
install: travis_retry composer install --no-interaction --prefer-source
10-
6+
- 7.1
7+
- hhvm
8+
cache:
9+
directories:
10+
- vendor
11+
- $HOME/.composer/cache
12+
env:
13+
matrix:
14+
- DEPENDENCIES=""
15+
- DEPENDENCIES="--prefer-lowest --prefer-stable"
16+
before_script:
17+
- composer self-update
18+
- composer update $DEPENDENCIES
1119
script:
12-
- if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then phpunit; fi
13-
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi
20+
- ./vendor/bin/phpunit --coverage-clover=coverage.clover;
21+
- if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then 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`; fi
1422

1523
after_script:
16-
- wget https://scrutinizer-ci.com/ocular.phar
17-
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
24+
- if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

composer.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
"Ray.Di module"
77
],
88
"require": {
9-
"ray/di": "^2.0",
10-
"foa/filter-input-bundle": "^1.1@dev",
11-
"aura/filter": "^2.0@dev",
9+
"ray/di": "^2.5",
10+
"aura/input": "^1.2",
11+
"aura/filter": "^2.3",
1212
"aura/html": "^2.4",
13-
"ray/aura-session-module": "~1.0"
13+
"ray/aura-session-module": "^1.0"
14+
},
15+
"require-dev": {
16+
"phpunit/phpunit": "^5.7.13"
1417
},
1518
"license": "MIT",
1619
"autoload":{
@@ -20,8 +23,13 @@
2023
},
2124
"autoload-dev":{
2225
"psr-4":{
23-
"Ray\\WebFormModule\\": "tests/",
24-
"Ray\\WebFormModule\\": "tests/Fake"
26+
"Ray\\WebFormModule\\": ["tests/", "tests/Fake"]
2527
}
28+
},
29+
"scripts" :{
30+
"test": ["@cs", "phpunit"],
31+
"coverage": ["php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
32+
"cs": ["php-cs-fixer fix -v --dry-run", "phpcs --standard=./phpcs.xml src"],
33+
"cs-fix": ["php-cs-fixer fix -v", "phpcbf src"]
2634
}
2735
}

docs/demo/1.csrf/ContactForm.php

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
2-
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
37
namespace Ray\WebFormModule;
48

59
use Aura\Input\Filter;
@@ -8,6 +12,35 @@ class ContactForm extends AbstractAuraForm
812
{
913
use SetAntiCsrfTrait;
1014

15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function __toString()
19+
{
20+
$form = $this->form();
21+
// name
22+
$form .= $this->helper->tag('div', ['class' => 'form-group']);
23+
$form .= $this->helper->tag('label', ['for' => 'name']);
24+
$form .= 'Name:';
25+
$form .= $this->helper->tag('/label') . PHP_EOL;
26+
$form .= $this->input('name');
27+
$form .= $this->error('name');
28+
$form .= $this->helper->tag('/div') . PHP_EOL;
29+
// message
30+
$form .= $this->helper->tag('div', ['class' => 'form-group']);
31+
$form .= $this->helper->tag('label', ['for' => 'message']);
32+
$form .= 'Message:';
33+
$form .= $this->helper->tag('/label') . PHP_EOL;
34+
$form .= $this->input('message');
35+
$form .= $this->error('message');
36+
$form .= $this->helper->tag('/div') . PHP_EOL;
37+
// submit
38+
$form .= $this->input('submit');
39+
$form .= $this->helper->tag('/form');
40+
41+
return $form;
42+
}
43+
1144
/**
1245
* {@inheritdoc}
1346
*/
@@ -60,33 +93,4 @@ public function submit()
6093
{
6194
return $_POST;
6295
}
63-
64-
/**
65-
* {@inheritdoc}
66-
*/
67-
public function __toString()
68-
{
69-
$form = $this->form();
70-
// name
71-
$form .= $this->helper->tag('div', ['class' => 'form-group']);
72-
$form .= $this->helper->tag('label', ['for' => 'name']);
73-
$form .= 'Name:';
74-
$form .= $this->helper->tag('/label') . PHP_EOL;
75-
$form .= $this->input('name');
76-
$form .= $this->error('name');
77-
$form .= $this->helper->tag('/div') . PHP_EOL;
78-
// message
79-
$form .= $this->helper->tag('div', ['class' => 'form-group']);
80-
$form .= $this->helper->tag('label', ['for' => 'message']);
81-
$form .= 'Message:';
82-
$form .= $this->helper->tag('/label') . PHP_EOL;
83-
$form .= $this->input('message');
84-
$form .= $this->error('message');
85-
$form .= $this->helper->tag('/div') . PHP_EOL;
86-
// submit
87-
$form .= $this->input('submit');
88-
$form .= $this->helper->tag('/form');
89-
90-
return $form;
91-
}
9296
}

docs/demo/1.csrf/Controller.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
2-
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
37
namespace Ray\WebFormModule;
48

59
use Ray\Di\Di\Inject;

docs/demo/1.csrf/MyModule.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
2-
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
37
namespace Ray\WebFormModule;
48

59
use Ray\Di\AbstractModule;

docs/demo/1.csrf/run.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
2-
3-
/* @var $loader \Composer\Autoload\ClassLoader */
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
47
$loader = require dirname(__DIR__) . '/autoload.php';
58
$loader->addPsr4('Ray\WebFormModule\\', __DIR__);
69
use Aura\Input\Exception\CsrfViolation;
@@ -14,7 +17,7 @@
1417
try {
1518
$controller->createUser(['name' => 'bear', 'message' => 'hello']);
1619
} catch (CsrfViolation $e) {
17-
echo 'Anti CSRF works !'. PHP_EOL;
20+
echo 'Anti CSRF works !' . PHP_EOL;
1821
exit;
1922
}
2023
echo 'Anti CSRF DOES NOT works !' . PHP_EOL;

docs/demo/1.csrf/web.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
2-
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
37
use Ray\Di\Injector;
48
use Ray\WebFormModule\Controller;
59
use Ray\WebFormModule\MyModule;

docs/demo/autoload.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
/**
3+
* This file is part of the Ray.WebFormModule package.
4+
*
5+
* @license http://opensource.org/licenses/MIT MIT
6+
*/
27
use Doctrine\Common\Annotations\AnnotationRegistry;
38

49
$autoloader = dirname(dirname(__DIR__)) . '/vendor/autoload.php';

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<rule ref="PSR2">
99
<exclude name="Generic.Files.LineLength"/>
1010
</rule>
11+
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
1112
<rule ref="PEAR.Commenting.FunctionComment">
1213
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn"/>
1314
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment"/>

0 commit comments

Comments
 (0)