From 27f63a230ac7def28270ac72832681ef70e10853 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 21 May 2019 13:08:38 +0200 Subject: [PATCH] some more PSR2 cleanup mostly overlong lines and more exclude patterns --- _test/phpcs.xml | 15 +++++++++------ inc/Cache/Cache.php | 8 +++++--- inc/Extension/RemotePlugin.php | 12 ++++++++---- inc/Remote/Api.php | 4 +++- inc/fulltext.php | 4 +++- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/_test/phpcs.xml b/_test/phpcs.xml index 98131e2fc..4ab65b2f2 100644 --- a/_test/phpcs.xml +++ b/_test/phpcs.xml @@ -7,7 +7,7 @@ - + ../inc @@ -32,6 +32,7 @@ */inc/cli.php + */inc/parser/* @@ -44,8 +45,6 @@ - */inc/parser/* - */inc/Plugin.php */inc/PluginInterface.php */inc/PluginTrait.php @@ -77,12 +76,16 @@ */inc/Extension/PluginInterface.php */inc/Extension/PluginTrait.php - - */inc/parser/* - + + */index.php + */inc/parserutils.php + */inc/mail.php + */inc/init.php + */inc/fulltext.php + */inc/Mailer.class.php */doku.php */install.php */feed.php diff --git a/inc/Cache/Cache.php b/inc/Cache/Cache.php index e30913b3b..599dc5f59 100644 --- a/inc/Cache/Cache.php +++ b/inc/Cache/Cache.php @@ -79,10 +79,12 @@ class Cache $this->addDependencies(); if ($this->_event) { - return $this->stats(Event::createAndTrigger($this->_event, $this, array($this, 'makeDefaultCacheDecision'))); - } else { - return $this->stats($this->makeDefaultCacheDecision()); + return $this->stats(Event::createAndTrigger( + $this->_event, $this, array($this, 'makeDefaultCacheDecision')) + ); } + + return $this->stats($this->makeDefaultCacheDecision()); } /** diff --git a/inc/Extension/RemotePlugin.php b/inc/Extension/RemotePlugin.php index 612db3349..33bca980a 100644 --- a/inc/Extension/RemotePlugin.php +++ b/inc/Extension/RemotePlugin.php @@ -41,9 +41,13 @@ abstract class RemotePlugin extends Plugin foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { // skip parent methods, only methods further down are exported $declaredin = $method->getDeclaringClass()->name; - if ($declaredin == 'dokuwiki\Extension\Plugin' || $declaredin == 'dokuwiki\Extension\RemotePlugin') continue; + if ($declaredin === 'dokuwiki\Extension\Plugin' || $declaredin === 'dokuwiki\Extension\RemotePlugin') { + continue; + } $method_name = $method->name; - if (substr($method_name, 0, 1) == '_') continue; + if (strpos($method_name, '_') === 0) { + continue; + } // strip asterisks $doc = $method->getDocComment(); @@ -94,10 +98,10 @@ abstract class RemotePlugin extends Plugin { $types = explode('|', $hint); foreach ($types as $t) { - if (substr($t, -2) == '[]') { + if (substr($t, -2) === '[]') { return 'array'; } - if ($t == 'boolean') { + if ($t === 'boolean') { return 'bool'; } if (in_array($t, array('array', 'string', 'int', 'double', 'bool', 'null', 'date', 'file'))) { diff --git a/inc/Remote/Api.php b/inc/Remote/Api.php index 9d473071e..5d9def59a 100644 --- a/inc/Remote/Api.php +++ b/inc/Remote/Api.php @@ -293,7 +293,9 @@ class Api /** @var RemotePlugin $plugin */ $plugin = plugin_load('remote', $pluginName); if (!is_subclass_of($plugin, 'dokuwiki\Extension\RemotePlugin')) { - throw new RemoteException("Plugin $pluginName does not implement dokuwiki\Plugin\DokuWiki_Remote_Plugin"); + throw new RemoteException( + "Plugin $pluginName does not implement dokuwiki\Plugin\DokuWiki_Remote_Plugin" + ); } try { diff --git a/inc/fulltext.php b/inc/fulltext.php index 51406fd34..e4d494c54 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -4,7 +4,9 @@ * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Andreas Gohr - */use dokuwiki\Extension\Event; + */ + +use dokuwiki\Extension\Event; /** * create snippets for the first few results only -- 2.11.4.GIT