Skip to content
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

refactor: fix implicit array creation #9316

Merged

Conversation

paulbalandan
Copy link
Member

Description
Implicit arrays are prone to bugs.

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

@paulbalandan paulbalandan added the refactor Pull requests that refactor code label Dec 11, 2024
@paulbalandan paulbalandan force-pushed the implicit-array-creation branch from d542f6d to c06d928 Compare December 11, 2024 17:05
@samsonasik samsonasik merged commit e9bb603 into codeigniter4:develop Dec 11, 2024
41 checks passed
@samsonasik
Copy link
Member

Thank you @paulbalandan

@paulbalandan paulbalandan deleted the implicit-array-creation branch December 12, 2024 01:11
Comment on lines +125 to 127
$filters = [];
$filters['before'] = array_intersect($filtersLongest['before'], $filtersShortest['before']);
$filters['after'] = array_intersect($filtersLongest['after'], $filtersShortest['after']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Late to comment this, I prefer this kind of style.

$filters = [
          'before' => array_intersect($filtersLongest['before'], $filtersShortest['before']),
          'after' => array_intersect($filtersLongest['after'], $filtersShortest['after']),
];

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I realised later on that I can do it that way. You can send a PR to clean that up.

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.

5 participants