Add PHPStan

This commit is contained in:
Belle Aerni 2023-01-06 18:25:28 -08:00
parent 6a354be240
commit 28ca1b87e4
7 changed files with 101 additions and 12 deletions

20
.github/phpstan.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: PHPStan
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpstan@v3
with:
configuration: phpstan.neon
memory_limit: 256M

View file

@ -16,5 +16,8 @@
],
"config": {
"vendor-dir": "src/Vendor"
},
"require-dev": {
"phpstan/phpstan": "^1.9"
}
}

78
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": "9fa90e5bf5828bb52c3654d04fd7383d",
"content-hash": "067bc4256a432b52ef1ab88b7708353e",
"packages": [
{
"name": "michelf/php-markdown",
@ -146,20 +146,20 @@
},
{
"name": "symfony/yaml",
"version": "v6.2.2",
"version": "v6.0.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "6ed8243aa5f2cb5a57009f826b5e7fb3c4200cf3"
"reference": "76c08913ea1c50541503a4563b2172710189fa29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/6ed8243aa5f2cb5a57009f826b5e7fb3c4200cf3",
"reference": "6ed8243aa5f2cb5a57009f826b5e7fb3c4200cf3",
"url": "https://api.github.com/repos/symfony/yaml/zipball/76c08913ea1c50541503a4563b2172710189fa29",
"reference": "76c08913ea1c50541503a4563b2172710189fa29",
"shasum": ""
},
"require": {
"php": ">=8.1",
"php": ">=8.0.2",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
@ -200,7 +200,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.2.2"
"source": "https://github.com/symfony/yaml/tree/v6.0.17"
},
"funding": [
{
@ -216,10 +216,70 @@
"type": "tidelift"
}
],
"time": "2022-12-14T16:11:27+00:00"
"time": "2022-12-14T15:52:41+00:00"
}
],
"packages-dev": [
{
"name": "phpstan/phpstan",
"version": "1.9.7",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "0501435cd342eac7664bd62155b1ef907fc60b6f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0501435cd342eac7664bd62155b1ef907fc60b6f",
"reference": "0501435cd342eac7664bd62155b1ef907fc60b6f",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.9.7"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
"type": "tidelift"
}
],
"time": "2023-01-04T21:59:57+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],

7
phpstan.neon Normal file
View file

@ -0,0 +1,7 @@
parameters:
level: 5
paths:
- src
excludePaths:
analyse:
- src/Vendor

View file

@ -120,7 +120,7 @@ class AntCMS
$pageHeaders['author'] = trim($matches[1] ?? 'AntCMS');
preg_match('/Description: (.*)/', $header, $matches);
$pageHeaders['description'] = trim($matches[1]) ?? 'AntCMS';
$pageHeaders['description'] = trim($matches[1] ?? 'AntCMS');
preg_match('/Keywords: (.*)/', $header, $matches);
$pageHeaders['keywords'] = trim($matches[1] ?? $AntKeywords->generateKeywords($pageContent));

View file

@ -42,7 +42,6 @@ class AntMarkdown
':flushed:' => '😳',
':frowning:' => '😦',
':anguished:' => '😧',
':fearful:' => '😨',
':weary:' => '😩',
':exploding_head:' => '🤯',
':grimacing:' => '😬',

View file

@ -1,7 +1,7 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('display_errors', '1');
const AntDir = __DIR__;
const AntCachePath = __DIR__ . '/Cache';