diff --git a/CHANGELOG.md b/CHANGELOG.md index 121028e0..d5ec1866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 3.2.0 +- Security: Bumped `symfony/process` dependency to a version without security vulnerabilities (affects Windows servers only) +- Updated: All composer dependencies to their latest supported versions for PHP >= 7.2.5 (same as Matomo 5 itself) + ## 3.1.0 - Added: Search for Node executable additionally in paths of `PATH` environment variable - Improved: Provide directory search path in error message if executable cannot be found diff --git a/Lighthouse.php b/Lighthouse.php index 8b990cab..6378adab 100644 --- a/Lighthouse.php +++ b/Lighthouse.php @@ -4,7 +4,7 @@ require PIWIK_INCLUDE_PATH . '/plugins/PerformanceAudit/vendor/autoload.php'; -use Dzava\Lighthouse\Lighthouse as BaseLighthouse; +use DevDavido\Lighthouse\Lighthouse as BaseLighthouse; use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedAuthoriseRefusedException; use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedException; use Piwik\Plugins\PerformanceAudit\Exceptions\AuditFailedMethodNotAllowedException; diff --git a/composer.json b/composer.json index a29e5225..b964768b 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "php": ">=7.2.5", "ext-json": "*", "ext-spl": "*", - "ducks-project/spl-types": "^1.2", - "symfony/polyfill-mbstring": "^1.28", - "symfony/process": "^4.4", - "jeroen-g/lighthouse": "^0.2" + "ducks-project/spl-types": "^5.0", + "symfony/polyfill-mbstring": "^1.31", + "symfony/process": "^5.4", + "devdavido/lighthouse": "dev-master#91ddfe4126453d3c9cb4c8263a5238967fbdf9ac" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.19" @@ -37,5 +37,11 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/devdavido/lighthouse-php" + } + ] } diff --git a/plugin.json b/plugin.json index fc850b4f..443760ff 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "PerformanceAudit", "description": "Daily performance audits of all your sites in Matomo.", - "version": "3.1.0", + "version": "3.2.0", "theme": false, "require": { "php": ">=7.2.5", diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index a72151c7..7824d8f7 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -45,35 +45,34 @@ class ClassLoader /** @var \Closure(string):void */ private static $includeFile; - /** @var ?string */ + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -81,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -90,21 +88,20 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { @@ -113,7 +110,7 @@ public function __construct($vendorDir = null) } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -125,8 +122,7 @@ public function getPrefixes() } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -134,8 +130,7 @@ public function getPrefixesPsr4() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -143,8 +138,7 @@ public function getFallbackDirs() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -152,8 +146,7 @@ public function getFallbackDirsPsr4() } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -161,8 +154,7 @@ public function getClassMap() } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -179,24 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -205,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -226,9 +219,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -236,17 +229,18 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -256,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -276,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -294,8 +288,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -481,9 +475,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 4d39e716..a1948b3a 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -11,17 +11,17 @@ 'Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php', 'Composer\\Autoload\\ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c' => $vendorDir . '/composer/autoload_static.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'DevDavido\\Lighthouse\\Exceptions\\AuditFailedException' => $vendorDir . '/devdavido/lighthouse/src/Exceptions/AuditFailedException.php', + 'DevDavido\\Lighthouse\\Lighthouse' => $vendorDir . '/devdavido/lighthouse/src/Lighthouse.php', + 'DevDavido\\Lighthouse\\Tests\\Integration\\LighthouseTest' => $vendorDir . '/devdavido/lighthouse/tests/Integration/LighthouseTest.php', + 'DevDavido\\Lighthouse\\Tests\\Unit\\LighthouseTest' => $vendorDir . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php', + 'DevDavido\\Lighthouse\\Tests\\Unit\\MockLighthouse' => $vendorDir . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php', 'Ducks\\Component\\SplTypes\\SplBool' => $vendorDir . '/ducks-project/spl-types/SplBool.php', 'Ducks\\Component\\SplTypes\\SplEnum' => $vendorDir . '/ducks-project/spl-types/SplEnum.php', 'Ducks\\Component\\SplTypes\\SplFloat' => $vendorDir . '/ducks-project/spl-types/SplFloat.php', 'Ducks\\Component\\SplTypes\\SplInt' => $vendorDir . '/ducks-project/spl-types/SplInt.php', 'Ducks\\Component\\SplTypes\\SplString' => $vendorDir . '/ducks-project/spl-types/SplString.php', 'Ducks\\Component\\SplTypes\\SplType' => $vendorDir . '/ducks-project/spl-types/SplType.php', - 'Dzava\\Lighthouse\\Exceptions\\AuditFailedException' => $vendorDir . '/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php', - 'Dzava\\Lighthouse\\Lighthouse' => $vendorDir . '/jeroen-g/lighthouse/src/Lighthouse.php', - 'Dzava\\Lighthouse\\Tests\\Integration\\LighthouseTest' => $vendorDir . '/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php', - 'Dzava\\Lighthouse\\Tests\\Unit\\LighthouseTest' => $vendorDir . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php', - 'Dzava\\Lighthouse\\Tests\\Unit\\MockLighthouse' => $vendorDir . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php', 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Piwik\\Plugins\\PerformanceAudit\\API' => $baseDir . '/API.php', 'Piwik\\Plugins\\PerformanceAudit\\Archiver' => $baseDir . '/Archiver.php', @@ -78,7 +78,7 @@ 'Piwik\\Plugins\\PerformanceAudit\\Tasks' => $baseDir . '/Tasks.php', 'Piwik\\Plugins\\PerformanceAudit\\Updates_1_1_0' => $baseDir . '/Updates/1.1.0.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\ApiTest' => $baseDir . '/tests/Integration/ApiTest.php', - 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationTest' => $baseDir . '/tests/Integration/PerformanceAuditIntegrationTest.php', + 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationPreparation' => $baseDir . '/tests/Integration/PerformanceAuditIntegrationPreparation.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Filter\\AuditScoreClassifierTest' => $baseDir . '/tests/Unit/Filter/AuditScoreClassifierTest.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\PercentTest' => $baseDir . '/tests/Unit/Metric/PercentTest.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\SecondsTest' => $baseDir . '/tests/Unit/Metric/SecondsTest.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index c0106c2d..7fc63184 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -9,6 +9,6 @@ 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), - 'Dzava\\Lighthouse\\' => array($vendorDir . '/jeroen-g/lighthouse/src'), 'Ducks\\Component\\SplTypes\\' => array($vendorDir . '/ducks-project/spl-types'), + 'DevDavido\\Lighthouse\\' => array($vendorDir . '/devdavido/lighthouse/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 4133061e..85647bdb 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -21,8 +21,8 @@ class ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c ), 'D' => array ( - 'Dzava\\Lighthouse\\' => 17, 'Ducks\\Component\\SplTypes\\' => 25, + 'DevDavido\\Lighthouse\\' => 21, ), ); @@ -39,14 +39,14 @@ class ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c array ( 0 => __DIR__ . '/..' . '/symfony/process', ), - 'Dzava\\Lighthouse\\' => - array ( - 0 => __DIR__ . '/..' . '/jeroen-g/lighthouse/src', - ), 'Ducks\\Component\\SplTypes\\' => array ( 0 => __DIR__ . '/..' . '/ducks-project/spl-types', ), + 'DevDavido\\Lighthouse\\' => + array ( + 0 => __DIR__ . '/..' . '/devdavido/lighthouse/src', + ), ); public static $classMap = array ( @@ -55,17 +55,17 @@ class ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c 'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php', 'Composer\\Autoload\\ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c' => __DIR__ . '/..' . '/composer/autoload_static.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'DevDavido\\Lighthouse\\Exceptions\\AuditFailedException' => __DIR__ . '/..' . '/devdavido/lighthouse/src/Exceptions/AuditFailedException.php', + 'DevDavido\\Lighthouse\\Lighthouse' => __DIR__ . '/..' . '/devdavido/lighthouse/src/Lighthouse.php', + 'DevDavido\\Lighthouse\\Tests\\Integration\\LighthouseTest' => __DIR__ . '/..' . '/devdavido/lighthouse/tests/Integration/LighthouseTest.php', + 'DevDavido\\Lighthouse\\Tests\\Unit\\LighthouseTest' => __DIR__ . '/..' . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php', + 'DevDavido\\Lighthouse\\Tests\\Unit\\MockLighthouse' => __DIR__ . '/..' . '/devdavido/lighthouse/tests/Unit/LighthouseTest.php', 'Ducks\\Component\\SplTypes\\SplBool' => __DIR__ . '/..' . '/ducks-project/spl-types/SplBool.php', 'Ducks\\Component\\SplTypes\\SplEnum' => __DIR__ . '/..' . '/ducks-project/spl-types/SplEnum.php', 'Ducks\\Component\\SplTypes\\SplFloat' => __DIR__ . '/..' . '/ducks-project/spl-types/SplFloat.php', 'Ducks\\Component\\SplTypes\\SplInt' => __DIR__ . '/..' . '/ducks-project/spl-types/SplInt.php', 'Ducks\\Component\\SplTypes\\SplString' => __DIR__ . '/..' . '/ducks-project/spl-types/SplString.php', 'Ducks\\Component\\SplTypes\\SplType' => __DIR__ . '/..' . '/ducks-project/spl-types/SplType.php', - 'Dzava\\Lighthouse\\Exceptions\\AuditFailedException' => __DIR__ . '/..' . '/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php', - 'Dzava\\Lighthouse\\Lighthouse' => __DIR__ . '/..' . '/jeroen-g/lighthouse/src/Lighthouse.php', - 'Dzava\\Lighthouse\\Tests\\Integration\\LighthouseTest' => __DIR__ . '/..' . '/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php', - 'Dzava\\Lighthouse\\Tests\\Unit\\LighthouseTest' => __DIR__ . '/..' . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php', - 'Dzava\\Lighthouse\\Tests\\Unit\\MockLighthouse' => __DIR__ . '/..' . '/jeroen-g/lighthouse/tests/Unit/LighthouseTest.php', 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Piwik\\Plugins\\PerformanceAudit\\API' => __DIR__ . '/../..' . '/API.php', 'Piwik\\Plugins\\PerformanceAudit\\Archiver' => __DIR__ . '/../..' . '/Archiver.php', @@ -122,7 +122,7 @@ class ComposerStaticInit98dde460e8a16c8877d8f8d8a8e6921c 'Piwik\\Plugins\\PerformanceAudit\\Tasks' => __DIR__ . '/../..' . '/Tasks.php', 'Piwik\\Plugins\\PerformanceAudit\\Updates_1_1_0' => __DIR__ . '/../..' . '/Updates/1.1.0.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\ApiTest' => __DIR__ . '/../..' . '/tests/Integration/ApiTest.php', - 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationTest' => __DIR__ . '/../..' . '/tests/Integration/PerformanceAuditIntegrationTest.php', + 'Piwik\\Plugins\\PerformanceAudit\\tests\\Integration\\PerformanceAuditIntegrationPreparation' => __DIR__ . '/../..' . '/tests/Integration/PerformanceAuditIntegrationPreparation.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Filter\\AuditScoreClassifierTest' => __DIR__ . '/../..' . '/tests/Unit/Filter/AuditScoreClassifierTest.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\PercentTest' => __DIR__ . '/../..' . '/tests/Unit/Metric/PercentTest.php', 'Piwik\\Plugins\\PerformanceAudit\\tests\\Unit\\Metric\\SecondsTest' => __DIR__ . '/../..' . '/tests/Unit/Metric/SecondsTest.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ed06e133..09f9bccc 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,24 +1,89 @@ { "packages": [ + { + "name": "devdavido/lighthouse", + "version": "dev-master", + "version_normalized": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/DevDavido/lighthouse-php.git", + "reference": "91ddfe4126453d3c9cb4c8263a5238967fbdf9ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DevDavido/lighthouse-php/zipball/91ddfe4126453d3c9cb4c8263a5238967fbdf9ac", + "reference": "91ddfe4126453d3c9cb4c8263a5238967fbdf9ac", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/process": "^5.4" + }, + "require-dev": { + "phpunit/phpunit": "^6.1|^7.0" + }, + "time": "2024-11-09T15:13:34+00:00", + "default-branch": true, + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "DevDavido\\Lighthouse\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "DevDavido\\Lighthouse\\Test\\": "tests/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "DevDavido", + "homepage": "https://github.com/DevDavido" + } + ], + "description": "Interface for the Google Lighthouse project", + "homepage": "https://github.com/DevDavido/lighthouse-php", + "keywords": [ + "lighthouse" + ], + "support": { + "source": "https://github.com/DevDavido/lighthouse-php/tree/master" + }, + "install-path": "../devdavido/lighthouse" + }, { "name": "ducks-project/spl-types", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "version": "v5.0.0", + "version_normalized": "5.0.0.0", "source": { "type": "git", "url": "https://github.com/ducks-project/spl-types.git", - "reference": "57fbd86788341f0d026c29f368058414f809870f" + "reference": "15093fc875ddd8bb1e14d009445b7e7fafa1a42e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ducks-project/spl-types/zipball/57fbd86788341f0d026c29f368058414f809870f", - "reference": "57fbd86788341f0d026c29f368058414f809870f", + "url": "https://api.github.com/repos/ducks-project/spl-types/zipball/15093fc875ddd8bb1e14d009445b7e7fafa1a42e", + "reference": "15093fc875ddd8bb1e14d009445b7e7fafa1a42e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" }, - "time": "2020-11-25T11:28:05+00:00", + "require-dev": { + "atoum/atoum": "^4.0||^4.1||^4.2", + "atoum/stubs": "^2.6", + "friendsofphp/php-cs-fixer": "^2.19||^3.64", + "phpbench/phpbench": "^1.1||^1.2", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^8.5||^9.6||^10.5||^11.3", + "squizlabs/php_codesniffer": "^3.10", + "vimeo/psalm": "^4.30||5.26" + }, + "time": "2024-09-18T20:41:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -64,7 +129,7 @@ "support": { "email": "adrien.loyant@gmail.com", "issues": "https://github.com/ducks-project/spl-types/issues", - "source": "https://github.com/ducks-project/spl-types/tree/v1.2.0" + "source": "https://github.com/ducks-project/spl-types/tree/v5.0.0" }, "funding": [ { @@ -78,70 +143,23 @@ ], "install-path": "../ducks-project/spl-types" }, - { - "name": "jeroen-g/lighthouse", - "version": "v0.2", - "version_normalized": "0.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/Jeroen-G/lighthouse-php.git", - "reference": "9cabb6a857b1a9ccc537328956b4e0af2c370f9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jeroen-G/lighthouse-php/zipball/9cabb6a857b1a9ccc537328956b4e0af2c370f9a", - "reference": "9cabb6a857b1a9ccc537328956b4e0af2c370f9a", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "symfony/process": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1|^7.0" - }, - "time": "2019-01-25T12:14:39+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Dzava\\Lighthouse\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dimitris Zavantias", - "email": "dzavantias@gmail.com" - } - ], - "description": "Interface for the Google Lighthouse project", - "homepage": "https://github.com/dzava/lighthouse-php", - "keywords": [ - "lighthouse" - ], - "install-path": "../jeroen-g/lighthouse" - }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.31.0", + "version_normalized": "1.31.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -149,12 +167,9 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2023-07-28T09:04:16+00:00", + "time": "2024-09-09T11:45:10+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -193,7 +208,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -213,28 +228,25 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", - "version_normalized": "1.28.0.0", + "version": "v1.31.0", + "version_normalized": "1.31.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, - "time": "2023-01-26T09:26:14+00:00", + "time": "2024-09-09T11:45:10+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -279,7 +291,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -299,24 +311,24 @@ }, { "name": "symfony/process", - "version": "v4.4.44", - "version_normalized": "4.4.44.0", + "version": "v5.4.46", + "version_normalized": "5.4.46.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2" + "reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", - "reference": "5cee9cdc4f7805e2699d9fd66991a0e6df8252a2", + "url": "https://api.github.com/repos/symfony/process/zipball/01906871cb9b5e3cf872863b91aba4ec9767daf4", + "reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-php80": "^1.16" }, - "time": "2022-06-27T13:16:42+00:00", + "time": "2024-11-06T09:18:28+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -344,7 +356,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v4.4.44" + "source": "https://github.com/symfony/process/tree/v5.4.46" }, "funding": [ { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 2f857d8f..58a6be6d 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,62 +3,64 @@ 'name' => 'devdavido/performance-audit-plugin', 'pretty_version' => 'dev-5.x-dev', 'version' => 'dev-5.x-dev', - 'reference' => '6bfad409aa2af43772a1dc53d87927a53fd3df26', + 'reference' => 'acaa1139e1ede76ca25cafe7e30e0ff3abfd1cd8', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => false, ), 'versions' => array( + 'devdavido/lighthouse' => array( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '91ddfe4126453d3c9cb4c8263a5238967fbdf9ac', + 'type' => 'library', + 'install_path' => __DIR__ . '/../devdavido/lighthouse', + 'aliases' => array( + 0 => '9999999-dev', + ), + 'dev_requirement' => false, + ), 'devdavido/performance-audit-plugin' => array( 'pretty_version' => 'dev-5.x-dev', 'version' => 'dev-5.x-dev', - 'reference' => '6bfad409aa2af43772a1dc53d87927a53fd3df26', + 'reference' => 'acaa1139e1ede76ca25cafe7e30e0ff3abfd1cd8', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'ducks-project/spl-types' => array( - 'pretty_version' => 'v1.2.0', - 'version' => '1.2.0.0', - 'reference' => '57fbd86788341f0d026c29f368058414f809870f', + 'pretty_version' => 'v5.0.0', + 'version' => '5.0.0.0', + 'reference' => '15093fc875ddd8bb1e14d009445b7e7fafa1a42e', 'type' => 'library', 'install_path' => __DIR__ . '/../ducks-project/spl-types', 'aliases' => array(), 'dev_requirement' => false, ), - 'jeroen-g/lighthouse' => array( - 'pretty_version' => 'v0.2', - 'version' => '0.2.0.0', - 'reference' => '9cabb6a857b1a9ccc537328956b4e0af2c370f9a', - 'type' => 'library', - 'install_path' => __DIR__ . '/../jeroen-g/lighthouse', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => '42292d99c55abe617799667f454222c54c60e229', + 'pretty_version' => 'v1.31.0', + 'version' => '1.31.0.0', + 'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.28.0', - 'version' => '1.28.0.0', - 'reference' => '6caa57379c4aec19c0a12a38b59b26487dcfe4b5', + 'pretty_version' => 'v1.31.0', + 'version' => '1.31.0.0', + 'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/process' => array( - 'pretty_version' => 'v4.4.44', - 'version' => '4.4.44.0', - 'reference' => '5cee9cdc4f7805e2699d9fd66991a0e6df8252a2', + 'pretty_version' => 'v5.4.46', + 'version' => '5.4.46.0', + 'reference' => '01906871cb9b5e3cf872863b91aba4ec9767daf4', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/process', 'aliases' => array(), diff --git a/vendor/jeroen-g/lighthouse/.gitignore b/vendor/devdavido/lighthouse/.gitignore similarity index 100% rename from vendor/jeroen-g/lighthouse/.gitignore rename to vendor/devdavido/lighthouse/.gitignore diff --git a/vendor/jeroen-g/lighthouse/LICENSE.md b/vendor/devdavido/lighthouse/LICENSE.md similarity index 100% rename from vendor/jeroen-g/lighthouse/LICENSE.md rename to vendor/devdavido/lighthouse/LICENSE.md diff --git a/vendor/jeroen-g/lighthouse/README.md b/vendor/devdavido/lighthouse/README.md similarity index 91% rename from vendor/jeroen-g/lighthouse/README.md rename to vendor/devdavido/lighthouse/README.md index 4d928c05..3b55db7f 100644 --- a/vendor/jeroen-g/lighthouse/README.md +++ b/vendor/devdavido/lighthouse/README.md @@ -5,7 +5,7 @@ This package provide a php interface for [Google Lighthouse](https://github.com/ Here's an example that will perform the default Lighthouse audits and store the result in `report.json` (You can use the [Lighthouse Viewer](https://googlechrome.github.io/lighthouse/viewer/) to open the report): ```php -use Dzava\Lighthouse\Lighthouse; +use DevDavido\Lighthouse\Lighthouse; (new Lighthouse()) ->setOutput('report.json') @@ -27,7 +27,7 @@ You can output both the json and html reports by passing an array as the second the following code will create two reports `example.report.html` and `example.report.json`. ```php -use Dzava\Lighthouse\Lighthouse; +use DevDavido\Lighthouse\Lighthouse; (new Lighthouse()) ->setOutput('example', ['html', 'json']) @@ -39,7 +39,7 @@ use Dzava\Lighthouse\Lighthouse; You can provide your own configuration file using the `withConfig` method. ```php -use Dzava\Lighthouse\Lighthouse; +use DevDavido\Lighthouse\Lighthouse; (new Lighthouse()) ->withConfig('./my-config.js') @@ -51,7 +51,7 @@ use Dzava\Lighthouse\Lighthouse; If you need to manually set these paths, you can do this by calling the `setNodeBinary` and `setLighthousePath` methods. ```php -use Dzava\Lighthouse\Lighthouse; +use DevDavido\Lighthouse\Lighthouse; (new Lighthouse()) ->setNodeBinary('/usr/bin/node') @@ -62,7 +62,7 @@ use Dzava\Lighthouse\Lighthouse; ### Passing flags to Chrome Use the `setChromeFlags` method to pass any flags to the Chrome instance. ```php -use Dzava\Lighthouse\Lighthouse; +use DevDavido\Lighthouse\Lighthouse; (new Lighthouse()) // these are the default flags used diff --git a/vendor/jeroen-g/lighthouse/composer.json b/vendor/devdavido/lighthouse/composer.json similarity index 52% rename from vendor/jeroen-g/lighthouse/composer.json rename to vendor/devdavido/lighthouse/composer.json index 7852902e..783bd776 100644 --- a/vendor/jeroen-g/lighthouse/composer.json +++ b/vendor/devdavido/lighthouse/composer.json @@ -1,32 +1,32 @@ { - "name": "jeroen-g/lighthouse", + "name": "devdavido/lighthouse", "description": "Interface for the Google Lighthouse project", "keywords": [ "lighthouse" ], - "homepage": "https://github.com/dzava/lighthouse-php", + "homepage": "https://github.com/DevDavido/lighthouse-php", "license": "MIT", "authors": [ { - "name": "Dimitris Zavantias", - "email": "dzavantias@gmail.com" + "name": "DevDavido", + "homepage": "https://github.com/DevDavido" } ], "require": { - "php": ">=5.5", - "symfony/process": "^4.0" + "php": ">=7.2.5", + "symfony/process": "^5.4" }, "require-dev": { "phpunit/phpunit": "^6.1|^7.0" }, "autoload": { "psr-4": { - "Dzava\\Lighthouse\\": "src/" + "DevDavido\\Lighthouse\\": "src/" } }, "autoload-dev": { "psr-4": { - "Dzava\\Lighthouse\\Test\\": "tests/" + "DevDavido\\Lighthouse\\Test\\": "tests/" } } } diff --git a/vendor/jeroen-g/lighthouse/phpunit.xml b/vendor/devdavido/lighthouse/phpunit.xml similarity index 100% rename from vendor/jeroen-g/lighthouse/phpunit.xml rename to vendor/devdavido/lighthouse/phpunit.xml diff --git a/vendor/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php b/vendor/devdavido/lighthouse/src/Exceptions/AuditFailedException.php similarity index 87% rename from vendor/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php rename to vendor/devdavido/lighthouse/src/Exceptions/AuditFailedException.php index 27802f0d..30bb3758 100644 --- a/vendor/jeroen-g/lighthouse/src/Exceptions/AuditFailedException.php +++ b/vendor/devdavido/lighthouse/src/Exceptions/AuditFailedException.php @@ -1,6 +1,6 @@ setTimeout($this->timeout)->run(); if (!$process->isSuccessful()) { - dump($process->getErrorOutput()); throw new AuditFailedException($url, $process->getErrorOutput()); } @@ -302,7 +301,7 @@ public function getCommand($url) $url, ], $this->processOptions()); - return implode(' ', array_filter($command)); + return array_values(array_filter($command)); } /** diff --git a/vendor/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php b/vendor/devdavido/lighthouse/tests/Integration/LighthouseTest.php similarity index 97% rename from vendor/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php rename to vendor/devdavido/lighthouse/tests/Integration/LighthouseTest.php index 6559adac..ad3a0efe 100644 --- a/vendor/jeroen-g/lighthouse/tests/Integration/LighthouseTest.php +++ b/vendor/devdavido/lighthouse/tests/Integration/LighthouseTest.php @@ -1,9 +1,9 @@ withConfig('/my/config') ->getCommand('http://example.com'); - $this->assertEquals(implode(' ', [ + $this->assertEquals([ 'lighthouse', '--output=json', '--quiet', "--config-path=/my/config", "http://example.com", "--chrome-flags='--headless --disable-gpu --no-sandbox'", - ]), $command); + ], $command); } /** @test */ @@ -73,7 +73,8 @@ public function can_set_chrome_path() $command = $this->lighthouse->getCommand('http://example.com'); - $this->assertContains("CHROME_PATH=/chrome lighthouse", $command); + $this->assertContains("CHROME_PATH=/chrome", $command); + $this->assertContains("lighthouse", $command); } /** @test */ @@ -150,13 +151,11 @@ public function can_override_the_output_format() $this->lighthouse->setOutput('/tmp/report.md', ['html', 'json']); $command = $this->lighthouse->getCommand('http://example.com'); - $this->assertContains("--output=html", $command); - $this->assertContains("--output=json", $command); + $this->assertContains("--output=json --output=html", $command); $this->lighthouse->setOutput('/tmp/report.md', ['html', 'json', 'md']); $command = $this->lighthouse->getCommand('http://example.com'); - $this->assertContains("--output=html", $command); - $this->assertContains("--output=json", $command); + $this->assertContains("--output=json --output=html", $command); $this->assertNotContains("--output=md", $command); } @@ -212,7 +211,7 @@ public function does_not_pass_headers_when_empty() $lighthouse = new MockLighthouse(); $lighthouse->setHeaders(['Cookie' => 'monster=blue']); - $this->assertContains('--extra-headers', $lighthouse->getCommand('')); + $this->assertContains('--extra-headers "{\"Cookie\":\"monster=blue\"}"', $lighthouse->getCommand('')); $lighthouse->setHeaders([]); $this->assertNotContains('--extra-headers', $lighthouse->getCommand('')); diff --git a/vendor/ducks-project/spl-types/.circleci/config.yml b/vendor/ducks-project/spl-types/.circleci/config.yml index 02fa0d3e..aec47445 100644 --- a/vendor/ducks-project/spl-types/.circleci/config.yml +++ b/vendor/ducks-project/spl-types/.circleci/config.yml @@ -1,16 +1,64 @@ -machine: - php: - version: 5.4.10 - -## Customize dependencies -dependencies: - override: - - mkdir -p build/logs - - composer install --no-interaction --optimize-autoloader - - sed -i 's/^;//' ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini - -## Customize test commands -test: - override: - - php vendor/bin/phpunit Tests/phpunit -c phpunit.xml.dist - - php vendor/bin/atoum -d Tests/atoum +version: 2.1 + +orbs: + codecov: codecov/codecov@4.0.1 + coveralls: coveralls/coveralls@2.2.1 + +# Define the jobs we want to run for this project +jobs: + test: + docker: + - image: cimg/php:7.4-node + steps: + - checkout + - run: php --version + # - run: sudo apt-get install libxslt1-dev + + - run: + name: Install PHP Extensions + command: sudo -E install-php-extensions zip intl + + #- run: + # name: Install xDebug + # command: sudo pecl install xdebug-3.1.5 && docker-php-ext-enable xdebug + + - run: echo -e "[Date]\ndate.timezone = Europe/Paris" | sudo tee /usr/local/etc/php/php.ini > /dev/null + - run: echo -e "memory_limit = -1" | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini + + # composer require + - run: composer require --dev --update-with-all-dependencies php-coveralls/php-coveralls + + # composer cache + - restore_cache: + keys: + # "composer.json" can be used if "composer.json" + # is not committed to the repository. + - composer-v1-{{ checksum "composer.lock" }} + # fallback to using the latest cache if no exact match is found + - composer-v1- + - run: composer install -n --prefer-dist + - save_cache: + key: composer-v1-{{ checksum "composer.lock" }} + paths: + - vendor + + # tests + - run: composer unittest + - run: composer atoumtest + + #- run: + # command: npm install && make test-coverage + # name: Install and Make + + # Stay commented Managed in github actions + #- coveralls/upload + #- codecov/upload + +# Orchestrate our job run sequence +workflows: + workflow: + jobs: + - test: + filters: + branches: + only: /5\..*/ diff --git a/vendor/ducks-project/spl-types/.corveralls.yml b/vendor/ducks-project/spl-types/.corveralls.yml deleted file mode 100644 index 5ce1686d..00000000 --- a/vendor/ducks-project/spl-types/.corveralls.yml +++ /dev/null @@ -1 +0,0 @@ -.corveralls.yml diff --git a/vendor/ducks-project/spl-types/.editorconfig b/vendor/ducks-project/spl-types/.editorconfig index f20ef1e2..0a25a939 100644 --- a/vendor/ducks-project/spl-types/.editorconfig +++ b/vendor/ducks-project/spl-types/.editorconfig @@ -1,14 +1,30 @@ -# .editorconfig.org root = true [*] -ident_style = space -indent_size = 4 -end_of_line = lf charset = utf-8 +end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true +[*.{php,html,twig,hac3,inc}] +indent_style = space +indent_size = 4 + +[*.{json,lock}] +indent_style = space +indent_size = 4 + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + [*.md] +max_line_length = 80 trim_trailing_whitespace = false -insert_final_newline = true + +[*.{xml,xsd}] +max_line_length = off +indent_size = 2 + +[COMMIT_EDITMSG] +max_line_length = 0 diff --git a/vendor/ducks-project/spl-types/.github/SECURITY.md b/vendor/ducks-project/spl-types/.github/SECURITY.md new file mode 100644 index 00000000..dbf9db05 --- /dev/null +++ b/vendor/ducks-project/spl-types/.github/SECURITY.md @@ -0,0 +1,16 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 1.1.x | :white_check_mark: | + +## Reporting a Vulnerability + +If you think that you have found a security issue in this repos, +please do not use the issue tracker and do not post it publicly. +Instead, all security issues must be sent to donald_duck [at] dteam-df.org diff --git a/vendor/ducks-project/spl-types/.github/workflows/php.yml b/vendor/ducks-project/spl-types/.github/workflows/php.yml new file mode 100644 index 00000000..4771964c --- /dev/null +++ b/vendor/ducks-project/spl-types/.github/workflows/php.yml @@ -0,0 +1,58 @@ +name: PHP Composer + +on: + push: + branches: [ "5.x" ] + pull_request: + branches: [ "5.x" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.2 + tools: composer:v2 + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install php-coveralls dev + run: composer require --dev --update-with-all-dependencies php-coveralls/php-coveralls + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run phpunit test + run: composer unittest + + - name: Run atoum test + run: composer atoumtest + + #- name: npm install, make test-coverage + # run: | + # npm install + # make test-coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + + - name: Coveralls + uses: coverallsapp/github-action@v2 diff --git a/vendor/ducks-project/spl-types/.gitignore b/vendor/ducks-project/spl-types/.gitignore index dab6eab3..230a46ca 100644 --- a/vendor/ducks-project/spl-types/.gitignore +++ b/vendor/ducks-project/spl-types/.gitignore @@ -25,6 +25,9 @@ # Idea .idea/* +# vscode +*.code-workspace + # Swap & temp files *~ *.tmp @@ -43,4 +46,5 @@ local.properties .vagrant/ /test /tests +/.history .DS_Store diff --git a/vendor/ducks-project/spl-types/.php-cs-fixer.dist.php b/vendor/ducks-project/spl-types/.php-cs-fixer.dist.php new file mode 100644 index 00000000..033c3f83 --- /dev/null +++ b/vendor/ducks-project/spl-types/.php-cs-fixer.dist.php @@ -0,0 +1,71 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR12' => true, + '@PHP74Migration:risky' => true, + '@PHP80Migration' => true, + 'binary_operator_spaces' => true, + 'cast_spaces' => ['space' => 'single'], + 'concat_space' => ['spacing' => 'one'], + 'declare_strict_types' => false, + 'empty_loop_body' => ['style' => 'semicolon'], + 'empty_loop_condition' => ['style' => 'while'], + 'fully_qualified_strict_types' => true, + 'function_typehint_space' => true, + 'include' => true, + 'lambda_not_used_import' => true, + 'linebreak_after_opening_tag' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'native_function_casing' => true, + 'native_function_type_declaration_casing' => true, + 'no_alias_language_construct_call' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_around_offset' => true, + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'return', 'switch_case', 'yield']], + 'no_unneeded_curly_braces' => true, + 'no_unneeded_import_alias' => true, + 'no_unused_imports' => true, + 'object_operator_without_whitespace' => true, + 'phpdoc_align' => ['align' => 'left'], + 'phpdoc_indent' => true, + 'phpdoc_inline_tag_normalizer' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_package' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => true, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => true, + 'semicolon_after_instruction' => true, + 'single_line_comment_spacing' => true, + 'single_space_after_construct' => true, + 'space_after_semicolon' => true, + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + // ->exclude('folder-to-exclude') // if you want to exclude some folders, you can do it like this! + ->in(__DIR__) + ) +; diff --git a/vendor/ducks-project/spl-types/.readthedocs.yml b/vendor/ducks-project/spl-types/.readthedocs.yml new file mode 100644 index 00000000..58622593 --- /dev/null +++ b/vendor/ducks-project/spl-types/.readthedocs.yml @@ -0,0 +1,6 @@ +version: 2 + +build: + os: ubuntu-lts-latest + tools: + python: "latest" diff --git a/vendor/ducks-project/spl-types/.scrutinizer.yml b/vendor/ducks-project/spl-types/.scrutinizer.yml new file mode 100644 index 00000000..02bb8c3b --- /dev/null +++ b/vendor/ducks-project/spl-types/.scrutinizer.yml @@ -0,0 +1,10 @@ +build: + nodes: + tests: + environment: + php: + version: 7.4 + pecl_extensions: + - spl_Types + ini: + 'date.timezone': 'Europe/Paris' diff --git a/vendor/ducks-project/spl-types/.styleci.yml b/vendor/ducks-project/spl-types/.styleci.yml index 6d8ab59e..fa218ef1 100644 --- a/vendor/ducks-project/spl-types/.styleci.yml +++ b/vendor/ducks-project/spl-types/.styleci.yml @@ -1,13 +1,22 @@ -preset: psr2 - -enabled: - - concat_with_spaces - - unused_use - -finder: - exclude: - - "Tests" - name: - - "*.php" - path: - - "." +php: + risky: false + version: 7.4 + preset: psr12 + monolithic: true + tab-width: 4 + use-tabs: false + finder: + exclude: + - "modules" + - "node_modules" + - "nova" + - "nova-components" + - "storage" + - "spark" + - "vendor" + - "Tests" + name: + - "*.php" + not-name: + - "*.blade.php" + - "_ide_helper.php" diff --git a/vendor/ducks-project/spl-types/.travis.yml b/vendor/ducks-project/spl-types/.travis.yml index ee3c1b7a..fce4a739 100644 --- a/vendor/ducks-project/spl-types/.travis.yml +++ b/vendor/ducks-project/spl-types/.travis.yml @@ -15,14 +15,11 @@ php: # dist: precise before_script: - - composer require --dev phpunit/phpunit ^5 - - composer require --dev php-coveralls/php-coveralls ^1 - - composer require --dev atoum/atoum ^3 - composer install --no-interaction --optimize-autoloader script: - mkdir -p build/logs - - php vendor/bin/phpunit Tests/phpunit -c phpunit.xml.dist - - php vendor/bin/atoum -d Tests/atoum + - composer unittest + - composer atoumtest after_success: - travis_retry php vendor/bin/php-coveralls diff --git a/vendor/ducks-project/spl-types/README.md b/vendor/ducks-project/spl-types/README.md index 94c14bc4..dc4aab33 100644 --- a/vendor/ducks-project/spl-types/README.md +++ b/vendor/ducks-project/spl-types/README.md @@ -1,36 +1,49 @@ # SplTypes +[![Github Action Status](https://github.com/ducks-project/spl-types/actions/workflows/php.yml/badge.svg)](https://github.com/ducks-project/spl-types) [![Build Status](https://travis-ci.org/ducks-project/spl-types.svg)](https://travis-ci.org/ducks-project/spl-types) - [![Coverage Status](https://coveralls.io/repos/github/ducks-project/spl-types/badge.svg)](https://coveralls.io/github/ducks-project/spl-types) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/ducks-project/spl-types/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ducks-project/spl-types/tree/master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ducks-project/spl-types/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ducks-project/spl-types/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/ducks-project/spl-types/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/ducks-project/spl-types/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/ducks-project/spl-types/badges/build.png?b=master)](https://scrutinizer-ci.com/g/ducks-project/spl-types/build-status/master) [![Code Intelligence Status](https://scrutinizer-ci.com/g/ducks-project/spl-types/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence) +[![Psalm Type Coverage](https://shepherd.dev/github/ducks-project/spl-types/coverage.svg)](https://shepherd.dev/github/ducks-project/spl-types) +[![codecov Status](https://codecov.io/github/ducks-project/spl-types/graph/badge.svg?token=M3LBGQQ6N9)](https://codecov.io/github/ducks-project/spl-types) +[![Appveyor status](https://ci.appveyor.com/api/projects/status/edj2aj94ebslnhy9?svg=true)](https://ci.appveyor.com/project/donaldinou/spl-types) [![License](https://poser.pugx.org/ducks-project/spl-types/license)](https://packagist.org/packages/ducks-project/spl-types) [![Latest Stable Version](https://poser.pugx.org/ducks-project/spl-types/v/stable)](https://packagist.org/packages/ducks-project/spl-types) +[![PHP Version Require](https://poser.pugx.org/ducks-project/spl-types/require/php)](https://packagist.org/packages/ducks-project/spl-types) [![Total Downloads](https://poser.pugx.org/ducks-project/spl-types/downloads)](https://packagist.org/packages/ducks-project/spl-types) [![Monthly Downloads](https://poser.pugx.org/ducks-project/spl-types/d/monthly)](https://packagist.org/packages/ducks-project/spl-types) [![Daily Downloads](https://poser.pugx.org/ducks-project/spl-types/d/daily)](https://packagist.org/packages/ducks-project/spl-types) +[![Duck's Validated](https://img.shields.io/badge/duck-validated-lightyellow)](https://opencollective.com/ducks-project) +[![Packagist online](https://img.shields.io/badge/packagist-online-brightgreen)](https://opencollective.com/ducks-project) +[![Documentation Status](https://readthedocs.org/projects/spl-types/badge/?version=latest)](https://spl-types.readthedocs.io/en/latest/?badge=latest) + +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md) + * Project page: https://github.com/ducks-project/spl-types * Repository: https://github.com/ducks-project/spl-types * Original PHP extension: http://php.net/manual/en/intro.spl-types.php +[![CircleCI](https://dl.circleci.com/insights-snapshot/gh/ducks-project/spl-types/master/workflow/badge.svg?window=30d)](https://app.circleci.com/insights/github/ducks-project/spl-types/workflows/workflow/overview?branch=master&reporting-window=last-30-days&insights-snapshot=true) + ## Description This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string It provides classes unavailable if you can't install [SPL Types](http://php.net/manual/en/intro.spl-types.php) extension: -- [`SplType`](http://php.net/manual/en/class.spltype.php) -- [`SplInt`](http://php.net/manual/en/class.splint.php) -- [`SplFloat`](http://php.net/manual/en/class.splfloat.php) -- [`SplEnum`](http://php.net/manual/en/class.splenum.php) -- [`SplBool`](http://php.net/manual/en/class.splbool.php) -- [`SplString`](http://php.net/manual/en/class.splstring.php) +- [`SplType`] +- [`SplInt`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] ## Known Issues & Limitations @@ -39,7 +52,8 @@ It provides classes unavailable if you can't install [SPL Types](http://php.net/ Because limitations of PHP it is impossible to directly reaffect Spl variables like the original extension. For example: -``` +```php + */ - final public function getConstList($include_default = false) + final public function getConstList(bool $include_default = false) { $class = new \ReflectionClass($this); $constants = $class->getConstants(); diff --git a/vendor/ducks-project/spl-types/SplFloat.php b/vendor/ducks-project/spl-types/SplFloat.php index a00927f2..06bcce12 100644 --- a/vendor/ducks-project/spl-types/SplFloat.php +++ b/vendor/ducks-project/spl-types/SplFloat.php @@ -15,21 +15,21 @@ * The SplFloat class is used to enforce strong typing of the float type. * * @see http://php.net/manual/en/class.splfloat.php + * + * @psalm-api */ class SplFloat extends SplType { /** * @var float - * - * @codingStandardsIgnoreStart */ - const __default = 0; - // @codingStandardsIgnoreEnd + // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase + public const __default = 0.0; /** * {@inheritdoc} */ - public function __construct($initial_value = self::__default, $strict = true) + public function __construct($initial_value = self::__default, bool $strict = true) { parent::__construct($initial_value, $strict); if (!$strict) { diff --git a/vendor/ducks-project/spl-types/SplInt.php b/vendor/ducks-project/spl-types/SplInt.php index 3827e6d3..70003286 100644 --- a/vendor/ducks-project/spl-types/SplInt.php +++ b/vendor/ducks-project/spl-types/SplInt.php @@ -15,21 +15,21 @@ * The SplInt class is used to enforce strong typing of the integer type. * * @see SplInt http://php.net/manual/en/class.splint.php + * + * @psalm-api */ class SplInt extends SplType { /** * @var int - * - * @codingStandardsIgnoreStart */ - const __default = 0; - // @codingStandardsIgnoreEnd + // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase + public const __default = 0; /** * {@inheritdoc} */ - public function __construct($initial_value = self::__default, $strict = true) + public function __construct($initial_value = self::__default, bool $strict = true) { parent::__construct($initial_value, $strict); if (!$strict) { diff --git a/vendor/ducks-project/spl-types/SplString.php b/vendor/ducks-project/spl-types/SplString.php index 83500b86..247b282b 100644 --- a/vendor/ducks-project/spl-types/SplString.php +++ b/vendor/ducks-project/spl-types/SplString.php @@ -15,21 +15,21 @@ * The SplString class is used to enforce strong typing of the string type. * * @see SplString http://php.net/manual/en/class.splstring.php + * + * @psalm-api */ class SplString extends SplType { /** * @var string - * - * @codingStandardsIgnoreStart */ - const __default = ''; - // @codingStandardsIgnoreEnd + // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase + public const __default = ''; /** * {@inheritdoc} */ - public function __construct($initial_value = self::__default, $strict = true) + public function __construct($initial_value = self::__default, bool $strict = true) { parent::__construct($initial_value, $strict); if (!$strict) { diff --git a/vendor/ducks-project/spl-types/SplType.php b/vendor/ducks-project/spl-types/SplType.php index 5effdaae..254a30e8 100644 --- a/vendor/ducks-project/spl-types/SplType.php +++ b/vendor/ducks-project/spl-types/SplType.php @@ -15,20 +15,23 @@ * Parent class for all SPL types. * * @see SplType http://php.net/manual/en/class.spltype.php + * + * @psalm-api */ abstract class SplType { /** * Default value. - * - * @codingStandardsIgnoreStart */ - const __default = null; - // @codingStandardsIgnoreEnd + // phpcs:ignore Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase + public const __default = null; /** - * Internal enum value + * Internal enum value. + * + * @var mixed */ + // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore public $__default; /** @@ -36,20 +39,20 @@ abstract class SplType * * @param mixed $initial_value Type and default value depends on the extension class. * @param bool $strict Whether to set the object's sctrictness. + * * @return void * * @throws \UnexpectedValueException if incompatible type is given. * - * @codingStandardsIgnoreStart + * @phpstan-ignore-next-line */ - public function __construct($initial_value = self::__default, $strict = true) + public function __construct($initial_value = self::__default, bool $strict = true) { - if ($initial_value === null) { + if (null === $initial_value) { $initial_value = static::__default; } $this->__default = $initial_value; } - // @codingStandardsIgnoreEnd /** * Stringify object. @@ -64,20 +67,25 @@ final public function __toString() /** * Export object. * + * @param array $properties + * * @return SplType */ - final public static function __set_state($properties) + final public static function __set_state(array $properties) { + // @phpstan-ignore-next-line return new static($properties['__default']); } /** * Dumping object (php > 5.6.0). * - * @return array + * @return array */ final public function __debugInfo() { - return array('__default' => $this->__default); + return [ + '__default' => $this->__default, + ]; } } diff --git a/vendor/ducks-project/spl-types/appveyor.yml b/vendor/ducks-project/spl-types/appveyor.yml new file mode 100644 index 00000000..387207a3 --- /dev/null +++ b/vendor/ducks-project/spl-types/appveyor.yml @@ -0,0 +1,3 @@ +version: 1.0.{build} +build: + verbosity: minimal diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplBool.md b/vendor/ducks-project/spl-types/assets/documentation/SplBool.md new file mode 100644 index 00000000..001134f2 --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplBool.md @@ -0,0 +1,72 @@ +# [The SplBool class](#The-SplBool-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +The SplBool class is used to enforce strong typing of the bool type. + +## [Class synopsis](#Class-synopsis) + +```php +SplBool extends SplEnum { + /* Constants */ + const boolean __default = false; + const boolean false = false; + const boolean true = true; + /* Inherited methods */ + public array SplEnum::getConstList ([ bool $include_default = false ] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplBool::__default** +**SplBool::false** +**SplBool::true** + +## [Examples](#Examples) + +### Example #1 SplBool usage example + +```php + ``` +> TRUE +> ``` + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type +- [SplEnum::getConstList] — Returns all consts (possible values) as an array. + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplInt`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplEnum.getConstList.md b/vendor/ducks-project/spl-types/assets/documentation/SplEnum.getConstList.md new file mode 100644 index 00000000..227ebf22 --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplEnum.getConstList.md @@ -0,0 +1,58 @@ +# [SplEnum::getConstList](#SplEnum::getConstList) + +(PHP 5, PHP 7, PHP 8) +SplEnum::getConstList — Returns all consts (possible values) as an array. + +## [Description](#Description) + +```php +public array SplEnum::getConstList ([ bool $include_default = false ] ) +``` + +## [Parameters](#Parameters) + +### [include_default](#include_default) +Whether to include __default property. + +## [Return Values](#Return-Values) + +An array of all possible values + +## [Examples](#Examples) + +### Example #1 SplEnum::getConstList() example + +```php +getConstList(true)); +``` + +The above example will output: + +> ``` +> array(3) { +> ["__default"] => bool(false) +> ["false"] => bool(false) +> ["true"] => bool(true) +> } +> ``` + +## [Notes](#Notes) + +> **Note:** Nothing to report yet + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplInt`] +- [`SplFloat`] +- [`SplBool`] +- [`SplString`] + +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplEnum.md b/vendor/ducks-project/spl-types/assets/documentation/SplEnum.md new file mode 100644 index 00000000..0ab20e4d --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplEnum.md @@ -0,0 +1,87 @@ +# [The SplEnum class](#The-SplEnum-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +SplEnum gives the ability to emulate and create enumeration objects natively in PHP. + +## [Class synopsis](#Class-synopsis) + +```php +SplEnum extends SplType { + /* Constants */ + const NULL __default = null ; + /* Methods */ + public array getConstList ([ bool $include_default = false ] ) + /* Inherited methods */ + SplType::__construct ([ mixed $initial_value [, bool $strict ]] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplEnum::__default** + +## [Examples](#Examples) + +### Example #1 SplEnum usage example + +```php +getMessage() . PHP_EOL; +} +``` + +The above example will output: + +> ``` +> 6 +> Value not a const in enum Month +> ``` + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type +- [SplEnum::getConstList] — Returns all consts (possible values) as an array. + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplInt`] +- [`SplFloat`] +- [`SplBool`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[SplEnum::getConstList]: ./SplEnum.getConstList.md#SplEnum::getConstList +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplFloat.md b/vendor/ducks-project/spl-types/assets/documentation/SplFloat.md new file mode 100644 index 00000000..b12f176f --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplFloat.md @@ -0,0 +1,71 @@ +# [The SplFloat class](#The-SplFloat-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +The SplFloat class is used to enforce strong typing of the float type. + +## [Class synopsis](#Class-synopsis) + +```php +SplFloat extends SplType { + /* Constants */ + const float __default = 0; + /* Inherited methods */ + SplType::__construct ([ mixed $initial_value [, bool $strict ]] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplFloat::__default** + +## [Examples](#Examples) + +### Example #1 SplFloat usage example + +```php +getMessage() . PHP_EOL; +} + +echo $float . PHP_EOL; +echo $newFloat . PHP_EOL; +``` + +The above example will output: + +> ``` +> Value not a float +> 3.154 +> 3 +> ``` + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplInt`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplInt.md b/vendor/ducks-project/spl-types/assets/documentation/SplInt.md new file mode 100644 index 00000000..6ba1df2a --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplInt.md @@ -0,0 +1,68 @@ +# [The SplInt class](#The-SplInt-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +The SplInt class is used to enforce strong typing of the integer type. + +## [Class synopsis](#Class-synopsis) + +```php +SplInt extends SplType { + /* Constants */ + const integer __default = 0; + /* Inherited methods */ + SplType::__construct ([ mixed $initial_value [, bool $strict ]] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplInt::__default** + +## [Examples](#Examples) + +### Example #1 SplInt usage example + +```php +getMessage() . PHP_EOL; +} + +echo $int . PHP_EOL; +``` + +The above example will output: + +> ``` +> Value not an integer +> 94 +> ``` + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplString.md b/vendor/ducks-project/spl-types/assets/documentation/SplString.md new file mode 100644 index 00000000..4261020e --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplString.md @@ -0,0 +1,72 @@ +# [The SplString class](#The-SplString-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +The SplString class is used to enforce strong typing of the string type. + +## [Class synopsis](#Class-synopsis) + +```php +SplString extends SplType { + /* Constants */ + const string __default = ''; + /* Inherited methods */ + SplType::__construct ([ mixed $initial_value [, bool $strict ]] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplString::__default** + +## [Examples](#Examples) + +### Example #1 SplString usage example + +```php +getMessage() . PHP_EOL; +} + +var_dump($string); +echo $string; // Outputs "Testing" +``` + +The above example will output: + +> ``` +> Value not a string +> object(SplString)#1 (1) { +> ["__default"] => string(7) "Testing" +> } +> Testing +> ``` + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type + +## [See Also](#See-Also) + +- [`SplType`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplType.construct.md b/vendor/ducks-project/spl-types/assets/documentation/SplType.construct.md new file mode 100644 index 00000000..08f7aa36 --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplType.construct.md @@ -0,0 +1,48 @@ +# [SplType::__construct](#SplType::__construct) + +(PHP 5, PHP 7, PHP 8) +SplType::__construct — Creates a new value of some type + +## [Description](#Description) + +```php +SplType::__construct ([ mixed $initial_value [, bool $strict ]] ) +``` + +## [Parameters](#Parameters) + +### [initial_value](#initial_value) +Type and default value depends on the extension class. + +### [strict](#strict) +Whether to set the object's sctrictness. + +## [Return Values](#Return-Values) + +A new Typed SplType + +## [Errors/Exceptions](#Errors/Exceptions) + +Throws an [UnexpectedValueException] if incompatible type is given. + +## [Examples](#Examples) + +## [Notes](#Notes) + +> **Note:** Nothing to report yet + +## [See Also](#See-Also) + +- [`SplInt`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] + +[UnexpectedValueException]: https://www.php.net/manual/en/class.unexpectedvalueexception.php +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/assets/documentation/SplType.md b/vendor/ducks-project/spl-types/assets/documentation/SplType.md new file mode 100644 index 00000000..2d05e17f --- /dev/null +++ b/vendor/ducks-project/spl-types/assets/documentation/SplType.md @@ -0,0 +1,44 @@ +# [The SplType class](#The-SplType-class) + +(PHP 5, PHP 7, PHP 8) +Check for [pecl SPL_Types] + +## [Introduction](#Introduction) + +Parent class for all SPL types. + +## [Class synopsis](#Class-synopsis) + +```php +abstract SplType { + /* Constants */ + const NULL __default = NULL ; + /* Methods */ + __construct ([ mixed $initial_value [, bool $strict ]] ) +} +``` + +## [Predefined Constants](#Predefined-Constants) + +**SplType::__default** + +## [Table of Contents](#Table-of-Contents) + +- [SplType::__construct] — Creates a new value of some type + +## [See Also](#See-Also) + +- [`SplInt`] +- [`SplFloat`] +- [`SplEnum`] +- [`SplBool`] +- [`SplString`] + +[SplType::__construct]: ./SplType.construct.md#SplType::__construct +[pecl SPL_Types]:https://pecl.php.net/package/SPL_Types +[`SplType`]: /assets/documentation/SplType.md +[`SplInt`]: /assets/documentation/SplInt.md +[`SplFloat`]: /assets/documentation/SplFloat.md +[`SplEnum`]: /assets/documentation/SplEnum.md +[`SplBool`]: /assets/documentation/SplBool.md +[`SplString`]: /assets/documentation/SplString.md diff --git a/vendor/ducks-project/spl-types/bootstrap.php b/vendor/ducks-project/spl-types/bootstrap.php index 21bdd44b..4f444f58 100644 --- a/vendor/ducks-project/spl-types/bootstrap.php +++ b/vendor/ducks-project/spl-types/bootstrap.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -$splTypes = array( +$splTypes = [ 'SplType', 'SplInt', 'SplFloat', 'SplEnum', 'SplBool', - 'SplString' -); + 'SplString', +]; foreach ($splTypes as $splType) { if (!class_exists($splType, false)) { diff --git a/vendor/ducks-project/spl-types/codecov.yml b/vendor/ducks-project/spl-types/codecov.yml new file mode 100644 index 00000000..0b542194 --- /dev/null +++ b/vendor/ducks-project/spl-types/codecov.yml @@ -0,0 +1,2 @@ +codecov: + token: 77f0d2fe-c97d-4466-9633-cebce47c0fa1 diff --git a/vendor/ducks-project/spl-types/composer.json b/vendor/ducks-project/spl-types/composer.json index 2b5339d7..97748b91 100755 --- a/vendor/ducks-project/spl-types/composer.json +++ b/vendor/ducks-project/spl-types/composer.json @@ -17,7 +17,17 @@ "email": "adrien.loyant@gmail.com" }, "require": { - "php": ">=5.3.3" + "php": ">=7.2" + }, + "require-dev": { + "atoum/atoum": "^4.0||^4.1||^4.2", + "atoum/stubs": "^2.6", + "friendsofphp/php-cs-fixer": "^2.19||^3.64", + "phpbench/phpbench": "^1.1||^1.2", + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^8.5||^9.6||^10.5||^11.3", + "squizlabs/php_codesniffer": "^3.10", + "vimeo/psalm": "^4.30||5.26" }, "autoload": { "psr-4": { @@ -29,5 +39,17 @@ "exclude-from-classmap": [ "/Tests/" ] + }, + "scripts": { + "test": [ + "@unittest", + "@atoumtest" + ], + "unittest": "XDEBUG_MODE=coverage ./vendor/bin/phpunit Tests/phpunit -c phpunit.xml.dist", + "atoumtest": "XDEBUG_MODE=coverage ./vendor/bin/atoum -d Tests/atoum", + "bench": "./vendor/bin/phpbench run Tests/benchmark/ --report=default" + }, + "scripts-descriptions": { + "test": "Run all tests!" } } diff --git a/vendor/ducks-project/spl-types/phpbench.json.dist b/vendor/ducks-project/spl-types/phpbench.json.dist new file mode 100644 index 00000000..364d4401 --- /dev/null +++ b/vendor/ducks-project/spl-types/phpbench.json.dist @@ -0,0 +1,6 @@ +{ + "$schema":"./vendor/phpbench/phpbench/phpbench.schema.json", + "runner.path": "Tests/benchmark", + "runner.bootstrap": "vendor/autoload.php", + "runner.php_disable_ini": true +} diff --git a/vendor/ducks-project/spl-types/phpcs.xml.dist b/vendor/ducks-project/spl-types/phpcs.xml.dist new file mode 100644 index 00000000..1d779961 --- /dev/null +++ b/vendor/ducks-project/spl-types/phpcs.xml.dist @@ -0,0 +1,5 @@ + + + Make this project use the PSR-12 coding standard. + + diff --git a/vendor/ducks-project/spl-types/phpstan.neon.dist b/vendor/ducks-project/spl-types/phpstan.neon.dist new file mode 100644 index 00000000..bc5cb39e --- /dev/null +++ b/vendor/ducks-project/spl-types/phpstan.neon.dist @@ -0,0 +1,5 @@ +parameters: + level: 6 + paths: + - src + - Tests diff --git a/vendor/ducks-project/spl-types/phpunit.xml.dist b/vendor/ducks-project/spl-types/phpunit.xml.dist index a6fdc682..40ae8bb1 100644 --- a/vendor/ducks-project/spl-types/phpunit.xml.dist +++ b/vendor/ducks-project/spl-types/phpunit.xml.dist @@ -1,33 +1,36 @@ - - - - + + + - - - + + + - - - ./Tests/ - - + + + ./Tests/ + + - - - ./ - - ./Resources - ./Tests - ./vendor - - - + + + ./ + + ./Resources + ./Tests + ./vendor + + + diff --git a/vendor/ducks-project/spl-types/psalm.xml.dist b/vendor/ducks-project/spl-types/psalm.xml.dist new file mode 100644 index 00000000..257a67ed --- /dev/null +++ b/vendor/ducks-project/spl-types/psalm.xml.dist @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 2e0b9694..3d45c9d9 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -48,6 +48,11 @@ * - mb_strstr - Finds first occurrence of a string within another * - mb_strwidth - Return width of string * - mb_substr_count - Count the number of substring occurrences + * - mb_ucfirst - Make a string's first character uppercase + * - mb_lcfirst - Make a string's first character lowercase + * - mb_trim - Strip whitespace (or other characters) from the beginning and end of a string + * - mb_ltrim - Strip whitespace (or other characters) from the beginning of a string + * - mb_rtrim - Strip whitespace (or other characters) from the end of a string * * Not implemented: * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) @@ -80,6 +85,15 @@ final class Mbstring public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) { + if (\is_array($s)) { + $r = []; + foreach ($s as $str) { + $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding); + } + + return $r; + } + if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) { $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); } else { @@ -410,12 +424,6 @@ public static function mb_encoding_aliases($encoding) public static function mb_check_encoding($var = null, $encoding = null) { - if (PHP_VERSION_ID < 70200 && \is_array($var)) { - trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING); - - return null; - } - if (null === $encoding) { if (null === $var) { return false; @@ -437,7 +445,6 @@ public static function mb_check_encoding($var = null, $encoding = null) } return true; - } public static function mb_detect_encoding($str, $encodingList = null, $strict = false) @@ -827,7 +834,7 @@ public static function mb_ord($s, $encoding = null) return $code; } - public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null): string + public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string { if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); @@ -835,17 +842,8 @@ public static function mb_str_pad(string $string, int $length, string $pad_strin if (null === $encoding) { $encoding = self::mb_internal_encoding(); - } - - try { - $validEncoding = @self::mb_check_encoding('', $encoding); - } catch (\ValueError $e) { - throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); - } - - // BC for PHP 7.3 and lower - if (!$validEncoding) { - throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } else { + self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given'); } if (self::mb_strlen($pad_string, $encoding) <= 0) { @@ -871,6 +869,34 @@ public static function mb_str_pad(string $string, int $length, string $pad_strin } } + public static function mb_ucfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + + public static function mb_lcfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + private static function getSubpart($pos, $part, $haystack, $encoding) { if (false === $pos) { @@ -944,4 +970,76 @@ private static function getEncoding($encoding) return $encoding; } + + public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{[%s]+$}D', $string, $characters, $encoding, __FUNCTION__); + } + + private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); + } + + if ('' === $characters) { + return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding); + } + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $string)) { + $string = @iconv('UTF-8', 'UTF-8//IGNORE', $string); + } + if (null !== $characters && !preg_match('//u', $characters)) { + $characters = @iconv('UTF-8', 'UTF-8//IGNORE', $characters); + } + } else { + $string = iconv($encoding, 'UTF-8//IGNORE', $string); + + if (null !== $characters) { + $characters = iconv($encoding, 'UTF-8//IGNORE', $characters); + } + } + + if (null === $characters) { + $characters = "\\0 \f\n\r\t\v\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}"; + } else { + $characters = preg_quote($characters); + } + + $string = preg_replace(sprintf($regex, $characters), '', $string); + + if (null === $encoding) { + return $string; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $string); + } + + private static function assertEncoding(string $encoding, string $errorFormat): void + { + try { + $validEncoding = @self::mb_check_encoding('', $encoding); + } catch (\ValueError $e) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + + // BC for PHP 7.3 and lower + if (!$validEncoding) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + } } diff --git a/vendor/symfony/polyfill-mbstring/bootstrap.php b/vendor/symfony/polyfill-mbstring/bootstrap.php index ecf1a035..ff51ae07 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -136,6 +136,27 @@ function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstrin function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } } +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + + if (extension_loaded('mbstring')) { return; } diff --git a/vendor/symfony/polyfill-mbstring/bootstrap80.php b/vendor/symfony/polyfill-mbstring/bootstrap80.php index 2f9fb5b4..5be7d201 100644 --- a/vendor/symfony/polyfill-mbstring/bootstrap80.php +++ b/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -93,7 +93,7 @@ function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?strin function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } } if (!function_exists('mb_get_info')) { - function mb_get_info(?string $type = 'all'): array|string|int|false { return p\Mbstring::mb_get_info((string) $type); } + function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); } } if (!function_exists('mb_http_output')) { function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } @@ -132,6 +132,26 @@ function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = nul function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } } +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst($string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + if (extension_loaded('mbstring')) { return; } diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 943e5029..4ed241a3 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -30,9 +30,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/vendor/symfony/polyfill-php80/composer.json b/vendor/symfony/polyfill-php80/composer.json index f1801f40..a503b039 100644 --- a/vendor/symfony/polyfill-php80/composer.json +++ b/vendor/symfony/polyfill-php80/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=7.1" + "php": ">=7.2" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php80\\": "" }, @@ -29,9 +29,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/vendor/symfony/process/CHANGELOG.md b/vendor/symfony/process/CHANGELOG.md index 69d4cbd7..31b9ee6a 100644 --- a/vendor/symfony/process/CHANGELOG.md +++ b/vendor/symfony/process/CHANGELOG.md @@ -1,6 +1,26 @@ CHANGELOG ========= +5.2.0 +----- + + * added `Process::setOptions()` to set `Process` specific options + * added option `create_new_console` to allow a subprocess to continue + to run after the main script exited, both on Linux and on Windows + +5.1.0 +----- + + * added `Process::getStartTime()` to retrieve the start time of the process as float + +5.0.0 +----- + + * removed `Process::inheritEnvironmentVariables()` + * removed `PhpProcess::setPhpBinary()` + * `Process` must be instantiated with a command array, use `Process::fromShellCommandline()` when the command should be parsed by the shell + * removed `Process::setCommandLine()` + 4.4.0 ----- diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php index e2dd064d..89edd22f 100644 --- a/vendor/symfony/process/ExecutableFinder.php +++ b/vendor/symfony/process/ExecutableFinder.php @@ -19,7 +19,15 @@ */ class ExecutableFinder { - private $suffixes = ['.exe', '.bat', '.cmd', '.com']; + private const CMD_BUILTINS = [ + 'assoc', 'break', 'call', 'cd', 'chdir', 'cls', 'color', 'copy', 'date', + 'del', 'dir', 'echo', 'endlocal', 'erase', 'exit', 'for', 'ftype', 'goto', + 'help', 'if', 'label', 'md', 'mkdir', 'mklink', 'move', 'path', 'pause', + 'popd', 'prompt', 'pushd', 'rd', 'rem', 'ren', 'rename', 'rmdir', 'set', + 'setlocal', 'shift', 'start', 'time', 'title', 'type', 'ver', 'vol', + ]; + + private $suffixes = []; /** * Replaces default suffixes of executable. @@ -31,10 +39,8 @@ public function setSuffixes(array $suffixes) /** * Adds new possible suffix to check for executable. - * - * @param string $suffix */ - public function addSuffix($suffix) + public function addSuffix(string $suffix) { $this->suffixes[] = $suffix; } @@ -46,43 +52,52 @@ public function addSuffix($suffix) * @param string|null $default The default to return if no executable is found * @param array $extraDirs Additional dirs to check into * - * @return string|null The executable path or default value + * @return string|null */ - public function find($name, $default = null, array $extraDirs = []) + public function find(string $name, ?string $default = null, array $extraDirs = []) { - if (\ini_get('open_basedir')) { - $searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs); - $dirs = []; - foreach ($searchPath as $path) { - // Silencing against https://bugs.php.net/69240 - if (@is_dir($path)) { - $dirs[] = $path; - } else { - if (basename($path) == $name && @is_executable($path)) { - return $path; - } - } - } - } else { - $dirs = array_merge( - explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), - $extraDirs - ); + // windows built-in commands that are present in cmd.exe should not be resolved using PATH as they do not exist as exes + if ('\\' === \DIRECTORY_SEPARATOR && \in_array(strtolower($name), self::CMD_BUILTINS, true)) { + return $name; } - $suffixes = ['']; + $dirs = array_merge( + explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), + $extraDirs + ); + + $suffixes = []; if ('\\' === \DIRECTORY_SEPARATOR) { $pathExt = getenv('PATHEXT'); - $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); + $suffixes = $this->suffixes; + $suffixes = array_merge($suffixes, $pathExt ? explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']); } + $suffixes = '' !== pathinfo($name, PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']); foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { + if ('' === $dir) { + $dir = '.'; + } if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) { return $file; } + + if (!@is_dir($dir) && basename($dir) === $name.$suffix && @is_executable($dir)) { + return $dir; + } } } + if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('exec') || \strlen($name) !== strcspn($name, '/'.\DIRECTORY_SEPARATOR)) { + return $default; + } + + $execResult = exec('command -v -- '.escapeshellarg($name)); + + if (($executablePath = substr($execResult, 0, strpos($execResult, \PHP_EOL) ?: null)) && @is_executable($executablePath)) { + return $executablePath; + } + return $default; } } diff --git a/vendor/symfony/process/InputStream.php b/vendor/symfony/process/InputStream.php index 4f8f7133..0c45b524 100644 --- a/vendor/symfony/process/InputStream.php +++ b/vendor/symfony/process/InputStream.php @@ -17,6 +17,8 @@ * Provides a way to continuously write to the input of a Process until the InputStream is closed. * * @author Nicolas Grekas + * + * @implements \IteratorAggregate */ class InputStream implements \IteratorAggregate { @@ -28,7 +30,7 @@ class InputStream implements \IteratorAggregate /** * Sets a callback that is called when the write buffer becomes empty. */ - public function onEmpty(callable $onEmpty = null) + public function onEmpty(?callable $onEmpty = null) { $this->onEmpty = $onEmpty; } @@ -67,7 +69,7 @@ public function isClosed() } /** - * @return \Traversable + * @return \Traversable */ #[\ReturnTypeWillChange] public function getIterator() diff --git a/vendor/symfony/process/LICENSE b/vendor/symfony/process/LICENSE index 88bf75bb..0138f8f0 100644 --- a/vendor/symfony/process/LICENSE +++ b/vendor/symfony/process/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php index 92e0262a..c3a9680d 100644 --- a/vendor/symfony/process/PhpExecutableFinder.php +++ b/vendor/symfony/process/PhpExecutableFinder.php @@ -29,22 +29,13 @@ public function __construct() /** * Finds The PHP executable. * - * @param bool $includeArgs Whether or not include command arguments - * - * @return string|false The PHP executable path or false if it cannot be found + * @return string|false */ - public function find($includeArgs = true) + public function find(bool $includeArgs = true) { if ($php = getenv('PHP_BINARY')) { - if (!is_executable($php)) { - $command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v'; - if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) { - if (!is_executable($php)) { - return false; - } - } else { - return false; - } + if (!is_executable($php) && !$php = $this->executableFinder->find($php)) { + return false; } if (@is_dir($php)) { @@ -58,7 +49,7 @@ public function find($includeArgs = true) $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; // PHP_BINARY return the current sapi executable - if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) { + if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) { return \PHP_BINARY.$args; } @@ -91,7 +82,7 @@ public function find($includeArgs = true) /** * Finds the PHP executable arguments. * - * @return array The PHP executable arguments + * @return array */ public function findArguments() { diff --git a/vendor/symfony/process/PhpProcess.php b/vendor/symfony/process/PhpProcess.php index dc064e0b..3a1d147c 100644 --- a/vendor/symfony/process/PhpProcess.php +++ b/vendor/symfony/process/PhpProcess.php @@ -32,7 +32,7 @@ class PhpProcess extends Process * @param int $timeout The timeout in seconds * @param array|null $php Path to the PHP binary to use with any additional arguments */ - public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null) + public function __construct(string $script, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null) { if (null === $php) { $executableFinder = new PhpExecutableFinder(); @@ -53,27 +53,15 @@ public function __construct(string $script, string $cwd = null, array $env = nul /** * {@inheritdoc} */ - public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) + public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60) { throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class)); } - /** - * Sets the path to the PHP binary to use. - * - * @deprecated since Symfony 4.2, use the $php argument of the constructor instead. - */ - public function setPhpBinary($php) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the $php argument of the constructor instead.', __METHOD__), \E_USER_DEPRECATED); - - $this->setCommandLine($php); - } - /** * {@inheritdoc} */ - public function start(callable $callback = null, array $env = []) + public function start(?callable $callback = null, array $env = []) { if (null === $this->getCommandLine()) { throw new RuntimeException('Unable to find the PHP executable.'); diff --git a/vendor/symfony/process/Pipes/AbstractPipes.php b/vendor/symfony/process/Pipes/AbstractPipes.php index 9532e3ef..656dc032 100644 --- a/vendor/symfony/process/Pipes/AbstractPipes.php +++ b/vendor/symfony/process/Pipes/AbstractPipes.php @@ -105,7 +105,7 @@ protected function write(): ?array } elseif (!isset($this->inputBuffer[0])) { if (!\is_string($input)) { if (!\is_scalar($input)) { - throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', \get_class($this->input), \gettype($input))); + throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input))); } $input = (string) $input; } diff --git a/vendor/symfony/process/Pipes/UnixPipes.php b/vendor/symfony/process/Pipes/UnixPipes.php index 58a8da07..5a0e9d47 100644 --- a/vendor/symfony/process/Pipes/UnixPipes.php +++ b/vendor/symfony/process/Pipes/UnixPipes.php @@ -35,10 +35,7 @@ public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveRea parent::__construct($input); } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/vendor/symfony/process/Pipes/WindowsPipes.php b/vendor/symfony/process/Pipes/WindowsPipes.php index 69768f3d..968dd026 100644 --- a/vendor/symfony/process/Pipes/WindowsPipes.php +++ b/vendor/symfony/process/Pipes/WindowsPipes.php @@ -88,10 +88,7 @@ public function __construct($input, bool $haveReadSupport) parent::__construct($input); } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } @@ -152,7 +149,7 @@ public function readAndWrite(bool $blocking, bool $close = false): array if ($w) { @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6); } elseif ($this->fileHandles) { - usleep(Process::TIMEOUT_PRECISION * 1E6); + usleep((int) (Process::TIMEOUT_PRECISION * 1E6)); } } foreach ($this->fileHandles as $type => $fileHandle) { diff --git a/vendor/symfony/process/Process.php b/vendor/symfony/process/Process.php index 09cd9602..91f9e8fe 100644 --- a/vendor/symfony/process/Process.php +++ b/vendor/symfony/process/Process.php @@ -27,6 +27,8 @@ * * @author Fabien Potencier * @author Romain Neutron + * + * @implements \IteratorAggregate */ class Process implements \IteratorAggregate { @@ -71,12 +73,14 @@ class Process implements \IteratorAggregate private $incrementalErrorOutputOffset = 0; private $tty = false; private $pty; + private $options = ['suppress_errors' => true, 'bypass_shell' => true]; private $useFileHandles = false; /** @var PipesInterface */ private $processPipes; private $latestSignal; + private $cachedExitCode; private static $sigchild; @@ -137,16 +141,12 @@ class Process implements \IteratorAggregate * * @throws LogicException When proc_open is not installed */ - public function __construct($command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) + public function __construct(array $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60) { if (!\function_exists('proc_open')) { throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.'); } - if (!\is_array($command)) { - @trigger_error(sprintf('Passing a command as string when creating a "%s" instance is deprecated since Symfony 4.2, pass it as an array of its arguments instead, or use the "Process::fromShellCommandline()" constructor if you need features provided by the shell.', __CLASS__), \E_USER_DEPRECATED); - } - $this->commandline = $command; $this->cwd = $cwd; @@ -190,7 +190,7 @@ public function __construct($command, string $cwd = null, array $env = null, $in * * @throws LogicException When proc_open is not installed */ - public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) + public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, $input = null, ?float $timeout = 60) { $process = new static([], $cwd, $env, $input, $timeout); $process->commandline = $command; @@ -213,7 +213,11 @@ public function __wakeup() public function __destruct() { - $this->stop(0); + if ($this->options['create_new_console'] ?? false) { + $this->processPipes->close(); + } else { + $this->stop(0); + } } public function __clone() @@ -244,7 +248,7 @@ public function __clone() * * @final */ - public function run(callable $callback = null, array $env = []): int + public function run(?callable $callback = null, array $env = []): int { $this->start($callback, $env); @@ -263,7 +267,7 @@ public function run(callable $callback = null, array $env = []): int * * @final */ - public function mustRun(callable $callback = null, array $env = []): self + public function mustRun(?callable $callback = null, array $env = []): self { if (0 !== $this->run($callback, $env)) { throw new ProcessFailedException($this); @@ -291,7 +295,7 @@ public function mustRun(callable $callback = null, array $env = []): self * @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 = []) { if ($this->isRunning()) { throw new RuntimeException('Process is already running.'); @@ -320,10 +324,7 @@ public function start(callable $callback = null, array $env = []) $commandline = $this->replacePlaceholders($commandline, $env); } - $options = ['suppress_errors' => true]; - if ('\\' === \DIRECTORY_SEPARATOR) { - $options['bypass_shell'] = true; $commandline = $this->prepareWindowsCommandLine($commandline, $env); } elseif (!$this->useFileHandles && $this->isSigchildEnabled()) { // last exit code is output on the fourth pipe and caught to work around --enable-sigchild @@ -331,7 +332,7 @@ public function start(callable $callback = null, array $env = []) // See https://unix.stackexchange.com/questions/71205/background-process-pipe-input $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;'; - $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code'; + $commandline .= 'pid=$!; echo $pid >&3; wait $pid 2>/dev/null; code=$?; echo $code >&3; exit $code'; // Workaround for the bug, when PTS functionality is enabled. // @see : https://bugs.php.net/69442 @@ -349,9 +350,9 @@ public function start(callable $callback = null, array $env = []) throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd)); } - $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $options); + $this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); - if (!\is_resource($this->process)) { + if (!$this->process) { throw new RuntimeException('Unable to launch a new process.'); } $this->status = self::STATUS_STARTED; @@ -385,7 +386,7 @@ public function start(callable $callback = null, array $env = []) * * @final */ - public function restart(callable $callback = null, array $env = []): self + public function restart(?callable $callback = null, array $env = []): self { if ($this->isRunning()) { throw new RuntimeException('Process is already running.'); @@ -412,7 +413,7 @@ public function restart(callable $callback = null, array $env = []): self * @throws ProcessSignaledException When process stopped after receiving signal * @throws LogicException When process is not yet started */ - public function wait(callable $callback = null) + public function wait(?callable $callback = null) { $this->requireProcessIsStarted(__FUNCTION__); @@ -428,7 +429,7 @@ public function wait(callable $callback = null) do { $this->checkTimeout(); - $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen(); + $running = $this->isRunning() && ('\\' === \DIRECTORY_SEPARATOR || $this->processPipes->areOpen()); $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running); } while ($running); @@ -511,7 +512,7 @@ public function getPid() * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed * @throws RuntimeException In case of failure */ - public function signal($signal) + public function signal(int $signal) { $this->doSignal($signal, true); @@ -532,7 +533,7 @@ public function disableOutput() throw new RuntimeException('Disabling output while the process is running is not possible.'); } if (null !== $this->idleTimeout) { - throw new LogicException('Output can not be disabled while an idle timeout is set.'); + throw new LogicException('Output cannot be disabled while an idle timeout is set.'); } $this->outputDisabled = true; @@ -571,7 +572,7 @@ public function isOutputDisabled() /** * Returns the current output of the process (STDOUT). * - * @return string The process output + * @return string * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started @@ -593,7 +594,7 @@ public function getOutput() * In comparison with the getOutput method which always return the whole * output, this one returns the new output since the last call. * - * @return string The process output since the last call + * @return string * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started @@ -617,13 +618,13 @@ public function getIncrementalOutput() * * @param int $flags A bit field of Process::ITER_* flags * + * @return \Generator + * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return \Generator */ #[\ReturnTypeWillChange] - public function getIterator($flags = 0) + public function getIterator(int $flags = 0) { $this->readPipesForOutput(__FUNCTION__, false); @@ -687,7 +688,7 @@ public function clearOutput() /** * Returns the current error output of the process (STDERR). * - * @return string The process error output + * @return string * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started @@ -710,7 +711,7 @@ public function getErrorOutput() * whole error output, this one returns the new error output since the last * call. * - * @return string The process error output since the last call + * @return string * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started @@ -778,7 +779,7 @@ public function getExitCodeText() /** * Checks if the process ended successfully. * - * @return bool true if the process ended successfully, false otherwise + * @return bool */ public function isSuccessful() { @@ -816,7 +817,7 @@ public function getTermSignal() $this->requireProcessIsTerminated(__FUNCTION__); if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) { - throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); + throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.'); } return $this->processInformation['termsig']; @@ -857,7 +858,7 @@ public function getStopSignal() /** * Checks if the process is currently running. * - * @return bool true if the process is currently running, false otherwise + * @return bool */ public function isRunning() { @@ -873,7 +874,7 @@ public function isRunning() /** * Checks if the process has been started with no regard to the current state. * - * @return bool true if status is ready, false otherwise + * @return bool */ public function isStarted() { @@ -883,7 +884,7 @@ public function isStarted() /** * Checks if the process is terminated. * - * @return bool true if process is terminated, false otherwise + * @return bool */ public function isTerminated() { @@ -897,7 +898,7 @@ public function isTerminated() * * The status is one of: ready, started, terminated. * - * @return string The current process status + * @return string */ public function getStatus() { @@ -910,11 +911,11 @@ public function getStatus() * Stops the process. * * @param int|float $timeout The timeout in seconds - * @param int $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) + * @param int|null $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) * * @return int|null The exit-code of the process or null if it's not running */ - public function stop($timeout = 10, $signal = null) + public function stop(float $timeout = 10, ?int $signal = null) { $timeoutMicro = microtime(true) + $timeout; if ($this->isRunning()) { @@ -982,7 +983,7 @@ public function getLastOutputTime(): ?float /** * Gets the command line to be executed. * - * @return string The command to execute + * @return string */ public function getCommandLine() { @@ -990,27 +991,9 @@ public function getCommandLine() } /** - * Sets the command line to be executed. - * - * @param string|array $commandline The command to execute - * - * @return $this - * - * @deprecated since Symfony 4.2. - */ - public function setCommandLine($commandline) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED); - - $this->commandline = $commandline; - - return $this; - } - - /** - * Gets the process timeout (max. runtime). + * Gets the process timeout in seconds (max. runtime). * - * @return float|null The timeout in seconds or null if it's disabled + * @return float|null */ public function getTimeout() { @@ -1018,9 +1001,9 @@ public function getTimeout() } /** - * Gets the process idle timeout (max. time since last output). + * Gets the process idle timeout in seconds (max. time since last output). * - * @return float|null The timeout in seconds or null if it's disabled + * @return float|null */ public function getIdleTimeout() { @@ -1032,13 +1015,11 @@ public function getIdleTimeout() * * To disable the timeout, set this value to null. * - * @param int|float|null $timeout The timeout in seconds - * * @return $this * * @throws InvalidArgumentException if the timeout is negative */ - public function setTimeout($timeout) + public function setTimeout(?float $timeout) { $this->timeout = $this->validateTimeout($timeout); @@ -1046,21 +1027,19 @@ public function setTimeout($timeout) } /** - * Sets the process idle timeout (max. time since last output). + * Sets the process idle timeout (max. time since last output) in seconds. * * To disable the timeout, set this value to null. * - * @param int|float|null $timeout The timeout in seconds - * * @return $this * * @throws LogicException if the output is disabled * @throws InvalidArgumentException if the timeout is negative */ - public function setIdleTimeout($timeout) + public function setIdleTimeout(?float $timeout) { if (null !== $timeout && $this->outputDisabled) { - throw new LogicException('Idle timeout can not be set while the output is disabled.'); + throw new LogicException('Idle timeout cannot be set while the output is disabled.'); } $this->idleTimeout = $this->validateTimeout($timeout); @@ -1071,13 +1050,11 @@ public function setIdleTimeout($timeout) /** * Enables or disables the TTY mode. * - * @param bool $tty True to enabled and false to disable - * * @return $this * * @throws RuntimeException In case the TTY mode is not supported */ - public function setTty($tty) + public function setTty(bool $tty) { if ('\\' === \DIRECTORY_SEPARATOR && $tty) { throw new RuntimeException('TTY mode is not supported on Windows platform.'); @@ -1087,7 +1064,7 @@ public function setTty($tty) throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.'); } - $this->tty = (bool) $tty; + $this->tty = $tty; return $this; } @@ -1095,7 +1072,7 @@ public function setTty($tty) /** * Checks if the TTY mode is enabled. * - * @return bool true if the TTY mode is enabled, false otherwise + * @return bool */ public function isTty() { @@ -1105,13 +1082,11 @@ public function isTty() /** * Sets PTY mode. * - * @param bool $bool - * * @return $this */ - public function setPty($bool) + public function setPty(bool $bool) { - $this->pty = (bool) $bool; + $this->pty = $bool; return $this; } @@ -1129,7 +1104,7 @@ public function isPty() /** * Gets the working directory. * - * @return string|null The current working directory or null on failure + * @return string|null */ public function getWorkingDirectory() { @@ -1145,11 +1120,9 @@ public function getWorkingDirectory() /** * Sets the current working directory. * - * @param string $cwd The new working directory - * * @return $this */ - public function setWorkingDirectory($cwd) + public function setWorkingDirectory(string $cwd) { $this->cwd = $cwd; @@ -1159,7 +1132,7 @@ public function setWorkingDirectory($cwd) /** * Gets the environment variables. * - * @return array The current environment variables + * @return array */ public function getEnv() { @@ -1183,7 +1156,7 @@ public function setEnv(array $env) /** * Gets the Process input. * - * @return resource|string|\Iterator|null The Process input + * @return resource|string|\Iterator|null */ public function getInput() { @@ -1204,7 +1177,7 @@ public function getInput() public function setInput($input) { if ($this->isRunning()) { - throw new LogicException('Input can not be set while the process is running.'); + throw new LogicException('Input cannot be set while the process is running.'); } $this->input = ProcessUtils::validateInput(__METHOD__, $input); @@ -1212,26 +1185,6 @@ public function setInput($input) return $this; } - /** - * Sets whether environment variables will be inherited or not. - * - * @param bool $inheritEnv - * - * @return $this - * - * @deprecated since Symfony 4.4, env variables are always inherited - */ - public function inheritEnvironmentVariables($inheritEnv = true) - { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, env variables are always inherited.', __METHOD__), \E_USER_DEPRECATED); - - if (!$inheritEnv) { - throw new InvalidArgumentException('Not inheriting environment variables is not supported.'); - } - - return $this; - } - /** * Performs a check between the timeout definition and the time the process started. * @@ -1259,6 +1212,44 @@ public function checkTimeout() } } + /** + * @throws LogicException in case process is not started + */ + public function getStartTime(): float + { + if (!$this->isStarted()) { + throw new LogicException('Start time is only available after process start.'); + } + + return $this->starttime; + } + + /** + * Defines options to pass to the underlying proc_open(). + * + * @see https://php.net/proc_open for the options supported by PHP. + * + * Enabling the "create_new_console" option allows a subprocess to continue + * to run after the main process exited, on both Windows and *nix + */ + public function setOptions(array $options) + { + if ($this->isRunning()) { + throw new RuntimeException('Setting options while the process is running is not possible.'); + } + + $defaultOptions = $this->options; + $existingOptions = ['blocking_pipes', 'create_process_group', 'create_new_console']; + + foreach ($options as $key => $value) { + if (!\in_array($key, $existingOptions)) { + $this->options = $defaultOptions; + throw new LogicException(sprintf('Invalid option "%s" passed to "%s()". Supported options are "%s".', $key, __METHOD__, implode('", "', $existingOptions))); + } + $this->options[$key] = $value; + } + } + /** * Returns whether TTY is supported on the current operating system. */ @@ -1318,9 +1309,9 @@ private function getDescriptors(): array * * @param callable|null $callback The user defined PHP callback * - * @return \Closure A PHP closure + * @return \Closure */ - protected function buildCallback(callable $callback = null) + protected function buildCallback(?callable $callback = null) { if ($this->outputDisabled) { return function ($type, $data) use ($callback): bool { @@ -1346,7 +1337,7 @@ protected function buildCallback(callable $callback = null) * * @param bool $blocking Whether to use a blocking read call */ - protected function updateStatus($blocking) + protected function updateStatus(bool $blocking) { if (self::STATUS_STARTED !== $this->status) { return; @@ -1355,6 +1346,19 @@ protected function updateStatus($blocking) $this->processInformation = proc_get_status($this->process); $running = $this->processInformation['running']; + // In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call. + // Subsequent calls return -1 as the process is discarded. This workaround caches the first + // retrieved exit status for consistent results in later calls, mimicking PHP 8.3 behavior. + if (\PHP_VERSION_ID < 80300) { + if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) { + $this->cachedExitCode = $this->processInformation['exitcode']; + } + + if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) { + $this->processInformation['exitcode'] = $this->cachedExitCode; + } + } + $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running); if ($this->fallbackStatus && $this->isSigchildEnabled()) { @@ -1452,8 +1456,9 @@ private function readPipes(bool $blocking, bool $close) private function close(): int { $this->processPipes->close(); - if (\is_resource($this->process)) { + if ($this->process) { proc_close($this->process); + $this->process = null; } $this->exitcode = $this->processInformation['exitcode']; $this->status = self::STATUS_TERMINATED; @@ -1509,7 +1514,7 @@ private function doSignal(int $signal, bool $throwException): bool { if (null === $pid = $this->getPid()) { if ($throwException) { - throw new LogicException('Can not send signal on a non running process.'); + throw new LogicException('Cannot send signal on a non running process.'); } return false; @@ -1587,7 +1592,14 @@ function ($m) use (&$env, &$varCache, &$varCount, $uid) { $cmd ); - $cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; + static $comSpec; + + if (!$comSpec && $comSpec = (new ExecutableFinder())->find('cmd.exe')) { + // Escape according to CommandLineToArgvW rules + $comSpec = '"'.preg_replace('{(\\\\*+)"}', '$1$1\"', $comSpec) .'"'; + } + + $cmd = ($comSpec ?? 'cmd').' /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')'; foreach ($this->processPipes->getFiles() as $offset => $filename) { $cmd .= ' '.$offset.'>"'.$filename.'"'; } @@ -1633,7 +1645,7 @@ private function escapeArgument(?string $argument): string if (str_contains($argument, "\0")) { $argument = str_replace("\0", '?', $argument); } - if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) { + if (!preg_match('/[()%!^"<>&|\s]/', $argument)) { return $argument; } $argument = preg_replace('/(\\\\+)$/', '$1$1', $argument); diff --git a/vendor/symfony/process/ProcessUtils.php b/vendor/symfony/process/ProcessUtils.php index 121693ba..2a7aff71 100644 --- a/vendor/symfony/process/ProcessUtils.php +++ b/vendor/symfony/process/ProcessUtils.php @@ -35,11 +35,11 @@ private function __construct() * @param string $caller The name of method call that validates the input * @param mixed $input The input to validate * - * @return mixed The validated input + * @return mixed * * @throws InvalidArgumentException In case the input is not valid */ - public static function validateInput($caller, $input) + public static function validateInput(string $caller, $input) { if (null !== $input) { if (\is_resource($input)) { diff --git a/vendor/symfony/process/README.md b/vendor/symfony/process/README.md index afce5e45..8777de4a 100644 --- a/vendor/symfony/process/README.md +++ b/vendor/symfony/process/README.md @@ -3,6 +3,17 @@ Process Component The Process component executes commands in sub-processes. +Sponsor +------- + +The Process component for Symfony 5.4/6.0 is [backed][1] by [SensioLabs][2]. + +As the creator of Symfony, SensioLabs supports companies using Symfony, with an +offering encompassing consultancy, expertise, services, training, and technical +assistance to ensure the success of web application development projects. + +Help Symfony by [sponsoring][3] its development! + Resources --------- @@ -11,3 +22,7 @@ Resources * [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) + +[1]: https://symfony.com/backers +[2]: https://sensiolabs.com +[3]: https://symfony.com/sponsor diff --git a/vendor/symfony/process/composer.json b/vendor/symfony/process/composer.json index c0f7599f..1669eba5 100644 --- a/vendor/symfony/process/composer.json +++ b/vendor/symfony/process/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-php80": "^1.16" }, "autoload": {