mirror of
https://github.com/elyby/php-code-style.git
synced 2024-12-22 13:09:50 +05:30
Add fixer to place promoted properties on a new line when there is more than 1 parameter
This commit is contained in:
parent
050dfe6399
commit
6d572ae421
@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
### Added
|
### Added
|
||||||
- Enh #12: Implemented `Ely\align_multiline_parameters` fixer.
|
- Enh #12: Implemented `Ely\align_multiline_parameters` fixer.
|
||||||
- Enabled `Ely\align_multiline_parameters` for Ely.by codestyle in `['types' => false, 'defaults' => false]` mode.
|
- Enabled `Ely\align_multiline_parameters` for Ely.by codestyle in `['types' => false, 'defaults' => false]` mode.
|
||||||
|
- Enabled
|
||||||
|
[`PhpCsFixerCustomFixers/multiline_promoted_properties`](https://github.com/kubawerlos/php-cs-fixer-custom-fixers#multilinepromotedpropertiesfixer)
|
||||||
|
fixer for Ely.by codestyle in 2+ parameters mode.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Bug #10: `Ely/blank_line_before_return` don't treat interpolation curly bracket as beginning of the scope.
|
- Bug #10: `Ely/blank_line_before_return` don't treat interpolation curly bracket as beginning of the scope.
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
"homepage": "https://github.com/elyby/php-code-style",
|
"homepage": "https://github.com/elyby/php-code-style",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.4 || ^8.0",
|
"php": "^7.4 || ^8.0",
|
||||||
"friendsofphp/php-cs-fixer": "^3.13"
|
"friendsofphp/php-cs-fixer": "^3.13",
|
||||||
|
"kubawerlos/php-cs-fixer-custom-fixers": "^3.13"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ergebnis/composer-normalize": "^2.28",
|
"ergebnis/composer-normalize": "^2.28",
|
||||||
|
48
composer.lock
generated
48
composer.lock
generated
@ -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": "984ffa466fb6bc9281a36b8701147fee",
|
"content-hash": "9fc362b1a074bf1a33695018a2b1b198",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/pcre",
|
"name": "composer/pcre",
|
||||||
@ -462,6 +462,52 @@
|
|||||||
],
|
],
|
||||||
"time": "2022-10-31T19:28:50+00:00"
|
"time": "2022-10-31T19:28:50+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "kubawerlos/php-cs-fixer-custom-fixers",
|
||||||
|
"version": "v3.13.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git",
|
||||||
|
"reference": "fb53d8bbe2224383a84c71f451d76eb7bc6c8e33"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/fb53d8bbe2224383a84c71f451d76eb7bc6c8e33",
|
||||||
|
"reference": "fb53d8bbe2224383a84c71f451d76eb7bc6c8e33",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-filter": "*",
|
||||||
|
"ext-tokenizer": "*",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.6.0",
|
||||||
|
"php": "^7.4 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5.20"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpCsFixerCustomFixers\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kuba Werłos",
|
||||||
|
"email": "werlos@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A set of custom fixers for PHP CS Fixer",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues",
|
||||||
|
"source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.13.0"
|
||||||
|
},
|
||||||
|
"time": "2023-02-15T18:51:16+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/cache",
|
"name": "psr/cache",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
@ -3,14 +3,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Ely\CS;
|
namespace Ely\CS;
|
||||||
|
|
||||||
|
use Ely\CS\Fixers as ElyFixers;
|
||||||
use PhpCsFixer\Config as PhpCsFixerConfig;
|
use PhpCsFixer\Config as PhpCsFixerConfig;
|
||||||
|
use PhpCsFixer\ConfigInterface as PhpCsFixerConfigInterface;
|
||||||
|
use PhpCsFixerCustomFixers\Fixers as KubawerlosFixers;
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
|
|
||||||
public static function create(array $overwrittenRules = []): PhpCsFixerConfig {
|
public static function create(array $overwrittenRules = []): PhpCsFixerConfigInterface {
|
||||||
return (new PhpCsFixerConfig())
|
return (new PhpCsFixerConfig())
|
||||||
->setRiskyAllowed(true)
|
->setRiskyAllowed(true)
|
||||||
->registerCustomFixers(new Fixers())
|
->registerCustomFixers(new ElyFixers())
|
||||||
|
->registerCustomFixers(new KubawerlosFixers())
|
||||||
->setRules(Rules::create($overwrittenRules));
|
->setRules(Rules::create($overwrittenRules));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +213,11 @@ class Rules {
|
|||||||
'space_multiple_catch' => 'none',
|
'space_multiple_catch' => 'none',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// kubawerlos fixers
|
||||||
|
'PhpCsFixerCustomFixers/multiline_promoted_properties' => [
|
||||||
|
'minimum_number_of_parameters' => 2,
|
||||||
|
],
|
||||||
|
|
||||||
// Our custom or extended fixers
|
// Our custom or extended fixers
|
||||||
'Ely/align_multiline_parameters' => [
|
'Ely/align_multiline_parameters' => [
|
||||||
'variables' => false,
|
'variables' => false,
|
||||||
|
Loading…
Reference in New Issue
Block a user