Skip to content

Commit f15f6f4

Browse files
committed
Fix code style
1 parent 6fd99eb commit f15f6f4

3 files changed

Lines changed: 32 additions & 36 deletions

File tree

.editorconfig

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
# editorconfig.org
21
root = true
32

43
[*]
5-
end_of_line = LF
6-
indent_style = space
74
charset = utf-8
8-
trim_trailing_whitespace = true
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
98
insert_final_newline = true
9+
trim_trailing_whitespace = true
1010

1111
[*.php]
12-
indent_style = space
1312
indent_size = 4
1413

15-
[*.js]
16-
indent_style = space
17-
indent_size = 2
18-
19-
[*.css]
20-
indent_style = tab
21-
indent_size = 2
14+
[*.md]
15+
trim_trailing_whitespace = false

phpcs.xml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
<?xml version="1.0"?>
2-
<ruleset name="xu">
3-
<description>Elda rules for PHP_CodeSniffer</description>
1+
<?php xml version="1.0"?>
2+
<ruleset name="Elda">
3+
<description>Elda rules for PHP_CodeSniffer</description>
44

5-
<exclude-pattern>tests/*</exclude-pattern>
6-
<exclude-pattern>vendor/*</exclude-pattern>
5+
<exclude-pattern>vendor/*</exclude-pattern>
76

8-
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
7+
<rule ref="WordPress-Core">
8+
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions" />
9+
<exclude name="WordPress.Arrays.ArrayDeclaration" />
10+
<exclude name="WordPress.PHP.YodaConditions" />
11+
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen" />
12+
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis" />
13+
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
14+
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis" />
15+
<exclude name="Generic.Files.LowercasedFilename.NotFound" />
16+
</rule>
917

10-
<rule ref="WordPress-Core">
11-
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions" />
12-
<exclude name="WordPress.Arrays.ArrayDeclaration" />
13-
<exclude name="WordPress.PHP.YodaConditions" />
14-
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen" />
15-
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis" />
16-
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBetweenStructureColon" />
17-
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
18-
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
19-
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
20-
</rule>
18+
<rule ref="Generic.WhiteSpace.ScopeIndent">
19+
<properties>
20+
<property name="indent" value="4"/>
21+
<property name="tabIndent" value="false"/>
22+
</properties>
23+
</rule>
2124
</ruleset>

src/Elda.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Elda {
2626
*
2727
* @var array
2828
*/
29-
protected $options = [
29+
protected $options = [
3030
'files' => [],
3131
'instance' => '',
3232
'namespace' => '',
@@ -60,7 +60,7 @@ protected function __construct( $base_path, array $options = [] ) {
6060
* @param string $base_path
6161
* @param array $options
6262
*
63-
* @return \Frozzare\Elda\Elda
63+
* @return object
6464
*/
6565
public static function boot( $base_path, array $options = [] ) {
6666
$name = plugin_basename( $base_path );
@@ -100,7 +100,7 @@ public function get_instance() {
100100
/**
101101
* Get full path to the path.
102102
*
103-
* @param string $path
103+
* @param string $path [description]
104104
*
105105
* @return string
106106
*/
@@ -147,7 +147,7 @@ protected function load_files() {
147147
/**
148148
* Get the instance from base path.
149149
*
150-
* @param string $base_path
150+
* @param strign $base_path
151151
*
152152
* @throws InvalidArgumentException when plugin instance don't exists.
153153
*
@@ -199,7 +199,7 @@ protected function set_namespace() {
199199
return;
200200
}
201201

202-
$namespace = $this->options->instance;
202+
$namespace = $this->options->namespace;
203203
$namespace = explode( '\\', $namespace );
204204
array_pop( $namespace );
205205

@@ -233,9 +233,8 @@ protected function set_options( array $options ) {
233233
throw new InvalidArgumentException( 'Invalid argument. `files` must be array.' );
234234
}
235235

236-
$this->options->files = array_filter( $this->options->files, function ( $file ) {
236+
$this->options->files = array_filter( $this->options->files, function( $file ) {
237237
return is_string( $file ) && file_exists( $this->get_src_path( $file ) );
238238
} );
239239
}
240-
241240
}

0 commit comments

Comments
 (0)