From 108a3efe0b6d37a7ed394a84c69b924ca727f17a Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 11 Oct 2022 18:34:03 +0000 Subject: update composer libs --- .../uuid/src/Provider/Node/SystemNodeProvider.php | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php') diff --git a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php index d512f22aa..d0a1e697f 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php @@ -27,8 +27,8 @@ use function ob_start; use function preg_match; use function preg_match_all; use function reset; +use function str_contains; use function str_replace; -use function strpos; use function strtolower; use function strtoupper; use function substr; @@ -100,12 +100,18 @@ class SystemNodeProvider implements NodeProviderInterface { $disabledFunctions = strtolower((string) ini_get('disable_functions')); - if (strpos($disabledFunctions, 'passthru') !== false) { + if (str_contains($disabledFunctions, 'passthru')) { return ''; } + /** + * @psalm-suppress UnnecessaryVarAnnotation + * @var string $phpOs + */ + $phpOs = constant('PHP_OS'); + ob_start(); - switch (strtoupper(substr(constant('PHP_OS'), 0, 3))) { + switch (strtoupper(substr($phpOs, 0, 3))) { case 'WIN': passthru('ipconfig /all 2>&1'); @@ -142,13 +148,20 @@ class SystemNodeProvider implements NodeProviderInterface { $mac = ''; - if (strtoupper(constant('PHP_OS')) === 'LINUX') { + /** + * @psalm-suppress UnnecessaryVarAnnotation + * @var string $phpOs + */ + $phpOs = constant('PHP_OS'); + + if (strtoupper($phpOs) === 'LINUX') { $addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT); if ($addressPaths === false || count($addressPaths) === 0) { return ''; } + /** @var array $macs */ $macs = []; array_walk($addressPaths, function (string $addressPath) use (&$macs): void { @@ -157,7 +170,10 @@ class SystemNodeProvider implements NodeProviderInterface } }); - $macs = array_map('trim', $macs); + /** @var callable $trim */ + $trim = 'trim'; + + $macs = array_map($trim, $macs); // Remove invalid entries. $macs = array_filter($macs, function (string $address) { @@ -165,6 +181,7 @@ class SystemNodeProvider implements NodeProviderInterface && preg_match(self::SYSFS_PATTERN, $address); }); + /** @var string|bool $mac */ $mac = reset($macs); } -- cgit v1.2.3