Skip to content

refactor: phpdoc for Config\Filters::$globals #9652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2025

Conversation

michalsn
Copy link
Member

Description
This PR updates PHPDoc for Config\Filters::$globals

Fixes #9651

Checklist:

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

Copy link
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

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

array<int|string, ...> Is INT needed for an empty array? Otherwise, it is optional - it is unlikely that it will ever be a list.

@michalsn
Copy link
Member Author

I don't feel strong with these rules at all, but PHPStan infers int|string when you write something like:

'after' => [
    'foo' => ['except' => ['api/*']],
    'bar', // <- this is an indexed element with key 0
],

So in this case int is required.

Maybe there is a better way to solve this.

@neznaika0
Copy link
Contributor

Okay, don't strain yourself. It is for filters that string keys should be used, but not int => string.

Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
Copy link
Member

@paulbalandan paulbalandan left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@michalsn michalsn merged commit 9973d05 into codeigniter4:develop Aug 1, 2025
48 checks passed
@paulbalandan paulbalandan added the refactor Pull requests that refactor code label Aug 2, 2025
@michalsn michalsn deleted the fix/phpstan-rule-filters branch August 3, 2025 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Docs: \App\Config\Filters::globals type does not pass PHPStan when using the multiple-URI 'except' pattern
3 participants