Skip to content

Commit e5e5712

Browse files
committed
Maintenance
1 parent 2d2e6a8 commit e5e5712

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
@@ -10,14 +10,14 @@ jobs:
1010
php-versions: ['8.4', '8.5']
1111
fail-fast: false
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
1414
- uses: shivammathur/setup-php@v2
1515
with:
1616
php-version: ${{ matrix.php-versions }}
1717
extensions: gd, mbstring, zip
1818
ini-values: max_execution_time=600, memory_limit=-1
1919
tools: composer:v2
20-
coverage: xdebug
20+
coverage: pcov
2121
env:
2222
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323

@@ -26,7 +26,7 @@ jobs:
2626
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
2727

2828
- name: Cache composer dependencies
29-
uses: actions/cache@v4
29+
uses: actions/cache@v5
3030
with:
3131
path: ${{ steps.composercache.outputs.dir }}
3232
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -47,8 +47,6 @@ jobs:
4747
4848
- name: Check code quality
4949
run: vendor/bin/code-quality
50-
env:
51-
PHP_CS_FIXER_IGNORE_ENV: 1
5250

5351
- name: Test against lowest versions
5452
run: |
@@ -58,13 +56,13 @@ jobs:
5856
5957
- name: Archive logs
6058
if: ${{ failure() }}
61-
uses: actions/upload-artifact@v4
59+
uses: actions/upload-artifact@v6
6260
with:
6361
name: logs-php-${{ matrix.php-versions }}
6462
path: vendor/endroid/quality/application/var/log
6563

6664
- name: Archive code coverage results
67-
uses: actions/upload-artifact@v5
65+
uses: actions/upload-artifact@v6
6866
with:
6967
name: coverage-php-${{ matrix.php-versions }}
7068
path: tests/coverage

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2025 (c) Jeroen van den Enden
1+
Copyright (c) Jeroen van den Enden
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"config": {
4242
"sort-packages": true,
4343
"allow-plugins": {
44-
"endroid/installer": true
44+
"endroid/installer": true,
45+
"carthage-software/mago": true
4546
}
4647
}
4748
}

src/Twig/Extension/EmbedExtension.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
final class EmbedExtension extends AbstractExtension
1111
{
12+
#[\Override]
1213
public function getFunctions(): array
1314
{
1415
return [
@@ -20,25 +21,17 @@ public function embed(string $source): string
2021
{
2122
$data = (string) file_get_contents($source);
2223

23-
return 'data:'.$this->getMimeType($data).';base64,'.base64_encode($data);
24+
return 'data:' . $this->getMimeType($data) . ';base64,' . base64_encode($data);
2425
}
2526

2627
private function getMimeType(string $data): string
2728
{
28-
$fileInfo = finfo_open();
29-
30-
if (false === $fileInfo) {
31-
throw new \Exception('Could not retrieve file info');
32-
}
33-
34-
$mimeType = finfo_buffer($fileInfo, $data, FILEINFO_MIME_TYPE);
29+
$mimeType = new \finfo(FILEINFO_MIME_TYPE)->buffer($data);
3530

3631
if (false === $mimeType) {
3732
throw new \Exception('Could not retrieve mime type');
3833
}
3934

40-
finfo_close($fileInfo);
41-
4235
return $mimeType;
4336
}
4437
}

0 commit comments

Comments
 (0)