From fd9f522f46c6e06cc4ae31a31b388e5fd0ab12d8 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Thu, 16 May 2019 01:27:32 +0700 Subject: [PATCH] phpstan config --- .phpstan.neon | 8 ++++++++ .pre-commit-config.yaml | 3 +++ kril.php | 14 ++------------ run.php | 2 +- wiki.php | 4 ++-- 5 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 .phpstan.neon diff --git a/.phpstan.neon b/.phpstan.neon new file mode 100644 index 0000000..c031858 --- /dev/null +++ b/.phpstan.neon @@ -0,0 +1,8 @@ +parameters: + level: 5 + autoload_files: + ignoreErrors: + excludes_analyse: + - vendor/ + - vndb-client-php/ + - tests/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8562571..f0418ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,3 +8,6 @@ repos: - id: php-md files: \.(php)$ args: ["codesize,controversial,design,naming,unusedcode"] +# - id: php-stan +# files: \.(php)$ +# args: ["--configuration=.phpstan.neon"] diff --git a/kril.php b/kril.php index 10596a1..cbb34d6 100755 --- a/kril.php +++ b/kril.php @@ -33,14 +33,6 @@ $client = new GuzzleClient([ 'timeout' => 30, ]); -/** - * Function to download images. - * - * @return string - */ -function get_file($url) { -} - $api = json_decode(file_get_contents('http://forum.ifiction.ru/extern.php?action=kril2018')); foreach ($api as $category) { $category_title = $category->category; @@ -81,9 +73,7 @@ foreach ($api as $category) { $game->url_online = $files[1]->url; $game->url_online_description = $files[1]->title; } - if ($game) { - $page = new Wikipage($game); - $page->create(); - } + $page = new Wikipage($game); + $page->create(); } } diff --git a/run.php b/run.php index 4066b69..b071597 100755 --- a/run.php +++ b/run.php @@ -33,7 +33,7 @@ $parsers = 'all'; if (PHP_SAPI !== 'cli') { ob_start(); echo '
';
-  if (isset($_GET) && isset($_GET['parsers'])) {
+  if (isset($_GET['parsers'])) {
     $parsers = $_GET['parsers'];
     $parsers = explode(',', $parsers);
   }
diff --git a/wiki.php b/wiki.php
index 351f487..cada919 100755
--- a/wiki.php
+++ b/wiki.php
@@ -33,7 +33,7 @@ if (!isset($argv[1])) {
   die();
 }
 $url = $argv[1];
-$game = new Game;
+$game = new Game();
 
 function check($classname) {
   global $game;
@@ -54,7 +54,7 @@ function check($classname) {
   }
 }
 
-check ('Urq', 'urq');
+check ('Urq');
 check ('Qsp');
 check ('Kvester');
 check ('Apero');