Skip to content

Commit 9f254e9

Browse files
committed
test fix
1 parent dc091dc commit 9f254e9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"symfony/config": "^3.4 || ^4.0 || ^5.0",
2727
"symfony/dependency-injection": "^3.4 || ^4.0 || ^5.0",
2828
"symfony/http-kernel": "^3.4 || ^4.0 || ^5.0",
29-
"symfony/polyfill-php80": "^1.15",
3029
"symfony/service-contracts": "^1.0 || ^2.0"
3130
},
3231
"require-dev": {

src/Asset/BuildFileLocator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function findFile(string $path, string $buildName = '_default'): string
2828
}
2929

3030
// sanity / security check
31-
if (!str_ends_with($path, '.css') && !str_ends_with($path, '.js')) {
31+
if (!$this->strEndsWith($path, '.css') && !$this->strEndsWith($path, '.js')) {
3232
throw new \InvalidArgumentException('Can only read files ending in .css and .js');
3333
}
3434

@@ -81,6 +81,11 @@ private function combinePaths(string $buildPath, string $path): string
8181
return $buildPathInfo->getPathname().'/'.implode('/', $pathParts);
8282
}
8383

84+
private function strEndsWith(string $haystack, string $needle): bool
85+
{
86+
return '' === $needle || $needle === \substr($haystack, -\strlen($needle));
87+
}
88+
8489
/**
8590
* @internal
8691
*/

tests/Asset/EntrypointLookupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testGetJavaScriptFilesWithFileTrackingDisabled()
9696
$this->assertEquals(
9797
['file1.js', 'file3.js'],
9898
$this->entrypointLookup->getJavaScriptFiles('other_entry'),
99-
'file1.js is returned even though it was also returned above',
99+
'file1.js is returned even though it was also returned above'
100100
);
101101

102102
$this->assertEquals(

0 commit comments

Comments
 (0)