Skip to content

Commit 3f8588d

Browse files
committed
Prepare 7.4.0 release
1 parent 81796a5 commit 3f8588d

File tree

5 files changed

+22
-40
lines changed

5 files changed

+22
-40
lines changed

components/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All Notable changes to `League\Uri\Components` will be documented in this file
44

5-
## Next - TBD
5+
## [7.4.0](https://github.com/thephpleague/uri-components/compare/7.3.0...7.4.0) - 2023-11-23
66

77
### Added
88

components/Components/Query.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use League\Uri\QueryString;
2323
use Psr\Http\Message\UriInterface as Psr7UriInterface;
2424
use Stringable;
25-
2625
use Traversable;
2726

2827
use function array_column;

interfaces/CHANGELOG.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,7 @@
22

33
All Notable changes to `League\Uri\Interfaces` will be documented in this file
44

5-
## Next - TBD
6-
7-
### Added
8-
9-
- None
10-
11-
### Fixed
12-
13-
- None
14-
15-
### Deprecated
16-
17-
- None
18-
19-
### Removed
20-
21-
- None
22-
23-
## [7.3.0](https://github.com/thephpleague/uri-interfaces/compare/7.2.0...7.3.0) - 2023-09-09
5+
## [Next](https://github.com/thephpleague/uri-interfaces/compare/7.2.0...7.3.0) - 2023-09-09
246

257
### Added
268

uri/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All Notable changes to `League\Uri` will be documented in this file
44

5-
## Next - TBD
5+
## [7.4.0](https://github.com/thephpleague/uri/compare/7.3.0...7.4.0) - 2023-09-09
66

77
### Added
88

uri/Uri.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -521,29 +521,30 @@ public static function fromData(string $data, string $mimetype = '', string $par
521521
default => throw new SyntaxError('Invalid mimeType, `'.$mimetype.'`.'),
522522
};
523523

524-
if ('' != $parameters) {
525-
if (str_starts_with($parameters, ';')) {
526-
$parameters = substr($parameters, 1);
527-
}
528-
529-
$validateParameter = function (string $parameter): bool {
530-
$properties = explode('=', $parameter);
524+
if ('' === $parameters) {
525+
return self::fromComponents([
526+
'scheme' => 'data',
527+
'path' => self::formatDataPath($mimetype.','.rawurlencode($data)),
528+
]);
529+
}
531530

532-
return 2 != count($properties) || 'base64' === strtolower($properties[0]);
533-
};
531+
$isInvalidParameter = static function (string $parameter): bool {
532+
$properties = explode('=', $parameter);
534533

535-
$params = array_filter(explode(';', $parameters));
536-
if ([] !== array_filter($params, $validateParameter(...))) {
537-
throw new SyntaxError(sprintf('Invalid mediatype parameters, `%s`.', $parameters));
538-
}
534+
return 2 !== count($properties) || 'base64' === strtolower($properties[0]);
535+
};
539536

540-
$parameters = ';'.$parameters;
537+
if (str_starts_with($parameters, ';')) {
538+
$parameters = substr($parameters, 1);
541539
}
542540

543-
return self::fromComponents([
544-
'scheme' => 'data',
545-
'path' => self::formatDataPath($mimetype.$parameters.','.rawurlencode($data)),
546-
]);
541+
return match ([]) {
542+
array_filter(explode(';', $parameters), $isInvalidParameter) => self::fromComponents([
543+
'scheme' => 'data',
544+
'path' => self::formatDataPath($mimetype.';'.$parameters.','.rawurlencode($data)),
545+
]),
546+
default => throw new SyntaxError(sprintf('Invalid mediatype parameters, `%s`.', $parameters))
547+
};
547548
}
548549

549550
/**

0 commit comments

Comments
 (0)