Skip to content

Commit 2a848e2

Browse files
authored
Phan: Address PhanPluginDuplicateConditionalNullCoalescing violations (#48887)
1 parent dbc836f commit 2a848e2

217 files changed

Lines changed: 691 additions & 680 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

projects/packages/analyzer/.phan/baseline.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// PhanUndeclaredProperty : 25+ occurrences
1313
// PhanTypeMismatchArgument : 8 occurrences
1414
// PhanParamSignatureMismatch : 6 occurrences
15-
// PhanPluginDuplicateConditionalNullCoalescing : 6 occurrences
1615
// PhanTypeMismatchReturnProbablyReal : 6 occurrences
1716
// PhanUndeclaredClassMethod : 6 occurrences
1817
// PhanUndeclaredMethod : 6 occurrences
@@ -28,10 +27,10 @@
2827
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
2928
'file_suppressions' => [
3029
'data/example-external.php' => ['PhanUndeclaredClassMethod', 'PhanUndeclaredClassStaticProperty', 'PhanUndeclaredFunction'],
31-
'scripts/core-calls.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchDeclaredParam', 'PhanUndeclaredClassMethod', 'PhanUndeclaredTypeParameter'],
32-
'scripts/core-definitions.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchDeclaredParam', 'PhanUndeclaredClassMethod', 'PhanUndeclaredTypeParameter'],
30+
'scripts/core-calls.php' => ['PhanTypeMismatchDeclaredParam', 'PhanUndeclaredClassMethod', 'PhanUndeclaredTypeParameter'],
31+
'scripts/core-definitions.php' => ['PhanTypeMismatchDeclaredParam', 'PhanUndeclaredClassMethod', 'PhanUndeclaredTypeParameter'],
3332
'scripts/example.php' => ['PhanTypeMismatchArgumentProbablyReal'],
34-
'scripts/jetpack-svn.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'],
33+
'scripts/jetpack-svn.php' => ['PhanTypeArraySuspiciousNullable'],
3534
'src/Differences/class-class-const-missing.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'],
3635
'src/Differences/class-class-const-moved.php' => ['PhanTypeMismatchArgument'],
3736
'src/Differences/class-class-method-deprecated.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturnProbablyReal'],
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Phan: Address PhanPluginDuplicateConditionalNullCoalescing violations.

projects/packages/analyzer/scripts/core-calls.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class CoreCalls {
2424
*/
2525
public static function callback( Event $event ) {
2626
$arguments = $event->getArguments();
27-
$scan_path = isset( $arguments[0] ) ? $arguments[0] : null;
28-
$core_path = isset( $arguments[1] ) ? $arguments[1] : null;
27+
$scan_path = $arguments[0] ?? null;
28+
$core_path = $arguments[1] ?? null;
2929
$io = $event->getIO();
3030

3131
if (

projects/packages/analyzer/scripts/core-definitions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CoreDefinitions {
2323
*/
2424
public static function callback( Event $event ) {
2525
$arguments = $event->getArguments();
26-
$scan_path = isset( $arguments[0] ) ? $arguments[0] : null;
26+
$scan_path = $arguments[0] ?? null;
2727
$io = $event->getIO();
2828

2929
if ( is_null( $scan_path ) ) {

projects/packages/analyzer/scripts/jetpack-svn.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
require dirname( __DIR__ ) . '/vendor/autoload.php';
2525

2626
// Args.
27-
$external_repo_path = isset( $argv[1] ) ? $argv[1] : '/path/to/workspace/a8c/some-repo';
28-
$from_version = isset( $argv[2] ) ? $argv[2] : ''; // Defaults to latest stable version in wp.org svn.
29-
$to_version = isset( $argv[3] ) ? $argv[3] : 'trunk';
27+
$external_repo_path = $argv[1] ?? '/path/to/workspace/a8c/some-repo';
28+
$from_version = $argv[2] ?? ''; // Defaults to latest stable version in wp.org svn.
29+
$to_version = $argv[3] ?? 'trunk';
3030

3131
if ( ! file_exists( $external_repo_path ) ) {
3232
echo "Need a path of another codebase to compare Jetpack changes against.\n";

projects/packages/blocks/.phan/baseline.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
// # Issue statistics:
1212
// PhanTypeMismatchArgument : 2 occurrences
1313
// PhanDeprecatedFunction : 1 occurrence
14-
// PhanPluginDuplicateConditionalNullCoalescing : 1 occurrence
1514
// PhanTypeMismatchArgumentNullableInternal : 1 occurrence
1615

1716
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
1817
'file_suppressions' => [
19-
'src/class-blocks.php' => ['PhanDeprecatedFunction', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullableInternal'],
18+
'src/class-blocks.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentNullableInternal'],
2019
'tests/php/Blocks_Test.php' => ['PhanTypeMismatchArgument'],
2120
],
2221
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Phan: Address PhanPluginDuplicateConditionalNullCoalescing violations.

projects/packages/blocks/src/class-blocks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private static function get_block_metadata( $arg ) {
155155
}
156156
}
157157

158-
return isset( $metadata ) ? $metadata : array();
158+
return $metadata ?? array();
159159
}
160160

161161
/**

projects/packages/compat/.phan/baseline.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
return [
1111
// # Issue statistics:
1212
// PhanDeprecatedFunction : 1 occurrence
13-
// PhanPluginDuplicateConditionalNullCoalescing : 1 occurrence
1413
// PhanTypeMismatchProperty : 1 occurrence
1514

1615
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
1716
'file_suppressions' => [
18-
'lib/locales.php' => ['PhanDeprecatedFunction', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchProperty'],
17+
'lib/locales.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchProperty'],
1918
],
2019
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
2120
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Phan: Address PhanPluginDuplicateConditionalNullCoalescing violations.

0 commit comments

Comments
 (0)