Skip to content

Commit 88d99bf

Browse files
committed
Give all functions explicit visibility
1 parent f5fcc65 commit 88d99bf

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,12 @@ public function process(File $phpcsFile, $stackPtr) {
351351
}
352352
}
353353

354-
function normalizeVarName($varName) {
354+
public function normalizeVarName($varName) {
355355
$varName = preg_replace('/[{}$]/', '', $varName);
356356
return $varName;
357357
}
358358

359-
function scopeKey($currScope) {
359+
public function scopeKey($currScope) {
360360
if ($currScope === false) {
361361
$currScope = 'file';
362362
}
@@ -365,7 +365,7 @@ function scopeKey($currScope) {
365365
}
366366

367367
// Warning: this is an autovivifying get
368-
function getScopeInfo($currScope, $autoCreate = true) {
368+
public function getScopeInfo($currScope, $autoCreate = true) {
369369
$scopeKey = $this->scopeKey($currScope);
370370
if (!isset($this->_scopes[$scopeKey])) {
371371
if (!$autoCreate) {
@@ -376,7 +376,7 @@ function getScopeInfo($currScope, $autoCreate = true) {
376376
return $this->_scopes[$scopeKey];
377377
}
378378

379-
function getVariableInfo($varName, $currScope, $autoCreate = true) {
379+
public function getVariableInfo($varName, $currScope, $autoCreate = true) {
380380
$scopeInfo = $this->getScopeInfo($currScope, $autoCreate);
381381
if (!isset($scopeInfo->variables[$varName])) {
382382
if (!$autoCreate) {
@@ -391,7 +391,7 @@ function getVariableInfo($varName, $currScope, $autoCreate = true) {
391391
return $scopeInfo->variables[$varName];
392392
}
393393

394-
function markVariableAssignment($varName, $stackPtr, $currScope) {
394+
protected function markVariableAssignment($varName, $stackPtr, $currScope) {
395395
$varInfo = $this->getVariableInfo($varName, $currScope);
396396
if (!isset($varInfo->scopeType)) {
397397
$varInfo->scopeType = 'local';
@@ -402,7 +402,7 @@ function markVariableAssignment($varName, $stackPtr, $currScope) {
402402
$varInfo->firstInitialized = $stackPtr;
403403
}
404404

405-
function markVariableDeclaration($varName, $scopeType, $typeHint, $stackPtr, $currScope, $permitMatchingRedeclaration = false) {
405+
protected function markVariableDeclaration($varName, $scopeType, $typeHint, $stackPtr, $currScope, $permitMatchingRedeclaration = false) {
406406
$varInfo = $this->getVariableInfo($varName, $currScope);
407407
if (isset($varInfo->scopeType)) {
408408
if (($permitMatchingRedeclaration === false) ||
@@ -433,23 +433,23 @@ function markVariableDeclaration($varName, $scopeType, $typeHint, $stackPtr, $cu
433433
$varInfo->firstDeclared = $stackPtr;
434434
}
435435

436-
function markVariableRead($varName, $stackPtr, $currScope) {
436+
protected function markVariableRead($varName, $stackPtr, $currScope) {
437437
$varInfo = $this->getVariableInfo($varName, $currScope);
438438
if (isset($varInfo->firstRead) && ($varInfo->firstRead <= $stackPtr)) {
439439
return;
440440
}
441441
$varInfo->firstRead = $stackPtr;
442442
}
443443

444-
function isVariableInitialized($varName, $stackPtr, $currScope) {
444+
protected function isVariableInitialized($varName, $stackPtr, $currScope) {
445445
$varInfo = $this->getVariableInfo($varName, $currScope);
446446
if (isset($varInfo->firstInitialized) && $varInfo->firstInitialized <= $stackPtr) {
447447
return true;
448448
}
449449
return false;
450450
}
451451

452-
function isVariableUndefined($varName, $stackPtr, $currScope) {
452+
protected function isVariableUndefined($varName, $stackPtr, $currScope) {
453453
$varInfo = $this->getVariableInfo($varName, $currScope, false);
454454
if (isset($varInfo->firstDeclared) && $varInfo->firstDeclared <= $stackPtr) {
455455
// TODO: do we want to check scopeType here?
@@ -461,7 +461,7 @@ function isVariableUndefined($varName, $stackPtr, $currScope) {
461461
return true;
462462
}
463463

464-
function markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $currScope) {
464+
protected function markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $currScope) {
465465
$this->markVariableRead($varName, $stackPtr, $currScope);
466466

467467
if ($this->isVariableUndefined($varName, $stackPtr, $currScope) === true) {
@@ -473,7 +473,7 @@ function markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $cu
473473
return true;
474474
}
475475

476-
function findFunctionPrototype(
476+
protected function findFunctionPrototype(
477477
File $phpcsFile,
478478
$stackPtr
479479
) {
@@ -496,7 +496,7 @@ function findFunctionPrototype(
496496
return false;
497497
}
498498

499-
function findVariableScope(
499+
protected function findVariableScope(
500500
File $phpcsFile,
501501
$stackPtr
502502
) {
@@ -528,7 +528,7 @@ function findVariableScope(
528528
return 0;
529529
}
530530

531-
function isNextThingAnAssign(
531+
protected function isNextThingAnAssign(
532532
File $phpcsFile,
533533
$stackPtr
534534
) {
@@ -544,7 +544,7 @@ function isNextThingAnAssign(
544544
return false;
545545
}
546546

547-
function findWhereAssignExecuted(
547+
protected function findWhereAssignExecuted(
548548
File $phpcsFile,
549549
$stackPtr
550550
) {
@@ -579,7 +579,7 @@ function findWhereAssignExecuted(
579579
return $semicolonPtr;
580580
}
581581

582-
function findContainingBrackets(
582+
protected function findContainingBrackets(
583583
File $phpcsFile,
584584
$stackPtr
585585
) {
@@ -593,7 +593,7 @@ function findContainingBrackets(
593593
}
594594

595595

596-
function findFunctionCall(
596+
protected function findFunctionCall(
597597
File $phpcsFile,
598598
$stackPtr
599599
) {
@@ -610,7 +610,7 @@ function findFunctionCall(
610610
return false;
611611
}
612612

613-
function findFunctionCallArguments(
613+
protected function findFunctionCallArguments(
614614
File $phpcsFile,
615615
$stackPtr
616616
) {

0 commit comments

Comments
 (0)