Skip to content

Commit

Permalink
http aware exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangut committed Feb 15, 2018
0 parents commit 8e8613c
Show file tree
Hide file tree
Showing 47 changed files with 1,889 additions and 0 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
@@ -0,0 +1 @@
service_name: travis-ci
27 changes: 27 additions & 0 deletions .editorconfig
@@ -0,0 +1,27 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
indent_size = 2

[*.html]
indent_size = 2

[*.json]
indent_size = 2

[*.neon]
indent_size = 2

[*.yml]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
14 changes: 14 additions & 0 deletions .gitattributes
@@ -0,0 +1,14 @@
* text=auto

.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.php_cs export-ignore
.travis.yml export-ignore
.coveralls.yml export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
infection.json.dist export-ignore
README.md export-ignore
CONTRIBUTING.md export-ignore
phpunit.xml.dist export-ignore
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
!.gitignore
composer.lock
cghooks.lock
vendor/
.yo-rc.json
*.cache
infection-log.*
build/
130 changes: 130 additions & 0 deletions .php_cs
@@ -0,0 +1,130 @@
<?php

/*
* http-exception (https://github.com/juliangut/http-exception).
* HTTP aware exceptions.
*
* @license BSD-3-Clause
* @link https://github.com/juliangut/http-exception
* @author Julián Gutiérrez <juliangut@gmail.com>
*/

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = <<<'HEADER'
http-exception (https://github.com/juliangut/http-exception).
HTTP aware exceptions.
@license BSD-3-Clause
@link https://github.com/juliangut/http-exception
@author Julián Gutiérrez <juliangut@gmail.com>
HEADER;

$finder = Finder::create()
->exclude(['vendor', 'build'])
->in(__DIR__);

return Config::create()
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'align_double_arrow' => false,
'align_equals' => false,
],
'blank_line_after_opening_tag' => true,
'cast_spaces' => true,
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'concat_space' => [
'spacing' => 'one'
],
'declare_equal_normalize' => true,
'declare_strict_types' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'header_comment' => [
'header' => $header,
'location' => 'after_open',
],
'heredoc_to_nowdoc' => true,
'include' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unreachable_default_argument_value' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'random_api_migration' => true,
'return_type_declaration' => [
'space_before' => 'none',
],
'self_accessor' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'trailing_comma_in_multiline_array' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true
])
->setFinder($finder);
84 changes: 84 additions & 0 deletions .scrutinizer.yml
@@ -0,0 +1,84 @@
# language: php

filter:
paths: [src/*]
excluded_paths: [tests/*, vendor/*]

before_commands:
- 'composer self-update'
- 'composer update --prefer-stable --prefer-source --no-interaction --no-scripts --no-progress --no-suggest'

coding_style:
php:
upper_lower_casing:
keywords:
general: lower
constants:
true_false_null: lower
spaces:
around_operators:
concatenation: true
negation: false
other:
after_type_cast: true

tools:
php_code_coverage: false
php_code_sniffer:
enabled: true
config:
standard: 'PSR2'
filter:
paths: [src/*, tests/*]
php_mess_detector:
enabled: true
config:
ruleset: 'unusedcode,naming,design,controversial,codesize'

php_cpd: true
php_loc: true
php_pdepend: true
php_analyzer: true
sensiolabs_security_checker: true

checks:
php:
code_rating: true
duplication: true
uppercase_constants: true
properties_in_camelcaps: true
prefer_while_loop_over_for_loop: true
parameters_in_camelcaps: true
optional_parameters_at_the_end: true
no_short_variable_names:
minimum: '3'
no_short_method_names:
minimum: '3'
no_goto: true
newline_at_end_of_file: true
more_specific_types_in_doc_comments: true
line_length:
max_length: '120'
function_in_camel_caps: true
encourage_single_quotes: true
encourage_postdec_operator: true
classes_in_camel_caps: true
avoid_perl_style_comments: true
avoid_multiple_statements_on_same_line: true
parameter_doc_comments: true
use_self_instead_of_fqcn: true
simplify_boolean_return: true
avoid_fixme_comments: true
return_doc_comments: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
83 changes: 83 additions & 0 deletions .styleci.yml
@@ -0,0 +1,83 @@
preset: psr2

finder:
exclude:
- vendor
- build

enabled:
- alpha_ordered_imports
- binary_operator_spaces
- blank_line_after_opening_tag
- blank_line_before_return
- cast_spaces
- concat_with_spaces
- declare_equal_normalize
- declare_strict_types
- function_typehint_space
- hash_to_slash_comment
- heredoc_to_nowdoc
- include
- linebreak_after_opening_tag
- lowercase_cast
- method_separation
- modernize_types_casting
- native_function_casing
- new_with_braces
- no_alias_functions
- no_blank_lines_after_class_opening
- no_blank_lines_after_phpdoc
- no_empty_comment
- no_empty_phpdoc
- no_empty_statement
- no_leading_import_slash
- no_leading_namespace_whitespace
- no_multiline_whitespace_around_double_arrow
- no_multiline_whitespace_before_semicolons
- no_php4_constructor
- no_short_bool_cast
- no_singleline_whitespace_before_semicolons
- no_spaces_inside_offset
- no_spaces_outside_offset
- no_trailing_comma_in_singleline_array
- no_unneeded_control_parentheses
- no_unreachable_default_argument_value
- no_unused_imports
- no_useless_else
- no_useless_return
- no_whitespace_before_comma_in_array
- no_whitespace_in_blank_line
- normalize_index_brace
- php_unit_construct
- php_unit_dedicate_assert
- phpdoc_align
- phpdoc_annotation_without_dot
- phpdoc_indent
- phpdoc_inline_tag
- phpdoc_no_access
- phpdoc_no_empty_return
- phpdoc_no_package
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_separation
- phpdoc_single_line_var_spacing
- phpdoc_summary
- phpdoc_to_comment
- phpdoc_trim
- phpdoc_types
- phpdoc_var_without_name
- print_to_echo
- return_type_declaration
- self_accessor
- short_array_syntax
- short_scalar_cast
- single_blank_line_before_namespace
- single_quote
- space_after_semicolon
- standardize_not_equals
- ternary_operator_spaces
- trailing_comma_in_multiline_array
- trim_array_spaces
- unary_operator_spaces
- whitespace_after_comma_in_array

0 comments on commit 8e8613c

Please sign in to comment.