Commit 4207b307 authored by catch's avatar catch

Issue #2901727 by iainp999, mfernea: Fix 'Drupal.Methods.MethodDeclaration' coding standard

parent 38ac1327
......@@ -30,7 +30,7 @@ public function findFile($class) {
/**
* Creates new mock file finder objects.
*/
static public function create($filename) {
public static function create($filename) {
$object = new static();
$object->filename = $filename;
return $object;
......
......@@ -20,7 +20,7 @@ class Timer {
* @param $name
* The name of the timer.
*/
static public function start($name) {
public static function start($name) {
static::$timers[$name]['start'] = microtime(TRUE);
static::$timers[$name]['count'] = isset(static::$timers[$name]['count']) ? ++static::$timers[$name]['count'] : 1;
}
......@@ -34,7 +34,7 @@ static public function start($name) {
* @return int
* The current timer value in ms.
*/
static public function read($name) {
public static function read($name) {
if (isset(static::$timers[$name]['start'])) {
$stop = microtime(TRUE);
$diff = round(($stop - static::$timers[$name]['start']) * 1000, 2);
......@@ -57,7 +57,7 @@ static public function read($name) {
* A timer array. The array contains the number of times the timer has been
* started and stopped (count) and the accumulated timer value in ms (time).
*/
static public function stop($name) {
public static function stop($name) {
if (isset(static::$timers[$name]['start'])) {
$stop = microtime(TRUE);
$diff = round(($stop - static::$timers[$name]['start']) * 1000, 2);
......
......@@ -48,7 +48,7 @@ protected function parse() {
*
* @return \Drupal\Core\TypedData\DataDefinitionInterface
*/
protected abstract function getElementDefinition($key);
abstract protected function getElementDefinition($key);
/**
* {@inheritdoc}
......
......@@ -33,7 +33,7 @@
* @return array
* Array of values with field names as keys.
*/
protected abstract function getFieldsToUpdate();
abstract protected function getFieldsToUpdate();
/**
* {@inheritdoc}
......
......@@ -115,7 +115,7 @@ public function __get($name) {
* @param string $destination
* The destination path.
*/
public final function copyDirectory($source, $destination) {
final public function copyDirectory($source, $destination) {
$source = $this->sanitizePath($source);
$destination = $this->fixRemotePath($destination);
$this->checkPath($destination);
......@@ -136,7 +136,7 @@ public function __get($name) {
*
* @see http://php.net/chmod
*/
public final function chmod($path, $mode, $recursive = FALSE) {
final public function chmod($path, $mode, $recursive = FALSE) {
if (!($this instanceof ChmodInterface)) {
throw new FileTransferException('Unable to change file permissions');
}
......@@ -152,7 +152,7 @@ public function __get($name) {
* @param string $directory
* The directory to be created.
*/
public final function createDirectory($directory) {
final public function createDirectory($directory) {
$directory = $this->fixRemotePath($directory);
$this->checkPath($directory);
$this->createDirectoryJailed($directory);
......@@ -164,7 +164,7 @@ public function __get($name) {
* @param string $directory
* The directory to be removed.
*/
public final function removeDirectory($directory) {
final public function removeDirectory($directory) {
$directory = $this->fixRemotePath($directory);
$this->checkPath($directory);
$this->removeDirectoryJailed($directory);
......@@ -178,7 +178,7 @@ public function __get($name) {
* @param string $destination
* The destination file.
*/
public final function copyFile($source, $destination) {
final public function copyFile($source, $destination) {
$source = $this->sanitizePath($source);
$destination = $this->fixRemotePath($destination);
$this->checkPath($destination);
......@@ -191,7 +191,7 @@ public function __get($name) {
* @param string $destination
* The destination file to be removed.
*/
public final function removeFile($destination) {
final public function removeFile($destination) {
$destination = $this->fixRemotePath($destination);
$this->checkPath($destination);
$this->removeFileJailed($destination);
......@@ -205,7 +205,7 @@ public function __get($name) {
*
* @throws \Drupal\Core\FileTransfer\FileTransferException
*/
protected final function checkPath($path) {
final protected function checkPath($path) {
$full_jail = $this->chroot . $this->jail;
$full_path = drupal_realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
$full_path = $this->fixRemotePath($full_path, FALSE);
......@@ -229,7 +229,7 @@ public function __get($name) {
* @return string
* The modified path.
*/
protected final function fixRemotePath($path, $strip_chroot = TRUE) {
final protected function fixRemotePath($path, $strip_chroot = TRUE) {
$path = $this->sanitizePath($path);
$path = preg_replace('|^([a-z]{1}):|i', '', $path); // Strip out windows driveletter if its there.
if ($strip_chroot) {
......
......@@ -166,7 +166,7 @@ protected function validateArguments(array $arguments) {
/**
* {@inheritdoc}
*/
public final function apply(array $arguments) {
final public function apply(array $arguments) {
$arguments = $this->prepareArguments($arguments);
$arguments = $this->validateArguments($arguments);
return $this->execute($arguments);
......
......@@ -50,7 +50,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
/**
* {@inheritdoc}
*/
static public function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
......
......@@ -64,6 +64,6 @@ public function fields(MigrationInterface $migration = NULL) {
* @return \Drupal\Core\Entity\Display\EntityDisplayInterface
* The entity display object.
*/
protected abstract function getEntity($entity_type, $bundle, $mode);
abstract protected function getEntity($entity_type, $bundle, $mode);
}
......@@ -177,7 +177,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
* @return array
* An array of the data for this source.
*/
protected abstract function initializeIterator();
abstract protected function initializeIterator();
/**
* Gets the module handler.
......
......@@ -117,7 +117,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
/**
* {@inheritdoc}
*/
static public function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
......
......@@ -69,7 +69,7 @@ protected function getTestBin() {
* @return \Drupal\Core\Cache\CacheBackendInterface
* Cache backend to test.
*/
protected abstract function createCacheBackend($bin);
abstract protected function createCacheBackend($bin);
/**
* Allows specific implementation to change the environment before a test run.
......
......@@ -52,7 +52,7 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
/**
* {@inheritdoc}
*/
static public function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$container->get('database'),
$container->get('entity.manager'),
......
......@@ -107,7 +107,7 @@ public function preRender(array $results) {
* @return array
* In any case we need a valid Drupal render array to return.
*/
public abstract function render($empty = FALSE);
abstract public function render($empty = FALSE);
/**
* Does that area have nothing to show.
......
......@@ -77,6 +77,11 @@
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/RequiredSniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Methods/MethodDeclarationSniff.php">
<!-- Silence method name underscore warning which is covered already in
Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps. -->
<exclude name="Drupal.Methods.MethodDeclaration.Underscore"/>
</rule>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php">
<!-- Sniff for: LowerStart -->
<exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
......
......@@ -66,7 +66,7 @@ protected function getTestBin() {
* @return \Drupal\Core\Cache\CacheBackendInterface
* Cache backend to test.
*/
protected abstract function createCacheBackend($bin);
abstract protected function createCacheBackend($bin);
/**
* Allows specific implementation to change the environment before a test run.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment