new api 2.0

This commit is contained in:
daniel 2024-01-24 11:47:02 +01:00
parent b35af80afb
commit 366b68a571
26 changed files with 148 additions and 228 deletions

View File

@ -9,7 +9,7 @@
],
"config": {
"platform": {
"php": "8.1"
"php": "8.2"
}
},
"require": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fcb5110418bf2f7066c8fd3ff2e19aca",
"content-hash": "c59ac791bff6b039091a3296023a8da6",
"packages": [
{
"name": "amphp/amp",
@ -3034,20 +3034,20 @@
},
{
"name": "symfony/filesystem",
"version": "v6.4.0",
"version": "v7.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59"
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59",
"reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"shasum": ""
},
"require": {
"php": ">=8.1",
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},
@ -3077,7 +3077,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v6.4.0"
"source": "https://github.com/symfony/filesystem/tree/v7.0.0"
},
"funding": [
{
@ -3093,27 +3093,27 @@
"type": "tidelift"
}
],
"time": "2023-07-26T17:27:13+00:00"
"time": "2023-07-27T06:33:22+00:00"
},
{
"name": "symfony/finder",
"version": "v6.4.0",
"version": "v7.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce"
"reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce",
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce",
"url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56",
"reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56",
"shasum": ""
},
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"require-dev": {
"symfony/filesystem": "^6.0|^7.0"
"symfony/filesystem": "^6.4|^7.0"
},
"type": "library",
"autoload": {
@ -3141,7 +3141,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v6.4.0"
"source": "https://github.com/symfony/finder/tree/v7.0.0"
},
"funding": [
{
@ -3157,7 +3157,7 @@
"type": "tidelift"
}
],
"time": "2023-10-31T17:30:12+00:00"
"time": "2023-10-31T17:59:56+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -3739,20 +3739,20 @@
},
{
"name": "symfony/process",
"version": "v6.4.2",
"version": "v7.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241"
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/c4b1ef0bc80533d87a2e969806172f1c2a980241",
"reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241",
"url": "https://api.github.com/repos/symfony/process/zipball/acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
"shasum": ""
},
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"type": "library",
"autoload": {
@ -3780,7 +3780,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.4.2"
"source": "https://github.com/symfony/process/tree/v7.0.2"
},
"funding": [
{
@ -3796,7 +3796,7 @@
"type": "tidelift"
}
],
"time": "2023-12-22T16:42:54+00:00"
"time": "2023-12-24T09:15:37+00:00"
},
{
"name": "symfony/var-dumper",
@ -3881,28 +3881,27 @@
},
{
"name": "symfony/yaml",
"version": "v6.4.0",
"version": "v7.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587"
"reference": "0055b230c408428b9b5cde7c55659555be5c0278"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/4f9237a1bb42455d609e6687d2613dde5b41a587",
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587",
"url": "https://api.github.com/repos/symfony/yaml/zipball/0055b230c408428b9b5cde7c55659555be5c0278",
"reference": "0055b230c408428b9b5cde7c55659555be5c0278",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.5|^3",
"php": ">=8.2",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<5.4"
"symfony/console": "<6.4"
},
"require-dev": {
"symfony/console": "^5.4|^6.0|^7.0"
"symfony/console": "^6.4|^7.0"
},
"bin": [
"Resources/bin/yaml-lint"
@ -3933,7 +3932,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.4.0"
"source": "https://github.com/symfony/yaml/tree/v7.0.0"
},
"funding": [
{
@ -3949,7 +3948,7 @@
"type": "tidelift"
}
],
"time": "2023-11-06T11:00:25+00:00"
"time": "2023-11-07T10:26:03+00:00"
},
{
"name": "tinymce/tinymce",
@ -4101,7 +4100,7 @@
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "8.1"
"php": "8.2"
},
"plugin-api-version": "2.3.0"
}

View File

@ -1,5 +1,5 @@
<?php
// Versions must be specified as a string in the following formats: '8', '8.0.30', ...
$php_version = '8';
$mysql_version = '8';
$php_version = '8.2';
$mysql_version = '8.2';

View File

@ -14,7 +14,6 @@ return array(
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
'3da389f428d8ee50333e4391c3f45046' => $vendorDir . '/amphp/serialization/src/functions.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'8dc56fe697ca93c4b40d876df1c94584' => $vendorDir . '/amphp/process/lib/functions.php',
@ -26,6 +25,7 @@ return array(
'384cf4f2eb4d2f896db72315a76066ad' => $vendorDir . '/amphp/parallel/lib/Worker/functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => $vendorDir . '/symfony/polyfill-iconv/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'861372841bb4b8ba9fdd215894666f40' => $vendorDir . '/amphp/parallel-functions/src/functions.php',

View File

@ -15,7 +15,6 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
'3da389f428d8ee50333e4391c3f45046' => __DIR__ . '/..' . '/amphp/serialization/src/functions.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'8dc56fe697ca93c4b40d876df1c94584' => __DIR__ . '/..' . '/amphp/process/lib/functions.php',
@ -27,6 +26,7 @@ class ComposerStaticInit94a17e624d873685991e8ae888e00eb9
'384cf4f2eb4d2f896db72315a76066ad' => __DIR__ . '/..' . '/amphp/parallel/lib/Worker/functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'861372841bb4b8ba9fdd215894666f40' => __DIR__ . '/..' . '/amphp/parallel-functions/src/functions.php',

View File

@ -3166,25 +3166,25 @@
},
{
"name": "symfony/filesystem",
"version": "v6.4.0",
"version_normalized": "6.4.0.0",
"version": "v7.0.0",
"version_normalized": "7.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59"
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59",
"reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"reference": "7da8ea2362a283771478c5f7729cfcb43a76b8b7",
"shasum": ""
},
"require": {
"php": ">=8.1",
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},
"time": "2023-07-26T17:27:13+00:00",
"time": "2023-07-27T06:33:22+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3212,7 +3212,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v6.4.0"
"source": "https://github.com/symfony/filesystem/tree/v7.0.0"
},
"funding": [
{
@ -3232,26 +3232,26 @@
},
{
"name": "symfony/finder",
"version": "v6.4.0",
"version_normalized": "6.4.0.0",
"version": "v7.0.0",
"version_normalized": "7.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce"
"reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/11d736e97f116ac375a81f96e662911a34cd50ce",
"reference": "11d736e97f116ac375a81f96e662911a34cd50ce",
"url": "https://api.github.com/repos/symfony/finder/zipball/6e5688d69f7cfc4ed4a511e96007e06c2d34ce56",
"reference": "6e5688d69f7cfc4ed4a511e96007e06c2d34ce56",
"shasum": ""
},
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"require-dev": {
"symfony/filesystem": "^6.0|^7.0"
"symfony/filesystem": "^6.4|^7.0"
},
"time": "2023-10-31T17:30:12+00:00",
"time": "2023-10-31T17:59:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3279,7 +3279,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v6.4.0"
"source": "https://github.com/symfony/finder/tree/v7.0.0"
},
"funding": [
{
@ -3898,23 +3898,23 @@
},
{
"name": "symfony/process",
"version": "v6.4.2",
"version_normalized": "6.4.2.0",
"version": "v7.0.2",
"version_normalized": "7.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241"
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/c4b1ef0bc80533d87a2e969806172f1c2a980241",
"reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241",
"url": "https://api.github.com/repos/symfony/process/zipball/acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
"shasum": ""
},
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"time": "2023-12-22T16:42:54+00:00",
"time": "2023-12-24T09:15:37+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3942,7 +3942,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.4.2"
"source": "https://github.com/symfony/process/tree/v7.0.2"
},
"funding": [
{
@ -4046,31 +4046,30 @@
},
{
"name": "symfony/yaml",
"version": "v6.4.0",
"version_normalized": "6.4.0.0",
"version": "v7.0.0",
"version_normalized": "7.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587"
"reference": "0055b230c408428b9b5cde7c55659555be5c0278"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/4f9237a1bb42455d609e6687d2613dde5b41a587",
"reference": "4f9237a1bb42455d609e6687d2613dde5b41a587",
"url": "https://api.github.com/repos/symfony/yaml/zipball/0055b230c408428b9b5cde7c55659555be5c0278",
"reference": "0055b230c408428b9b5cde7c55659555be5c0278",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.5|^3",
"php": ">=8.2",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<5.4"
"symfony/console": "<6.4"
},
"require-dev": {
"symfony/console": "^5.4|^6.0|^7.0"
"symfony/console": "^6.4|^7.0"
},
"time": "2023-11-06T11:00:25+00:00",
"time": "2023-11-07T10:26:03+00:00",
"bin": [
"Resources/bin/yaml-lint"
],
@ -4101,7 +4100,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.4.0"
"source": "https://github.com/symfony/yaml/tree/v7.0.0"
},
"funding": [
{

View File

@ -3,7 +3,7 @@
'name' => 'pandorafms/console',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '353c7e1fa14d9b527c430664165c43247443adc5',
'reference' => 'b35af80afb452f53ceb175793f2827286508e2df',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -283,7 +283,7 @@
'pandorafms/console' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '353c7e1fa14d9b527c430664165c43247443adc5',
'reference' => 'b35af80afb452f53ceb175793f2827286508e2df',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -466,18 +466,18 @@
'dev_requirement' => false,
),
'symfony/filesystem' => array(
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'reference' => '952a8cb588c3bc6ce76f6023000fb932f16a6e59',
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => '7da8ea2362a283771478c5f7729cfcb43a76b8b7',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/finder' => array(
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'reference' => '11d736e97f116ac375a81f96e662911a34cd50ce',
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => '6e5688d69f7cfc4ed4a511e96007e06c2d34ce56',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(),
@ -547,9 +547,9 @@
'dev_requirement' => false,
),
'symfony/process' => array(
'pretty_version' => 'v6.4.2',
'version' => '6.4.2.0',
'reference' => 'c4b1ef0bc80533d87a2e969806172f1c2a980241',
'pretty_version' => 'v7.0.2',
'version' => '7.0.2.0',
'reference' => 'acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
@ -565,9 +565,9 @@
'dev_requirement' => false,
),
'symfony/yaml' => array(
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'reference' => '4f9237a1bb42455d609e6687d2613dde5b41a587',
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => '0055b230c408428b9b5cde7c55659555be5c0278',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),

View File

@ -4,8 +4,8 @@
$issues = array();
if (!(PHP_VERSION_ID >= 80100)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.';
if (!(PHP_VERSION_ID >= 80200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
7.0
---
* Add argument `$lock` to `Filesystem::appendToFile()`
5.4
---

View File

@ -31,12 +31,10 @@ class Filesystem
* If the target file is newer, it is overwritten only when the
* $overwriteNewerFiles option is set to true.
*
* @return void
*
* @throws FileNotFoundException When originFile doesn't exist
* @throws IOException When copy fails
*/
public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false)
public function copy(string $originFile, string $targetFile, bool $overwriteNewerFiles = false): void
{
$originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
if ($originIsLocal && !is_file($originFile)) {
@ -84,11 +82,9 @@ class Filesystem
/**
* Creates a directory recursively.
*
* @return void
*
* @throws IOException On any directory creation failure
*/
public function mkdir(string|iterable $dirs, int $mode = 0777)
public function mkdir(string|iterable $dirs, int $mode = 0777): void
{
foreach ($this->toIterable($dirs) as $dir) {
if (is_dir($dir)) {
@ -127,11 +123,9 @@ class Filesystem
* @param int|null $time The touch time as a Unix timestamp, if not supplied the current system time is used
* @param int|null $atime The access time as a Unix timestamp, if not supplied the current system time is used
*
* @return void
*
* @throws IOException When touch fails
*/
public function touch(string|iterable $files, int $time = null, int $atime = null)
public function touch(string|iterable $files, int $time = null, int $atime = null): void
{
foreach ($this->toIterable($files) as $file) {
if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
@ -143,11 +137,9 @@ class Filesystem
/**
* Removes files or directories.
*
* @return void
*
* @throws IOException When removal fails
*/
public function remove(string|iterable $files)
public function remove(string|iterable $files): void
{
if ($files instanceof \Traversable) {
$files = iterator_to_array($files, false);
@ -211,11 +203,9 @@ class Filesystem
* @param int $umask The mode mask (octal)
* @param bool $recursive Whether change the mod recursively or not
*
* @return void
*
* @throws IOException When the change fails
*/
public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false)
public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false): void
{
foreach ($this->toIterable($files) as $file) {
if (!self::box('chmod', $file, $mode & ~$umask)) {
@ -233,11 +223,9 @@ class Filesystem
* @param string|int $user A user name or number
* @param bool $recursive Whether change the owner recursively or not
*
* @return void
*
* @throws IOException When the change fails
*/
public function chown(string|iterable $files, string|int $user, bool $recursive = false)
public function chown(string|iterable $files, string|int $user, bool $recursive = false): void
{
foreach ($this->toIterable($files) as $file) {
if ($recursive && is_dir($file) && !is_link($file)) {
@ -261,11 +249,9 @@ class Filesystem
* @param string|int $group A group name or number
* @param bool $recursive Whether change the group recursively or not
*
* @return void
*
* @throws IOException When the change fails
*/
public function chgrp(string|iterable $files, string|int $group, bool $recursive = false)
public function chgrp(string|iterable $files, string|int $group, bool $recursive = false): void
{
foreach ($this->toIterable($files) as $file) {
if ($recursive && is_dir($file) && !is_link($file)) {
@ -286,12 +272,10 @@ class Filesystem
/**
* Renames a file or a directory.
*
* @return void
*
* @throws IOException When target file or directory already exists
* @throws IOException When origin cannot be renamed
*/
public function rename(string $origin, string $target, bool $overwrite = false)
public function rename(string $origin, string $target, bool $overwrite = false): void
{
// we check that target does not exist
if (!$overwrite && $this->isReadable($target)) {
@ -329,11 +313,9 @@ class Filesystem
/**
* Creates a symbolic link or copy a directory.
*
* @return void
*
* @throws IOException When symlink fails
*/
public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false)
public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false): void
{
self::assertFunctionExists('symlink');
@ -367,12 +349,10 @@ class Filesystem
*
* @param string|string[] $targetFiles The target file(s)
*
* @return void
*
* @throws FileNotFoundException When original file is missing or not a file
* @throws IOException When link fails, including if link already exists
*/
public function hardlink(string $originFile, string|iterable $targetFiles)
public function hardlink(string $originFile, string|iterable $targetFiles): void
{
self::assertFunctionExists('link');
@ -526,11 +506,9 @@ class Filesystem
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false)
* - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
*
* @return void
*
* @throws IOException When file type is unknown
*/
public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $options = [])
public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $options = []): void
{
$targetDir = rtrim($targetDir, '/\\');
$originDir = rtrim($originDir, '/\\');
@ -652,11 +630,9 @@ class Filesystem
*
* @param string|resource $content The data to write into the file
*
* @return void
*
* @throws IOException if the file cannot be written to
*/
public function dumpFile(string $filename, $content)
public function dumpFile(string $filename, $content): void
{
if (\is_array($content)) {
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
@ -699,11 +675,9 @@ class Filesystem
* @param string|resource $content The content to append
* @param bool $lock Whether the file should be locked when writing to it
*
* @return void
*
* @throws IOException If the file is not writable
*/
public function appendToFile(string $filename, $content/* , bool $lock = false */)
public function appendToFile(string $filename, $content, bool $lock = false): void
{
if (\is_array($content)) {
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__));
@ -715,8 +689,6 @@ class Filesystem
$this->mkdir($dir);
}
$lock = \func_num_args() > 2 && func_get_arg(2);
if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) {
throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename);
}

View File

@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=8.1",
"php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8"
},

View File

@ -397,10 +397,8 @@ class Finder implements \IteratorAggregate, \Countable
* @see ignoreVCS()
*
* @param string|string[] $pattern VCS patterns to ignore
*
* @return void
*/
public static function addVCSPattern(string|array $pattern)
public static function addVCSPattern(string|array $pattern): void
{
foreach ((array) $pattern as $p) {
self::$vcsPatterns[] = $p;
@ -588,9 +586,8 @@ class Finder implements \IteratorAggregate, \Countable
*
* @see CustomFilterIterator
*/
public function filter(\Closure $closure /* , bool $prune = false */): static
public function filter(\Closure $closure, bool $prune = false): static
{
$prune = 1 < \func_num_args() ? func_get_arg(1) : false;
$this->filters[] = $closure;
if ($prune) {

View File

@ -23,8 +23,8 @@ namespace Symfony\Component\Finder\Iterator;
*/
abstract class MultiplePcreFilterIterator extends \FilterIterator
{
protected $matchRegexps = [];
protected $noMatchRegexps = [];
protected array $matchRegexps = [];
protected array $noMatchRegexps = [];
/**
* @param \Iterator<TKey, TValue> $iterator The Iterator to filter
@ -80,11 +80,7 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
*/
protected function isRegex(string $str): bool
{
$availableModifiers = 'imsxuADU';
if (\PHP_VERSION_ID >= 80200) {
$availableModifiers .= 'n';
}
$availableModifiers = 'imsxuADUn';
if (preg_match('/^(.{3,}?)['.$availableModifiers.']*$/', $str, $m)) {
$start = substr($m[1], 0, 1);

View File

@ -16,10 +16,10 @@
}
],
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"require-dev": {
"symfony/filesystem": "^6.0|^7.0"
"symfony/filesystem": "^6.4|^7.0"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Finder\\": "" },

View File

@ -47,10 +47,7 @@ class ProcessFailedException extends RuntimeException
$this->process = $process;
}
/**
* @return Process
*/
public function getProcess()
public function getProcess(): Process
{
return $this->process;
}

View File

@ -38,26 +38,17 @@ class ProcessTimedOutException extends RuntimeException
));
}
/**
* @return Process
*/
public function getProcess()
public function getProcess(): Process
{
return $this->process;
}
/**
* @return bool
*/
public function isGeneralTimeout()
public function isGeneralTimeout(): bool
{
return self::TYPE_GENERAL === $this->timeoutType;
}
/**
* @return bool
*/
public function isIdleTimeout()
public function isIdleTimeout(): bool
{
return self::TYPE_IDLE === $this->timeoutType;
}

View File

@ -23,20 +23,16 @@ class ExecutableFinder
/**
* Replaces default suffixes of executable.
*
* @return void
*/
public function setSuffixes(array $suffixes)
public function setSuffixes(array $suffixes): void
{
$this->suffixes = $suffixes;
}
/**
* Adds new possible suffix to check for executable.
*
* @return void
*/
public function addSuffix(string $suffix)
public function addSuffix(string $suffix): void
{
$this->suffixes[] = $suffix;
}

View File

@ -28,10 +28,8 @@ class InputStream implements \IteratorAggregate
/**
* Sets a callback that is called when the write buffer becomes empty.
*
* @return void
*/
public function onEmpty(callable $onEmpty = null)
public function onEmpty(callable $onEmpty = null): void
{
$this->onEmpty = null !== $onEmpty ? $onEmpty(...) : null;
}
@ -41,10 +39,8 @@ class InputStream implements \IteratorAggregate
*
* @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar,
* stream resource or \Traversable
*
* @return void
*/
public function write(mixed $input)
public function write(mixed $input): void
{
if (null === $input) {
return;
@ -57,20 +53,16 @@ class InputStream implements \IteratorAggregate
/**
* Closes the write buffer.
*
* @return void
*/
public function close()
public function close(): void
{
$this->open = false;
}
/**
* Tells whether the write buffer is closed or not.
*
* @return bool
*/
public function isClosed()
public function isClosed(): bool
{
return !$this->open;
}

View File

@ -55,10 +55,7 @@ class PhpProcess extends Process
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}
/**
* @return void
*/
public function start(callable $callback = null, array $env = [])
public function start(callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');

View File

@ -88,7 +88,7 @@ class Process implements \IteratorAggregate
*
* User-defined errors must use exit codes in the 64-113 range.
*/
public static $exitCodes = [
public static array $exitCodes = [
0 => 'OK',
1 => 'General error',
2 => 'Misuse of shell builtins',
@ -199,10 +199,7 @@ class Process implements \IteratorAggregate
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
/**
* @return void
*/
public function __wakeup()
public function __wakeup(): void
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
@ -287,13 +284,11 @@ class Process implements \IteratorAggregate
* @param callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR
*
* @return void
*
* @throws RuntimeException When process can't be launched
* @throws RuntimeException When process is already running
* @throws LogicException In case a callback is provided and output has been disabled
*/
public function start(callable $callback = null, array $env = [])
public function start(callable $callback = null, array $env = []): void
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
@ -1140,11 +1135,9 @@ class Process implements \IteratorAggregate
* In case you run a background process (with the start method), you should
* trigger this method regularly to ensure the process timeout
*
* @return void
*
* @throws ProcessTimedOutException In case the timeout was reached
*/
public function checkTimeout()
public function checkTimeout(): void
{
if (self::STATUS_STARTED !== $this->status) {
return;
@ -1182,10 +1175,8 @@ class Process implements \IteratorAggregate
*
* Enabling the "create_new_console" option allows a subprocess to continue
* to run after the main process exited, on both Windows and *nix
*
* @return void
*/
public function setOptions(array $options)
public function setOptions(array $options): void
{
if ($this->isRunning()) {
throw new RuntimeException('Setting options while the process is running is not possible.');
@ -1279,10 +1270,8 @@ class Process implements \IteratorAggregate
* Updates the status of the process, reads pipes.
*
* @param bool $blocking Whether to use a blocking read call
*
* @return void
*/
protected function updateStatus(bool $blocking)
protected function updateStatus(bool $blocking): void
{
if (self::STATUS_STARTED !== $this->status) {
return;

View File

@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=8.1"
"php": ">=8.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Process\\": "" },

View File

@ -1,6 +1,11 @@
CHANGELOG
=========
7.0
---
* Remove the `!php/const:` tag, use `!php/const` instead (without the colon)
6.3
---

View File

@ -50,10 +50,7 @@ class LintCommand extends Command
$this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...);
}
/**
* @return void
*/
protected function configure()
protected function configure(): void
{
$this
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')

View File

@ -51,10 +51,8 @@ class ParseException extends RuntimeException
/**
* Sets the snippet of code near the error.
*
* @return void
*/
public function setSnippet(string $snippet)
public function setSnippet(string $snippet): void
{
$this->snippet = $snippet;
@ -73,10 +71,8 @@ class ParseException extends RuntimeException
/**
* Sets the filename where the error occurred.
*
* @return void
*/
public function setParsedFile(string $parsedFile)
public function setParsedFile(string $parsedFile): void
{
$this->parsedFile = $parsedFile;
@ -93,10 +89,8 @@ class ParseException extends RuntimeException
/**
* Sets the line where the error occurred.
*
* @return void
*/
public function setParsedLine(int $parsedLine)
public function setParsedLine(int $parsedLine): void
{
$this->parsedLine = $parsedLine;

View File

@ -197,14 +197,9 @@ class Parser
array_pop($this->refsBeingParsed);
}
} elseif (
// @todo in 7.0 remove legacy "(?:!?!php/const:)?"
self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values)
self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values)
&& (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"]))
) {
if (str_starts_with($values['key'], '!php/const:')) {
trigger_deprecation('symfony/yaml', '6.2', 'YAML syntax for key "%s" is deprecated and replaced by "!php/const %s".', $values['key'], substr($values['key'], 11));
}
if ($context && 'sequence' == $context) {
throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename);
}
@ -412,7 +407,7 @@ class Parser
throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename);
}
if ($deprecatedUsage = (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1])) {
if (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1]) {
throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
}
@ -442,7 +437,7 @@ class Parser
continue;
}
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
if (0 === $this->offset && isset($line[0]) && ' ' === $line[0]) {
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}

View File

@ -16,15 +16,14 @@
}
],
"require": {
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.5|^3",
"php": ">=8.2",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"symfony/console": "^5.4|^6.0|^7.0"
"symfony/console": "^6.4|^7.0"
},
"conflict": {
"symfony/console": "<5.4"
"symfony/console": "<6.4"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Yaml\\": "" },