Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
4207b307
Commit
4207b307
authored
Sep 06, 2017
by
Nathaniel Catchpole
Browse files
Issue
#2901727
by iainp999, mfernea: Fix 'Drupal.Methods.MethodDeclaration' coding standard
parent
38ac1327
Changes
15
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Component/Annotation/Reflection/MockFileFinder.php
View file @
4207b307
...
...
@@ -30,7 +30,7 @@ public function findFile($class) {
/**
* Creates new mock file finder objects.
*/
static
publ
ic
function
create
(
$filename
)
{
public
stat
ic
function
create
(
$filename
)
{
$object
=
new
static
();
$object
->
filename
=
$filename
;
return
$object
;
...
...
core/lib/Drupal/Component/Utility/Timer.php
View file @
4207b307
...
...
@@ -20,7 +20,7 @@ class Timer {
* @param $name
* The name of the timer.
*/
static
publ
ic
function
start
(
$name
)
{
public
stat
ic
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
publ
ic
function
read
(
$name
)
{
public
stat
ic
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
publ
ic
function
stop
(
$name
)
{
public
stat
ic
function
stop
(
$name
)
{
if
(
isset
(
static
::
$timers
[
$name
][
'start'
]))
{
$stop
=
microtime
(
TRUE
);
$diff
=
round
((
$stop
-
static
::
$timers
[
$name
][
'start'
])
*
1000
,
2
);
...
...
core/lib/Drupal/Core/Config/Schema/ArrayElement.php
View file @
4207b307
...
...
@@ -48,7 +48,7 @@ protected function parse() {
*
* @return \Drupal\Core\TypedData\DataDefinitionInterface
*/
protected
abstract
function
getElementDefinition
(
$key
);
abstract
protected
function
getElementDefinition
(
$key
);
/**
* {@inheritdoc}
...
...
core/lib/Drupal/Core/Field/FieldUpdateActionBase.php
View file @
4207b307
...
...
@@ -33,7 +33,7 @@ abstract class FieldUpdateActionBase extends ActionBase {
* @return array
* Array of values with field names as keys.
*/
protected
abstract
function
getFieldsToUpdate
();
abstract
protected
function
getFieldsToUpdate
();
/**
* {@inheritdoc}
...
...
core/lib/Drupal/Core/FileTransfer/FileTransfer.php
View file @
4207b307
...
...
@@ -115,7 +115,7 @@ abstract public function connect();
* @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 final function copyDirectory($source, $destination) {
*
* @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 final function chmod($path, $mode, $recursive = FALSE) {
* @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 final function createDirectory($directory) {
* @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 final function removeDirectory($directory) {
* @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 final function copyFile($source, $destination) {
* @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 final function removeFile($destination) {
*
* @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 @@ protected final function checkPath($path) {
* @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
)
{
...
...
core/lib/Drupal/Core/ImageToolkit/ImageToolkitOperationBase.php
View file @
4207b307
...
...
@@ -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
);
...
...
core/modules/editor/src/Plugin/Filter/EditorFileReference.php
View file @
4207b307
...
...
@@ -50,7 +50,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
/**
* {@inheritdoc}
*/
static
publ
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
public
stat
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$configuration
,
$plugin_id
,
...
...
core/modules/migrate/src/Plugin/migrate/destination/ComponentEntityDisplayBase.php
View file @
4207b307
...
...
@@ -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
);
}
core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
View file @
4207b307
...
...
@@ -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.
...
...
core/modules/node/src/Plugin/Search/NodeSearch.php
View file @
4207b307
...
...
@@ -117,7 +117,7 @@ class NodeSearch extends ConfigurableSearchPluginBase implements AccessibleInter
/**
* {@inheritdoc}
*/
static
publ
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
public
stat
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$configuration
,
$plugin_id
,
...
...
core/modules/system/src/Tests/Cache/GenericCacheBackendUnitTestBase.php
View file @
4207b307
...
...
@@ -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.
...
...
core/modules/user/src/Plugin/Search/UserSearch.php
View file @
4207b307
...
...
@@ -52,7 +52,7 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
/**
* {@inheritdoc}
*/
static
publ
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
public
stat
ic
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$container
->
get
(
'database'
),
$container
->
get
(
'entity.manager'
),
...
...
core/modules/views/src/Plugin/views/area/AreaPluginBase.php
View file @
4207b307
...
...
@@ -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.
...
...
core/phpcs.xml.dist
View file @
4207b307
...
...
@@ -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"
/>
...
...
core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
View file @
4207b307
...
...
@@ -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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment