Skip to content

Commit 30b12f7

Browse files
authored
Merge pull request #202 from antecedent/feature/cs-declare-visibility
CS fixes/src: all methods/properties/constants should have a declared visibility
2 parents 1b36205 + 89753a1 commit 30b12f7

9 files changed

Lines changed: 54 additions & 54 deletions

File tree

src/CallRerouting.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ function getInstantiator($class, $calledClass)
605605

606606
class State
607607
{
608-
static $routes = [];
609-
static $queue = [];
610-
static $preprocessedFiles = [];
611-
static $routeStack = [];
608+
public static $routes = [];
609+
public static $queue = [];
610+
public static $preprocessedFiles = [];
611+
public static $routeStack = [];
612612
}

src/CodeManipulation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ function onImport($listeners)
181181

182182
class State
183183
{
184-
static $actions = [];
185-
static $importListeners = [];
186-
static $cacheIndex = [];
187-
static $cacheIndexFile;
184+
public static $actions = [];
185+
public static $importListeners = [];
186+
public static $cacheIndex = [];
187+
public static $cacheIndexFile;
188188
}

src/CodeManipulation/Actions/RedefinitionOfNew.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,5 @@ function suspendFor(callable $function)
198198

199199
class State
200200
{
201-
static $enabled = true;
201+
public static $enabled = true;
202202
}

src/CodeManipulation/Source.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
class Source
1616
{
17-
const TYPE_OFFSET = 0;
18-
const STRING_OFFSET = 1;
17+
public const TYPE_OFFSET = 0;
18+
public const STRING_OFFSET = 1;
1919

20-
const PREPEND = 'PREPEND';
21-
const APPEND = 'APPEND';
22-
const OVERWRITE = 'OVERWRITE';
20+
public const PREPEND = 'PREPEND';
21+
public const APPEND = 'APPEND';
22+
public const OVERWRITE = 'OVERWRITE';
2323

24-
const ANY = null;
24+
public const ANY = null;
2525

2626
public $tokens;
2727
public $tokensByType;
@@ -37,13 +37,13 @@ class Source
3737
public $tokensByLevelAndType;
3838
public $cache;
3939

40-
function __construct($string)
40+
public function __construct($string)
4141
{
4242
$this->code = $string;
4343
$this->initialize();
4444
}
4545

46-
function initialize()
46+
public function initialize()
4747
{
4848
$this->tokens = Utils\tokenize($this->code);
4949
$this->tokens[] = [T_WHITESPACE, ""];
@@ -55,15 +55,15 @@ function initialize()
5555
$this->cache = [];
5656
}
5757

58-
function indexTokensByType()
58+
public function indexTokensByType()
5959
{
6060
$this->tokensByType = [];
6161
foreach ($this->tokens as $offset => $token) {
6262
$this->tokensByType[$token[self::TYPE_OFFSET]][] = $offset;
6363
}
6464
}
6565

66-
function collectBracketMatchings()
66+
public function collectBracketMatchings()
6767
{
6868
$this->matchingBrackets = [];
6969
$stack = [];
@@ -89,7 +89,7 @@ function collectBracketMatchings()
8989
}
9090
}
9191

92-
function collectLevelInfo()
92+
public function collectLevelInfo()
9393
{
9494
$level = 0;
9595
$this->levels = [];
@@ -123,7 +123,7 @@ function collectLevelInfo()
123123
Utils\appendUnder($this->levelEndings, 0, count($this->tokens) - 1);
124124
}
125125

126-
function has($types)
126+
public function has($types)
127127
{
128128
foreach ((array) $types as $type) {
129129
if ($this->all($type) !== []) {
@@ -133,7 +133,7 @@ function has($types)
133133
return false;
134134
}
135135

136-
function is($types, $offset)
136+
public function is($types, $offset)
137137
{
138138
foreach ((array) $types as $type) {
139139
if ($this->tokens[$offset][self::TYPE_OFFSET] === $type) {
@@ -143,7 +143,7 @@ function is($types, $offset)
143143
return false;
144144
}
145145

146-
function skip($types, $offset, $direction = 1)
146+
public function skip($types, $offset, $direction = 1)
147147
{
148148
$offset += $direction;
149149
$types = (array) $types;
@@ -156,12 +156,12 @@ function skip($types, $offset, $direction = 1)
156156
return ($direction > 0) ? INF : -1;
157157
}
158158

159-
function skipBack($types, $offset)
159+
public function skipBack($types, $offset)
160160
{
161161
return $this->skip($types, $offset, -1);
162162
}
163163

164-
function within($types, $low, $high)
164+
public function within($types, $low, $high)
165165
{
166166
$result = [];
167167
foreach ((array) $types as $type) {
@@ -171,7 +171,7 @@ function within($types, $low, $high)
171171
return $result;
172172
}
173173

174-
function read($offset, $count = 1)
174+
public function read($offset, $count = 1)
175175
{
176176
$result = '';
177177
$pos = $offset;
@@ -186,7 +186,7 @@ function read($offset, $count = 1)
186186
return $result;
187187
}
188188

189-
function siblings($types, $offset)
189+
public function siblings($types, $offset)
190190
{
191191
$level = $this->levels[$offset];
192192
$begin = Utils\lastNotGreaterThan(Utils\access($this->levelBeginnings, $level, []), $offset);
@@ -203,7 +203,7 @@ function siblings($types, $offset)
203203
}
204204
}
205205

206-
function next($types, $offset)
206+
public function next($types, $offset)
207207
{
208208
if (!is_array($types)) {
209209
$candidates = Utils\access($this->tokensByType, $types, []);
@@ -216,7 +216,7 @@ function next($types, $offset)
216216
return $result;
217217
}
218218

219-
function all($types)
219+
public function all($types)
220220
{
221221
if (!is_array($types)) {
222222
return Utils\access($this->tokensByType, $types, []);
@@ -229,13 +229,13 @@ function all($types)
229229
return $result;
230230
}
231231

232-
function match($offset)
232+
public function match($offset)
233233
{
234234
$offset = (string) $offset;
235235
return isset($this->matchingBrackets[$offset]) ? $this->matchingBrackets[$offset] : INF;
236236
}
237237

238-
function splice($splice, $offset, $length = 0, $policy = self::OVERWRITE)
238+
public function splice($splice, $offset, $length = 0, $policy = self::OVERWRITE)
239239
{
240240
if ($policy === self::OVERWRITE) {
241241
$this->splices[$offset] = $splice;
@@ -256,7 +256,7 @@ function splice($splice, $offset, $length = 0, $policy = self::OVERWRITE)
256256
$this->code = null;
257257
}
258258

259-
function createCodeFromTokens()
259+
public function createCodeFromTokens()
260260
{
261261
$splices = $this->splices;
262262
$code = "";
@@ -274,28 +274,28 @@ function createCodeFromTokens()
274274
$this->code = $code;
275275
}
276276

277-
static function junk()
277+
public static function junk()
278278
{
279279
return [T_WHITESPACE, T_COMMENT, T_DOC_COMMENT];
280280
}
281281

282-
function __toString()
282+
public function __toString()
283283
{
284284
if ($this->code === null) {
285285
$this->createCodeFromTokens();
286286
}
287287
return (string) $this->code;
288288
}
289289

290-
function flush()
290+
public function flush()
291291
{
292292
$this->initialize(Utils\tokenize($this));
293293
}
294294

295295
/**
296296
* @since 2.1.0
297297
*/
298-
function cache(array $args, \Closure $function)
298+
public function cache(array $args, \Closure $function)
299299
{
300300
$found = true;
301301
$trace = debug_backtrace()[1];

src/CodeManipulation/Stream.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
class Stream
1515
{
16-
const STREAM_OPEN_FOR_INCLUDE = 128;
17-
const STAT_MTIME_NUMERIC_OFFSET = 9;
18-
const STAT_MTIME_ASSOC_OFFSET = 'mtime';
16+
public const STREAM_OPEN_FOR_INCLUDE = 128;
17+
public const STAT_MTIME_NUMERIC_OFFSET = 9;
18+
public const STAT_MTIME_ASSOC_OFFSET = 'mtime';
1919

2020
protected static $protocols = ['file', 'phar'];
2121
protected static $otherWrapperClass;

src/Config.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ function getTimestamp()
224224

225225
class State
226226
{
227-
static $blacklist = [];
228-
static $whitelist = [];
229-
static $cachePath;
230-
static $redefinableInternals = [];
231-
static $redefinableLanguageConstructs = [];
232-
static $newKeywordRedefinable = false;
233-
static $timestamp = 0;
227+
public static $blacklist = [];
228+
public static $whitelist = [];
229+
public static $cachePath;
230+
public static $redefinableInternals = [];
231+
public static $redefinableLanguageConstructs = [];
232+
public static $newKeywordRedefinable = false;
233+
public static $timestamp = 0;
234234
}

src/Exceptions.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StackEmpty extends Exception
2626

2727
abstract class CallbackException extends Exception
2828
{
29-
function __construct($callback)
29+
public function __construct($callback)
3030
{
3131
parent::__construct(sprintf($this->message, Utils\callableToString($callback)));
3232
}
@@ -39,7 +39,7 @@ class NotUserDefined extends CallbackException
3939

4040
class DefinedTooEarly extends CallbackException
4141
{
42-
function __construct($callback)
42+
public function __construct($callback)
4343
{
4444
$this->message = "The file that defines %s() was included earlier than Patchwork. " .
4545
"Please reverse this order to be able to redefine the function in question.";
@@ -62,7 +62,7 @@ class InternalsNotSupportedOnHHVM extends CallbackException
6262

6363
class CachePathUnavailable extends Exception
6464
{
65-
function __construct($location)
65+
public function __construct($location)
6666
{
6767
parent::__construct(sprintf(
6868
"The specified cache path is nonexistent or read-only: %s",
@@ -77,7 +77,7 @@ class ConfigException extends Exception
7777

7878
class ConfigMalformed extends ConfigException
7979
{
80-
function __construct($file, $message)
80+
public function __construct($file, $message)
8181
{
8282
parent::__construct(sprintf(
8383
'The configuration file %s is malformed: %s',
@@ -89,7 +89,7 @@ function __construct($file, $message)
8989

9090
class ConfigKeyNotRecognized extends ConfigException
9191
{
92-
function __construct($key, $list, $file)
92+
public function __construct($key, $list, $file)
9393
{
9494
parent::__construct(sprintf(
9595
"The key '%s' in the configuration file %s was not recognized. " .
@@ -103,7 +103,7 @@ function __construct($key, $list, $file)
103103

104104
class CachePathConflict extends ConfigException
105105
{
106-
function __construct($first, $second)
106+
public function __construct($first, $second)
107107
{
108108
parent::__construct(sprintf(
109109
"Detected configuration files provide conflicting cache paths: %s and %s",

src/Stack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ function allCalledClasses()
9292

9393
class State
9494
{
95-
static $items = [];
95+
public static $items = [];
9696
}

src/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,5 +385,5 @@ function tokenize($string)
385385

386386
class State
387387
{
388-
static $missedCallables = [];
388+
public static $missedCallables = [];
389389
}

0 commit comments

Comments
 (0)