Skip to content

Commit

Permalink
Leverage str_ends_with
Browse files Browse the repository at this point in the history
added the php80 polyfill to requirements when necessary
  • Loading branch information
Tobion committed Jul 21, 2021
1 parent c1f7f3f commit de282c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Csp/ContentSecurityPolicyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private function authorizesInline(array $directivesSet, string $type): bool
private function hasHashOrNonce(array $directives): bool
{
foreach ($directives as $directive) {
if ('\'' !== substr($directive, -1)) {
if (!str_ends_with($directive, '\'')) {
continue;
}
if ('\'nonce-' === substr($directive, 0, 7)) {
Expand Down
2 changes: 1 addition & 1 deletion Profiler/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getNames(Profile $profile)
continue;
}

if ('.html.twig' === substr($template, -10)) {
if (str_ends_with($template, '.html.twig')) {
$template = substr($template, 0, -10);
}

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"symfony/config": "^4.2|^5.0",
"symfony/framework-bundle": "^4.4|^5.0",
"symfony/http-kernel": "^4.4",
"symfony/polyfill-php80": "^1.16",
"symfony/routing": "^4.3|^5.0",
"symfony/twig-bundle": "^4.2|^5.0",
"twig/twig": "^1.43|^2.13|^3.0.4"
Expand Down

0 comments on commit de282c9

Please sign in to comment.