3 Commits
0.2.1 ... 0.3.0

Author SHA1 Message Date
2140798d0a Update CHANGELOG 2019-02-23 20:29:08 +03:00
d8eafd4505 First set of fixes 2019-02-23 02:26:51 +03:00
714a38d53e Bump minimal php-cs-fixer version to 2.13.0. Add additional rules. 2019-02-23 02:05:20 +03:00
6 changed files with 123 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/vendor/
vendor
dist
.php_cs
.php_cs.cache

View File

@ -6,6 +6,61 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
## [0.3.0] - 2019-02-23
### Added
- `array_indentation` fixer.
- `combine_consecutive_issets` fixer.
- `combine_nested_dirname` fixer.
- `dir_constant` fixer.
- `ereg_to_preg` fixer.
- `explicit_string_variable` fixer.
- `implode_call` fixer.
- `is_null` fixer.
- `list_syntax` fixer.
- `logical_operators` fixer.
- `lowercase_cast` fixer.
- `lowercase_static_reference` fixer.
- `magic_constant_casing` fixer.
- `magic_method_casing` fixer.
- `multiline_whitespace_before_semicolons` fixer.
- `native_function_casing` fixer.
- `no_alternative_syntax` fixer.
- `no_homoglyph_names` fixer.
- `no_leading_import_slash` fixer.
- `no_leading_namespace_whitespace` fixer.
- `no_mixed_echo_print` fixer.
- `no_multiline_whitespace_around_double_arrow` fixer.
- `no_php4_constructor` fixer.
- `no_spaces_around_offset` fixer.
- `no_superfluous_elseif` fixer.
- `no_unneeded_control_parentheses` fixer.
- `no_useless_return` fixer.
- `php_unit_construct` fixer.
- `php_unit_expectation` fixer.
- `php_unit_method_casing` fixer.
- `php_unit_mock` fixer.
- `php_unit_namespaced` fixer.
- `php_unit_set_up_tear_down_visibility` fixer.
- `php_unit_strict` fixer.
- `pow_to_exponentiation` fixer.
- `psr4` fixer.
- `return_assignment` fixer.
- `random_api_migration` fixer.
- `self_accessor` fixer.
- `set_type_to_cast` fixer.
- `short_scalar_cast` fixer.
- `space_after_semicolon` fixer.
- `standardize_increment` fixer.
- `standardize_not_equals` fixer.
- `trim_array_spaces` fixer.
- `unary_operator_spaces` fixer.
### Changed
- `friendsofphp/php-cs-fixer` version bumped to `^2.13.0`.
### Fixed
- `ordered_imports` now has fixed order of import types.
## [0.2.1] - 2019-02-22
### Fixed
- Compatibility with the `friendsofphp/php-cs-fixer` version 2.13.3 and above.
@ -28,5 +83,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- First release
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/0.2.0...HEAD
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/0.3.0...HEAD
[0.3.0]: https://github.com/elyby/php-code-style/compare/0.2.1...0.3.0
[0.2.1]: https://github.com/elyby/php-code-style/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/elyby/php-code-style/compare/0.1.0...0.2.0

View File

@ -17,7 +17,7 @@
"type": "library",
"require": {
"php": "^7.0",
"friendsofphp/php-cs-fixer": "^2.12.2"
"friendsofphp/php-cs-fixer": "^2.13.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5.1"

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "80849b188628ffdf06b4ffc4be3edb84",
"content-hash": "0d399f36e24f93c2b3ce717b19cfa1ac",
"packages": [
{
"name": "composer/semver",

View File

@ -7,6 +7,7 @@ class Rules {
private static $rules = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
@ -20,41 +21,98 @@ class Rules {
'class_attributes_separation' => [
'elements' => ['method', 'property'],
],
'combine_consecutive_issets' => true,
'combine_nested_dirname' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
'declare_equal_normalize' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'explicit_string_variable' => true, // Should be configurable to choose between ${var} and {$var}
'function_declaration' => [
'closure_function_spacing' => 'none',
],
'function_to_constant' => true,
'implode_call' => true,
'include' => true,
'is_null' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => [
'syntax' => 'short',
],
'logical_operators' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'native_function_casing' => true,
'no_alternative_syntax' => true,
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_final_method' => 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,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'random_api_migration' => true,
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
],
'php_unit_construct' => true,
'php_unit_expectation' => true,
'php_unit_method_casing' => true,
'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'pow_to_exponentiation' => true,
'psr4' => true,
'return_assignment' => true,
'random_api_migration' => [
'replacements' => [
'getrandmax' => 'mt_getrandmax',
'rand' => 'random_int',
'srand' => 'mt_srand',
],
],
'return_type_declaration' => [
'space_before' => 'none',
],
'self_accessor' => true,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'strict_comparison' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => ['property', 'method', 'const'],
],

View File

@ -36,7 +36,7 @@ final class BlankLineBeforeReturnFixerTest extends AbstractFixerTestCase {
public function provideFixCases() {
$cases = [];
$cases[] = [
'$a = $a;
'$a = $a;
return $a;
',
];