Skip to content

Commit 65eed69

Browse files
author
Emmanuel Campait
committed
fix: normalize localize filter paths for standalone package tests
1 parent 4dcbb40 commit 65eed69

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/phpstan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ jobs:
2727
- name: Install dependencies
2828
run: composer install --no-interaction --prefer-dist
2929

30+
- name: Prepare PHPStan temp directory
31+
run: mkdir -p build build/phpstan-tmp
32+
3033
- name: Run PHPStan
3134
run: vendor/bin/phpstan analyse -c phpstan.neon.dist

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parameters:
99
excludePaths:
1010
- tests/_support/*
1111
scanDirectories:
12-
- ../../../vendor/codeigniter4/framework/system/Helpers
12+
- %currentWorkingDirectory%/vendor/codeigniter4/framework/system/Helpers
1313
universalObjectCratesClasses:
1414
- CodeIgniter\Entity
1515
- CodeIgniter\Entity\Entity

src/Filters/Localize.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public function before(RequestInterface $request, $arguments = null)
3636
}
3737

3838
$supportedLocales = $this->getSupportedLocales($appConfig);
39-
$path = trim($request->getUri()->getPath(), '/');
39+
$path = trim($request->getPath(), '/');
4040

4141
if ($this->isExcluded($path, $localizeConfig->excluded)) {
4242
return null;
4343
}
4444

45-
$segments = $request->getUri()->getSegments();
45+
$segments = $path === '' ? [] : explode('/', $path);
4646
$firstSegment = $segments[0] ?? '';
4747
$requestedLocale = $this->resolveSupportedLocale($firstSegment, $supportedLocales);
4848

0 commit comments

Comments
 (0)