@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | $this->config = $processor->processConfiguration($definition, $profiles); |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param string $profileDir |
|
41 | + */ |
|
39 | 42 | private function readProfiles(YamlLoader $loader, $profileDir) { |
40 | 43 | $profiles = []; |
41 | 44 | foreach (new \DirectoryIterator($profileDir) as $file) { |
@@ -51,18 +54,27 @@ discard block |
||
51 | 54 | return $this->config; |
52 | 55 | } |
53 | 56 | |
57 | + /** |
|
58 | + * @param string $key |
|
59 | + */ |
|
54 | 60 | public function getIndentation($key) { |
55 | 61 | if (isset($this->config['indentation'][$key])) { |
56 | 62 | return $this->config['indentation'][$key]; |
57 | 63 | } |
58 | 64 | } |
59 | 65 | |
66 | + /** |
|
67 | + * @param string $key |
|
68 | + */ |
|
60 | 69 | public function getBraces($key) { |
61 | 70 | if (isset($this->config['braces'][$key])) { |
62 | 71 | return $this->config['braces'][$key]; |
63 | 72 | } |
64 | 73 | } |
65 | 74 | |
75 | + /** |
|
76 | + * @param string $key |
|
77 | + */ |
|
66 | 78 | public function getWhitespace($key, $context = 'default') { |
67 | 79 | if (isset($this->config['whitespace'][$context][$key])) { |
68 | 80 | $val = $this->config['whitespace'][$context][$key]; |
@@ -77,6 +89,9 @@ discard block |
||
77 | 89 | return false; |
78 | 90 | } |
79 | 91 | |
92 | + /** |
|
93 | + * @param string $key |
|
94 | + */ |
|
80 | 95 | public function getBlanks($key) { |
81 | 96 | if (isset($this->config['blanks'][$key])) { |
82 | 97 | return $this->config['blanks'][$key]; |
@@ -84,6 +99,9 @@ discard block |
||
84 | 99 | return 0; |
85 | 100 | } |
86 | 101 | |
102 | + /** |
|
103 | + * @param string $key |
|
104 | + */ |
|
87 | 105 | public function getNewline($key) { |
88 | 106 | if (isset($this->config['newlines'][$key])) { |
89 | 107 | return $this->config['newlines'][$key]; |
@@ -71,7 +71,8 @@ |
||
71 | 71 | return $this->getWhitespace($key); |
72 | 72 | } |
73 | 73 | return $val; |
74 | - } else if ($context !== 'default') { // workaround? |
|
74 | + } else if ($context !== 'default') { |
|
75 | +// workaround? |
|
75 | 76 | return $this->getWhitespace($key); |
76 | 77 | } |
77 | 78 | return false; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | public function write($content) { |
59 | 59 | $lines = explode("\n", $content); |
60 | - for ($i = 0, $c = count($lines); $i < $c; $i ++) { |
|
60 | + for ($i = 0, $c = count($lines); $i < $c; $i++) { |
|
61 | 61 | if ($this->indentationLevel > 0 |
62 | 62 | && !empty($lines[$i]) |
63 | 63 | && (empty($this->content) || "\n" === substr($this->content, -1))) { |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Keyswords that are followed by a single space |
19 | - */ |
|
19 | + */ |
|
20 | 20 | public static $KEYWORDS = [T_ABSTRACT, T_CASE, T_CLASS, T_FUNCTION, T_CLONE, T_CONST, T_EXTENDS, T_FINAL, T_GLOBAL, T_IMPLEMENTS, T_INTERFACE, T_NAMESPACE, T_NEW, T_PRIVATE, T_PUBLIC, T_PROTECTED, T_THROW, T_TRAIT, T_USE]; |
21 | 21 | public static $BLOCKS = [T_IF, T_ELSEIF, T_ELSE, T_FOR, T_FOREACH, T_WHILE, T_DO, T_SWITCH, T_TRY, T_CATCH]; |
22 | 22 | public static $CASTS = [T_ARRAY_CAST, T_BOOL_CAST, T_DOUBLE_CAST, T_INT_CAST, T_OBJECT_CAST, T_STRING_CAST, T_UNSET_CAST]; |
@@ -256,6 +256,9 @@ |
||
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | + /** |
|
260 | + * @param Token $token |
|
261 | + */ |
|
259 | 262 | private function isFunctionInvocation($token) { |
260 | 263 | $prevToken = $this->tracker->getPrevToken(); |
261 | 264 | return $token->contents == '(' && $prevToken->type == T_STRING; |