File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -54,8 +54,18 @@ public function getLatestReleaseFromGithub(array $options = []): ?array
5454 ], $ options );
5555
5656 foreach ($ this ->getReleasesFromGithub () as $ releaseVersion => $ release ) {
57- // We do not care about this release if it does not contain assets.
58- if (!isset ($ release ['assets ' ][0 ]) || !is_object ($ release ['assets ' ][0 ])) {
57+ // Find the first asset with a .phar extension.
58+ $ pharAsset = null ;
59+ if (isset ($ release ['assets ' ]) && is_array ($ release ['assets ' ])) {
60+ foreach ($ release ['assets ' ] as $ asset ) {
61+ if (is_object ($ asset ) && isset ($ asset ->content_type ) && $ asset ->content_type === 'application/octet-stream ' ) {
62+ $ pharAsset = $ asset ;
63+ break ;
64+ }
65+ }
66+ }
67+
68+ if (!$ pharAsset ) {
5969 continue ;
6070 }
6171
@@ -77,7 +87,7 @@ public function getLatestReleaseFromGithub(array $options = []): ?array
7787 return [
7888 'version ' => $ releaseVersion ,
7989 'tag_name ' => $ release ['tag_name ' ],
80- 'download_url ' => $ release [ ' assets ' ][ 0 ] ->browser_download_url ,
90+ 'download_url ' => $ pharAsset ->browser_download_url ,
8191 ];
8292 }
8393
You can’t perform that action at this time.
0 commit comments