Issue #2706753 by Mile23: Fix 'PSR2.Classes.PropertyDeclaration.ScopeMissing/VarUsed' coding standard

8.2.x
Alex Pott 2016-05-05 12:21:09 +01:00
parent a239719598
commit c26745da88
41 changed files with 79 additions and 74 deletions

View File

@ -18,7 +18,7 @@ class DiffFormatter {
/**
* Should a block header be shown?
*/
var $show_header = TRUE;
public $show_header = TRUE;
/**
* Number of leading context "lines" to preserve.
@ -26,7 +26,7 @@ class DiffFormatter {
* This should be left at zero for this class, but subclasses
* may want to set this to other values.
*/
var $leading_context_lines = 0;
public $leading_context_lines = 0;
/**
* Number of trailing context "lines" to preserve.
@ -34,7 +34,7 @@ class DiffFormatter {
* This should be left at zero for this class, but subclasses
* may want to set this to other values.
*/
var $trailing_context_lines = 0;
public $trailing_context_lines = 0;
/**
* Format a diff.

View File

@ -8,9 +8,9 @@ namespace Drupal\Component\Diff\Engine;
* @subpackage DifferenceEngine
*/
class DiffOp {
var $type;
var $orig;
var $closing;
public $type;
public $orig;
public $closing;
public function reverse() {
trigger_error('pure virtual', E_USER_ERROR);

View File

@ -8,7 +8,7 @@ namespace Drupal\Component\Diff\Engine;
* @subpackage DifferenceEngine
*/
class DiffOpAdd extends DiffOp {
var $type = 'add';
public $type = 'add';
public function __construct($lines) {
$this->closing = $lines;

View File

@ -8,7 +8,7 @@ namespace Drupal\Component\Diff\Engine;
* @subpackage DifferenceEngine
*/
class DiffOpChange extends DiffOp {
var $type = 'change';
public $type = 'change';
public function __construct($orig, $closing) {
$this->orig = $orig;

View File

@ -8,7 +8,7 @@ namespace Drupal\Component\Diff\Engine;
* @subpackage DifferenceEngine
*/
class DiffOpCopy extends DiffOp {
var $type = 'copy';
public $type = 'copy';
public function __construct($orig, $closing = FALSE) {
if (!is_array($closing)) {

View File

@ -8,7 +8,7 @@ namespace Drupal\Component\Diff\Engine;
* @subpackage DifferenceEngine
*/
class DiffOpDelete extends DiffOp {
var $type = 'delete';
public $type = 'delete';
public function __construct($lines) {
$this->orig = $lines;

View File

@ -41,7 +41,7 @@ class Connection extends DatabaseConnection {
*
* @var bool
*/
var $tableDropped = FALSE;
public $tableDropped = FALSE;
/**
* Constructs a \Drupal\Core\Database\Driver\sqlite\Connection object.

View File

@ -21,7 +21,7 @@ class PagerSelectExtender extends SelectExtender {
*
* @var int
*/
static $maxElement = 0;
public static $maxElement = 0;
/**
* The number of elements per page to allow.

View File

@ -29,7 +29,7 @@ class PhpassHashedPassword implements PasswordInterface {
/**
* Returns a string for mapping an int to the corresponding base 64 character.
*/
static $ITOA64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
public static $ITOA64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
/**
* Specifies the number of times the hashing function will be applied when

View File

@ -16,7 +16,7 @@ class MigrateBlockTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
static $modules = [
public static $modules = [
'block',
'views',
'comment',

View File

@ -15,7 +15,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
*/
class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
static $modules = array('block', 'block_content', 'filter', 'text');
public static $modules = array('block', 'block_content', 'filter', 'text');
/**
* {@inheritdoc}

View File

@ -13,7 +13,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
*/
class MigrateBlockContentTypeTest extends MigrateDrupal7TestBase {
static $modules = array('block', 'block_content', 'filter', 'text');
public static $modules = array('block', 'block_content', 'filter', 'text');
/**
* {@inheritdoc}

View File

@ -20,7 +20,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
*
* @var array
*/
static $modules = array(
public static $modules = array(
'comment',
'datetime',
'file',

View File

@ -18,7 +18,7 @@ class MigrateFieldTest extends MigrateDrupal7TestBase {
*
* @var array
*/
static $modules = array(
public static $modules = array(
'comment',
'datetime',
'file',

View File

@ -14,7 +14,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
*/
class MigrateFileTest extends MigrateDrupal7TestBase {
static $modules = ['file'];
public static $modules = ['file'];
/**
* {@inheritdoc}

View File

@ -16,7 +16,7 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
static $modules = array('filter');
public static $modules = array('filter');
/**
* {@inheritdoc}

View File

@ -21,7 +21,7 @@ class HistoryUserTimestamp extends FilterPluginBase {
use UncacheableDependencyTrait;
// Don't display empty space where the operator would be.
var $no_operator = TRUE;
public $no_operator = TRUE;
/**
* {@inheritdoc}

View File

@ -22,12 +22,12 @@ use Drupal\views\Plugin\views\row\RssPluginBase;
class Rss extends RssPluginBase {
// Basic properties that let the row style follow relationships.
var $base_table = 'node_field_data';
public $base_table = 'node_field_data';
var $base_field = 'nid';
public $base_field = 'nid';
// Stores the nodes loaded with preRender.
var $nodes = array();
public $nodes = array();
/**
* {@inheritdoc}

View File

@ -13,7 +13,7 @@ use Drupal\node\NodeInterface;
*/
class MigrateNodeTest extends MigrateDrupal7TestBase {
static $modules = array(
public static $modules = array(
'comment',
'datetime',
'filter',

View File

@ -18,7 +18,7 @@ class MigrateShortcutSetTest extends MigrateDrupal7TestBase {
*
* @var array
*/
static $modules = array(
public static $modules = array(
'link',
'field',
'shortcut',

View File

@ -17,7 +17,7 @@ class MigrateShortcutSetUsersTest extends MigrateDrupal7TestBase {
*
* @var array
*/
static $modules = array(
public static $modules = array(
'link',
'field',
'shortcut',

View File

@ -18,7 +18,7 @@ class MigrateShortcutTest extends MigrateDrupal7TestBase {
*
* @var array
*/
static $modules = array(
public static $modules = array(
'link',
'field',
'shortcut',

View File

@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class TaxonomyIndexTid extends ManyToOne {
// Stores the exposed input for this filter.
var $validated_exposed_input = NULL;
public $validated_exposed_input = NULL;
/**
* The vocabulary storage.

View File

@ -55,15 +55,15 @@ use Drupal\views\Views;
*/
abstract class ArgumentPluginBase extends HandlerBase implements CacheableDependencyInterface {
var $validator = NULL;
var $argument = NULL;
var $value = NULL;
public $validator = NULL;
public $argument = NULL;
public $value = NULL;
/**
* The table to use for the name, should it not be in the same table as the argument.
* @var string
*/
var $name_table;
public $name_table;
/**
* The field to use for the name to use in the summary, which is
@ -71,7 +71,7 @@ abstract class ArgumentPluginBase extends HandlerBase implements CacheableDepend
* the argument itself is the nid, but node.title is displayed.
* @var string
*/
var $name_field;
public $name_field;
/**
* Overrides Drupal\views\Plugin\views\HandlerBase:init().

View File

@ -40,7 +40,7 @@ class Date extends Formula implements ContainerFactoryPluginInterface {
*/
protected $argFormat = 'Y-m-d';
var $option_name = 'default_argument_date';
public $option_name = 'default_argument_date';
/**
* The route match.

View File

@ -19,7 +19,7 @@ use Drupal\views\ViewExecutable;
*/
class Formula extends ArgumentPluginBase {
var $formula = NULL;
public $formula = NULL;
/**
* {@inheritdoc}

View File

@ -18,13 +18,13 @@ class NumericArgument extends ArgumentPluginBase {
* The operator used for the query: or|and.
* @var string
*/
var $operator;
public $operator;
/**
* The actual value which is used for querying.
* @var array
*/
var $value;
public $value;
protected function defineOptions() {
$options = parent::defineOptions();

View File

@ -31,7 +31,7 @@ abstract class CachePluginBase extends PluginBase {
/**
* Contains all data that should be written/read from cache.
*/
var $storage = array();
public $storage = array();
/**
* Which cache bin to store query results in.

View File

@ -30,7 +30,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
*
* @var \Drupal\views\ViewExecutable
*/
var $view = NULL;
public $view = NULL;
/**
* An array of instantiated handlers used in this display.

View File

@ -68,8 +68,8 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
*/
const RENDER_TEXT_PHASE_EMPTY = 2;
var $field_alias = 'unknown';
var $aliases = array();
public $field_alias = 'unknown';
public $aliases = array();
/**
* The field value prior to any rewriting.
@ -85,7 +85,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
*
* @var array
*/
var $additional_fields = array();
public $additional_fields = array();
/**
* The link generator.

View File

@ -25,7 +25,7 @@ abstract class PrerenderList extends FieldPluginBase implements MultiItemsFieldH
*
* @var array
*/
var $items = array();
public $items = array();
/**
* {@inheritdoc}

View File

@ -44,9 +44,9 @@ class BooleanOperator extends FilterPluginBase {
// exposed filter options
protected $alwaysMultiple = TRUE;
// Don't display empty space where the operator would be.
var $no_operator = TRUE;
public $no_operator = TRUE;
// Whether to accept NULL as a false value or not
var $accept_null = FALSE;
public $accept_null = FALSE;

View File

@ -16,7 +16,7 @@ class Combine extends StringFilter {
/**
* @var views_plugin_query_default
*/
var $query;
public $query;
protected function defineOptions() {
$options = parent::defineOptions();

View File

@ -48,17 +48,17 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
* Contains the actual value of the field,either configured in the views ui
* or entered in the exposed filters.
*/
var $value = NULL;
public $value = NULL;
/**
* Contains the operator which is used on the query.
*/
var $operator = '=';
public $operator = '=';
/**
* Contains the information of the selected item in a grouped filter.
*/
var $group_info = NULL;
public $group_info = NULL;
/**
* @var bool
@ -70,13 +70,13 @@ abstract class FilterPluginBase extends HandlerBase implements CacheableDependen
* @var bool
* Disable the possibility to use operators.
*/
var $no_operator = FALSE;
public $no_operator = FALSE;
/**
* @var bool
* Disable the possibility to allow a exposed input to be optional.
*/
var $always_required = FALSE;
public $always_required = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\HandlerBase::init().

View File

@ -26,7 +26,7 @@ class ManyToOne extends InOperator {
*
* Stores the Helper object which handles the many_to_one complexity.
*/
var $helper = NULL;
public $helper = NULL;
/**
* {@inheritdoc}

View File

@ -27,9 +27,9 @@ use Drupal\views\Plugin\views\PluginBase;
*/
abstract class PagerPluginBase extends PluginBase {
var $current_page = NULL;
public $current_page = NULL;
var $total_items = 0;
public $total_items = 0;
/**
* {@inheritdoc}

View File

@ -38,7 +38,7 @@ abstract class QueryPluginBase extends PluginBase implements CacheableDependency
*
* @var views_plugin_pager
*/
var $pager = NULL;
public $pager = NULL;
/**
* Stores the limit of items that should be requested in the query.
@ -62,7 +62,7 @@ abstract class QueryPluginBase extends PluginBase implements CacheableDependency
* @param view $view
* The view which is executed.
*/
function alter(ViewExecutable $view) { }
public function alter(ViewExecutable $view) { }
/**
* Builds the necessary info to execute the query.
@ -70,7 +70,7 @@ abstract class QueryPluginBase extends PluginBase implements CacheableDependency
* @param view $view
* The view which is executed.
*/
function build(ViewExecutable $view) { }
public function build(ViewExecutable $view) { }
/**
* Executes the query and fills the associated view object with according
@ -85,7 +85,7 @@ abstract class QueryPluginBase extends PluginBase implements CacheableDependency
* @param view $view
* The view which is executed.
*/
function execute(ViewExecutable $view) { }
public function execute(ViewExecutable $view) { }
/**
* Add a signature to the query, if such a thing is feasible.

View File

@ -35,26 +35,26 @@ class Sql extends QueryPluginBase {
/**
* Holds an array of tables and counts added so that we can create aliases
*/
var $tables = array();
public $tables = array();
/**
* Holds an array of relationships, which are aliases of the primary
* table that represent different ways to join the same table in.
*/
var $relationships = array();
public $relationships = array();
/**
* An array of sections of the WHERE query. Each section is in itself
* an array of pieces and a flag as to whether or not it should be AND
* or OR.
*/
var $where = array();
public $where = array();
/**
* An array of sections of the HAVING query. Each section is in itself
* an array of pieces and a flag as to whether or not it should be AND
* or OR.
*/
var $having = array();
public $having = array();
/**
* The default operator to use when connecting the WHERE groups. May be
* AND or OR.
@ -64,23 +64,23 @@ class Sql extends QueryPluginBase {
/**
* A simple array of order by clauses.
*/
var $orderby = array();
public $orderby = array();
/**
* A simple array of group by clauses.
*/
var $groupby = array();
public $groupby = array();
/**
* An array of fields.
*/
var $fields = array();
public $fields = array();
/**
* A flag as to whether or not to make the primary field distinct.
*/
var $distinct = FALSE;
public $distinct = FALSE;
protected $hasAggregate = FALSE;
@ -97,7 +97,7 @@ class Sql extends QueryPluginBase {
/**
* Query tags which will be passed over to the dbtng query object.
*/
var $tags = array();
public $tags = array();
/**
* Is the view marked as not distinct.
@ -993,7 +993,7 @@ class Sql extends QueryPluginBase {
/**
* Generates a unique placeholder used in the db query.
*/
function placeholder($base = 'views') {
public function placeholder($base = 'views') {
static $placeholders = array();
if (!isset($placeholders[$base])) {
$placeholders[$base] = 0;
@ -1332,14 +1332,14 @@ class Sql extends QueryPluginBase {
/**
* Let modules modify the query just prior to finalizing it.
*/
function alter(ViewExecutable $view) {
public function alter(ViewExecutable $view) {
\Drupal::moduleHandler()->invokeAll('views_query_alter', array($view, $this));
}
/**
* Builds the necessary info to execute the query.
*/
function build(ViewExecutable $view) {
public function build(ViewExecutable $view) {
// Make the query distinct if the option was set.
if (!empty($this->options['distinct'])) {
$this->setDistinct(TRUE);
@ -1364,7 +1364,7 @@ class Sql extends QueryPluginBase {
* Values to set: $view->result, $view->total_rows, $view->execute_time,
* $view->current_page.
*/
function execute(ViewExecutable $view) {
public function execute(ViewExecutable $view) {
$query = $view->build_info['query'];
$count_query = $view->build_info['count_query'];

View File

@ -22,7 +22,7 @@ class PluginBaseTest extends KernelTestBase {
/**
* @var TestPluginBase
*/
var $testPluginBase;
protected $testPluginBase;
protected function setUp() {
parent::setUp();

View File

@ -105,6 +105,11 @@
<rule ref="Generic.PHP.UpperCaseConstant"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- PSR-2 sniffs -->
<rule ref="PSR2.Classes.PropertyDeclaration">
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
</rule>
<!-- Squiz sniffs -->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>

View File

@ -19,7 +19,7 @@ class ConfigEntityQueryTest extends KernelTestBase {
*
* @var array
*/
static $modules = array('config_test');
public static $modules = array('config_test');
/**
* Stores the search results for alter comparison.