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`.
    👉 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
This commit is contained in:
jrfnl
2021-08-08 21:31:44 +02:00
committed by Jaapio
parent e45d003a09
commit 9ab603b069
5 changed files with 64 additions and 7 deletions
+1 -2
View File
@@ -188,7 +188,6 @@ jobs:
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
tools: psalm
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
- name: Install Composer dependencies & cache dependencies - name: Install Composer dependencies & cache dependencies
@@ -197,7 +196,7 @@ jobs:
composer-options: --optimize-autoloader composer-options: --optimize-autoloader
- name: Run psalm - name: Run psalm
run: psalm --output-format=github run: vendor/bin/psalm.phar --output-format=github
bc_check: bc_check:
+1 -1
View File
@@ -25,7 +25,7 @@ phpstan:
.PHONY: psalm .PHONY: psalm
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 .PHONY: test
test: test:
+2 -1
View File
@@ -21,7 +21,8 @@
"ext-filter": "*" "ext-filter": "*"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "~1.3.2" "mockery/mockery": "~1.3.2",
"psalm/phar": "^4.8"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
Generated
+60 -2
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "8a52bc233d90a2f83a3d5ac697d9ccdc", "content-hash": "f1e7818879f1626c05926f50c2c96f44",
"packages": [ "packages": [
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@@ -53,6 +53,10 @@
"reflection", "reflection",
"static analysis" "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" "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", "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" "time": "2020-09-17T18:55:26+00:00"
}, },
{ {
@@ -160,6 +168,9 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.17.1"
},
"funding": [ "funding": [
{ {
"url": "https://symfony.com/sponsor", "url": "https://symfony.com/sponsor",
@@ -223,6 +234,10 @@
"check", "check",
"validate" "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" "time": "2020-07-08T17:02:28+00:00"
} }
], ],
@@ -272,6 +287,10 @@
"keywords": [ "keywords": [
"test" "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" "time": "2020-07-09T08:09:16+00:00"
}, },
{ {
@@ -337,7 +356,46 @@
"test double", "test double",
"testing" "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" "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": [], "aliases": [],
@@ -350,5 +408,5 @@
"ext-filter": "*" "ext-filter": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "1.1.0" "plugin-api-version": "2.1.0"
} }
-1
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive"> <phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.2" installed="9.3.7" location="./tools/phpunit" copy="true"/> <phar name="phpunit" version="^9.2" installed="9.3.7" location="./tools/phpunit" copy="true"/>
<phar name="psalm" version="^3.12.1" installed="3.12.1" location="./tools/psalm" copy="true"/>
</phive> </phive>