From 9ab603b0698baad625f0e5d5dfef980024bbc7e8 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 1 Aug 2021 01:53:47 +0200 Subject: [PATCH] Psalm: switch from Phive to Composer This switches the installation method for Psalm from Phive to Composer, while still using a Phar file for running Psalm. Includes: * Removing Psalm from the Phive configuration. * Adding Psalm to the Composer configuration. Includes upgrading from version `3.11.2` to version `4.8.1`. * Adjusting the script used in the `Makefile`. :point_right: Please verify and test this as things work differently on different OS-es and this should work for you. * Adjusting the GH Actions script to use the Composer installed version of Psalm. Note: due to the committed `composer.lock` file, Psalm will not automatically upgrade when newer versions are available. Refs: * https://github.com/vimeo/psalm/releases * https://github.com/psalm/phar/releases --- .github/workflows/push.yml | 3 +- Makefile | 2 +- composer.json | 3 +- composer.lock | 62 ++++++++++++++++++++++++++++++++++++-- phive.xml | 1 - 5 files changed, 64 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index be1e408..140d9bb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -188,7 +188,6 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: ${{ env.extensions }} - tools: psalm ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 - name: Install Composer dependencies & cache dependencies @@ -197,7 +196,7 @@ jobs: composer-options: --optimize-autoloader - name: Run psalm - run: psalm --output-format=github + run: vendor/bin/psalm.phar --output-format=github bc_check: diff --git a/Makefile b/Makefile index ca5f31b..1c92888 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ phpstan: .PHONY: psalm psalm: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/psalm + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.3 vendor/bin/psalm.phar .PHONY: test test: diff --git a/composer.json b/composer.json index 323501e..d907630 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "ext-filter": "*" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 42d3739..630b391 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": "8a52bc233d90a2f83a3d5ac697d9ccdc", + "content-hash": "f1e7818879f1626c05926f50c2c96f44", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -53,6 +53,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -98,6 +102,10 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, "time": "2020-09-17T18:55:26+00:00" }, { @@ -160,6 +168,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.17.1" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -223,6 +234,10 @@ "check", "validate" ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, "time": "2020-07-08T17:02:28+00:00" } ], @@ -272,6 +287,10 @@ "keywords": [ "test" ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, "time": "2020-07-09T08:09:16+00:00" }, { @@ -337,7 +356,46 @@ "test double", "testing" ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.4" + }, "time": "2021-02-24T09:51:00+00:00" + }, + { + "name": "psalm/phar", + "version": "4.8.1", + "source": { + "type": "git", + "url": "https://github.com/psalm/phar.git", + "reference": "ce0856e5c28a78382d1fa4e1a11cf9aac6292231" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/psalm/phar/zipball/ce0856e5c28a78382d1fa4e1a11cf9aac6292231", + "reference": "ce0856e5c28a78382d1fa4e1a11cf9aac6292231", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "vimeo/psalm": "*" + }, + "bin": [ + "psalm.phar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer-based Psalm Phar", + "support": { + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/4.8.1" + }, + "time": "2021-06-21T02:02:58+00:00" } ], "aliases": [], @@ -350,5 +408,5 @@ "ext-filter": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.1.0" } diff --git a/phive.xml b/phive.xml index c1ace19..b869ea7 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,4 @@ -