Initial work with Psalm reporting

This commit is contained in:
Jonny Barnes 2023-06-25 14:18:40 +01:00
parent 1ac8e27157
commit 3a681c0a44
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
9 changed files with 224 additions and 38 deletions

View file

@ -33,7 +33,7 @@ jobs:
- name: Setup PHP with pecl extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
extensions: phpredis,imagick
- name: Copy .env

View file

@ -16,7 +16,7 @@ jobs:
- name: Setup PHP with pecl extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
- name: Get Composer Cache Directory
id: composer-cache

View file

@ -7,23 +7,12 @@ use Throwable;
class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
$this->reportable(function (Throwable $_e) {
//
});
}

View file

@ -1,7 +0,0 @@
<?php
namespace App\Exceptions;
class TwitterContentException extends \Exception
{
}

View file

@ -16,7 +16,7 @@ class FrontPageController extends Controller
/**
* Show all the recent activity.
*/
public function index(Request $request): Response|View
public function index(): Response|View
{
$notes = Note::latest()->with(['media', 'client', 'place'])->get();
$articles = Article::latest()->get();

View file

@ -71,7 +71,6 @@ class SendWebMentions implements ShouldQueue
$endpoint = null;
/** @var Client $guzzle */
$guzzle = resolve(Client::class);
$response = $guzzle->get($url);
//check HTTP Headers for webmention endpoint

View file

@ -5,7 +5,7 @@
"keywords": ["laravel", "framework", "indieweb"],
"license": "CC0-1.0",
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-dom": "*",
"ext-intl": "*",
"ext-json": "*",
@ -42,6 +42,7 @@
"openai-php/client": "^0.6.1",
"phpunit/php-code-coverage": "^10.0",
"phpunit/phpunit": "^10.1",
"psalm/plugin-laravel": "^2.8",
"spatie/laravel-ray": "^1.12",
"vimeo/psalm": "^5.0"
},

213
composer.lock generated
View file

@ -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": "ebd4c00143a4dfb090f4d12d808d4782",
"content-hash": "a0824739b9d145bf875bf9ae54e89b07",
"packages": [
{
"name": "aws/aws-crt-php",
@ -9734,6 +9734,142 @@
],
"time": "2023-06-15T04:11:23+00:00"
},
{
"name": "orchestra/testbench",
"version": "v8.5.8",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench.git",
"reference": "df6976dd3d50a5aabe78195b38ae6fd1d3abee7b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/testbench/zipball/df6976dd3d50a5aabe78195b38ae6fd1d3abee7b",
"reference": "df6976dd3d50a5aabe78195b38ae6fd1d3abee7b",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.2",
"fakerphp/faker": "^1.21",
"laravel/framework": ">=10.13.5 <10.14.0",
"mockery/mockery": "^1.5.1",
"orchestra/testbench-core": ">=8.5.7 <8.6.0",
"php": "^8.1",
"phpunit/phpunit": "^9.6 || ^10.1",
"spatie/laravel-ray": "^1.32.4",
"symfony/process": "^6.2",
"symfony/yaml": "^6.2",
"vlucas/phpdotenv": "^5.4.1"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mior Muhammad Zaki",
"email": "crynobone@gmail.com",
"homepage": "https://github.com/crynobone"
}
],
"description": "Laravel Testing Helper for Packages Development",
"homepage": "https://packages.tools/testbench/",
"keywords": [
"BDD",
"TDD",
"dev",
"laravel",
"laravel-packages",
"testing"
],
"support": {
"issues": "https://github.com/orchestral/testbench/issues",
"source": "https://github.com/orchestral/testbench/tree/v8.5.8"
},
"time": "2023-06-13T23:59:59+00:00"
},
{
"name": "orchestra/testbench-core",
"version": "v8.5.8",
"source": {
"type": "git",
"url": "https://github.com/orchestral/testbench-core.git",
"reference": "c9c36e8ef9a8b91cbcc85f629be5ff3670133737"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/orchestral/testbench-core/zipball/c9c36e8ef9a8b91cbcc85f629be5ff3670133737",
"reference": "c9c36e8ef9a8b91cbcc85f629be5ff3670133737",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.2",
"php": "^8.1"
},
"require-dev": {
"fakerphp/faker": "^1.21",
"laravel/framework": "^10.13.5",
"laravel/pint": "^1.6",
"mockery/mockery": "^1.5.1",
"phpstan/phpstan": "^1.10.7",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ray": "^1.32.4",
"symfony/process": "^6.2",
"symfony/yaml": "^6.2",
"vlucas/phpdotenv": "^5.4.1"
},
"suggest": {
"brianium/paratest": "Allow using parallel tresting (^6.4 || ^7.1.4).",
"fakerphp/faker": "Allow using Faker for testing (^1.21).",
"laravel/framework": "Required for testing (^10.13.5).",
"mockery/mockery": "Allow using Mockery for testing (^1.5.1).",
"nunomaduro/collision": "Allow using Laravel style tests output and parallel testing (^6.4 || ^7.4).",
"orchestra/testbench-browser-kit": "Allow using legacy Laravel BrowserKit for testing (^8.0).",
"orchestra/testbench-dusk": "Allow using Laravel Dusk for testing (^8.0).",
"phpunit/phpunit": "Allow using PHPUnit for testing (^9.6 || ^10.1).",
"symfony/yaml": "Required for CLI Commander (^6.2).",
"vlucas/phpdotenv": "Required for CLI Commander (^5.4.1)."
},
"bin": [
"testbench"
],
"type": "library",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Orchestra\\Testbench\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mior Muhammad Zaki",
"email": "crynobone@gmail.com",
"homepage": "https://github.com/crynobone"
}
],
"description": "Testing Helper for Laravel Development",
"homepage": "https://packages.tools/testbench",
"keywords": [
"BDD",
"TDD",
"dev",
"laravel",
"laravel-packages",
"testing"
],
"support": {
"issues": "https://github.com/orchestral/testbench/issues",
"source": "https://github.com/orchestral/testbench-core"
},
"time": "2023-06-22T05:28:42+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
@ -10734,6 +10870,79 @@
},
"time": "2021-10-28T11:13:42+00:00"
},
{
"name": "psalm/plugin-laravel",
"version": "v2.8.0",
"source": {
"type": "git",
"url": "https://github.com/psalm/psalm-plugin-laravel.git",
"reference": "0b42a51f977d216e0b5d649f68346e2f324f4a55"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/psalm/psalm-plugin-laravel/zipball/0b42a51f977d216e0b5d649f68346e2f324f4a55",
"reference": "0b42a51f977d216e0b5d649f68346e2f324f4a55",
"shasum": ""
},
"require": {
"barryvdh/laravel-ide-helper": "^2.13",
"ext-simplexml": "*",
"illuminate/config": "^9.48 || ^10.0",
"illuminate/container": "^9.48 || ^10.0",
"illuminate/contracts": "^9.48 || ^10.0",
"illuminate/database": "^9.48 || ^10.0",
"illuminate/events": "^9.48 || ^10.0",
"illuminate/http": "^9.48 || ^10.0",
"illuminate/routing": "^9.48 || ^10.0",
"illuminate/support": "^9.48 || ^10.0",
"illuminate/view": "^9.48 || ^10.0",
"nikic/php-parser": "^4.13",
"orchestra/testbench": "^7.19 || ^8.0",
"php": "^8.0.2",
"symfony/console": "^6.0",
"vimeo/psalm": "^4.30 || ^5.1"
},
"require-dev": {
"codeception/codeception": "^5.0",
"codeception/module-asserts": "^3.0",
"codeception/module-cli": "^2.0",
"codeception/module-filesystem": "^3.0",
"codeception/module-phpbrowser": "^3.0",
"phpunit/phpunit": "^9.6 || ^10.0",
"ramsey/collection": "^1.3",
"slevomat/coding-standard": "^8.8",
"squizlabs/php_codesniffer": "*",
"symfony/http-foundation": "^6.0"
},
"type": "psalm-plugin",
"extra": {
"psalm": {
"pluginClass": "Psalm\\LaravelPlugin\\Plugin"
}
},
"autoload": {
"psr-4": {
"Psalm\\LaravelPlugin\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthew Brown",
"email": "github@muglug.com"
}
],
"description": "A Laravel plugin for Psalm",
"homepage": "https://github.com/psalm/psalm-plugin-laravel",
"support": {
"issues": "https://github.com/psalm/psalm-plugin-laravel/issues",
"source": "https://github.com/psalm/psalm-plugin-laravel/tree/v2.8.0"
},
"time": "2023-02-26T18:23:48+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
@ -12618,7 +12827,7 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.1",
"php": "^8.2",
"ext-dom": "*",
"ext-intl": "*",
"ext-json": "*"

View file

@ -1,23 +1,18 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="app" />
<directory name="app"/>
<directory name="database/factories"/>
<directory name="database/seeders"/>
<ignoreFiles>
<directory name="vendor" />
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<InvalidStaticInvocation>
<errorLevel type="suppress">
<file name="app/Providers/RouteServiceProvider.php" />
</errorLevel>
</InvalidStaticInvocation>
</issueHandlers>
</psalm>
<plugins><pluginClass class="Psalm\LaravelPlugin\Plugin"/></plugins></psalm>