Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vipgoci_options
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"lint-only-modified-files":true}
{"lint-only-modified-files":false}
49 changes: 49 additions & 0 deletions src/PHP8Fun.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/**
* @param $a
* @param $b
* Call str_contains!
* @return bool
*/
function find_my_string( $a, $b ): bool {
if ( $x = str_contains( $a, $b ) ) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: Variable assignment found within a condition. Did you mean to do a comparison? (WordPress.CodeAnalysis.AssignmentInCondition.Found).

echo 'The string has been found';
} else {
echo "String not found";
}

return $x;
}
$result2 = find_my_string('a', 'b');
var_dump( $result2 );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: var_dump() found. Debug code should not normally be used in production (WordPress.PHP.DevelopmentFunctions.error_log_var_dump).


// Just a test files with various cool PHP8 stuffs
$my_super_array = [
1.0,
'string',
true,
];

/**
* Yay fun function
*
* @param integer|string|boolean $arg
*
* @return string
*/
function php8_fun( int|string|bool $arg ): string {
$result = match ( $arg ) {
1.0 => 'Float!',
'string' => 'String',
'sup' => 'string!!!',
default => gettype( $arg )
};
return $result;
}

$result = fn( $c ) => $c . php8_fun( $my_super_array[ array_rand( $my_super_array, 1 ) ] );

$x = 'x';
var_dump( $result($x) );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: var_dump() found. Debug code should not normally be used in production (WordPress.PHP.DevelopmentFunctions.error_log_var_dump).


11 changes: 11 additions & 0 deletions src/PHP8FunFatal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

/**
* Fatal error
*/
class C1 {
public function method(array $a) {}
}
class C2 extends C1 {
public function method(int $a) {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 Error: PHP syntax error: Declaration of C2::method(int $a) must be compatible with C1::method(array $a) (Generic.PHP.Syntax.PHPSyntax).

}