Skip to content

Conversation

sven-81
Copy link

@sven-81 sven-81 commented Nov 26, 2024

  • fix for possibly missing key in yoda condition
  • adding php 8.3

@sven-81 sven-81 closed this Nov 26, 2024
Copy link
Contributor

@MichelHartmann MichelHartmann left a comment

Choose a reason for hiding this comment

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

Thank you @sven-81 for your contribution. Please check my comments in the PR, before we can merge the change.

@@ -25,7 +26,9 @@ public function process(File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();

$startOfConditionPtr = $stackPtr;
$endPtr = $tokens[$startOfConditionPtr]['scope_opener'] + 1;
if (array_key_exists('scope_opener', $tokens[$startOfConditionPtr])) {
$endPtr = $tokens[$startOfConditionPtr]['scope_opener'] + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

$endPtr should always be initialized.

@@ -25,7 +26,9 @@ public function process(File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();

$startOfConditionPtr = $stackPtr;
$endPtr = $tokens[$startOfConditionPtr]['scope_opener'] + 1;
if (array_key_exists('scope_opener', $tokens[$startOfConditionPtr])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test-case for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants