From 01105c3d26b55e4657589b3b34164a9b02e13b12 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Fri, 26 Jul 2024 11:22:11 -0700 Subject: [PATCH] CLI-979: Consolidate update-check logic --- composer.json | 6 + composer.lock | 241 ++++++++++++++++++------------------ src/Command/CommandBase.php | 51 ++------ 3 files changed, 135 insertions(+), 163 deletions(-) diff --git a/composer.json b/composer.json index b184cb4f7..c8f800675 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,12 @@ } ], "minimum-stability": "dev", + "repositories": [ + { + "type": "path", + "url": "../../consolidation/self-update" + } + ], "require": { "php": "^8.1", "ext-json": "*", diff --git a/composer.lock b/composer.lock index 97dd5dbd5..34f6fa418 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": "c49bd75c4ca413cd16cd85fe278e6352", + "content-hash": "974d29cdceae7ea1755f0900182898c9", "packages": [ { "name": "acquia/drupal-environment-detector", @@ -408,16 +408,10 @@ { "name": "consolidation/self-update", "version": "dev-main", - "source": { - "type": "git", - "url": "https://github.com/consolidation/self-update.git", - "reference": "e3cc75a07c36b68bd5ab72ead23a375529fba71f" - }, "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/self-update/zipball/e3cc75a07c36b68bd5ab72ead23a375529fba71f", - "reference": "e3cc75a07c36b68bd5ab72ead23a375529fba71f", - "shasum": "" + "type": "path", + "url": "../../consolidation/self-update", + "reference": "26d3119428454fb0f58e39614e324910acdf4ef3" }, "require": { "composer/semver": "^3.2", @@ -426,7 +420,6 @@ "symfony/filesystem": "^5.4 || ^6.4 || ^7", "symfony/http-client": "^5.4 || ^6.4 || ^7" }, - "default-branch": true, "bin": [ "scripts/release" ], @@ -441,7 +434,11 @@ "SelfUpdate\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "scripts": { + "release": [ + "./scripts/release VERSION" + ] + }, "license": [ "MIT" ], @@ -456,11 +453,9 @@ } ], "description": "Provides a self:update command for Symfony Console applications.", - "support": { - "issues": "https://github.com/consolidation/self-update/issues", - "source": "https://github.com/consolidation/self-update/tree/main" - }, - "time": "2024-07-18T18:42:07+00:00" + "transport-options": { + "relative": true + } }, { "name": "dflydev/dot-access-data", @@ -700,16 +695,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.9.1", + "version": "7.9.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "a629e5b69db96eb4939c1b34114130077dd4c6fc" + "reference": "d281ed313b989f213357e3be1a179f02196ac99b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a629e5b69db96eb4939c1b34114130077dd4c6fc", - "reference": "a629e5b69db96eb4939c1b34114130077dd4c6fc", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b", + "reference": "d281ed313b989f213357e3be1a179f02196ac99b", "shasum": "" }, "require": { @@ -806,7 +801,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.9.1" + "source": "https://github.com/guzzle/guzzle/tree/7.9.2" }, "funding": [ { @@ -822,7 +817,7 @@ "type": "tidelift" } ], - "time": "2024-07-19T16:19:57+00:00" + "time": "2024-07-24T11:22:20+00:00" }, { "name": "guzzlehttp/promises", @@ -3518,31 +3513,31 @@ }, { "name": "react/socket", - "version": "v1.15.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.11", + "react/dns": "^1.13", "react/event-loop": "^1.2", - "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/stream": "^1.2" + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", + "react/async": "^4.3 || ^3.3 || ^2", "react/promise-stream": "^1.4", - "react/promise-timer": "^1.10" + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -3586,7 +3581,7 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.15.0" + "source": "https://github.com/reactphp/socket/tree/v1.16.0" }, "funding": [ { @@ -3594,7 +3589,7 @@ "type": "open_collective" } ], - "time": "2023-12-15T11:02:10+00:00" + "time": "2024-07-26T10:38:09+00:00" }, { "name": "react/stream", @@ -3676,16 +3671,16 @@ }, { "name": "symfony/cache", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "287142df5579ce223c485b3872df3efae8390984" + "reference": "6702d2d777260e6ff3451fee2d7d78ab5f715cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/287142df5579ce223c485b3872df3efae8390984", - "reference": "287142df5579ce223c485b3872df3efae8390984", + "url": "https://api.github.com/repos/symfony/cache/zipball/6702d2d777260e6ff3451fee2d7d78ab5f715cdc", + "reference": "6702d2d777260e6ff3451fee2d7d78ab5f715cdc", "shasum": "" }, "require": { @@ -3752,7 +3747,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.8" + "source": "https://github.com/symfony/cache/tree/v6.4.10" }, "funding": [ { @@ -3768,7 +3763,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-17T06:05:49+00:00" }, { "name": "symfony/cache-contracts", @@ -3923,16 +3918,16 @@ }, { "name": "symfony/console", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9" + "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9", - "reference": "6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9", + "url": "https://api.github.com/repos/symfony/console/zipball/504974cbe43d05f83b201d6498c206f16fc0cdbc", + "reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc", "shasum": "" }, "require": { @@ -3997,7 +3992,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.9" + "source": "https://github.com/symfony/console/tree/v6.4.10" }, "funding": [ { @@ -4013,20 +4008,20 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:49:33+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "a4df9dfe5da2d177af6643610c7bee2cb76a9f5e" + "reference": "5caf9c5f6085f13b27d70a236b776c07e4a1c3eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a4df9dfe5da2d177af6643610c7bee2cb76a9f5e", - "reference": "a4df9dfe5da2d177af6643610c7bee2cb76a9f5e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5caf9c5f6085f13b27d70a236b776c07e4a1c3eb", + "reference": "5caf9c5f6085f13b27d70a236b776c07e4a1c3eb", "shasum": "" }, "require": { @@ -4078,7 +4073,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.9" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.10" }, "funding": [ { @@ -4094,7 +4089,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T10:45:28+00:00" + "time": "2024-07-26T07:32:07+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4165,16 +4160,16 @@ }, { "name": "symfony/dotenv", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "55aefa0029adff89ecffdb560820e945c7983f06" + "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/55aefa0029adff89ecffdb560820e945c7983f06", - "reference": "55aefa0029adff89ecffdb560820e945c7983f06", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/2ae0c84cc9be0dc1eeb86016970b63c764d8472e", + "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e", "shasum": "" }, "require": { @@ -4219,7 +4214,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.8" + "source": "https://github.com/symfony/dotenv/tree/v6.4.10" }, "funding": [ { @@ -4235,20 +4230,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-09T18:29:35+00:00" }, { "name": "symfony/error-handler", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "c9b7cc075b3ab484239855622ca05cb0b99c13ec" + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/c9b7cc075b3ab484239855622ca05cb0b99c13ec", - "reference": "c9b7cc075b3ab484239855622ca05cb0b99c13ec", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/231f1b2ee80f72daa1972f7340297d67439224f0", + "reference": "231f1b2ee80f72daa1972f7340297d67439224f0", "shasum": "" }, "require": { @@ -4294,7 +4289,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.9" + "source": "https://github.com/symfony/error-handler/tree/v6.4.10" }, "funding": [ { @@ -4310,7 +4305,7 @@ "type": "tidelift" } ], - "time": "2024-06-21T16:04:15+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/event-dispatcher", @@ -4600,16 +4595,16 @@ }, { "name": "symfony/finder", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c" + "reference": "af29198d87112bebdd397bd7735fbd115997824c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c", - "reference": "3ef977a43883215d560a2cecb82ec8e62131471c", + "url": "https://api.github.com/repos/symfony/finder/zipball/af29198d87112bebdd397bd7735fbd115997824c", + "reference": "af29198d87112bebdd397bd7735fbd115997824c", "shasum": "" }, "require": { @@ -4644,7 +4639,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.8" + "source": "https://github.com/symfony/finder/tree/v6.4.10" }, "funding": [ { @@ -4660,7 +4655,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-24T07:06:38+00:00" }, { "name": "symfony/flex", @@ -4729,16 +4724,16 @@ }, { "name": "symfony/http-client", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045" + "reference": "b5e498f763e0bf5eed8dcd946e50a3b3f71d4ded" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/6e9db0025db565bcf8f1d46ed734b549e51e6045", - "reference": "6e9db0025db565bcf8f1d46ed734b549e51e6045", + "url": "https://api.github.com/repos/symfony/http-client/zipball/b5e498f763e0bf5eed8dcd946e50a3b3f71d4ded", + "reference": "b5e498f763e0bf5eed8dcd946e50a3b3f71d4ded", "shasum": "" }, "require": { @@ -4802,7 +4797,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.9" + "source": "https://github.com/symfony/http-client/tree/v6.4.10" }, "funding": [ { @@ -4818,7 +4813,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T07:59:05+00:00" + "time": "2024-07-15T09:26:24+00:00" }, { "name": "symfony/http-client-contracts", @@ -4900,16 +4895,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.8", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947" + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/27de8cc95e11db7a50b027e71caaab9024545947", - "reference": "27de8cc95e11db7a50b027e71caaab9024545947", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b", "shasum": "" }, "require": { @@ -4957,7 +4952,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.8" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.10" }, "funding": [ { @@ -4973,20 +4968,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-07-26T12:36:27+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "cc4a9bec6e1bdd2405f40277a68a6ed1bb393005" + "reference": "147e0daf618d7575b5007055340d09aece5cf068" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/cc4a9bec6e1bdd2405f40277a68a6ed1bb393005", - "reference": "cc4a9bec6e1bdd2405f40277a68a6ed1bb393005", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/147e0daf618d7575b5007055340d09aece5cf068", + "reference": "147e0daf618d7575b5007055340d09aece5cf068", "shasum": "" }, "require": { @@ -5071,7 +5066,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.9" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.10" }, "funding": [ { @@ -5087,7 +5082,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T11:48:06+00:00" + "time": "2024-07-26T14:52:04+00:00" }, { "name": "symfony/options-resolver", @@ -5776,16 +5771,16 @@ }, { "name": "symfony/string", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7" + "reference": "ccf9b30251719567bfd46494138327522b9a9446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/76792dbd99690a5ebef8050d9206c60c59e681d7", - "reference": "76792dbd99690a5ebef8050d9206c60c59e681d7", + "url": "https://api.github.com/repos/symfony/string/zipball/ccf9b30251719567bfd46494138327522b9a9446", + "reference": "ccf9b30251719567bfd46494138327522b9a9446", "shasum": "" }, "require": { @@ -5842,7 +5837,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.9" + "source": "https://github.com/symfony/string/tree/v6.4.10" }, "funding": [ { @@ -5858,7 +5853,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:25:38+00:00" + "time": "2024-07-22T10:21:14+00:00" }, { "name": "symfony/translation-contracts", @@ -5940,16 +5935,16 @@ }, { "name": "symfony/validator", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "ee0a4d6a327a963aee094f730da238f7ea18cb01" + "reference": "bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/ee0a4d6a327a963aee094f730da238f7ea18cb01", - "reference": "ee0a4d6a327a963aee094f730da238f7ea18cb01", + "url": "https://api.github.com/repos/symfony/validator/zipball/bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd", + "reference": "bcf939a9d1acd7d2912e9474c0c3d7840a03cbcd", "shasum": "" }, "require": { @@ -6017,7 +6012,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.9" + "source": "https://github.com/symfony/validator/tree/v6.4.10" }, "funding": [ { @@ -6033,20 +6028,20 @@ "type": "tidelift" } ], - "time": "2024-06-22T07:42:41+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.9", + "version": "v6.4.10", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "c31566e4ca944271cc8d8ac6887cbf31b8c6a172" + "reference": "a71cc3374f5fb9759da1961d28c452373b343dd4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/c31566e4ca944271cc8d8ac6887cbf31b8c6a172", - "reference": "c31566e4ca944271cc8d8ac6887cbf31b8c6a172", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/a71cc3374f5fb9759da1961d28c452373b343dd4", + "reference": "a71cc3374f5fb9759da1961d28c452373b343dd4", "shasum": "" }, "require": { @@ -6102,7 +6097,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.9" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.10" }, "funding": [ { @@ -6118,7 +6113,7 @@ "type": "tidelift" } ], - "time": "2024-06-27T13:23:14+00:00" + "time": "2024-07-26T12:30:32+00:00" }, { "name": "symfony/var-exporter", @@ -8035,30 +8030,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/ea4ab6f9580a4fd221e0418f2c357cdd39102a90", + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.8" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.8", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -8086,7 +8089,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.2.0" }, "funding": [ { @@ -8102,7 +8105,7 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-07-25T09:36:02+00:00" }, { "name": "composer/spdx-licenses", @@ -10800,16 +10803,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.7", + "version": "1.11.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" + "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", + "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", "shasum": "" }, "require": { @@ -10854,7 +10857,7 @@ "type": "github" } ], - "time": "2024-07-06T11:17:41+00:00" + "time": "2024-07-24T07:01:22+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index a8f56a816..02ca3626e 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -54,6 +54,7 @@ use Psr\Log\LoggerAwareTrait; use Psr\Log\LoggerInterface; use Safe\Exceptions\FilesystemException; +use SelfUpdate\SelfUpdateCommand; use stdClass; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Console\Command\Command; @@ -1204,56 +1205,18 @@ public function checkForNewVersion(): bool|string return false; } try { - if ($latest = $this->hasUpdate()) { - return $latest; + /** @var SelfUpdateCommand $selfUpdateCommand */ + $selfUpdateCommand = $this->getApplication()->get('self:update'); + $selfUpdateManager = $selfUpdateCommand->getSelfUpdateManager([]); + if (!$selfUpdateManager->isUpToDate()) { + return $selfUpdateManager->getLatestReleaseFromGithub()['tag_name']; } - } catch (Exception) { + } catch (Exception $exception) { $this->logger->debug("Could not determine if Acquia CLI has a new version available."); } return false; } - /** - * Check if an update is available. - * - * @todo unify with consolidation/self-update and support unstable channels - */ - protected function hasUpdate(): bool|string - { - $versionParser = new VersionParser(); - // Fail fast on development builds (throw UnexpectedValueException). - $currentVersion = $versionParser->normalize($this->getApplication() - ->getVersion()); - $client = $this->getUpdateClient(); - $response = $client->get('https://api.github.com/repos/acquia/cli/releases'); - if ($response->getStatusCode() !== 200) { - $this->logger->debug('Encountered ' . $response->getStatusCode() . ' error when attempting to check for new ACLI releases on GitHub: ' . $response->getReasonPhrase()); - return false; - } - - $releases = json_decode((string) $response->getBody(), false, 512, JSON_THROW_ON_ERROR); - if (!isset($releases[0])) { - $this->logger->debug('No releases found at GitHub repository acquia/cli'); - return false; - } - - foreach ($releases as $release) { - if (!$release->prerelease) { - /** - * @var string $version - */ - $version = $release->tag_name; - $versionStability = VersionParser::parseStability($version); - $versionIsNewer = Comparator::greaterThan($versionParser->normalize($version), $currentVersion); - if ($versionStability === 'stable' && $versionIsNewer) { - return $version; - } - return false; - } - } - return false; - } - public function setUpdateClient(\GuzzleHttp\Client $client): void { $this->updateClient = $client;