Refine keymap descriptions for clarity and consistency
Updated keymap descriptions across various plugins to include specific prefixes for better identification and organization.
This commit is contained in:
parent
99ea741fbb
commit
f4f6260b20
9 changed files with 83 additions and 66 deletions
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Test file for PHP LSP diagnostics
|
||||
* Tests error, warning, info, and hint virtual text colors
|
||||
*
|
||||
*
|
||||
* Note: Configure Intelephense to show different diagnostic levels:
|
||||
* - diagnostics.undefinedSymbols = true (errors)
|
||||
* - diagnostics.undefinedVariables = true (warnings)
|
||||
|
|
@ -11,10 +12,10 @@
|
|||
|
||||
// Define some valid functions and variables first to avoid cascading errors
|
||||
function validFunction(): void {
|
||||
echo "This is valid\n";
|
||||
echo "This is valid\n";
|
||||
}
|
||||
|
||||
$definedVariable = "I exist";
|
||||
$definedVariable = 'I exist';
|
||||
|
||||
// ERROR: Undefined function
|
||||
someUndefinedFunction();
|
||||
|
|
@ -23,26 +24,26 @@ someUndefinedFunction();
|
|||
echo $completelyUndefined;
|
||||
|
||||
// WARNING/HINT: Unused variable (depends on Intelephense config)
|
||||
$unused = "Never used anywhere";
|
||||
$unused = 'Never used anywhere';
|
||||
|
||||
// Valid code to separate errors
|
||||
validFunction();
|
||||
|
||||
// ERROR: Wrong number of arguments
|
||||
function requiresTwoArgs(string $a, string $b): void {
|
||||
echo "$a $b\n";
|
||||
function requiresTwoArgs( string $a, string $b ): void {
|
||||
echo "$a $b\n";
|
||||
}
|
||||
requiresTwoArgs("only one"); // Missing second argument
|
||||
requiresTwoArgs( 'only one' ); // Missing second argument
|
||||
|
||||
// ERROR: Type mismatch
|
||||
function expectsString(string $param): void {
|
||||
echo $param;
|
||||
function expectsString( string $param ): void {
|
||||
echo $param;
|
||||
}
|
||||
expectsString(123); // Passing int to string parameter
|
||||
expectsString( 123 ); // Passing int to string parameter
|
||||
|
||||
// WARNING: Variable might not be defined in all code paths
|
||||
if (rand(0, 1)) {
|
||||
$maybeUndefined = "sometimes defined";
|
||||
if ( rand( 0, 1 ) ) {
|
||||
$maybeUndefined = 'sometimes defined';
|
||||
}
|
||||
// Commenting out to reduce errors: echo $maybeUndefined;
|
||||
|
||||
|
|
@ -50,21 +51,20 @@ if (rand(0, 1)) {
|
|||
echo $definedVariable . "\n";
|
||||
|
||||
// ERROR: Calling method on non-object
|
||||
$notAnObject = "string";
|
||||
$notAnObject = 'string';
|
||||
$notAnObject->someMethod();
|
||||
|
||||
// ERROR: Invalid array access (multiple levels)
|
||||
$emptyArray = [];
|
||||
$emptyArray = array();
|
||||
echo $emptyArray['key']['nested']['deep'];
|
||||
|
||||
// Valid function call
|
||||
requiresTwoArgs("hello", "world");
|
||||
requiresTwoArgs( 'hello', 'world' );
|
||||
|
||||
// HINT/WARNING: Unreachable code (some configs)
|
||||
function hasDeadCode(): string {
|
||||
return "done";
|
||||
echo "This is unreachable"; // Dead code
|
||||
return 'done';
|
||||
echo 'This is unreachable'; // Dead code.
|
||||
}
|
||||
|
||||
echo "Test complete!\n";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue