aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2019-05-21 13:08:38 +0200
committerAndreas Gohr <andi@splitbrain.org>2019-05-21 13:08:38 +0200
commit27f63a230ac7def28270ac72832681ef70e10853 (patch)
tree5856d1aa30577629b2d8513965006e9cc0ba29fe
parentf42515548aab88878ae4121496a4e70a00b6af63 (diff)
downloaddokuwiki-27f63a230ac7def28270ac72832681ef70e10853.tar.gz
dokuwiki-27f63a230ac7def28270ac72832681ef70e10853.zip
some more PSR2 cleanup
mostly overlong lines and more exclude patterns
-rw-r--r--_test/phpcs.xml15
-rw-r--r--inc/Cache/Cache.php8
-rw-r--r--inc/Extension/RemotePlugin.php12
-rw-r--r--inc/Remote/Api.php4
-rw-r--r--inc/fulltext.php4
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 @@
<arg value="sp"/>
<arg name="extensions" value="php"/>
- <ini name="memory_limit" value="-1" />
+ <ini name="memory_limit" value="-1"/>
<!-- where to look -->
<file>../inc</file>
@@ -32,6 +32,7 @@
<!-- deprecated files to be removed soon -->
<exclude-pattern>*/inc/cli.php</exclude-pattern>
+ <exclude-pattern>*/inc/parser/*</exclude-pattern>
<!-- rules on top of PSR-2 -->
<rule ref="PSR2">
@@ -44,8 +45,6 @@
<!-- disable some rules for certain paths, for legacy support -->
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
- <exclude-pattern>*/inc/parser/*</exclude-pattern>
-
<exclude-pattern>*/inc/Plugin.php</exclude-pattern>
<exclude-pattern>*/inc/PluginInterface.php</exclude-pattern>
<exclude-pattern>*/inc/PluginTrait.php</exclude-pattern>
@@ -77,12 +76,16 @@
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>*/inc/Extension/PluginInterface.php</exclude-pattern>
<exclude-pattern>*/inc/Extension/PluginTrait.php</exclude-pattern>
-
- <exclude-pattern>*/inc/parser/*</exclude-pattern>
</rule>
- <!-- for now we mix declarations and execution here FIXME -->
+ <!-- for now we mix declarations and execution here (mostly for defines) -->
<rule ref="PSR1.Files.SideEffects">
+ <exclude-pattern>*/index.php</exclude-pattern>
+ <exclude-pattern>*/inc/parserutils.php</exclude-pattern>
+ <exclude-pattern>*/inc/mail.php</exclude-pattern>
+ <exclude-pattern>*/inc/init.php</exclude-pattern>
+ <exclude-pattern>*/inc/fulltext.php</exclude-pattern>
+ <exclude-pattern>*/inc/Mailer.class.php</exclude-pattern>
<exclude-pattern>*/doku.php</exclude-pattern>
<exclude-pattern>*/install.php</exclude-pattern>
<exclude-pattern>*/feed.php</exclude-pattern>
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 <andi@splitbrain.org>
- */use dokuwiki\Extension\Event;
+ */
+
+use dokuwiki\Extension\Event;
/**
* create snippets for the first few results only