Skip to content

fix: [Filters] normalize $filters arguments#8994

Merged
kenjis merged 4 commits intocodeigniter4:4.6from
kenjis:normalizer-filters-filter-args
Jun 29, 2024
Merged

fix: [Filters] normalize $filters arguments#8994
kenjis merged 4 commits intocodeigniter4:4.6from
kenjis:normalizer-filters-filter-args

Conversation

@kenjis
Copy link
Member

@kenjis kenjis commented Jun 24, 2024

Description
This PR normalizes $filters arguments.
Because Route filter's arguments are already normalized (trimmed).

[$name, $arguments] = $this->getCleanName($name);

private function getCleanName(string $name): array
{
$arguments = [];
if (str_contains($name, ':')) {
[$name, $arguments] = explode(':', $name);
$arguments = explode(',', $arguments);
array_walk($arguments, static function (&$item) {
$item = trim($item);
});
}
return [$name, $arguments];
}

  • normalize $filters arguments
  • refactor

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

@kenjis kenjis added enhancement PRs that improve existing functionalities 4.6 bug Verified issues on the current code behavior or pull requests that will fix them and removed enhancement PRs that improve existing functionalities labels Jun 24, 2024
@kenjis kenjis changed the title feat: [Filter] normalize $filters arguments fix: [Filter] normalize $filters arguments Jun 24, 2024
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from 3317bda to bdfe019 Compare June 24, 2024 02:14
@kenjis kenjis changed the title fix: [Filter] normalize $filters arguments fix: [Filters] normalize $filters arguments Jun 24, 2024
kenjis added 2 commits June 27, 2024 10:39
For consistency. Route filter arguments are already normalized.
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from bdfe019 to 81efd57 Compare June 27, 2024 01:42
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from 81efd57 to f3e5504 Compare June 27, 2024 04:55
@kenjis kenjis merged commit 85434df into codeigniter4:4.6 Jun 29, 2024
@kenjis kenjis deleted the normalizer-filters-filter-args branch June 29, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants