From e594eda1feb22a67e3d4de4a84291ad03dd98f88 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Wed, 24 Jul 2024 14:31:02 -0700 Subject: [PATCH 01/12] Fix #8: Add public API --- src/SelfUpdateCommand.php | 125 ++------------------------------- src/SelfUpdateManager.php | 142 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 121 deletions(-) create mode 100644 src/SelfUpdateManager.php diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index ee41dba..8ba2cae 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -3,15 +3,12 @@ namespace SelfUpdate; use Composer\Semver\VersionParser; -use Composer\Semver\Semver; -use Composer\Semver\Comparator; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem as sfFilesystem; -use Symfony\Component\HttpClient\HttpClient; use UnexpectedValueException; /** @@ -73,104 +70,6 @@ protected function configure(): void ); } - /** - * Get all releases from GitHub. - * - * @return array - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface - * - * @throws \Exception - */ - protected function getReleasesFromGithub(): array - { - $version_parser = new VersionParser(); - - $opts = [ - 'headers' => [ - 'User-Agent' => $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)', - ], - ]; - $client = HttpClient::create($opts); - $response = $client->request( - 'GET', - 'https://api.github.com/repos/' . $this->gitHubRepository . '/releases' - ); - - $releases = json_decode($response->getContent(), FALSE, 512, JSON_THROW_ON_ERROR); - - if (!isset($releases[0])) { - throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository); - } - $parsed_releases = []; - foreach ($releases as $release) { - try { - $normalized = $version_parser->normalize($release->tag_name); - } catch (UnexpectedValueException) { - // If this version does not look quite right, let's ignore it. - continue; - } - - $parsed_releases[$normalized] = [ - 'tag_name' => $release->tag_name, - 'assets' => $release->assets, - 'prerelease' => $release->prerelease, - ]; - } - $sorted_versions = Semver::rsort(array_keys($parsed_releases)); - $sorted_releases = []; - foreach ($sorted_versions as $version) { - $sorted_releases[$version] = $parsed_releases[$version]; - } - return $sorted_releases; - } - - /** - * Get the latest release version and download URL according to given - * constraints. - * - * @return string[]|null - * "version" and "download_url" elements if the latest release is - * available, otherwise - NULL. - */ - public function getLatestReleaseFromGithub(array $options): ?array - { - $options = array_merge([ - 'preview' => false, - 'compatible' => false, - 'version_constraint' => null, - ], $options); - - foreach ($this->getReleasesFromGithub() as $releaseVersion => $release) { - // We do not care about this release if it does not contain assets. - if (!isset($release['assets'][0]) || !is_object($release['assets'][0])) { - continue; - } - - if ($options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { - // If it does not satisfy, look for the next one. - continue; - } - - if (!$options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { - // If preview not requested and current version is not stable, look for the next one. - continue; - } - - if (null !== $options['version_constraint'] && !Semver::satisfies($releaseVersion, $options['version_constraint'])) { - // Release version does not match version constraint option. - continue; - } - - return [ - 'version' => $releaseVersion, - 'tag_name' => $release['tag_name'], - 'download_url' => $release['assets'][0]->browser_download_url, - ]; - } - - return null; - } - /** * {@inheritdoc} * @@ -206,19 +105,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' support either stable or preview, not both.'); } - $isCompatibleOptionSet = $input->getOption('compatible'); - $versionConstraintArg = $input->getArgument('version_constraint'); + $selfUpdateManager = new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $isPreviewOptionSet, $input->getOption('compatible'), $input->getArgument('version_constraint')); - $latestRelease = $this->getLatestReleaseFromGithub([ - 'preview' => $isPreviewOptionSet, - 'compatible' => $isCompatibleOptionSet, - 'version_constraint' => $versionConstraintArg, - ]); - if (null === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version'])) { + if ($selfUpdateManager->isUpToDate()) { $output->writeln('No update available'); return Command::SUCCESS; } + $latestRelease = $selfUpdateManager->getLatestReleaseFromGithub(); + $fs = new sfFilesystem(); $output->writeln('Downloading ' . $this->applicationName . ' (' . $this->gitHubRepository . ') ' . $latestRelease['tag_name']); @@ -253,18 +148,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - /** - * Returns TRUE if the release version satisfies current major version constraint. - */ - protected function satisfiesMajorVersionConstraint(string $releaseVersion): bool - { - if (preg_match('/^v?(\d+)/', $this->currentVersion, $matches)) { - return Semver::satisfies($releaseVersion , '^' . $matches[1]); - } - - return false; - } - /** * Stop execution * diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php new file mode 100644 index 0000000..fd480cd --- /dev/null +++ b/src/SelfUpdateManager.php @@ -0,0 +1,142 @@ + + */ +class SelfUpdateManager +{ + private ?array $latestRelease = null; + + public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, protected bool $isPreviewOptionSet, protected bool $isCompatibleOptionSet, protected string $versionConstraintArg){} + + public function isUpToDate(): bool { + $latestRelease = $this->getLatestReleaseFromGithub(); + return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version']); + } + + /** + * Get the latest release version and download URL according to given + * constraints. + * + * @return string[]|null + * "version" and "download_url" elements if the latest release is + * available, otherwise - NULL. + */ + public function getLatestReleaseFromGithub(): ?array + { + if (null !== $this->latestRelease) { + return $this->latestRelease; + } + + $options = [ + 'preview' => $this->isPreviewOptionSet, + 'compatible' => $this->isCompatibleOptionSet, + 'version_constraint' => $this->versionConstraintArg, + ]; + + foreach ($this->getReleasesFromGithub() as $releaseVersion => $release) { + // We do not care about this release if it does not contain assets. + if (!isset($release['assets'][0]) || !is_object($release['assets'][0])) { + continue; + } + + if ($options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { + // If it does not satisfy, look for the next one. + continue; + } + + if (!$options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { + // If preview not requested and current version is not stable, look for the next one. + continue; + } + + if (null !== $options['version_constraint'] && !Semver::satisfies($releaseVersion, $options['version_constraint'])) { + // Release version does not match version constraint option. + continue; + } + + $this->latestRelease = [ + 'version' => $releaseVersion, + 'tag_name' => $release['tag_name'], + 'download_url' => $release['assets'][0]->browser_download_url, + ]; + return $this->latestRelease; + } + + return null; + } + + /** + * Get all releases from GitHub. + * + * @return array + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * + * @throws \Exception + */ + private function getReleasesFromGithub(): array + { + $version_parser = new VersionParser(); + + $opts = [ + 'headers' => [ + 'User-Agent' => $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)', + ], + ]; + $client = HttpClient::create($opts); + $response = $client->request( + 'GET', + 'https://api.github.com/repos/' . $this->gitHubRepository . '/releases' + ); + + $releases = json_decode($response->getContent(), FALSE, 512, JSON_THROW_ON_ERROR); + + if (!isset($releases[0])) { + throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository); + } + $parsed_releases = []; + foreach ($releases as $release) { + try { + $normalized = $version_parser->normalize($release->tag_name); + } catch (UnexpectedValueException) { + // If this version does not look quite right, let's ignore it. + continue; + } + + $parsed_releases[$normalized] = [ + 'tag_name' => $release->tag_name, + 'assets' => $release->assets, + 'prerelease' => $release->prerelease, + ]; + } + $sorted_versions = Semver::rsort(array_keys($parsed_releases)); + $sorted_releases = []; + foreach ($sorted_versions as $version) { + $sorted_releases[$version] = $parsed_releases[$version]; + } + return $sorted_releases; + } + + /** + * Returns TRUE if the release version satisfies current major version constraint. + */ + private function satisfiesMajorVersionConstraint(string $releaseVersion): bool + { + if (preg_match('/^v?(\d+)/', $this->currentVersion, $matches)) { + return Semver::satisfies($releaseVersion , '^' . $matches[1]); + } + + return false; + } + +} From c8dbe4358b21b4fc612d4014a2c780262d260567 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 26 Jul 2024 10:26:08 -0700 Subject: [PATCH 02/12] getSelfUpdateManager() --- src/SelfUpdateCommand.php | 17 ++++++++++------- src/SelfUpdateManager.php | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index 8ba2cae..c67d678 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -99,13 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - $isPreviewOptionSet = $input->getOption('preview'); - $isStable = $input->getOption('stable') || !$isPreviewOptionSet; - if ($isPreviewOptionSet && $isStable) { - throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' support either stable or preview, not both.'); - } - - $selfUpdateManager = new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $isPreviewOptionSet, $input->getOption('compatible'), $input->getArgument('version_constraint')); + $selfUpdateManager = $this->getSelfUpdateManager($input); if ($selfUpdateManager->isUpToDate()) { $output->writeln('No update available'); @@ -148,6 +142,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } + public function getSelfUpdateManager(InputInterface $input): SelfUpdateManager { + $isPreviewOptionSet = $input->getOption('preview'); + $isStable = $input->getOption('stable') || !$isPreviewOptionSet; + if ($isPreviewOptionSet && $isStable) { + throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' support either stable or preview, not both.'); + } + return new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $isPreviewOptionSet, $input->getOption('compatible'), $input->getArgument('version_constraint')); + } + /** * Stop execution * diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index fd480cd..3637c86 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -31,6 +31,7 @@ public function isUpToDate(): bool { * @return string[]|null * "version" and "download_url" elements if the latest release is * available, otherwise - NULL. + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface */ public function getLatestReleaseFromGithub(): ?array { @@ -102,7 +103,7 @@ private function getReleasesFromGithub(): array $releases = json_decode($response->getContent(), FALSE, 512, JSON_THROW_ON_ERROR); if (!isset($releases[0])) { - throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository); + throw new \RuntimeException('API error - no release found at GitHub repository ' . $this->gitHubRepository); } $parsed_releases = []; foreach ($releases as $release) { From 26d3119428454fb0f58e39614e324910acdf4ef3 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 26 Jul 2024 10:39:07 -0700 Subject: [PATCH 03/12] typeerror --- src/SelfUpdateManager.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 3637c86..a1026ad 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -17,8 +17,11 @@ class SelfUpdateManager { private ?array $latestRelease = null; - public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, protected bool $isPreviewOptionSet, protected bool $isCompatibleOptionSet, protected string $versionConstraintArg){} + public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, protected bool $isPreviewOptionSet, protected bool $isCompatibleOptionSet, protected ?string $versionConstraintArg){} + /** + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + */ public function isUpToDate(): bool { $latestRelease = $this->getLatestReleaseFromGithub(); return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version']); @@ -39,29 +42,23 @@ public function getLatestReleaseFromGithub(): ?array return $this->latestRelease; } - $options = [ - 'preview' => $this->isPreviewOptionSet, - 'compatible' => $this->isCompatibleOptionSet, - 'version_constraint' => $this->versionConstraintArg, - ]; - foreach ($this->getReleasesFromGithub() as $releaseVersion => $release) { // We do not care about this release if it does not contain assets. if (!isset($release['assets'][0]) || !is_object($release['assets'][0])) { continue; } - if ($options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { + if ($this->isCompatibleOptionSet && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { // If it does not satisfy, look for the next one. continue; } - if (!$options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { + if (!$this->isPreviewOptionSet && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { // If preview not requested and current version is not stable, look for the next one. continue; } - if (null !== $options['version_constraint'] && !Semver::satisfies($releaseVersion, $options['version_constraint'])) { + if (null !== $this->versionConstraintArg && !Semver::satisfies($releaseVersion, $this->versionConstraintArg)) { // Release version does not match version constraint option. continue; } From 38e3163f14143c8b61aaeac437e3a29bc40c0988 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 26 Jul 2024 11:16:09 -0700 Subject: [PATCH 04/12] refactor --- src/SelfUpdateCommand.php | 25 +++++++++++++++++-------- src/SelfUpdateManager.php | 16 ++++++++++++---- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index c67d678..3968793 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -74,6 +74,7 @@ protected function configure(): void * {@inheritdoc} * * @throws \Exception + * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface */ protected function execute(InputInterface $input, OutputInterface $output): int { @@ -99,7 +100,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } - $selfUpdateManager = $this->getSelfUpdateManager($input); + $isPreviewOptionSet = $input->getOption('preview'); + $isStable = $input->getOption('stable') || !$isPreviewOptionSet; + if ($isPreviewOptionSet && $isStable) { + throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' support either stable or preview, not both.'); + } + + $isCompatibleOptionSet = $input->getOption('compatible'); + $versionConstraintArg = $input->getArgument('version_constraint'); + + $selfUpdateManager = $this->getSelfUpdateManager([ + 'preview' => $isPreviewOptionSet, + 'compatible' => $isCompatibleOptionSet, + 'version_constraint' => $versionConstraintArg, + ]); if ($selfUpdateManager->isUpToDate()) { $output->writeln('No update available'); @@ -142,13 +156,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - public function getSelfUpdateManager(InputInterface $input): SelfUpdateManager { - $isPreviewOptionSet = $input->getOption('preview'); - $isStable = $input->getOption('stable') || !$isPreviewOptionSet; - if ($isPreviewOptionSet && $isStable) { - throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' support either stable or preview, not both.'); - } - return new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $isPreviewOptionSet, $input->getOption('compatible'), $input->getArgument('version_constraint')); + public function getSelfUpdateManager(array $options): SelfUpdateManager { + return new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $options); } /** diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index a1026ad..d98f56a 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -15,9 +15,17 @@ */ class SelfUpdateManager { + protected array $options; private ?array $latestRelease = null; - public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, protected bool $isPreviewOptionSet, protected bool $isCompatibleOptionSet, protected ?string $versionConstraintArg){} + public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, array $options){ + // Options need to be passed in the constructor since we cache the latestRelease which may vary based on options. + $this->options = array_merge([ + 'preview' => false, + 'compatible' => false, + 'version_constraint' => null, + ], $options); + } /** * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface @@ -48,17 +56,17 @@ public function getLatestReleaseFromGithub(): ?array continue; } - if ($this->isCompatibleOptionSet && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { + if ($this->options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { // If it does not satisfy, look for the next one. continue; } - if (!$this->isPreviewOptionSet && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { + if (!$this->options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { // If preview not requested and current version is not stable, look for the next one. continue; } - if (null !== $this->versionConstraintArg && !Semver::satisfies($releaseVersion, $this->versionConstraintArg)) { + if (null !== $this->options['version_constraint'] && !Semver::satisfies($releaseVersion, $this->options['version_constraint'])) { // Release version does not match version constraint option. continue; } From 4f5d3d1ea3b6956bd18f5ffaf4191d3e17c9de93 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 2 Aug 2024 11:15:56 -0700 Subject: [PATCH 05/12] use cache --- composer.json | 6 +- composer.lock | 1040 +++++++++++++++++++++++++++++++------ src/SelfUpdateCommand.php | 2 +- src/SelfUpdateManager.php | 29 +- 4 files changed, 917 insertions(+), 160 deletions(-) diff --git a/composer.json b/composer.json index 248814e..b61d1c1 100644 --- a/composer.json +++ b/composer.json @@ -20,9 +20,11 @@ "require": { "php": "^8.1", "composer/semver": "^3.2", + "guzzlehttp/guzzle": "^7.9", + "kevinrob/guzzle-cache-middleware": "^5.1", + "symfony/cache": "^7.1", "symfony/console": "^5.4 || ^6.4 || ^7", - "symfony/filesystem": "^5.4 || ^6.4 || ^7", - "symfony/http-client": "^5.4 || ^6.4 || ^7" + "symfony/filesystem": "^7.1" }, "bin": [ "scripts/release" diff --git a/composer.lock b/composer.lock index dbaefa6..1989e0a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3364267b350d04436dd057ed8c82f521", + "content-hash": "b9c46b233141043e95d3825c9c49a806", "packages": [ { "name": "composer/semver", @@ -87,6 +87,465 @@ ], "time": "2024-07-12T11:35:52+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "7.9.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.3", + "guzzlehttp/psr7": "^2.7.0", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2024-07-24T11:22:20+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "reference": "6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2024-07-18T10:29:17+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "phpunit/phpunit": "^8.5.39 || ^9.6.20" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2024-07-18T11:15:46+00:00" + }, + { + "name": "kevinrob/guzzle-cache-middleware", + "version": "v5.1.0", + "source": { + "type": "git", + "url": "https://github.com/Kevinrob/guzzle-cache-middleware.git", + "reference": "6bd64dbbe5155107d84a0f67140a8822a709c6d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Kevinrob/guzzle-cache-middleware/zipball/6bd64dbbe5155107d84a0f67140a8822a709c6d0", + "reference": "6bd64dbbe5155107d84a0f67140a8822a709c6d0", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0 || ^7.0", + "guzzlehttp/promises": "^1.4 || ^2.0", + "guzzlehttp/psr7": "^1.7.0 || ^2.0.0", + "php": ">=7.2.0" + }, + "require-dev": { + "cache/array-adapter": "^0.4 || ^0.5 || ^1.0", + "cache/simple-cache-bridge": "^0.1 || ^1.0", + "doctrine/cache": "^1.10", + "illuminate/cache": "^5.0", + "league/flysystem": "^2.5", + "phpunit/phpunit": "^8.5.15 || ^9.5", + "psr/cache": "^1.0", + "symfony/cache": "^4.4 || ^5.0", + "symfony/phpunit-bridge": "^4.4 || ^5.0" + }, + "suggest": { + "doctrine/cache": "This library has a lot of ready-to-use cache storage (to be used with Kevinrob\\GuzzleCache\\Storage\\DoctrineCacheStorage). Use only versions >=1.4.0 < 2.0.0", + "guzzlehttp/guzzle": "For using this library. It was created for Guzzle6 (but you can use it with any PSR-7 HTTP client).", + "laravel/framework": "To be used with Kevinrob\\GuzzleCache\\Storage\\LaravelCacheStorage", + "league/flysystem": "To be used with Kevinrob\\GuzzleCache\\Storage\\FlysystemStorage", + "psr/cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr6CacheStorage", + "psr/simple-cache": "To be used with Kevinrob\\GuzzleCache\\Storage\\Psr16CacheStorage" + }, + "type": "library", + "autoload": { + "psr-4": { + "Kevinrob\\GuzzleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kevin Robatel", + "email": "kevinrob2@gmail.com", + "homepage": "https://github.com/Kevinrob" + } + ], + "description": "A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)", + "homepage": "https://github.com/Kevinrob/guzzle-cache-middleware", + "keywords": [ + "Etag", + "Flysystem", + "Guzzle", + "cache", + "cache-control", + "doctrine", + "expiration", + "guzzle6", + "handler", + "http", + "http 1.1", + "middleware", + "performance", + "php", + "promise", + "psr6", + "psr7", + "rfc7234", + "validation" + ], + "support": { + "issues": "https://github.com/Kevinrob/guzzle-cache-middleware/issues", + "source": "https://github.com/Kevinrob/guzzle-cache-middleware/tree/v5.1.0" + }, + "time": "2023-11-09T06:53:45+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -140,6 +599,166 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, { "name": "psr/log", "version": "3.0.0", @@ -174,70 +793,120 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], + "description": "A polyfill for getallheaders.", "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2019-03-08T08:55:37+00:00" }, { - "name": "symfony/console", - "version": "v7.1.2", + "name": "symfony/cache", + "version": "v7.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" + "url": "https://github.com/symfony/cache.git", + "reference": "8ac37acee794372f9732fe8a61a8221f6762148e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", + "url": "https://api.github.com/repos/symfony/cache/zipball/8ac37acee794372f9732fe8a61a8221f6762148e", + "reference": "8ac37acee794372f9732fe8a61a8221f6762148e", "shasum": "" }, "require": { "php": ">=8.2", - "symfony/polyfill-mbstring": "~1.0", + "psr/cache": "^2.0|^3.0", + "psr/log": "^1.1|^2|^3", + "symfony/cache-contracts": "^2.5|^3", + "symfony/deprecation-contracts": "^2.5|^3.0", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^6.4|^7.0" + "symfony/var-exporter": "^6.4|^7.0" }, "conflict": { + "doctrine/dbal": "<3.6", "symfony/dependency-injection": "<6.4", - "symfony/dotenv": "<6.4", - "symfony/event-dispatcher": "<6.4", - "symfony/lock": "<6.4", - "symfony/process": "<6.4" + "symfony/http-kernel": "<6.4", + "symfony/var-dumper": "<6.4" }, "provide": { - "psr/log-implementation": "1.0|2.0|3.0" + "psr/cache-implementation": "2.0|3.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0", + "symfony/cache-implementation": "1.1|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2|^3", + "cache/integration-tests": "dev-master", + "doctrine/dbal": "^3.6|^4", + "predis/predis": "^1.1|^2.0", + "psr/simple-cache": "^1.0|^2.0|^3.0", "symfony/config": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", - "symfony/event-dispatcher": "^6.4|^7.0", - "symfony/http-foundation": "^6.4|^7.0", + "symfony/filesystem": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^6.4|^7.0", "symfony/messenger": "^6.4|^7.0", - "symfony/process": "^6.4|^7.0", - "symfony/stopwatch": "^6.4|^7.0", "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Console\\": "" + "Symfony\\Component\\Cache\\": "" }, + "classmap": [ + "Traits/ValueWrapper.php" + ], "exclude-from-classmap": [ "/Tests/" ] @@ -248,24 +917,22 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Eases the creation of beautiful and testable command line interfaces", + "description": "Provides extended PSR-6, PSR-16 (and tags) implementations", "homepage": "https://symfony.com", "keywords": [ - "cli", - "command-line", - "console", - "terminal" + "caching", + "psr6" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.2" + "source": "https://github.com/symfony/cache/tree/v7.1.3" }, "funding": [ { @@ -281,24 +948,25 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-07-17T06:10:24+00:00" }, { - "name": "symfony/deprecation-contracts", + "name": "symfony/cache-contracts", "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/df6a1a44c890faded49a5fca33c2d5c5fd3c2197", + "reference": "df6a1a44c890faded49a5fca33c2d5c5fd3c2197", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.1", + "psr/cache": "^3.0" }, "type": "library", "extra": { @@ -311,9 +979,9 @@ } }, "autoload": { - "files": [ - "function.php" - ] + "psr-4": { + "Symfony\\Contracts\\Cache\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -329,10 +997,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Generic abstractions related to caching", "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/cache-contracts/tree/v3.5.0" }, "funding": [ { @@ -351,31 +1027,52 @@ "time": "2024-04-18T09:32:20+00:00" }, { - "name": "symfony/filesystem", - "version": "v7.1.2", + "name": "symfony/console", + "version": "v7.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" + "url": "https://github.com/symfony/console.git", + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", - "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", + "url": "https://api.github.com/repos/symfony/console/zipball/cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", "shasum": "" }, "require": { "php": ">=8.2", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "symfony/process": "^6.4|^7.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Console\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -395,10 +1092,16 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides basic utilities for the filesystem", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.2" + "source": "https://github.com/symfony/console/tree/v7.1.3" }, "funding": [ { @@ -414,62 +1117,38 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-07-26T12:41:01+00:00" }, { - "name": "symfony/http-client", - "version": "v7.1.2", + "name": "symfony/deprecation-contracts", + "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/symfony/http-client.git", - "reference": "90ace27d17ccc9afc6f7ec0081e8529fb0e29425" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/90ace27d17ccc9afc6f7ec0081e8529fb0e29425", - "reference": "90ace27d17ccc9afc6f7ec0081e8529fb0e29425", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", "shasum": "" }, "require": { - "php": ">=8.2", - "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "^3.4.1", - "symfony/service-contracts": "^2.5|^3" - }, - "conflict": { - "php-http/discovery": "<1.15", - "symfony/http-foundation": "<6.4" - }, - "provide": { - "php-http/async-client-implementation": "*", - "php-http/client-implementation": "*", - "psr/http-client-implementation": "1.0", - "symfony/http-client-implementation": "3.0" - }, - "require-dev": { - "amphp/amp": "^2.5", - "amphp/http-client": "^4.2.1", - "amphp/http-tunnel": "^1.0", - "amphp/socket": "^1.1", - "guzzlehttp/promises": "^1.4|^2.0", - "nyholm/psr7": "^1.0", - "php-http/httplug": "^1.0|^2.0", - "psr/http-client": "^1.0", - "symfony/dependency-injection": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/messenger": "^6.4|^7.0", - "symfony/process": "^6.4|^7.0", - "symfony/rate-limiter": "^6.4|^7.0", - "symfony/stopwatch": "^6.4|^7.0" + "php": ">=8.1" }, "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpClient\\": "" + "extra": { + "branch-alias": { + "dev-main": "3.5-dev" }, - "exclude-from-classmap": [ - "/Tests/" + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -486,13 +1165,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "keywords": [ - "http" - ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.1.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" }, "funding": [ { @@ -508,41 +1184,37 @@ "type": "tidelift" } ], - "time": "2024-06-28T08:00:31+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { - "name": "symfony/http-client-contracts", - "version": "v3.5.0", + "name": "symfony/filesystem", + "version": "v7.1.2", "source": { "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "20414d96f391677bf80078aa55baece78b82647d" + "url": "https://github.com/symfony/filesystem.git", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/20414d96f391677bf80078aa55baece78b82647d", - "reference": "20414d96f391677bf80078aa55baece78b82647d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } + "require-dev": { + "symfony/process": "^6.4|^7.0" }, + "type": "library", "autoload": { "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" + "Symfony\\Component\\Filesystem\\": "" }, "exclude-from-classmap": [ - "/Test/" + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -551,26 +1223,18 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Generic abstractions related to HTTP clients", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/filesystem/tree/v7.1.2" }, "funding": [ { @@ -586,7 +1250,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/polyfill-ctype", @@ -991,16 +1655,16 @@ }, { "name": "symfony/string", - "version": "v7.1.2", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", + "url": "https://api.github.com/repos/symfony/string/zipball/ea272a882be7f20cad58d5d78c215001617b7f07", + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07", "shasum": "" }, "require": { @@ -1058,7 +1722,83 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.2" + "source": "https://github.com/symfony/string/tree/v7.1.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-07-22T10:25:37+00:00" + }, + { + "name": "symfony/var-exporter", + "version": "v7.1.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "b80a669a2264609f07f1667f891dbfca25eba44c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/b80a669a2264609f07f1667f891dbfca25eba44c", + "reference": "b80a669a2264609f07f1667f891dbfca25eba44c", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/property-access": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "lazy-loading", + "proxy", + "serialize" + ], + "support": { + "source": "https://github.com/symfony/var-exporter/tree/v7.1.2" }, "funding": [ { @@ -1074,7 +1814,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:27:18+00:00" + "time": "2024-06-28T08:00:31+00:00" } ], "packages-dev": [], diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index 3968793..ac4b8cf 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -74,7 +74,7 @@ protected function configure(): void * {@inheritdoc} * * @throws \Exception - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ protected function execute(InputInterface $input, OutputInterface $output): int { diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index d98f56a..03be75a 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -5,7 +5,11 @@ use Composer\Semver\Comparator; use Composer\Semver\VersionParser; use Composer\Semver\Semver; -use Symfony\Component\HttpClient\HttpClient; +use GuzzleHttp\HandlerStack; +use Kevinrob\GuzzleCache\CacheMiddleware; +use Kevinrob\GuzzleCache\Storage\Psr6CacheStorage; +use Kevinrob\GuzzleCache\Strategy\PublicCacheStrategy; +use Symfony\Component\Cache\Adapter\FilesystemAdapter; use UnexpectedValueException; /** @@ -28,7 +32,7 @@ public function __construct(protected string $gitHubRepository, protected string } /** - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function isUpToDate(): bool { $latestRelease = $this->getLatestReleaseFromGithub(); @@ -42,7 +46,7 @@ public function isUpToDate(): bool { * @return string[]|null * "version" and "download_url" elements if the latest release is * available, otherwise - NULL. - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws \GuzzleHttp\Exception\GuzzleException */ public function getLatestReleaseFromGithub(): ?array { @@ -86,26 +90,37 @@ public function getLatestReleaseFromGithub(): ?array * Get all releases from GitHub. * * @return array - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface * * @throws \Exception + * @throws \GuzzleHttp\Exception\GuzzleException */ private function getReleasesFromGithub(): array { $version_parser = new VersionParser(); - + $stack = HandlerStack::create(); + $stack->push( + new CacheMiddleware( + new PublicCacheStrategy( + new Psr6CacheStorage( + new FilesystemAdapter('self-update') + ) + ) + ), + 'cache' + ); $opts = [ + 'handler' => $stack, 'headers' => [ 'User-Agent' => $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)', ], ]; - $client = HttpClient::create($opts); + $client = new \GuzzleHttp\Client($opts); $response = $client->request( 'GET', 'https://api.github.com/repos/' . $this->gitHubRepository . '/releases' ); - $releases = json_decode($response->getContent(), FALSE, 512, JSON_THROW_ON_ERROR); + $releases = json_decode($response->getBody(), FALSE, 512, JSON_THROW_ON_ERROR); if (!isset($releases[0])) { throw new \RuntimeException('API error - no release found at GitHub repository ' . $this->gitHubRepository); From 56d4305e10576aefc8728fbb0a9104ef6ab4e270 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 2 Aug 2024 11:22:57 -0700 Subject: [PATCH 06/12] support symfony 5 --- composer.json | 4 ++-- composer.lock | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index b61d1c1..62491fc 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ "composer/semver": "^3.2", "guzzlehttp/guzzle": "^7.9", "kevinrob/guzzle-cache-middleware": "^5.1", - "symfony/cache": "^7.1", + "symfony/cache": "^5.4 || ^6.4 || ^7", "symfony/console": "^5.4 || ^6.4 || ^7", - "symfony/filesystem": "^7.1" + "symfony/filesystem": "^5.4 || ^6.4 || ^7" }, "bin": [ "scripts/release" diff --git a/composer.lock b/composer.lock index 1989e0a..85f0757 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b9c46b233141043e95d3825c9c49a806", + "content-hash": "b635f4918218e7c8a64270c684c47309", "packages": [ { "name": "composer/semver", From 352b5c283cf3f7da763b7911edcaca517c0bee52 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 8 Aug 2024 12:51:07 -0700 Subject: [PATCH 07/12] remove static cache --- src/SelfUpdateManager.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 03be75a..927ad3c 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -20,10 +20,8 @@ class SelfUpdateManager { protected array $options; - private ?array $latestRelease = null; public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, array $options){ - // Options need to be passed in the constructor since we cache the latestRelease which may vary based on options. $this->options = array_merge([ 'preview' => false, 'compatible' => false, @@ -50,10 +48,6 @@ public function isUpToDate(): bool { */ public function getLatestReleaseFromGithub(): ?array { - if (null !== $this->latestRelease) { - return $this->latestRelease; - } - foreach ($this->getReleasesFromGithub() as $releaseVersion => $release) { // We do not care about this release if it does not contain assets. if (!isset($release['assets'][0]) || !is_object($release['assets'][0])) { @@ -75,12 +69,11 @@ public function getLatestReleaseFromGithub(): ?array continue; } - $this->latestRelease = [ + return [ 'version' => $releaseVersion, 'tag_name' => $release['tag_name'], 'download_url' => $release['assets'][0]->browser_download_url, ]; - return $this->latestRelease; } return null; @@ -89,6 +82,8 @@ public function getLatestReleaseFromGithub(): ?array /** * Get all releases from GitHub. * + * Network requests are cached up to the max-age in the GitHub response (i.e., 60 seconds). + * * @return array * * @throws \Exception From ed37ade626d320b4aaf4c96e36091fe0097c0c29 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 8 Aug 2024 13:38:00 -0700 Subject: [PATCH 08/12] default argument --- src/SelfUpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index ac4b8cf..824083d 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -156,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - public function getSelfUpdateManager(array $options): SelfUpdateManager { + public function getSelfUpdateManager(array $options = []): SelfUpdateManager { return new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $options); } From 2d76f4b8c26902bc5f592ba103e5023820bb6e74 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 12 Aug 2024 13:43:02 -0700 Subject: [PATCH 09/12] refactor --- src/SelfUpdateCommand.php | 49 ++++++++------------------------------- src/SelfUpdateManager.php | 28 +++++++++++----------- 2 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index 824083d..c2bbd4c 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -2,7 +2,7 @@ namespace SelfUpdate; -use Composer\Semver\VersionParser; +use JetBrains\PhpStorm\NoReturn; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -20,39 +20,17 @@ class SelfUpdateCommand extends Command { public const SELF_UPDATE_COMMAND_NAME = 'self:update'; - protected string $gitHubRepository; - - protected string $currentVersion; - - protected string $applicationName; - - protected bool $ignorePharRunningCheck; - - public function __construct(string $applicationName = null, string $currentVersion = null, string $gitHubRepository = null) + public function __construct(private readonly SelfUpdateManager $selfUpdateManager, private readonly bool $ignorePharRunningCheck = false) { - $this->applicationName = $applicationName; - $version_parser = new VersionParser(); - $this->currentVersion = $version_parser->normalize($currentVersion); - $this->gitHubRepository = $gitHubRepository; - $this->ignorePharRunningCheck = false; - parent::__construct(self::SELF_UPDATE_COMMAND_NAME); } - /** - * Set ignorePharRunningCheck to true. - */ - public function ignorePharRunningCheck($ignore = true): void - { - $this->ignorePharRunningCheck = $ignore; - } - /** * {@inheritdoc} */ protected function configure(): void { - $app = $this->applicationName; + $app = $this->selfUpdateManager->applicationName; // Follow Composer's pattern of command and channel names. $this @@ -79,7 +57,7 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { if (!$this->ignorePharRunningCheck && empty(\Phar::running())) { - throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' only works when running the phar version of ' . $this->applicationName . '.'); + throw new \RuntimeException(self::SELF_UPDATE_COMMAND_NAME . ' only works when running the phar version of ' . $this->selfUpdateManager->applicationName . '.'); } $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0]; @@ -109,22 +87,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int $isCompatibleOptionSet = $input->getOption('compatible'); $versionConstraintArg = $input->getArgument('version_constraint'); - $selfUpdateManager = $this->getSelfUpdateManager([ + $options = [ 'preview' => $isPreviewOptionSet, 'compatible' => $isCompatibleOptionSet, 'version_constraint' => $versionConstraintArg, - ]); + ]; - if ($selfUpdateManager->isUpToDate()) { + if ($this->selfUpdateManager->isUpToDate($options)) { $output->writeln('No update available'); return Command::SUCCESS; } - $latestRelease = $selfUpdateManager->getLatestReleaseFromGithub(); + $latestRelease = $this->selfUpdateManager->getLatestReleaseFromGithub($options); $fs = new sfFilesystem(); - $output->writeln('Downloading ' . $this->applicationName . ' (' . $this->gitHubRepository . ') ' . $latestRelease['tag_name']); + $output->writeln('Downloading ' . $this->selfUpdateManager->applicationName . ' (' . $this->selfUpdateManager->gitHubRepository . ') ' . $latestRelease['tag_name']); $fs->copy($latestRelease['download_url'], $tempFilename); @@ -152,12 +130,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } - // This will never be reached, but it keeps static analysis tools happy :) - return Command::SUCCESS; - } - - public function getSelfUpdateManager(array $options = []): SelfUpdateManager { - return new SelfUpdateManager($this->gitHubRepository, $this->currentVersion, $this->applicationName, $options); } /** @@ -168,8 +140,7 @@ public function getSelfUpdateManager(array $options = []): SelfUpdateManager { * * @return void */ - protected function _exit() - { + #[NoReturn] protected function _exit(): void { exit; } } diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 927ad3c..0fc3375 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -19,21 +19,17 @@ */ class SelfUpdateManager { - protected array $options; - public function __construct(protected string $gitHubRepository, protected string $currentVersion, protected string $applicationName, array $options){ - $this->options = array_merge([ - 'preview' => false, - 'compatible' => false, - 'version_constraint' => null, - ], $options); + public function __construct(public string $applicationName, public string $currentVersion, public string $gitHubRepository){ + $version_parser = new VersionParser(); + $this->currentVersion = $version_parser->normalize($currentVersion); } /** * @throws \GuzzleHttp\Exception\GuzzleException */ - public function isUpToDate(): bool { - $latestRelease = $this->getLatestReleaseFromGithub(); + public function isUpToDate(array $options = []): bool { + $latestRelease = $this->getLatestReleaseFromGithub($options); return NULL === $latestRelease || Comparator::greaterThanOrEqualTo($this->currentVersion, $latestRelease['version']); } @@ -46,25 +42,31 @@ public function isUpToDate(): bool { * available, otherwise - NULL. * @throws \GuzzleHttp\Exception\GuzzleException */ - public function getLatestReleaseFromGithub(): ?array + public function getLatestReleaseFromGithub(array $options = []): ?array { + $options = array_merge([ + 'preview' => false, + 'compatible' => false, + 'version_constraint' => null, + ], $options); + foreach ($this->getReleasesFromGithub() as $releaseVersion => $release) { // We do not care about this release if it does not contain assets. if (!isset($release['assets'][0]) || !is_object($release['assets'][0])) { continue; } - if ($this->options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { + if ($options['compatible'] && !$this->satisfiesMajorVersionConstraint($releaseVersion)) { // If it does not satisfy, look for the next one. continue; } - if (!$this->options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { + if (!$options['preview'] && ((VersionParser::parseStability($releaseVersion) !== 'stable') || $release['prerelease'])) { // If preview not requested and current version is not stable, look for the next one. continue; } - if (null !== $this->options['version_constraint'] && !Semver::satisfies($releaseVersion, $this->options['version_constraint'])) { + if (null !== $options['version_constraint'] && !Semver::satisfies($releaseVersion, $options['version_constraint'])) { // Release version does not match version constraint option. continue; } From 62d7a7d30700830efb928284ade1e31e6a3bfe33 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 12 Aug 2024 15:32:18 -0700 Subject: [PATCH 10/12] remove validation to support autowiring --- src/SelfUpdateManager.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 0fc3375..2c68c3d 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -21,8 +21,6 @@ class SelfUpdateManager { public function __construct(public string $applicationName, public string $currentVersion, public string $gitHubRepository){ - $version_parser = new VersionParser(); - $this->currentVersion = $version_parser->normalize($currentVersion); } /** From c7878c1ed712997a9ab960705df44946802f86e7 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 12 Aug 2024 15:51:07 -0700 Subject: [PATCH 11/12] add comment --- src/SelfUpdateManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SelfUpdateManager.php b/src/SelfUpdateManager.php index 2c68c3d..5bc5e73 100644 --- a/src/SelfUpdateManager.php +++ b/src/SelfUpdateManager.php @@ -20,6 +20,10 @@ class SelfUpdateManager { + /** + * We can't accept $options here because they likely depend on user input + * which isn't available at this point in the Symfony bootstrap. + */ public function __construct(public string $applicationName, public string $currentVersion, public string $gitHubRepository){ } From cbdd9f667b11879c34a86219799fee1faee4ae03 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 19 Aug 2024 11:03:19 -0700 Subject: [PATCH 12/12] remove phpstorm dependency --- src/SelfUpdateCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SelfUpdateCommand.php b/src/SelfUpdateCommand.php index c2bbd4c..03b96fa 100644 --- a/src/SelfUpdateCommand.php +++ b/src/SelfUpdateCommand.php @@ -2,7 +2,6 @@ namespace SelfUpdate; -use JetBrains\PhpStorm\NoReturn; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -130,6 +129,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } + // This will never be reached, but it keeps static analysis tools happy :) + return Command::SUCCESS; } /** @@ -140,7 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int * * @return void */ - #[NoReturn] protected function _exit(): void { + protected function _exit(): void { exit; } }