Skip to content

Commit 0e7137b

Browse files
committed
Require PHP 8.4+
1 parent 10ff0d8 commit 0e7137b

24 files changed

+579
-947
lines changed

.github/workflows/code-style.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: shivammathur/setup-php@v2
1515
with:
1616
coverage: none
17-
php-version: "8.3"
17+
php-version: "8.4"
1818
ini-values: memory_limit=-1
1919
tools: phpcs, cs2pr
2020
- name: Run PHP Code Sniffer

.github/workflows/static-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: "8.3"
17+
php-version: "8.4"
1818
ini-values: memory_limit=-1
1919
tools: composer:v2
2020
- name: Cache dependencies

.github/workflows/test.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
php-version:
14-
- "8.2"
15-
- "8.3"
1614
- "8.4"
1715
steps:
1816
- name: Checkout
@@ -41,7 +39,7 @@ jobs:
4139
run: make test-coveralls
4240

4341
- name: Upload code coverage
44-
if: ${{ matrix.php-version == '8.3' }}
42+
if: ${{ matrix.php-version == '8.4' }}
4543
env:
4644
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4745
run: |

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# CHANGELOG
22

3+
## v7.0
4+
5+
### New Requirements
6+
7+
PHP 8.4+
8+
9+
### New features
10+
11+
None
12+
13+
### Deprecated Features
14+
15+
None
16+
17+
### Backward Incompatible Changes
18+
19+
None
20+
21+
### Other changes
22+
23+
None
24+
25+
26+
327
## v4.x to v6.0
428

529
### New requirements

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=8.2
1+
ARG PHP_VERSION=8.4
22
FROM php:${PHP_VERSION}-cli-bookworm
33

44
RUN <<-EOF

Makefile

+1-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,7 @@ test-cleanup:
3131
@rm -rf tests/sandbox/*
3232

3333
.PHONY: test-container
34-
test-container: test-container-82
35-
36-
.PHONY: test-container-82
37-
test-container-82:
38-
@-docker-compose run --rm app82 bash
39-
@docker-compose down -v
40-
41-
.PHONY: test-container-83
42-
test-container-83:
43-
@-docker-compose run --rm app83 bash
44-
@docker-compose down -v
34+
test-container: test-container-84
4535

4636
.PHONY: test-container-84
4737
test-container-84:

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "icanboogie/http",
33
"type": "library",
4-
"version": "6.0",
4+
"version": "7.0",
55
"description": "Provides an API to handle HTTP requests.",
66
"keywords": [
77
"http",
@@ -29,10 +29,10 @@
2929
"minimum-stability": "dev",
3030
"prefer-stable": true,
3131
"require": {
32-
"php": ">=8.2",
32+
"php": ">=8.4",
3333
"ext-mbstring": "*",
3434
"icanboogie/accessor": "^6.0",
35-
"icanboogie/event": "^6.0"
35+
"icanboogie/event": "^7.0"
3636
},
3737
"require-dev": {
3838
"ext-fileinfo": "*",

docker-compose.yaml

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
---
22
services:
3-
app82:
4-
build:
5-
context: .
6-
args:
7-
PHP_VERSION: "8.2"
8-
environment:
9-
PHP_IDE_CONFIG: 'serverName=icanboogie-http'
10-
volumes:
11-
- .:/app:delegated
12-
- ~/.composer:/root/.composer:delegated
13-
working_dir: /app
14-
app83:
15-
build:
16-
context: .
17-
args:
18-
PHP_VERSION: "8.3"
19-
environment:
20-
PHP_IDE_CONFIG: 'serverName=icanboogie-http'
21-
volumes:
22-
- .:/app:delegated
23-
- ~/.composer:/root/.composer:delegated
24-
working_dir: /app
253
app84:
264
build:
275
context: .
286
args:
29-
PHP_VERSION: "8.4.0RC3"
7+
PHP_VERSION: "8.4"
308
environment:
319
PHP_IDE_CONFIG: 'serverName=icanboogie-http'
3210
volumes:

lib/File.php

+23-29
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@
3232
* @property-read int|null $error Error code, one of `UPLOAD_ERR_*`.
3333
* @property-read FormattedString|null $error_message A formatted message representing the error.
3434
* @property-read string $pathname Pathname of the file.
35-
* @property-read string $extension The extension of the file. If any, the dot is included e.g.
36-
* ".zip".
3735
* @property-read string $unsuffixed_name The name of the file without its extension.
38-
* @property-read bool $is_uploaded `true` if the file is uploaded, `false` otherwise.
39-
* @property-read bool $is_valid `true` if the file is valid, `false` otherwise.
40-
* See: {@see get_is_valid()}.
4136
*/
4237
class File implements ToArray, FileOptions
4338
{
@@ -48,10 +43,7 @@ class File implements ToArray, FileOptions
4843
* @uses get_size
4944
* @uses get_error
5045
* @uses get_error_message
51-
* @uses get_is_valid
5246
* @uses get_pathname
53-
* @uses get_extension
54-
* @uses get_is_uploaded
5547
*/
5648
use AccessorTrait;
5749

@@ -243,11 +235,12 @@ protected function get_error_message(): ?FormattedString
243235
* A file is considered valid if it has no error code, if it has a size,
244236
* if it has either a temporary name or a pathname and that the file actually exists.
245237
*/
246-
protected function get_is_valid(): bool
247-
{
248-
return !$this->error
249-
&& $this->size
250-
&& ($this->tmp_name || ($this->pathname && file_exists($this->pathname)));
238+
public bool $is_valid {
239+
get {
240+
return !$this->error
241+
&& $this->size
242+
&& ($this->tmp_name || ($this->pathname && file_exists($this->pathname)));
243+
}
251244
}
252245

253246
private ?string $pathname = null;
@@ -334,32 +327,33 @@ public function to_array(): array
334327
}
335328

336329
/**
337-
* Returns the extension of the file, if any.
330+
* The extension of the file, if any.
338331
*
339332
* **Note**: The extension includes the dot e.g. ".zip". The extension is always in lower case.
340333
*/
341-
protected function get_extension(): ?string
342-
{
343-
if (!$this->name) {
344-
return null;
345-
}
334+
public ?string $extension {
335+
get {
336+
if (!$this->name) {
337+
return null;
338+
}
346339

347-
$extension = pathinfo($this->name, PATHINFO_EXTENSION);
340+
$extension = pathinfo($this->name, PATHINFO_EXTENSION);
348341

349-
if (!$extension) {
350-
return null;
351-
}
342+
if (!$extension) {
343+
return null;
344+
}
352345

353-
return '.' . strtolower($extension);
346+
return '.' . strtolower($extension);
347+
}
354348
}
355349

356350
/**
357-
* Checks if a file is uploaded.
351+
* Whether the file was uploaded.
358352
*/
359-
protected function get_is_uploaded(): bool
360-
{
361-
return $this->tmp_name && is_uploaded_file($this->tmp_name);
362-
}
353+
public bool $is_uploaded
354+
{
355+
get => $this->tmp_name && is_uploaded_file($this->tmp_name);
356+
}
363357

364358
/**
365359
* Checks if the file matches a MIME class, a MIME type, or a file extension.

lib/FileOptions.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ interface FileOptions
1010
/**
1111
* Name of the file.
1212
*/
13-
public const OPTION_NAME = 'name';
13+
public const string OPTION_NAME = 'name';
1414

1515
/**
1616
* MIME type of the file.
1717
*/
18-
public const OPTION_TYPE = 'type';
18+
public const string OPTION_TYPE = 'type';
1919

2020
/**
2121
* Size of the file.
2222
*/
23-
public const OPTION_SIZE = 'size';
23+
public const string OPTION_SIZE = 'size';
2424

2525
/**
2626
* Temporary filename.
2727
*/
28-
public const OPTION_TMP_NAME = 'tmp_name';
28+
public const string OPTION_TMP_NAME = 'tmp_name';
2929

3030
/**
3131
* Error code, one of `UPLOAD_ERR_*`.
3232
*/
33-
public const OPTION_ERROR = 'error';
33+
public const string OPTION_ERROR = 'error';
3434

3535
/**
3636
* Pathname of the file.
3737
*/
38-
public const OPTION_PATHNAME = 'pathname';
38+
public const string OPTION_PATHNAME = 'pathname';
3939
}

0 commit comments

Comments
 (0)