Skip to content

Conversation

samsonasik
Copy link
Member

Description

To fix phpstan notice on PHPStan 2.1.23

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@samsonasik
Copy link
Member Author

Ready for review 👍

$request->setGlobal(
'request',
$request->fetchGlobal('post') + $request->fetchGlobal('get'),
(array) $request->fetchGlobal('post') + (array) $request->fetchGlobal('get'),
Copy link
Member Author

Choose a reason for hiding this comment

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

not sure about it tho...

Copy link
Member Author

@samsonasik samsonasik Sep 10, 2025

Choose a reason for hiding this comment

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

Looking at the code, should be fine with this patch, since no 2nd argument as index, means it always array:

// Return all values when $index is null
if ($index === null) {
$values = [];
foreach ($this->globals[$name] as $key => $value) {
$values[$key] = is_array($value)
? $this->fetchGlobal($name, $key, $filter, $flags)
: filter_var($value, $filter, $flags);
}
return $values;
}

Copy link
Member

Choose a reason for hiding this comment

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

We should be fine here.

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

Thanks!

@samsonasik
Copy link
Member Author

@michalsn thank you for the review, let's merge 👍

@samsonasik samsonasik merged commit df987ae into codeigniter4:develop Sep 10, 2025
47 checks passed
@samsonasik samsonasik deleted the chore-fix-phpstan-notice branch September 10, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants