Skip to content

Commit c456ebc

Browse files
committed
PHPCS: add some targetted inline ignore annotations
* `CallRerouting`: I've verified that the issue flagged will not occur. * `Namespaces`: I've verified that the issue flagged will not occur. * `RedefinitionOfNew`: I've elected not to address the line length issue for this code snippet.
1 parent 0630412 commit c456ebc

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/CallRerouting.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ function connectOnHHVM($function, Handle $handle)
360360
} elseif (is_object($obj)) {
361361
$calledClass = get_class($obj);
362362
}
363+
// phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection -- Verified okay.
363364
$frame = count(debug_backtrace(0)) - 1;
364365
$result = null;
365366
$done = dispatch($class, $calledClass, $method, $frame, $result, $args);

src/CodeManipulation/Actions/Namespaces.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function getNamespaceAt(Source $s, $pos)
5252

5353
function collectNamespaceBoundaries(Source $s)
5454
{
55+
// phpcs:disable PHPCompatibility.FunctionDeclarations.NewClosure.ThisFoundOutsideClass -- Using $this is okay. Source::cache() binds the closure.
5556
return $s->cache([], function () {
5657
if (!$this->has(T_NAMESPACE)) {
5758
return ['' => [[0, INF]]];
@@ -71,6 +72,7 @@ function collectNamespaceBoundaries(Source $s)
7172
}
7273
return $result;
7374
});
75+
// phpcs:enable
7476
}
7577

7678
function collectUseDeclarations(Source $s, $begin)
@@ -84,6 +86,8 @@ function collectUseDeclarations(Source $s, $begin)
8486
}
8587
}
8688
}
89+
90+
// phpcs:disable PHPCompatibility.FunctionDeclarations.NewClosure.ThisFoundOutsideClass -- Using $this is okay. Source::cache() binds the closure.
8791
return $s->cache([$begin], function ($begin) {
8892
$result = ['class' => [], 'function' => [], 'const' => []];
8993
# only tokens that are siblings bracket-wise are considered,
@@ -98,6 +102,7 @@ function collectUseDeclarations(Source $s, $begin)
98102
}
99103
return $result;
100104
});
105+
// phpcs:enable
101106
}
102107

103108
function parseUseDeclaration(Source $s, $pos, array &$aliases, $prefix = '', $type = 'class')

src/CodeManipulation/Actions/RedefinitionOfNew.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
const STATIC_INSTANTIATION_REPLACEMENT = '\Patchwork\CallRerouting\getInstantiator(\'%s\', %s)->instantiate(%s)';
1818
const DYNAMIC_INSTANTIATION_REPLACEMENT = '\Patchwork\CallRerouting\getInstantiator(%s, %s)->instantiate(%s)';
19+
// phpcs:ignore Generic.Files.LineLength.TooLong
1920
const CALLED_CLASS = '((__CLASS__ && __FUNCTION__ !== (__NAMESPACE__ ? __NAMESPACE__ . "\\\\{closure}" : "\\\\{closure}")) ? \get_called_class() : null)';
2021

2122
const spliceAllInstantiations = 'Patchwork\CodeManipulation\Actions\RedefinitionOfNew\spliceAllInstantiations';

0 commit comments

Comments
 (0)