Skip to content

Commit 9337770

Browse files
authored
Merge pull request #10 from simonschaufi/php-cs-fixer
Update and run php-cs-fixer
2 parents 05d490b + 16a209c commit 9337770

File tree

60 files changed

+223
-175
lines changed

Some content is hidden

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

60 files changed

+223
-175
lines changed

.php_cs

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,61 @@
11
<?php
22

3-
return Symfony\CS\Config\Config::create()
4-
->setUsingCache(true)
5-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
6-
->fixers([
7-
'concat_with_spaces',
8-
'newline_after_open_tag',
9-
'ordered_use',
10-
'phpdoc_order',
11-
'short_array_syntax',
12-
'-empty_return',
13-
'-concat_without_spaces',
14-
'-phpdoc_inline_tag',
15-
])
16-
->finder(
17-
Symfony\CS\Finder\DefaultFinder::create()->in(['src', 'tests'])
18-
)
19-
;
3+
$config = new \PhpCsFixer\Config();
4+
$config
5+
->setRiskyAllowed(true)
6+
->setRules([
7+
'@DoctrineAnnotation' => true,
8+
'@PSR2' => true,
9+
'array_syntax' => ['syntax' => 'short'],
10+
'blank_line_after_opening_tag' => true,
11+
'braces' => ['allow_single_line_closure' => true],
12+
'cast_spaces' => ['space' => 'none'],
13+
'compact_nullable_typehint' => true,
14+
'concat_space' => ['spacing' => 'one'],
15+
'declare_equal_normalize' => ['space' => 'none'],
16+
'dir_constant' => true,
17+
'function_typehint_space' => true,
18+
'hash_to_slash_comment' => true,
19+
'lowercase_cast' => true,
20+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
21+
'modernize_types_casting' => true,
22+
'native_function_casing' => true,
23+
'new_with_braces' => true,
24+
'no_alias_functions' => true,
25+
'no_blank_lines_after_phpdoc' => true,
26+
'no_empty_phpdoc' => true,
27+
'no_empty_statement' => true,
28+
'no_extra_consecutive_blank_lines' => true,
29+
'no_leading_import_slash' => true,
30+
'no_leading_namespace_whitespace' => true,
31+
'no_null_property_initialization' => true,
32+
'no_short_bool_cast' => true,
33+
'no_singleline_whitespace_before_semicolons' => true,
34+
'no_superfluous_elseif' => true,
35+
'no_trailing_comma_in_singleline_array' => true,
36+
'no_unneeded_control_parentheses' => true,
37+
'no_unused_imports' => true,
38+
'no_useless_else' => true,
39+
'no_whitespace_in_blank_line' => true,
40+
'ordered_imports' => true,
41+
'php_unit_construct' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame'],
42+
'php_unit_mock_short_will_return' => true,
43+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
44+
'phpdoc_no_access' => true,
45+
'phpdoc_no_empty_return' => true,
46+
'phpdoc_no_package' => true,
47+
'phpdoc_scalar' => true,
48+
'phpdoc_trim' => true,
49+
'phpdoc_types' => true,
50+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
51+
'return_type_declaration' => ['space_before' => 'none'],
52+
'single_quote' => true,
53+
'single_trait_insert_per_statement' => true,
54+
'whitespace_after_comma_in_array' => true,
55+
]);
56+
57+
$config
58+
->getFinder()
59+
->in(['src', 'tests']);
60+
61+
return $config;

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"doctrine/collections": "^1.2"
3232
},
3333
"require-dev": {
34-
"phpunit/phpunit": "^7.0|^8.0|^9.0",
34+
"friendsofphp/php-cs-fixer": "^2.18",
3535
"mockery/mockery": "^1.0",
36+
"phpunit/phpunit": "^7.0|^8.0|^9.0",
3637
"symfony/var-dumper": "^2.3|^3.0|^4.0|^5.0"
3738
},
3839
"suggest": {

src/Model/Attachment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Attachment extends AbstractModel
8686
private $actions;
8787

8888
/**
89-
* @var Array
89+
* @var array
9090
*/
9191
private $mrkdwnIn;
9292

@@ -320,7 +320,7 @@ public function setMrkdwnIn(array $mrkdwnIn)
320320
}
321321

322322
/**
323-
* @return Array Valid values for mrkdwn_in are: ["pretext", "text", "fields"]. Setting "fields" will enable markup formatting for the value of each field
323+
* @return array Valid values for mrkdwn_in are: ["pretext", "text", "fields"]. Setting "fields" will enable markup formatting for the value of each field
324324
*/
325325
public function getMrkdwnIn()
326326
{

src/Model/AttachmentAction.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
class AttachmentAction extends AbstractModel
2222
{
23-
2423
const TYPE_BUTTON = 'button';
2524

2625
const STYLE_DEFAULT = 'default';

src/Model/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getNext2Alt()
8686
}
8787

8888
/**
89-
* @return null|string
89+
* @return string|null
9090
*/
9191
public function getPermalink()
9292
{

src/Model/SimpleMessage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public function getType()
7373
{
7474
return $this->type;
7575
}
76-
76+
7777
/**
78-
* @return null|string The subtype of message
78+
* @return string|null The subtype of message
7979
*/
8080
public function getSubtype()
8181
{
@@ -125,7 +125,7 @@ public function getAttachments()
125125
}
126126

127127
/**
128-
* @return boolean wether or not this message has attachments
128+
* @return bool wether or not this message has attachments
129129
*/
130130
public function hasAttachments()
131131
{

src/Payload/AbstractPayloadResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class AbstractPayloadResponse implements PayloadResponseInterface
2222
*/
2323
public function isOk()
2424
{
25-
return (bool) $this->ok;
25+
return (bool)$this->ok;
2626
}
2727

2828
/**

src/Payload/ChatPostMessagePayload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function getText()
151151
}
152152

153153
/**
154-
* Change how messages are treated. Defaults to none.
154+
* Change how messages are treated. Defaults to none.
155155
*
156156
* @param string $parse full, none
157157
*
@@ -262,7 +262,7 @@ public function getUnfurlLinks()
262262
* Pass false to disable unfurling of media content.
263263
*
264264
* @param bool $unfurlMedia
265-
*
265+
*
266266
* @see https://api.slack.com/docs/unfurling
267267
*/
268268
public function setUnfurlMedia($unfurlMedia)

src/Payload/ChatUpdatePayload.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function getTs()
9494

9595
/**
9696
* Channel (ID only!) containing the message to be updated.
97-
*
97+
*
9898
* @param string $channel
9999
*
100100
* @return ChatUpdatePayload
@@ -116,7 +116,7 @@ public function getChannelId()
116116

117117
/**
118118
* New text for the message, using the default formatting rules.
119-
*
119+
*
120120
* @param string $text
121121
*
122122
* @return ChatUpdatePayload
@@ -179,8 +179,8 @@ public function getAttachmentsJson()
179179
}
180180

181181
/**
182-
* Change how messages are treated. Defaults to client, unlike chat.postMessage.
183-
*
182+
* Change how messages are treated. Defaults to client, unlike chat.postMessage.
183+
*
184184
* @param string $parse
185185
*
186186
* @return ChatUpdatePayload
@@ -206,7 +206,7 @@ public function getParse()
206206
* Find and link channel names and usernames. Defaults to none.
207207
* This parameter should be used in conjunction with parse.
208208
* To set link_names to 1, specify a parse mode of full.
209-
*
209+
*
210210
* @param bool $linkNames
211211
*
212212
* @return ChatUpdatePayload

src/Payload/ReactionsPayloadResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ public function getReactions()
5959

6060
return $this->message['reactions'];
6161
}
62-
}
62+
}

0 commit comments

Comments
 (0)