10 Commits
0.2.0 ... 0.3.0

9 changed files with 270 additions and 88 deletions

3
.gitignore vendored
View File

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

View File

@ -3,7 +3,7 @@ php:
- '7.0' - '7.0'
- '7.1' - '7.1'
- '7.2' - '7.2'
- nightly - '7.3'
cache: cache:
directories: directories:
@ -25,11 +25,11 @@ stages:
jobs: jobs:
include: include:
- stage: Static Code Analysis - stage: Static Code Analysis
php: 7.2 php: 7.3
script: script:
- vendor/bin/php-cs-fixer fix -v --dry-run - vendor/bin/php-cs-fixer fix -v --dry-run
- stage: Test
script:
- vendor/bin/phpunit
allow_failures: allow_failures:
- php: nightly - php: nightly
script:
- vendor/bin/phpunit

View File

@ -6,6 +6,65 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased] ## [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.
## [0.2.0] - 2018-08-08 ## [0.2.0] - 2018-08-08
### Added ### Added
- Enh #4: `Ely\remove_class_name_method_usages` fixer. - Enh #4: `Ely\remove_class_name_method_usages` fixer.
@ -24,5 +83,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added ### Added
- First release - 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 [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", "type": "library",
"require": { "require": {
"php": "^7.0", "php": "^7.0",
"friendsofphp/php-cs-fixer": "^2.12.2" "friendsofphp/php-cs-fixer": "^2.13.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.5.1" "phpunit/phpunit": "^6.5.1"
@ -34,7 +34,7 @@
}, },
"config": { "config": {
"platform": { "platform": {
"php": "7.0.0" "php": "7.0.8"
} }
} }
} }

204
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "70eecd9b529cd72627b990072a7e0ff5", "content-hash": "0d399f36e24f93c2b3ce717b19cfa1ac",
"packages": [ "packages": [
{ {
"name": "composer/semver", "name": "composer/semver",
@ -70,16 +70,16 @@
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
"version": "1.1.0", "version": "1.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/xdebug-handler.git", "url": "https://github.com/composer/xdebug-handler.git",
"reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08" "reference": "d17708133b6c276d6e42ef887a877866b909d892"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/c919dc6c62e221fc6406f861ea13433c0aa24f08", "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/d17708133b6c276d6e42ef887a877866b909d892",
"reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08", "reference": "d17708133b6c276d6e42ef887a877866b909d892",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -110,7 +110,7 @@
"Xdebug", "Xdebug",
"performance" "performance"
], ],
"time": "2018-04-11T15:42:36+00:00" "time": "2019-01-28T20:25:53+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -236,27 +236,27 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v2.12.2", "version": "v2.14.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183" "reference": "ff401e58261ffc5934a58f795b3f95b355e276cb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/dcc87d5414e9d0bd316fce81a5bedb9ce720b183", "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ff401e58261ffc5934a58f795b3f95b355e276cb",
"reference": "dcc87d5414e9d0bd316fce81a5bedb9ce720b183", "reference": "ff401e58261ffc5934a58f795b3f95b355e276cb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer/semver": "^1.4", "composer/semver": "^1.4",
"composer/xdebug-handler": "^1.0", "composer/xdebug-handler": "^1.2",
"doctrine/annotations": "^1.2", "doctrine/annotations": "^1.2",
"ext-json": "*", "ext-json": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": "^5.6 || >=7.0 <7.3", "php": "^5.6 || ^7.0",
"php-cs-fixer/diff": "^1.3", "php-cs-fixer/diff": "^1.3",
"symfony/console": "^3.2 || ^4.0", "symfony/console": "^3.4.17 || ^4.1.6",
"symfony/event-dispatcher": "^3.0 || ^4.0", "symfony/event-dispatcher": "^3.0 || ^4.0",
"symfony/filesystem": "^3.0 || ^4.0", "symfony/filesystem": "^3.0 || ^4.0",
"symfony/finder": "^3.0 || ^4.0", "symfony/finder": "^3.0 || ^4.0",
@ -266,13 +266,10 @@
"symfony/process": "^3.0 || ^4.0", "symfony/process": "^3.0 || ^4.0",
"symfony/stopwatch": "^3.0 || ^4.0" "symfony/stopwatch": "^3.0 || ^4.0"
}, },
"conflict": {
"hhvm": "*"
},
"require-dev": { "require-dev": {
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0",
"justinrainbow/json-schema": "^5.0", "justinrainbow/json-schema": "^5.0",
"keradus/cli-executor": "^1.1", "keradus/cli-executor": "^1.2",
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.1", "php-coveralls/php-coveralls": "^2.1",
"php-cs-fixer/accessible-object": "^1.0", "php-cs-fixer/accessible-object": "^1.0",
@ -323,7 +320,7 @@
} }
], ],
"description": "A tool to automatically fix PHP code style", "description": "A tool to automatically fix PHP code style",
"time": "2018-07-06T10:37:40+00:00" "time": "2019-02-17T17:44:13+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
@ -423,16 +420,16 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.0.2", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -466,49 +463,52 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2016-10-10T12:19:37+00:00" "time": "2018-11-20T15:27:04+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.3.6", "version": "v3.4.22",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "b0878233cb5c4391347e5495089c7af11b8e6201" "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/b0878233cb5c4391347e5495089c7af11b8e6201", "url": "https://api.github.com/repos/symfony/console/zipball/069bf3f0e8f871a2169a06e43d9f3f03f355e9be",
"reference": "b0878233cb5c4391347e5495089c7af11b8e6201", "reference": "069bf3f0e8f871a2169a06e43d9f3f03f355e9be",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9", "php": "^5.5.9|>=7.0.8",
"symfony/debug": "~2.8|~3.0", "symfony/debug": "~2.8|~3.0|~4.0",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "~1.0"
}, },
"conflict": { "conflict": {
"symfony/dependency-injection": "<3.3" "symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
}, },
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/config": "~3.3", "symfony/config": "~3.3|~4.0",
"symfony/dependency-injection": "~3.3", "symfony/dependency-injection": "~3.4|~4.0",
"symfony/event-dispatcher": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/filesystem": "~2.8|~3.0", "symfony/lock": "~3.4|~4.0",
"symfony/http-kernel": "~2.8|~3.0", "symfony/process": "~3.3|~4.0"
"symfony/process": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log": "For using the console logger",
"symfony/event-dispatcher": "", "symfony/event-dispatcher": "",
"symfony/filesystem": "", "symfony/lock": "",
"symfony/process": "" "symfony/process": ""
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3-dev" "dev-master": "3.4-dev"
} }
}, },
"autoload": { "autoload": {
@ -535,7 +535,7 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-07-29T21:27:59+00:00" "time": "2019-01-25T10:42:12+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
@ -810,16 +810,16 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.9.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -865,20 +865,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-08-06T14:22:27+00:00" "time": "2018-09-21T13:07:52+00:00"
}, },
{ {
"name": "symfony/polyfill-php70", "name": "symfony/polyfill-php70",
"version": "v1.9.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php70.git", "url": "https://github.com/symfony/polyfill-php70.git",
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224",
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -924,20 +924,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-08-06T14:22:27+00:00" "time": "2018-09-21T06:26:08+00:00"
}, },
{ {
"name": "symfony/polyfill-php72", "name": "symfony/polyfill-php72",
"version": "v1.9.0", "version": "v1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php72.git", "url": "https://github.com/symfony/polyfill-php72.git",
"reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
"reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -979,7 +979,7 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-08-06T14:22:27+00:00" "time": "2018-09-21T13:07:52+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
@ -1748,16 +1748,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "6.5.11", "version": "6.5.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7bab54cb366076023bbf457a2a0d513332cd40f2" "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7bab54cb366076023bbf457a2a0d513332cd40f2", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bac23fe7ff13dbdb461481f706f0e9fe746334b7",
"reference": "7bab54cb366076023bbf457a2a0d513332cd40f2", "reference": "bac23fe7ff13dbdb461481f706f0e9fe746334b7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1828,20 +1828,20 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2018-08-07T07:05:35+00:00" "time": "2019-02-01T05:22:47+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "5.0.9", "version": "5.0.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "141129c578f58f38f55eccf15a1039bd413ea57c" "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/141129c578f58f38f55eccf15a1039bd413ea57c", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/cd1cf05c553ecfec36b170070573e540b67d3f1f",
"reference": "141129c578f58f38f55eccf15a1039bd413ea57c", "reference": "cd1cf05c553ecfec36b170070573e540b67d3f1f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1854,7 +1854,7 @@
"phpunit/phpunit": "<6.0" "phpunit/phpunit": "<6.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.5" "phpunit/phpunit": "^6.5.11"
}, },
"suggest": { "suggest": {
"ext-soap": "*" "ext-soap": "*"
@ -1887,7 +1887,8 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2018-08-07T07:02:44+00:00" "abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@ -2448,6 +2449,64 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00" "time": "2016-10-03T07:35:21+00:00"
}, },
{
"name": "symfony/polyfill-ctype",
"version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2018-08-06T14:22:27+00:00"
},
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
"version": "1.1.0", "version": "1.1.0",
@ -2490,20 +2549,21 @@
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
"version": "1.3.0", "version": "1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/webmozart/assert.git", "url": "https://github.com/webmozart/assert.git",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a" "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "0df1908962e7a3071564e857d86874dad1ef204a", "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3.3 || ^7.0" "php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.6", "phpunit/phpunit": "^4.6",
@ -2536,7 +2596,7 @@
"check", "check",
"validate" "validate"
], ],
"time": "2018-01-29T19:49:41+00:00" "time": "2018-12-25T11:19:39+00:00"
} }
], ],
"aliases": [], "aliases": [],
@ -2549,6 +2609,6 @@
}, },
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.0.0" "php": "7.0.8"
} }
} }

View File

@ -10,10 +10,10 @@ use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
use PhpCsFixer\FixerConfiguration\FixerOptionBuilder; use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\CodeSample;
use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinition;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Token; use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens; use PhpCsFixer\Tokenizer\Tokens;
use PhpCsFixer\Tokenizer\TokensAnalyzer; use PhpCsFixer\Tokenizer\TokensAnalyzer;
use PhpCsFixer\Utils;
/** /**
* This is copy of the PR https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3688 * This is copy of the PR https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3688
@ -142,7 +142,8 @@ new class extends Foo {
} }
// The final bit of the whitespace must be the next statement's indentation // The final bit of the whitespace must be the next statement's indentation
$lines = Utils::splitLines($content); Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
$lines = $matches[0];
$eol = $this->whitespacesConfig->getLineEnding(); $eol = $this->whitespacesConfig->getLineEnding();
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]); $tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
} }

View File

@ -7,9 +7,9 @@ use Ely\CS\Fixer\AbstractFixer;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface; use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerDefinition\CodeSample; use PhpCsFixer\FixerDefinition\CodeSample;
use PhpCsFixer\FixerDefinition\FixerDefinition; use PhpCsFixer\FixerDefinition\FixerDefinition;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Token; use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens; use PhpCsFixer\Tokenizer\Tokens;
use PhpCsFixer\Utils;
use SplFileInfo; use SplFileInfo;
/** /**
@ -123,7 +123,8 @@ class Foo
} }
// The final bit of the whitespace must be the next statement's indentation // The final bit of the whitespace must be the next statement's indentation
$lines = Utils::splitLines($content); Preg::matchAll('/[^\n\r]+[\r\n]*/', $content, $matches);
$lines = $matches[0];
$eol = $this->whitespacesConfig->getLineEnding(); $eol = $this->whitespacesConfig->getLineEnding();
$tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]); $tokens[$index] = new Token([T_WHITESPACE, str_repeat($eol, $countLines + 1) . end($lines)]);
} }

View File

@ -7,6 +7,7 @@ class Rules {
private static $rules = [ private static $rules = [
'@PSR2' => true, '@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [ 'array_syntax' => [
'syntax' => 'short', 'syntax' => 'short',
], ],
@ -20,41 +21,98 @@ class Rules {
'class_attributes_separation' => [ 'class_attributes_separation' => [
'elements' => ['method', 'property'], 'elements' => ['method', 'property'],
], ],
'combine_consecutive_issets' => true,
'combine_nested_dirname' => true,
'compact_nullable_typehint' => true, 'compact_nullable_typehint' => true,
'concat_space' => [ 'concat_space' => [
'spacing' => 'one', 'spacing' => 'one',
], ],
'declare_equal_normalize' => true, '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' => [ 'function_declaration' => [
'closure_function_spacing' => 'none', 'closure_function_spacing' => 'none',
], ],
'function_to_constant' => true, 'function_to_constant' => true,
'implode_call' => true,
'include' => true, 'include' => true,
'is_null' => true,
'linebreak_after_opening_tag' => 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, 'method_chaining_indentation' => true,
'modernize_types_casting' => 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_short_bool_cast' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true, 'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_final_method' => true, 'no_unneeded_final_method' => true,
'no_unused_imports' => true, 'no_unused_imports' => true,
'no_useless_else' => true, 'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true, 'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true, 'no_whitespace_in_blank_line' => true,
'non_printable_character' => [ 'non_printable_character' => [
'use_escape_sequences_in_strings' => true, 'use_escape_sequences_in_strings' => true,
], ],
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true, 'object_operator_without_whitespace' => true,
'ordered_class_elements' => true, 'ordered_class_elements' => true,
'ordered_imports' => true, 'ordered_imports' => [
'random_api_migration' => true, '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' => [ 'return_type_declaration' => [
'space_before' => 'none', 'space_before' => 'none',
], ],
'self_accessor' => true,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'single_quote' => true, 'single_quote' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'strict_comparison' => true, 'strict_comparison' => true,
'ternary_operator_spaces' => true, 'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true, 'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true, 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [ 'visibility_required' => [
'elements' => ['property', 'method', 'const'], 'elements' => ['property', 'method', 'const'],
], ],

View File

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