' . t('This page provides a drag-and-drop interface for adding a block to a region, and for controlling the order of blocks within regions. To add a block to a region, or to configure its specific title and visibility settings, click the block title under Place blocks. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the Save blocks button at the bottom of the page.') . '
';
@@ -83,7 +83,7 @@ function block_page_build(&$page) {
// Fetch a list of regions for the current theme.
$all_regions = system_region_list($theme);
- if (\Drupal::routeMatch()->getRouteName() != 'block.admin_demo') {
+ if (\Drupal::routeMatch()->getRouteName() !== 'block.admin_demo') {
// Create a full page display variant, which will load blocks into their
// regions.
$page += \Drupal::service('plugin.manager.display_variant')
@@ -103,7 +103,7 @@ function block_page_build(&$page) {
$page['page_top']['backlink'] = array(
'#type' => 'link',
'#title' => t('Exit block region demonstration'),
- '#href' => 'admin/structure/block' . (\Drupal::config('system.theme')->get('default') == $theme ? '' : '/list/' . $theme),
+ '#href' => 'admin/structure/block' . (\Drupal::config('system.theme')->get('default') === $theme ? '' : '/list/' . $theme),
'#options' => array('attributes' => array('class' => array('block-demo-backlink'))),
'#weight' => -10,
);
@@ -134,14 +134,14 @@ function _block_rehash($theme = NULL) {
$region = $block->get('region');
$status = $block->status();
// Disable blocks in invalid regions.
- if (!empty($region) && $region != BlockInterface::BLOCK_REGION_NONE && !isset($regions[$region]) && $status) {
+ if (!empty($region) && $region !== BlockInterface::BLOCK_REGION_NONE && !isset($regions[$region]) && $status) {
drupal_set_message(t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $block_id, '%region' => $region)), 'warning');
// Disabled modules are moved into the BlockInterface::BLOCK_REGION_NONE
// later so no need to move the block to another region.
$block->disable()->save();
}
// Set region to none if not enabled.
- if (!$status && $region != BlockInterface::BLOCK_REGION_NONE) {
+ if (!$status && $region !== BlockInterface::BLOCK_REGION_NONE) {
$block->set('region', BlockInterface::BLOCK_REGION_NONE);
$block->save();
}
@@ -310,7 +310,7 @@ function block_user_role_delete($role) {
function block_menu_delete(Menu $menu) {
if (!$menu->isSyncing()) {
foreach (Block::loadMultiple() as $block) {
- if ($block->get('plugin') == 'system_menu_block:' . $menu->id()) {
+ if ($block->get('plugin') === 'system_menu_block:' . $menu->id()) {
$block->delete();
}
}
diff --git a/core/modules/block/src/BlockAccessControlHandler.php b/core/modules/block/src/BlockAccessControlHandler.php
index 8bfa365..c9e064a 100644
--- a/core/modules/block/src/BlockAccessControlHandler.php
+++ b/core/modules/block/src/BlockAccessControlHandler.php
@@ -24,7 +24,7 @@ class BlockAccessControlHandler extends EntityAccessControlHandler {
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
/** @var $entity \Drupal\block\BlockInterface */
- if ($operation != 'view') {
+ if ($operation !== 'view') {
return parent::checkAccess($entity, $operation, $langcode, $account);
}
diff --git a/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php
index e5da65d..608ab33 100644
--- a/core/modules/block/src/BlockListBuilder.php
+++ b/core/modules/block/src/BlockListBuilder.php
@@ -216,7 +216,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
),
);
$form['blocks'][$region]['title'] = array(
- '#markup' => $region != BlockInterface::BLOCK_REGION_NONE ? $title : t('Disabled'),
+ '#markup' => $region !== BlockInterface::BLOCK_REGION_NONE ? $title : t('Disabled'),
'#wrapper_attributes' => array(
'colspan' => 5,
),
@@ -247,7 +247,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'class' => array('draggable'),
),
);
- if ($placement && $placement == drupal_html_class($entity_id)) {
+ if ($placement && $placement === drupal_html_class($entity_id)) {
$form['blocks'][$entity_id]['#attributes']['id'] = 'block-placed';
}
@@ -404,7 +404,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$entity_values = $form_state->getValue(array('blocks', $entity_id));
$entity->set('weight', $entity_values['weight']);
$entity->set('region', $entity_values['region']);
- if ($entity->get('region') == BlockInterface::BLOCK_REGION_NONE) {
+ if ($entity->get('region') === BlockInterface::BLOCK_REGION_NONE) {
$entity->disable();
}
else {
diff --git a/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php
index ee977d0..f629ee1 100644
--- a/core/modules/block/src/Entity/Block.php
+++ b/core/modules/block/src/Entity/Block.php
@@ -136,7 +136,7 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
return $status;
}
// Sort by weight, unless disabled.
- if ($a->get('region') != static::BLOCK_REGION_NONE) {
+ if ($a->get('region') !== static::BLOCK_REGION_NONE) {
$weight = $a->get('weight') - $b->get('weight');
if ($weight) {
return $weight;
diff --git a/core/modules/block/src/EventSubscriber/NodeRouteContext.php b/core/modules/block/src/EventSubscriber/NodeRouteContext.php
index c1bd2bf..20be6f4 100644
--- a/core/modules/block/src/EventSubscriber/NodeRouteContext.php
+++ b/core/modules/block/src/EventSubscriber/NodeRouteContext.php
@@ -45,7 +45,7 @@ protected function determineBlockContext() {
}
$this->addContext('node', $context);
}
- elseif ($this->routeMatch->getRouteName() == 'node.add') {
+ elseif ($this->routeMatch->getRouteName() === 'node.add') {
$node_type = $this->routeMatch->getParameter('node_type');
$context = new Context(new ContextDefinition('entity:node'));
$context->setContextValue(Node::create(array('type' => $node_type->id())));
diff --git a/core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php b/core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php
index 849df45..2da4e74 100644
--- a/core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php
+++ b/core/modules/block/src/Plugin/Derivative/ThemeLocalTask.php
@@ -68,7 +68,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives[$theme_name]['route_parameters'] = array('theme' => $theme_name);
}
// Default task!
- if ($default_theme == $theme_name) {
+ if ($default_theme === $theme_name) {
$this->derivatives[$theme_name]['route_name'] = 'block.admin_display';
// Emulate default logic because without the base plugin id we can't
// change the base_route.
diff --git a/core/modules/block/src/Tests/BlockRenderOrderTest.php b/core/modules/block/src/Tests/BlockRenderOrderTest.php
index b21d5f0..e149853 100644
--- a/core/modules/block/src/Tests/BlockRenderOrderTest.php
+++ b/core/modules/block/src/Tests/BlockRenderOrderTest.php
@@ -73,7 +73,7 @@ function testBlockRenderOrder() {
foreach ($controller->loadMultiple() as $return_block) {
$id = $return_block->get('id');
if ($return_block_weight = $return_block->get('weight')) {
- $this->assertTrue($test_blocks[$id]['weight'] == $return_block_weight, 'Block weight is set as "' . $return_block_weight . '" for ' . $id . ' block.');
+ $this->assertTrue($test_blocks[$id]['weight'] === $return_block_weight, 'Block weight is set as "' . $return_block_weight . '" for ' . $id . ' block.');
$position[$id] = strpos($test_content, drupal_html_class('block-' . $test_blocks[$id]['id']));
}
}
diff --git a/core/modules/block/src/Tests/BlockUiTest.php b/core/modules/block/src/Tests/BlockUiTest.php
index ebe5712..d7908c6 100644
--- a/core/modules/block/src/Tests/BlockUiTest.php
+++ b/core/modules/block/src/Tests/BlockUiTest.php
@@ -101,7 +101,7 @@ function testBlockAdminUiPage() {
$block = $this->blocks[$delta];
$label = $block->label();
$element = $this->xpath('//*[@id="blocks"]/tbody/tr[' . $values['tr'] . ']/td[1]/text()');
- $this->assertTrue((string) $element[0] == $label, 'The "' . $label . '" block title is set inside the ' . $values['settings']['region'] . ' region.');
+ $this->assertTrue((string) $element[0] === $label, 'The "' . $label . '" block title is set inside the ' . $values['settings']['region'] . ' region.');
// Look for a test block region select form element.
$this->assertField('blocks[' . $values['settings']['id'] . '][region]', 'The block "' . $values['label'] . '" has a region assignment field.');
// Move the test block to the header region.
diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php
index 8c9fb13..35eac0c 100644
--- a/core/modules/block/src/Tests/BlockViewBuilderTest.php
+++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php
@@ -157,7 +157,7 @@ protected function verifyRenderCacheHandling() {
// Test that entities with caching disabled do not generate a cache entry.
$build = $this->getBlockRenderArray();
- $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) == array('tags'), 'The render array element of uncacheable blocks is not cached, but does have cache tags set.');
+ $this->assertTrue(isset($build['#cache']) && array_keys($build['#cache']) === array('tags'), 'The render array element of uncacheable blocks is not cached, but does have cache tags set.');
// Enable block caching.
$this->setBlockCacheConfig(array(
diff --git a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
index 9a6642c..3383172 100644
--- a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
@@ -44,7 +44,7 @@ function testNewDefaultThemeBlocks() {
// Enable a different theme.
$new_theme = 'bartik';
- $this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.');
+ $this->assertFalse($new_theme === $default_theme, 'The new theme is different from the previous default theme.');
theme_enable(array($new_theme));
\Drupal::config('system.theme')
->set('default', $new_theme)
@@ -57,7 +57,7 @@ function testNewDefaultThemeBlocks() {
$new_blocks = $this->container->get('entity.query')->get('block')
->condition('theme', $new_theme)
->execute();
- $this->assertTrue(count($default_block_names) == count($new_blocks), 'The new default theme has the same number of blocks as the previous theme.');
+ $this->assertTrue(count($default_block_names) === count($new_blocks), 'The new default theme has the same number of blocks as the previous theme.');
foreach ($default_block_names as $default_block_name) {
// Remove the matching block from the list of blocks in the new theme.
// E.g., if the old theme has block.block.stark_admin,
diff --git a/core/modules/block/src/Theme/AdminDemoNegotiator.php b/core/modules/block/src/Theme/AdminDemoNegotiator.php
index 50d88c3..13094ae 100644
--- a/core/modules/block/src/Theme/AdminDemoNegotiator.php
+++ b/core/modules/block/src/Theme/AdminDemoNegotiator.php
@@ -19,7 +19,7 @@ class AdminDemoNegotiator implements ThemeNegotiatorInterface {
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
- return $route_match->getRouteName() == 'block.admin_demo';
+ return $route_match->getRouteName() === 'block.admin_demo';
}
/**
diff --git a/core/modules/block_content/src/BlockContentForm.php b/core/modules/block_content/src/BlockContentForm.php
index df923ee..1a30a03 100644
--- a/core/modules/block_content/src/BlockContentForm.php
+++ b/core/modules/block_content/src/BlockContentForm.php
@@ -95,7 +95,7 @@ public function form(array $form, FormStateInterface $form_state) {
$block = $this->entity;
$account = $this->currentUser();
- if ($this->operation == 'edit') {
+ if ($this->operation === 'edit') {
$form['#title'] = $this->t('Edit custom block %label', array('%label' => $block->label()));
}
// Override the default CSS class name, since the user-defined custom block
diff --git a/core/modules/block_content/src/BlockContentTypeForm.php b/core/modules/block_content/src/BlockContentTypeForm.php
index e34bbc3..57dac62 100644
--- a/core/modules/block_content/src/BlockContentTypeForm.php
+++ b/core/modules/block_content/src/BlockContentTypeForm.php
@@ -94,7 +94,7 @@ public function save(array $form, FormStateInterface $form_state) {
$edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo());
$logger = $this->logger('block_content');
- if ($status == SAVED_UPDATED) {
+ if ($status === SAVED_UPDATED) {
drupal_set_message(t('Custom block type %label has been updated.', array('%label' => $block_type->label())));
$logger->notice('Custom block type %label has been updated.', array('%label' => $block_type->label(), 'link' => $edit_link));
}
diff --git a/core/modules/block_content/src/BlockContentViewBuilder.php b/core/modules/block_content/src/BlockContentViewBuilder.php
index ff2a853..fa471bc 100644
--- a/core/modules/block_content/src/BlockContentViewBuilder.php
+++ b/core/modules/block_content/src/BlockContentViewBuilder.php
@@ -33,7 +33,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco
protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode, $langcode = NULL) {
parent::alterBuild($build, $entity, $display, $view_mode, $langcode);
// Add contextual links for this custom block.
- if (!$entity->isNew() && $view_mode == 'full') {
+ if (!$entity->isNew() && $view_mode === 'full') {
$build['#contextual_links']['block_content'] = array(
'route_parameters' => array('block_content' => $entity->id()),
'metadata' => array('changed' => $entity->getChangedTime()),
diff --git a/core/modules/block_content/src/Controller/BlockContentController.php b/core/modules/block_content/src/Controller/BlockContentController.php
index 4716bba..ea5d6ef 100644
--- a/core/modules/block_content/src/Controller/BlockContentController.php
+++ b/core/modules/block_content/src/Controller/BlockContentController.php
@@ -67,7 +67,7 @@ public function __construct(EntityStorageInterface $block_content_storage, Entit
*/
public function add(Request $request) {
$types = $this->blockContentTypeStorage->loadMultiple();
- if ($types && count($types) == 1) {
+ if ($types && count($types) === 1) {
$type = reset($types);
return $this->addForm($type, $request);
}
diff --git a/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php b/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
index e22425e..a73603b 100644
--- a/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
+++ b/core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php
@@ -26,11 +26,11 @@ public function getOptions(Request $request) {
$options['query']['theme'] = $request->attributes->get('theme');
}
// Adds a destination on custom block listing.
- if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'block_content.list') {
+ if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) === 'block_content.list') {
$options['query']['destination'] = 'admin/structure/block/block-content';
}
// Adds a destination on custom block listing.
- if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) == 'block_content.list') {
+ if ($request->attributes->get(RouteObjectInterface::ROUTE_NAME) === 'block_content.list') {
$options['query']['destination'] = 'admin/structure/block/block-content';
}
return $options;
diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
index aec6f69..59cc41d 100644
--- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php
@@ -90,7 +90,7 @@ protected function getNewEntityValues($langcode) {
protected function getEditValues($values, $langcode, $new = FALSE) {
$edit = parent::getEditValues($values, $langcode, $new);
foreach ($edit as $property => $value) {
- if ($property == 'info') {
+ if ($property === 'info') {
$edit['info[0][value]'] = $value;
unset($edit[$property]);
}
diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
index b36d009..e720025 100644
--- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php
@@ -156,12 +156,12 @@ public function testsBlockContentAddTypes() {
foreach ($themes as $theme) {
// Test that adding a block from the 'place blocks' form sends you to the
// block configure form.
- $path = $theme == $default_theme ? 'admin/structure/block' : "admin/structure/block/list/$theme";
+ $path = $theme === $default_theme ? 'admin/structure/block' : "admin/structure/block/list/$theme";
$this->drupalGet($path);
$this->clickLink(t('Add custom block'));
// The seven theme has markup inside the link, we cannot use clickLink().
- if ($default_theme == 'seven') {
- $options = $theme != $default_theme ? array('query' => array('theme' => $theme)) : array();
+ if ($default_theme === 'seven') {
+ $options = $theme !== $default_theme ? array('query' => array('theme' => $theme)) : array();
$this->assertLinkByHref(url('block/add/foo', $options));
$this->drupalGet('block/add/foo', $options);
}
diff --git a/core/modules/block_content/tests/modules/block_content_test/block_content_test.module b/core/modules/block_content/tests/modules/block_content_test/block_content_test.module
index d714cb2..7a2074a 100644
--- a/core/modules/block_content/tests/modules/block_content_test/block_content_test.module
+++ b/core/modules/block_content/tests/modules/block_content_test/block_content_test.module
@@ -24,12 +24,12 @@ function block_content_test_block_content_view(array &$build, BlockContent $bloc
* Implements hook_block_content_presave().
*/
function block_content_test_block_content_presave(BlockContent $block_content) {
- if ($block_content->label() == 'testing_block_content_presave') {
+ if ($block_content->label() === 'testing_block_content_presave') {
$block_content->setInfo($block_content->label() .'_presave');
}
// Determine changes.
- if (!empty($block_content->original) && $block_content->original->label() == 'test_changes') {
- if ($block_content->original->label() != $block_content->label()) {
+ if (!empty($block_content->original) && $block_content->original->label() === 'test_changes') {
+ if ($block_content->original->label() !== $block_content->label()) {
$block_content->setInfo($block_content->label() .'_presave');
// Drupal 1.0 release.
$block_content->changed = 979534800;
@@ -42,8 +42,8 @@ function block_content_test_block_content_presave(BlockContent $block_content) {
*/
function block_content_test_block_content_update(BlockContent $block_content) {
// Determine changes on update.
- if (!empty($block_content->original) && $block_content->original->label() == 'test_changes') {
- if ($block_content->original->label() != $block_content->label()) {
+ if (!empty($block_content->original) && $block_content->original->label() === 'test_changes') {
+ if ($block_content->original->label() !== $block_content->label()) {
$block_content->setInfo($block_content->label() .'_update');
}
}
@@ -58,11 +58,11 @@ function block_content_test_block_content_update(BlockContent $block_content) {
*/
function block_content_test_block_content_insert(BlockContent $block_content) {
// Set the block_content title to the block_content ID and save.
- if ($block_content->label() == 'new') {
+ if ($block_content->label() === 'new') {
$block_content->setInfo('BlockContent ' . $block_content->id());
$block_content->save();
}
- if ($block_content->label() == 'fail_creation') {
+ if ($block_content->label() === 'fail_creation') {
throw new Exception('Test exception for rollback.');
}
}
diff --git a/core/modules/book/book.install b/core/modules/book/book.install
index 76ddc81..4de44da 100644
--- a/core/modules/book/book.install
+++ b/core/modules/book/book.install
@@ -55,7 +55,7 @@ function book_schema() {
'default' => 0,
),
'depth' => array(
- 'description' => 'The depth relative to the top level. A link with pid == 0 will have depth == 1.',
+ 'description' => 'The depth relative to the top level. A link with pid === 0 will have depth === 1.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index e67b279..a6d19a6 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -118,11 +118,11 @@ function book_entity_type_build(array &$entity_types) {
* Implements hook_node_links_alter().
*/
function book_node_links_alter(array &$node_links, NodeInterface $node, array &$context) {
- if ($context['view_mode'] != 'rss') {
+ if ($context['view_mode'] !== 'rss') {
$account = \Drupal::currentUser();
if (isset($node->book['depth'])) {
- if ($context['view_mode'] == 'full' && node_is_page($node)) {
+ if ($context['view_mode'] === 'full' && node_is_page($node)) {
$child_type = \Drupal::config('book.settings')->get('child_type');
$access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && $access_control_handler->createAccess($child_type) && $node->isPublished() && $node->book['depth'] < BookManager::BOOK_MAX_DEPTH) {
@@ -253,7 +253,7 @@ function book_node_load($nodes) {
* Implements hook_ENTITY_TYPE_view() for node entities.
*/
function book_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {
- if ($view_mode == 'full') {
+ if ($view_mode === 'full') {
if (!empty($node->book['bid']) && empty($node->in_preview)) {
$book_navigation = array( '#theme' => 'book_navigation', '#book_link' => $node->book);
$build['book_navigation'] = array(
@@ -488,7 +488,7 @@ function template_preprocess_book_export_html(&$variables) {
$variables['title'] = String::checkPlain($variables['title']);
$variables['base_url'] = $base_url;
$variables['language'] = $language_interface;
- $variables['language_rtl'] = ($language_interface->direction == LanguageInterface::DIRECTION_RTL);
+ $variables['language_rtl'] = ($language_interface->direction === LanguageInterface::DIRECTION_RTL);
$variables['head'] = drupal_get_html_head();
// HTML element attributes.
@@ -563,7 +563,7 @@ function book_type_is_allowed($type) {
* node type is changed.
*/
function book_node_type_update(NodeTypeInterface $type) {
- if ($type->getOriginalId() != $type->id()) {
+ if ($type->getOriginalId() !== $type->id()) {
$config = \Drupal::config('book.settings');
// Update the list of node types that are allowed to be added to books.
$allowed_types = $config->get('allowed_types');
@@ -578,7 +578,7 @@ function book_node_type_update(NodeTypeInterface $type) {
}
// Update the setting for the "Add child page" link.
- if ($config->get('child_type') == $type->getOriginalId()) {
+ if ($config->get('child_type') === $type->getOriginalId()) {
$config->set('child_type', $type->id());
}
$config->save();
diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php
index ad906ed..5ef42ee 100644
--- a/core/modules/book/src/BookManager.php
+++ b/core/modules/book/src/BookManager.php
@@ -210,7 +210,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod
);
$options = array();
$nid = !$node->isNew() ? $node->id() : 'new';
- if ($node->id() && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
+ if ($node->id() && ($nid === $node->book['original_bid']) && ($node->book['parent_depth_limit'] === 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
$options[$node->id()] = $node->label();
}
@@ -220,7 +220,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod
}
}
- if ($account->hasPermission('create new books') && ($nid == 'new' || ($nid != $node->book['original_bid']))) {
+ if ($account->hasPermission('create new books') && ($nid === 'new' || ($nid !== $node->book['original_bid']))) {
// The node can become a new book, if it is not one already.
$options = array($nid => $this->t('- Create a new book -')) + $options;
}
@@ -253,7 +253,7 @@ public function addFormElements(array $form, FormStateInterface $form_state, Nod
* {@inheritdoc}
*/
public function checkNodeIsRemovable(NodeInterface $node) {
- return (!empty($node->book['bid']) && (($node->book['bid'] != $node->id()) || !$node->book['has_children']));
+ return (!empty($node->book['bid']) && (($node->book['bid'] !== $node->id()) || !$node->book['has_children']));
}
/**
@@ -264,7 +264,7 @@ public function updateOutline(NodeInterface $node) {
return FALSE;
}
- if (!empty($node->book['bid']) && $node->book['bid'] == 'new') {
+ if (!empty($node->book['bid']) && $node->book['bid'] === 'new') {
// New nodes that are their own book.
$node->book['bid'] = $node->id();
}
@@ -276,7 +276,7 @@ public function updateOutline(NodeInterface $node) {
$node->book['nid'] = $node->id();
// Create a new book from a node.
- if ($node->book['bid'] == $node->id()) {
+ if ($node->book['bid'] === $node->id()) {
$node->book['pid'] = 0;
}
elseif ($node->book['pid'] < 0) {
@@ -293,7 +293,7 @@ public function updateOutline(NodeInterface $node) {
*/
public function getBookParents(array $item, array $parent = array()) {
$book = array();
- if ($item['pid'] == 0) {
+ if ($item['pid'] === 0) {
$book['p1'] = $item['nid'];
for ($i = 2; $i <= static::BOOK_MAX_DEPTH; $i++) {
$parent_property = "p$i";
@@ -439,7 +439,7 @@ public function deleteFromBook($nid) {
$this->connection->delete('book')
->condition('nid', $nid)
->execute();
- if ($nid == $original['bid']) {
+ if ($nid === $original['bid']) {
// Handle deletion of a top-level post.
$result = $this->connection->query("SELECT * FROM {book} WHERE pid = :nid", array(
':nid' => $nid
@@ -522,10 +522,10 @@ public function bookTreeOutput(array $tree) {
$num_items = count($items);
foreach ($items as $i => $data) {
$class = array();
- if ($i == 0) {
+ if ($i === 0) {
$class[] = 'first';
}
- if ($i == $num_items - 1) {
+ if ($i === $num_items - 1) {
$class[] = 'last';
}
// Set a class for the -tag. Since $data['below'] may contain local
@@ -640,7 +640,7 @@ protected function doBookTreeBuild($bid, array $parameters = array()) {
$query->condition('pid', $parameters['expanded'], 'IN');
}
$min_depth = (isset($parameters['min_depth']) ? $parameters['min_depth'] : 1);
- if ($min_depth != 1) {
+ if ($min_depth !== 1) {
$query->condition('depth', $min_depth, '>=');
}
if (isset($parameters['max_depth'])) {
@@ -771,15 +771,15 @@ public function saveBookLink(array $link, $new) {
// Using the Book ID as the key keeps this unique.
$affected_bids[$original['bid']] = $original['bid'];
// Handle links that are moving.
- if ($link['bid'] != $original['bid'] || $link['pid'] != $original['pid']) {
+ if ($link['bid'] !== $original['bid'] || $link['pid'] !== $original['pid']) {
// Update the bid for this page and all children.
- if ($link['pid'] == 0) {
+ if ($link['pid'] === 0) {
$link['depth'] = 1;
$parent = array();
}
// In case the form did not specify a proper PID we use the BID as new
// parent.
- elseif (($parent_link = $this->loadBookLink($link['pid'], FALSE)) && $parent_link['bid'] != $link['bid']) {
+ elseif (($parent_link = $this->loadBookLink($link['pid'], FALSE)) && $parent_link['bid'] !== $link['bid']) {
$link['pid'] = $link['bid'];
$parent = $this->loadBookLink($link['pid'], FALSE);
$link['depth'] = $parent['depth'] + 1;
@@ -871,7 +871,7 @@ protected function moveChildren(array $link, array $original) {
* or the parent was updated successfully), FALSE on failure.
*/
protected function updateParent(array $link) {
- if ($link['pid'] == 0) {
+ if ($link['pid'] === 0) {
// Nothing to update.
return TRUE;
}
@@ -896,7 +896,7 @@ protected function updateParent(array $link) {
* failure.
*/
protected function updateOriginalParent(array $original) {
- if ($original['pid'] == 0) {
+ if ($original['pid'] === 0) {
// There were no parents of this link. Nothing to update.
return TRUE;
}
diff --git a/core/modules/book/src/BookOutline.php b/core/modules/book/src/BookOutline.php
index 484fd2c..37db727 100644
--- a/core/modules/book/src/BookOutline.php
+++ b/core/modules/book/src/BookOutline.php
@@ -41,7 +41,7 @@ public function __construct(BookManagerInterface $book_manager) {
*/
public function prevLink(array $book_link) {
// If the parent is zero, we are at the start of a book.
- if ($book_link['pid'] == 0) {
+ if ($book_link['pid'] === 0) {
return NULL;
}
// Assigning the array to $flat resets the array pointer for use with each().
@@ -50,11 +50,11 @@ public function prevLink(array $book_link) {
do {
$prev = $curr;
list($key, $curr) = each($flat);
- } while ($key && $key != $book_link['nid']);
+ } while ($key && $key !== $book_link['nid']);
- if ($key == $book_link['nid']) {
+ if ($key === $book_link['nid']) {
// The previous page in the book may be a child of the previous visible link.
- if ($prev['depth'] == $book_link['depth']) {
+ if ($prev['depth'] === $book_link['depth']) {
// The subtree will have only one link at the top level - get its data.
$tree = $this->bookManager->bookSubtreeData($prev);
$data = array_shift($tree);
@@ -87,9 +87,9 @@ public function nextLink(array $book_link) {
$flat = $this->bookManager->bookTreeGetFlat($book_link);
do {
list($key,) = each($flat);
- } while ($key && $key != $book_link['nid']);
+ } while ($key && $key !== $book_link['nid']);
- if ($key == $book_link['nid']) {
+ if ($key === $book_link['nid']) {
$next = current($flat);
if ($next) {
$this->bookManager->bookLinkTranslate($next);
@@ -116,9 +116,9 @@ public function childrenLinks(array $book_link) {
// Walk through the array until we find the current page.
do {
$link = array_shift($flat);
- } while ($link && ($link['nid'] != $book_link['nid']));
+ } while ($link && ($link['nid'] !== $book_link['nid']));
// Continue though the array and collect the links whose parent is this page.
- while (($link = array_shift($flat)) && $link['pid'] == $book_link['nid']) {
+ while (($link = array_shift($flat)) && $link['pid'] === $book_link['nid']) {
$data['link'] = $link;
$data['below'] = '';
$children[] = $data;
diff --git a/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php
index 9a2b754..afac6ea 100644
--- a/core/modules/book/src/Form/BookAdminEditForm.php
+++ b/core/modules/book/src/Form/BookAdminEditForm.php
@@ -85,7 +85,7 @@ public function buildForm(array $form, FormStateInterface $form_state, NodeInter
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
- if ($form_state->getValue('tree_hash') != $form_state->getValue('tree_current_hash')) {
+ if ($form_state->getValue('tree_hash') !== $form_state->getValue('tree_current_hash')) {
$form_state->setErrorByName('', $this->t('This book has been modified by another user, the changes could not be saved.'));
}
}
@@ -106,7 +106,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValue(array('table', $key));
// Update menu item if moved.
- if ($row['pid']['#default_value'] != $values['pid'] || $row['weight']['#default_value'] != $values['weight']) {
+ if ($row['pid']['#default_value'] !== $values['pid'] || $row['weight']['#default_value'] !== $values['weight']) {
$link = $this->bookManager->loadBookLink($values['nid'], FALSE);
$link['weight'] = $values['weight'];
$link['pid'] = $values['pid'];
@@ -114,7 +114,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
}
// Update the title if changed.
- if ($row['title']['#default_value'] != $values['title']) {
+ if ($row['title']['#default_value'] !== $values['title']) {
$node = $this->nodeStorage->load($values['nid']);
$node->revision_log = $this->t('Title changed from %original to %current.', array('%original' => $node->label(), '%current' => $values['title']));
$node->title = $values['title'];
diff --git a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
index 441d052..f06059f 100644
--- a/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
+++ b/core/modules/book/src/Plugin/Block/BookNavigationBlock.php
@@ -117,11 +117,11 @@ public function build() {
if ($node = $this->requestStack->getCurrentRequest()->get('node')) {
$current_bid = empty($node->book['bid']) ? 0 : $node->book['bid'];
}
- if ($this->configuration['block_mode'] == 'all pages') {
+ if ($this->configuration['block_mode'] === 'all pages') {
$book_menus = array();
$pseudo_tree = array(0 => array('below' => FALSE));
foreach ($this->bookManager->getAllBooks() as $book_id => $book) {
- if ($book['bid'] == $current_bid) {
+ if ($book['bid'] === $current_bid) {
// If the current page is a node associated with a book, the menu
// needs to be retrieved.
$data = $this->bookManager->bookTreeAllData($node->book['bid'], $node->book);
diff --git a/core/modules/breakpoint/src/BreakpointManager.php b/core/modules/breakpoint/src/BreakpointManager.php
index 757f2cf..0053e7d 100644
--- a/core/modules/breakpoint/src/BreakpointManager.php
+++ b/core/modules/breakpoint/src/BreakpointManager.php
@@ -171,7 +171,7 @@ public function getBreakpointsByGroup($group) {
else {
$breakpoints = array();
foreach ($this->getDefinitions() as $plugin_id => $plugin_definition) {
- if ($plugin_definition['group'] == $group) {
+ if ($plugin_definition['group'] === $group) {
$breakpoints[$plugin_id] = $plugin_definition;
}
}
diff --git a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
index 02049b6..e0a6edb 100644
--- a/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
+++ b/core/modules/ckeditor/src/Plugin/CKEditorPlugin/Internal.php
@@ -326,7 +326,7 @@ protected function generateFormatTagsSetting(Editor $editor) {
foreach ($possible_format_tags as $tag) {
$input = '<' . $tag . '>TEST' . $tag . '>';
$output = trim(check_markup($input, $editor->id()));
- if ($input == $output) {
+ if ($input === $output) {
$format_tags[] = $tag;
}
}
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 7041583..e888136 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -347,15 +347,15 @@ function testLanguages() {
$langcodes = $this->ckeditor->getLangcodes();
// Language codes transformed with browser mappings.
- $this->assertTrue($langcodes['pt-pt'] == 'pt', '"pt" properly resolved');
- $this->assertTrue($langcodes['zh-hans'] == 'zh-cn', '"zh-hans" properly resolved');
+ $this->assertTrue($langcodes['pt-pt'] === 'pt', '"pt" properly resolved');
+ $this->assertTrue($langcodes['zh-hans'] === 'zh-cn', '"zh-hans" properly resolved');
// Language code both in Drupal and CKEditor.
- $this->assertTrue($langcodes['gl'] == 'gl', '"gl" properly resolved');
+ $this->assertTrue($langcodes['gl'] === 'gl', '"gl" properly resolved');
// Language codes only in CKEditor.
- $this->assertTrue($langcodes['en-au'] == 'en-au', '"en-au" properly resolved');
- $this->assertTrue($langcodes['sr-latn'] == 'sr-latn', '"sr-latn" properly resolved');
+ $this->assertTrue($langcodes['en-au'] === 'en-au', '"en-au" properly resolved');
+ $this->assertTrue($langcodes['sr-latn'] === 'sr-latn', '"sr-latn" properly resolved');
}
/**
diff --git a/core/modules/color/color.install b/core/modules/color/color.install
index c3f9a74..83f1f61 100644
--- a/core/modules/color/color.install
+++ b/core/modules/color/color.install
@@ -11,7 +11,7 @@
function color_requirements($phase) {
$requirements = array();
- if ($phase == 'runtime') {
+ if ($phase === 'runtime') {
// Check for the PHP GD library.
if (function_exists('imagegd2')) {
$info = gd_info();
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index a0c0896..0dbca90 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -83,7 +83,7 @@ function color_css_alter(&$css) {
foreach ($color_paths as $color_path) {
// Color module currently requires unique file names to be used,
// which allows us to compare different file paths.
- if (drupal_basename($old_path) == drupal_basename($color_path)) {
+ if (drupal_basename($old_path) === drupal_basename($color_path)) {
// Replace the path to the new css file.
// This keeps the order of the stylesheets intact.
$css[drupal_basename($old_path)]['data'] = $color_path;
@@ -186,7 +186,7 @@ function color_scheme_form($complete_form, FormStateInterface $form_state, $them
// Note: we use the original theme when the default scheme is chosen.
$current_scheme = \Drupal::config('color.theme.' . $theme)->get('palette');
foreach ($schemes as $key => $scheme) {
- if ($current_scheme == $scheme) {
+ if ($current_scheme === $scheme) {
$scheme_name = $key;
break;
}
@@ -360,7 +360,7 @@ function color_scheme_form_submit($form, FormStateInterface $form_state) {
// Resolve palette.
$palette = $form_state->getValue('palette');
- if ($form_state->getValue('scheme') != '') {
+ if ($form_state->getValue('scheme') !== '') {
foreach ($palette as $key => $color) {
if (isset($info['schemes'][$form_state->getValue('scheme')]['colors'][$key])) {
$palette[$key] = $info['schemes'][$form_state->getValue('scheme')]['colors'][$key];
@@ -403,7 +403,7 @@ function color_scheme_form_submit($form, FormStateInterface $form_state) {
}
// No change in color config, use the standard theme from color.inc.
- if (implode(',', color_get_palette($theme, TRUE)) == implode(',', $palette)) {
+ if (implode(',', color_get_palette($theme, TRUE)) === implode(',', $palette)) {
$config->delete();
return;
}
@@ -581,7 +581,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) {
// Render gradients.
foreach ($info['gradients'] as $gradient) {
// Get direction of the gradient.
- if (isset($gradient['direction']) && $gradient['direction'] == 'horizontal') {
+ if (isset($gradient['direction']) && $gradient['direction'] === 'horizontal') {
// Horizontal gradient.
for ($x = 0; $x < $gradient['dimension'][2]; $x++) {
$color = _color_blend($target, $palette[$gradient['colors'][0]], $palette[$gradient['colors'][1]], $x / ($gradient['dimension'][2] - 1));
@@ -610,7 +610,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) {
$image = drupal_realpath($paths['target'] . $base);
// Cut out slice.
- if ($file == 'screenshot.png') {
+ if ($file === 'screenshot.png') {
$slice = imagecreatetruecolor(150, 90);
imagecopyresampled($slice, $target, 0, 0, $x, $y, 150, 90, $width, $height);
\Drupal::config('color.theme.' . $theme)
@@ -644,8 +644,8 @@ function _color_render_images($theme, &$info, &$paths, $palette) {
* Note: this function is significantly different from the JS version, as it
* is written to match the blended images perfectly.
*
- * Constraint: if (ref2 == target + (ref1 - target) * delta) for some fraction
- * delta then (return == target + (given - target) * delta).
+ * Constraint: if (ref2 === target + (ref1 - target) * delta) for some fraction
+ * delta then (return === target + (given - target) * delta).
*
* Loose constraint: Preserve relative positions in saturation and luminance
* space.
@@ -723,7 +723,7 @@ function _color_blend($img, $hex1, $hex2, $alpha) {
* Converts a hex color into an RGB triplet.
*/
function _color_unpack($hex, $normalize = FALSE) {
- if (strlen($hex) == 4) {
+ if (strlen($hex) === 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
}
$c = hexdec($hex);
@@ -794,9 +794,9 @@ function _color_rgb2hsl($rgb) {
$h = 0;
if ($delta > 0) {
- if ($max == $r && $max != $g) $h += ($g - $b) / $delta;
- if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta);
- if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta);
+ if ($max === $r && $max !== $g) $h += ($g - $b) / $delta;
+ if ($max === $g && $max !== $b) $h += (2 + ($b - $r) / $delta);
+ if ($max === $b && $max !== $r) $h += (4 + ($r - $g) / $delta);
$h /= 6;
}
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index dbe3bee..fd313d2 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -142,7 +142,7 @@ function comment_theme() {
* Implements hook_ENTITY_TYPE_create() for 'field_instance_config'.
*/
function comment_field_instance_config_create(FieldInstanceConfigInterface $instance) {
- if ($instance->getType() == 'comment' && !$instance->isSyncing()) {
+ if ($instance->getType() === 'comment' && !$instance->isSyncing()) {
// Assign default values for the field instance.
if (!isset($instance->default_value)) {
$instance->default_value = array();
@@ -163,7 +163,7 @@ function comment_field_instance_config_create(FieldInstanceConfigInterface $inst
* Implements hook_ENTITY_TYPE_update() for 'field_instance_config'.
*/
function comment_field_instance_config_update(FieldInstanceConfigInterface $instance) {
- if ($instance->getType() == 'comment') {
+ if ($instance->getType() === 'comment') {
// Comment field settings also affects the rendering of *comment* entities,
// not only the *commented* entities.
\Drupal::entityManager()->getViewBuilder('comment')->resetCache();
@@ -174,7 +174,7 @@ function comment_field_instance_config_update(FieldInstanceConfigInterface $inst
* Implements hook_ENTITY_TYPE_insert() for 'field_storage_config'.
*/
function comment_field_storage_config_insert(FieldStorageConfigInterface $field_storage) {
- if ($field_storage->getType() == 'comment') {
+ if ($field_storage->getType() === 'comment') {
// Check that the target entity type uses an integer ID.
$entity_type_id = $field_storage->getTargetEntityTypeId();
if (!_comment_entity_uses_integer_id($entity_type_id)) {
@@ -187,7 +187,7 @@ function comment_field_storage_config_insert(FieldStorageConfigInterface $field_
* Implements hook_ENTITY_TYPE_delete() for 'field_instance_config'.
*/
function comment_field_instance_config_delete(FieldInstanceConfigInterface $instance) {
- if ($instance->getType() == 'comment') {
+ if ($instance->getType() === 'comment') {
// Delete all comments that used by the entity bundle.
$entity_query = \Drupal::entityQuery('comment');
$entity_query->condition('entity_type', $instance->getEntityTypeId());
@@ -344,7 +344,7 @@ function comment_view_multiple($comments, $view_mode = 'full', $langcode = NULL)
*/
function comment_form_field_ui_field_overview_form_alter(&$form, FormStateInterface $form_state) {
$request = \Drupal::request();
- if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
+ if ($form['#entity_type'] === 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
$entity_type_id = $form['#entity_type'];
@@ -359,7 +359,7 @@ function comment_form_field_ui_field_overview_form_alter(&$form, FormStateInterf
*/
function comment_form_field_ui_form_display_overview_form_alter(&$form, FormStateInterface $form_state) {
$request = \Drupal::request();
- if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
+ if ($form['#entity_type'] === 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
}
@@ -369,7 +369,7 @@ function comment_form_field_ui_form_display_overview_form_alter(&$form, FormStat
*/
function comment_form_field_ui_display_overview_form_alter(&$form, FormStateInterface $form_state) {
$request = \Drupal::request();
- if ($form['#entity_type'] == 'comment' && $request->attributes->has('commented_entity_type')) {
+ if ($form['#entity_type'] === 'comment' && $request->attributes->has('commented_entity_type')) {
$form['#title'] = \Drupal::service('comment.manager')->getFieldUIPageTitle($request->attributes->get('commented_entity_type'), $request->attributes->get('field_name'));
}
}
@@ -378,7 +378,7 @@ function comment_form_field_ui_display_overview_form_alter(&$form, FormStateInte
* Implements hook_form_FORM_ID_alter().
*/
function comment_form_field_ui_field_storage_edit_form_alter(&$form, FormStateInterface $form_state) {
- if ($form['#field']->getType() == 'comment') {
+ if ($form['#field']->getType() === 'comment') {
// We only support posting one comment at the time so it doesn't make sense
// to let the site builder choose anything else.
$form['field']['cardinality_container']['cardinality']['#options'] = array(1 => 1);
@@ -491,7 +491,7 @@ function comment_node_update_index(EntityInterface $node, $langcode) {
$authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access comments');
foreach ($roles as $rid => $role) {
if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) {
- if ($rid == DRUPAL_AUTHENTICATED_RID || $rid == DRUPAL_ANONYMOUS_RID || !$authenticated_can_access) {
+ if ($rid === DRUPAL_AUTHENTICATED_RID || $rid === DRUPAL_ANONYMOUS_RID || !$authenticated_can_access) {
$index_comments = FALSE;
break;
}
@@ -549,8 +549,8 @@ function comment_node_search_result(EntityInterface $node) {
}
// Do not make a string if comments are hidden.
$status = $node->get($field_name)->status;
- if (\Drupal::currentUser()->hasPermission('access comments') && $status != CommentItemInterface::HIDDEN) {
- if ($status == CommentItemInterface::OPEN) {
+ if (\Drupal::currentUser()->hasPermission('access comments') && $status !== CommentItemInterface::HIDDEN) {
+ if ($status === CommentItemInterface::OPEN) {
// At least one comment field is open.
$open = TRUE;
}
@@ -674,7 +674,7 @@ function comment_preview(CommentInterface $comment, FormStateInterface $form_sta
* Implements hook_preprocess_HOOK() for block templates.
*/
function comment_preprocess_block(&$variables) {
- if ($variables['configuration']['provider'] == 'comment') {
+ if ($variables['configuration']['provider'] === 'comment') {
$variables['attributes']['role'] = 'navigation';
}
}
@@ -730,7 +730,7 @@ function template_preprocess_comment(&$variables) {
$variables['new_indicator_timestamp'] = $comment->getChangedTime();
$variables['created'] = format_date($comment->getCreatedTime());
// Avoid calling format_date() twice on the same timestamp.
- if ($comment->getChangedTime() == $comment->getCreatedTime()) {
+ if ($comment->getChangedTime() === $comment->getCreatedTime()) {
$variables['changed'] = $variables['created'];
}
else {
@@ -781,7 +781,7 @@ function template_preprocess_comment(&$variables) {
$variables['parent_author'] = drupal_render($username);
$variables['parent_created'] = format_date($comment_parent->getCreatedTime());
// Avoid calling format_date() twice on the same timestamp.
- if ($comment_parent->getChangedTime() == $comment_parent->getCreatedTime()) {
+ if ($comment_parent->getChangedTime() === $comment_parent->getCreatedTime()) {
$variables['parent_changed'] = $variables['parent_created'];
}
else {
@@ -822,7 +822,7 @@ function template_preprocess_comment(&$variables) {
// Gather comment classes.
$variables['attributes']['class'][] = 'comment';
// 'published' class is not needed, it is either 'preview' or 'unpublished'.
- if ($variables['status'] != 'published') {
+ if ($variables['status'] !== 'published') {
$variables['attributes']['class'][] = $variables['status'];
}
if (!$comment->getOwnerId()) {
@@ -830,7 +830,7 @@ function template_preprocess_comment(&$variables) {
}
else {
// @todo Use $entity->getAuthorId() after https://drupal.org/node/2078387
- if ($commented_entity instanceof EntityOwnerInterface && $comment->getOwnerId() == $commented_entity->getOwnerId()) {
+ if ($commented_entity instanceof EntityOwnerInterface && $comment->getOwnerId() === $commented_entity->getOwnerId()) {
$variables['attributes']['class'][] = 'by-' . $commented_entity->getEntityTypeId() . '-author';
}
}
@@ -858,7 +858,7 @@ function template_preprocess_comment(&$variables) {
*/
function comment_preprocess_field(&$variables) {
$element = $variables['element'];
- if ($element['#field_type'] == 'comment') {
+ if ($element['#field_type'] === 'comment') {
// Provide contextual information.
$variables['comment_display_mode'] = $element[0]['#comment_display_mode'];
$variables['comment_type'] = $element[0]['#comment_type'];
diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc
index b34fdcb..93c3209 100644
--- a/core/modules/comment/comment.tokens.inc
+++ b/core/modules/comment/comment.tokens.inc
@@ -129,7 +129,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements = array();
- if ($type == 'comment' && !empty($data['comment'])) {
+ if ($type === 'comment' && !empty($data['comment'])) {
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $data['comment'];
@@ -206,7 +206,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
// Support legacy comment node tokens, since tokens are embedded in
// user data and can't be upgraded directly.
// @todo Remove in Drupal 9, see https://drupal.org/node/2031901.
- if ($comment->getCommentedEntityTypeId() == 'node') {
+ if ($comment->getCommentedEntityTypeId() === 'node') {
$entity = $comment->getCommentedEntity();
$title = $entity->label();
$replacements[$original] = $sanitize ? Xss::filter($title) : $title;
@@ -224,7 +224,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements += $token_service->generate($comment->getCommentedEntityTypeId(), $entity_tokens, array($comment->getCommentedEntityTypeId() => $entity), $options);
}
- if (($node_tokens = $token_service->findwithPrefix($tokens, 'node')) && $comment->getCommentedEntityTypeId() == 'node') {
+ if (($node_tokens = $token_service->findwithPrefix($tokens, 'node')) && $comment->getCommentedEntityTypeId() === 'node') {
$node = $comment->getCommentedEntity();
$replacements += $token_service->generate('node', $node_tokens, array('node' => $node), $options);
}
@@ -245,8 +245,8 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
$replacements += $token_service->generate('user', $author_tokens, array('user' => $account), $options);
}
}
- elseif (($type == 'entity' & !empty($data['entity'])) ||
- ($type == 'node' & !empty($data['node']))) {
+ elseif (($type === 'entity' & !empty($data['entity'])) ||
+ ($type === 'node' & !empty($data['node']))) {
/** @var $entity \Drupal\Core\Entity\ContentEntityInterface */
$entity = !empty($data['entity']) ? $data['entity'] : $data['node'];
diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc
index a3d873b..244f2e5 100644
--- a/core/modules/comment/comment.views.inc
+++ b/core/modules/comment/comment.views.inc
@@ -22,7 +22,7 @@ function comment_views_data_alter(&$data) {
// Provide a integration for each entity type except comment.
foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) {
- if ($entity_type_id == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
+ if ($entity_type_id === 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
continue;
}
$fields = \Drupal::service('comment.manager')->getFields($entity_type_id);
diff --git a/core/modules/comment/src/CommentAccessControlHandler.php b/core/modules/comment/src/CommentAccessControlHandler.php
index a31f5d7..4827d5d 100644
--- a/core/modules/comment/src/CommentAccessControlHandler.php
+++ b/core/modules/comment/src/CommentAccessControlHandler.php
@@ -27,7 +27,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
if ($account->hasPermission('administer comments')) {
$access = AccessResult::allowed()->cachePerRole();
- return ($operation != 'view') ? $access : $access->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE));
+ return ($operation !== 'view') ? $access : $access->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE));
}
switch ($operation) {
@@ -36,7 +36,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
->andIf($entity->getCommentedEntity()->access($operation, $account, TRUE));
case 'update':
- return AccessResult::allowedIf($account->id() && $account->id() == $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerRole()->cachePerUser()->cacheUntilEntityChanges($entity);
+ return AccessResult::allowedIf($account->id() && $account->id() === $entity->getOwnerId() && $entity->isPublished() && $account->hasPermission('edit own comments'))->cachePerRole()->cachePerUser()->cacheUntilEntityChanges($entity);
default:
// No opinion.
diff --git a/core/modules/comment/src/CommentBreadcrumbBuilder.php b/core/modules/comment/src/CommentBreadcrumbBuilder.php
index 1ec574d..4855ca0 100644
--- a/core/modules/comment/src/CommentBreadcrumbBuilder.php
+++ b/core/modules/comment/src/CommentBreadcrumbBuilder.php
@@ -22,7 +22,7 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface {
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
- return $route_match->getRouteName() == 'comment.reply' && $route_match->getParameter('entity');
+ return $route_match->getRouteName() === 'comment.reply' && $route_match->getParameter('entity');
}
/**
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index 2c99bf8..813884b 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -87,7 +87,7 @@ public function form(array $form, FormStateInterface $form_state) {
$anonymous_contact = $field_definition->getSetting('anonymous');
$is_admin = $comment->id() && $this->currentUser->hasPermission('administer comments');
- if (!$this->currentUser->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+ if (!$this->currentUser->isAuthenticated() && $anonymous_contact !== COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
$form['#attached']['library'][] = 'core/drupal.form';
$form['#attributes']['data-user-info-from-browser'] = TRUE;
}
@@ -142,7 +142,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => $this->t('Your name'),
'#default_value' => $author,
- '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+ '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact === COMMENT_ANONYMOUS_MUST_CONTACT),
'#maxlength' => 60,
'#size' => 30,
);
@@ -175,11 +175,11 @@ public function form(array $form, FormStateInterface $form_state) {
'#type' => 'email',
'#title' => $this->t('Email'),
'#default_value' => $comment->getAuthorEmail(),
- '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+ '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact === COMMENT_ANONYMOUS_MUST_CONTACT),
'#maxlength' => 64,
'#size' => 30,
'#description' => $this->t('The content of this field is kept private and will not be shown publicly.'),
- '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+ '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact !== COMMENT_ANONYMOUS_MAYNOT_CONTACT),
);
$form['author']['homepage'] = array(
@@ -188,7 +188,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#default_value' => $comment->getHomepage(),
'#maxlength' => 255,
'#size' => 30,
- '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+ '#access' => $is_admin || ($this->currentUser->isAnonymous() && $anonymous_contact !== COMMENT_ANONYMOUS_MAYNOT_CONTACT),
);
// Add administrative comment publishing options.
@@ -239,12 +239,12 @@ protected function actions(array $form, FormStateInterface $form_state) {
// Only show the save button if comment previews are optional or if we are
// already previewing the submission.
- $element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer comments')) || $preview_mode != DRUPAL_REQUIRED || $form_state->get('comment_preview');
+ $element['submit']['#access'] = ($comment->id() && $this->currentUser->hasPermission('administer comments')) || $preview_mode !== DRUPAL_REQUIRED || $form_state->get('comment_preview');
$element['preview'] = array(
'#type' => 'submit',
'#value' => $this->t('Preview'),
- '#access' => $preview_mode != DRUPAL_DISABLED,
+ '#access' => $preview_mode !== DRUPAL_DISABLED,
'#validate' => array('::validate'),
'#submit' => array('::submitForm', '::preview'),
);
@@ -323,7 +323,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Validate the comment's subject. If not specified, extract from comment
// body.
- if (trim($comment->getSubject()) == '') {
+ if (trim($comment->getSubject()) === '') {
// The body may be in any format, so:
// 1) Filter it into HTML
// 2) Strip out all HTML tags
@@ -332,7 +332,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$comment->setSubject(Unicode::truncate(trim(String::decodeEntities(strip_tags($comment_text))), 29, TRUE));
// Edge cases where the comment body is populated only by HTML tags will
// require a default subject.
- if ($comment->getSubject() == '') {
+ if ($comment->getSubject() === '') {
$comment->setSubject($this->t('(No subject)'));
}
}
@@ -365,7 +365,7 @@ public function save(array $form, FormStateInterface $form_state) {
$uri = $entity->urlInfo();
$logger = $this->logger('content');
- if ($this->currentUser->hasPermission('post comments') && ($this->currentUser->hasPermission('administer comments') || $entity->{$field_name}->status == CommentItemInterface::OPEN)) {
+ if ($this->currentUser->hasPermission('post comments') && ($this->currentUser->hasPermission('administer comments') || $entity->{$field_name}->status === CommentItemInterface::OPEN)) {
$comment->save();
$form_state->setValue('cid', $comment->id());
diff --git a/core/modules/comment/src/CommentLinkBuilder.php b/core/modules/comment/src/CommentLinkBuilder.php
index b1864da..fd30ddd 100644
--- a/core/modules/comment/src/CommentLinkBuilder.php
+++ b/core/modules/comment/src/CommentLinkBuilder.php
@@ -69,7 +69,7 @@ public function __construct(AccountInterface $current_user, CommentManagerInterf
public function buildCommentedEntityLinks(ContentEntityInterface $entity, array &$context) {
$entity_links = array();
$view_mode = $context['view_mode'];
- if ($view_mode == 'search_index' || $view_mode == 'search_result' || $view_mode == 'print') {
+ if ($view_mode === 'search_index' || $view_mode === 'search_result' || $view_mode === 'print') {
// Do not add any links if the entity is displayed for:
// - search indexing.
// - constructing a search result excerpt.
@@ -85,10 +85,10 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
}
$links = array();
$commenting_status = $entity->get($field_name)->status;
- if ($commenting_status != CommentItemInterface::HIDDEN) {
+ if ($commenting_status !== CommentItemInterface::HIDDEN) {
// Entity has commenting status open or closed.
$field_definition = $entity->getFieldDefinition($field_name);
- if ($view_mode == 'rss') {
+ if ($view_mode === 'rss') {
// Add a comments RSS element which is a URL to the comments of this
// entity.
$options = array(
@@ -100,7 +100,7 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
'value' => $entity->url('canonical', $options),
);
}
- elseif ($view_mode == 'teaser') {
+ elseif ($view_mode === 'teaser') {
// Teaser view: display the number of comments that have been posted,
// or a link to add new comments if the user has permission, the
// entity is open to new comments, and there currently are none.
@@ -126,7 +126,7 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
}
}
// Provide a link to new comment form.
- if ($commenting_status == CommentItemInterface::OPEN) {
+ if ($commenting_status === CommentItemInterface::OPEN) {
$comment_form_location = $field_definition->getSetting('form_location');
if ($this->currentUser->hasPermission('post comments')) {
$links['comment-add'] = array(
@@ -135,7 +135,7 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
'attributes' => array('title' => $this->t('Add a new comment to this page.')),
'fragment' => 'comment-form',
);
- if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE) {
+ if ($comment_form_location === CommentItemInterface::FORM_SEPARATE_PAGE) {
$links['comment-add']['route_name'] = 'comment.reply';
$links['comment-add']['route_parameters'] = array(
'entity_type' => $entity->getEntityTypeId(),
@@ -159,18 +159,18 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
// Entity in other view modes: add a "post comment" link if the user
// is allowed to post comments and if this entity is allowing new
// comments.
- if ($commenting_status == CommentItemInterface::OPEN) {
+ if ($commenting_status === CommentItemInterface::OPEN) {
$comment_form_location = $field_definition->getSetting('form_location');
if ($this->currentUser->hasPermission('post comments')) {
// Show the "post comment" link if the form is on another page, or
// if there are existing comments that the link will skip past.
- if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE || (!empty($entity->get($field_name)->comment_count) && $this->currentUser->hasPermission('access comments'))) {
+ if ($comment_form_location === CommentItemInterface::FORM_SEPARATE_PAGE || (!empty($entity->get($field_name)->comment_count) && $this->currentUser->hasPermission('access comments'))) {
$links['comment-add'] = array(
'title' => $this->t('Add new comment'),
'attributes' => array('title' => $this->t('Share your thoughts and opinions related to this posting.')),
'fragment' => 'comment-form',
);
- if ($comment_form_location == CommentItemInterface::FORM_SEPARATE_PAGE) {
+ if ($comment_form_location === CommentItemInterface::FORM_SEPARATE_PAGE) {
$links['comment-add']['route_name'] = 'comment.reply';
$links['comment-add']['route_parameters'] = array(
'entity_type' => $entity->getEntityTypeId(),
@@ -199,7 +199,7 @@ public function buildCommentedEntityLinks(ContentEntityInterface $entity, array
'#links' => $links,
'#attributes' => array('class' => array('links', 'inline')),
);
- if ($view_mode == 'teaser' && $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated()) {
+ if ($view_mode === 'teaser' && $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated()) {
$entity_links['comment__' . $field_name]['#attached']['library'][] = 'comment/drupal.node-new-comments-link';
// Embed the metadata for the "X new comments" link (if any) on this
diff --git a/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php
index 5c76abb..d711968 100644
--- a/core/modules/comment/src/CommentManager.php
+++ b/core/modules/comment/src/CommentManager.php
@@ -273,14 +273,14 @@ public function forbiddenMessage(EntityInterface $entity, $field_name) {
if ($this->authenticatedCanPostComments) {
// We cannot use drupal_get_destination() because these links
// sometimes appear on /node and taxonomy listing pages.
- if ($entity->get($field_name)->getFieldDefinition()->getSetting('form_location') == CommentItemInterface::FORM_SEPARATE_PAGE) {
+ if ($entity->get($field_name)->getFieldDefinition()->getSetting('form_location') === CommentItemInterface::FORM_SEPARATE_PAGE) {
$destination = array('destination' => 'comment/reply/' . $entity->getEntityTypeId() . '/' . $entity->id() . '/' . $field_name . '#comment-form');
}
else {
$destination = array('destination' => $entity->getSystemPath() . '#comment-form');
}
- if ($this->userConfig->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
+ if ($this->userConfig->get('register') !== USER_REGISTER_ADMINISTRATORS_ONLY) {
// Users can register themselves.
return $this->t('Log in or register to post comments', array(
'@login' => $this->urlGenerator->generateFromRoute('user.login', array(), array('query' => $destination)),
@@ -306,7 +306,7 @@ public function getCountNewComments(EntityInterface $entity, $field_name = NULL,
if ($this->currentUser->isAuthenticated() && $this->moduleHandler->moduleExists('history')) {
// Retrieve the timestamp at which the current user last viewed this entity.
if (!$timestamp) {
- if ($entity->getEntityTypeId() == 'node') {
+ if ($entity->getEntityTypeId() === 'node') {
$timestamp = history_read($entity->id());
}
else {
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 714b4c1..4fe778d 100644
--- a/core/modules/comment/src/CommentStorage.php
+++ b/core/modules/comment/src/CommentStorage.php
@@ -107,7 +107,7 @@ public function getDisplayOrdinal(CommentInterface $comment, $comment_mode, $div
$query->condition('c1.status', CommentInterface::PUBLISHED);
}
- if ($comment_mode == CommentManagerInterface::COMMENT_MODE_FLAT) {
+ if ($comment_mode === CommentManagerInterface::COMMENT_MODE_FLAT) {
// For rendering flat comments, cid is used for ordering comments due to
// unpredictable behavior with timestamp, so we make the same assumption
// here.
@@ -139,7 +139,7 @@ public function getNewCommentPageNumber($total_comments, $new_comments, ContentE
// Only one page of comments.
$count = 0;
}
- elseif ($instance->getSetting('default_mode') == CommentManagerInterface::COMMENT_MODE_FLAT) {
+ elseif ($instance->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_FLAT) {
// Flat comments.
$count = $total_comments - $new_comments;
}
@@ -296,7 +296,7 @@ public function loadThread(EntityInterface $entity, $field_name, $mode, $comment
$query->condition('c.status', CommentInterface::PUBLISHED);
$count_query->condition('c.status', CommentInterface::PUBLISHED);
}
- if ($mode == CommentManagerInterface::COMMENT_MODE_FLAT) {
+ if ($mode === CommentManagerInterface::COMMENT_MODE_FLAT) {
$query->orderBy('c.cid', 'ASC');
}
else {
diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php
index 0d93b1c..5b6495c 100644
--- a/core/modules/comment/src/CommentTypeForm.php
+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -148,7 +148,7 @@ public function save(array $form, FormStateInterface $form_state) {
$status = $comment_type->save();
$edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo());
- if ($status == SAVED_UPDATED) {
+ if ($status === SAVED_UPDATED) {
drupal_set_message(t('Comment type %label has been updated.', array('%label' => $comment_type->label())));
$this->logger->notice('Comment type %label has been updated.', array('%label' => $comment_type->label(), 'link' => $edit_link));
}
diff --git a/core/modules/comment/src/CommentViewBuilder.php b/core/modules/comment/src/CommentViewBuilder.php
index cd36bc4..d382250 100644
--- a/core/modules/comment/src/CommentViewBuilder.php
+++ b/core/modules/comment/src/CommentViewBuilder.php
@@ -224,7 +224,7 @@ protected static function buildLinks(CommentInterface $entity, EntityInterface $
$container = \Drupal::getContainer();
- if ($status == CommentItemInterface::OPEN) {
+ if ($status === CommentItemInterface::OPEN) {
if ($entity->access('delete')) {
$links['comment-delete'] = array(
'title' => t('Delete'),
@@ -289,7 +289,7 @@ protected function alterBuild(array &$build, EntityInterface $comment, EntityVie
$commented_entity = $comment->getCommentedEntity();
$field_definition = $this->entityManager->getFieldDefinitions($commented_entity->getEntityTypeId(), $commented_entity->bundle())[$comment->getFieldName()];
$is_threaded = isset($comment->divs)
- && $field_definition->getSetting('default_mode') == CommentManagerInterface::COMMENT_MODE_THREADED;
+ && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED;
// Add indentation div or close open divs as needed.
if ($is_threaded) {
diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php
index 866bc99..3835fd0 100644
--- a/core/modules/comment/src/CommentViewsData.php
+++ b/core/modules/comment/src/CommentViewsData.php
@@ -386,7 +386,7 @@ public function getViewsData() {
// Provide a relationship for each entity type except comment.
foreach ($entities_types as $type => $entity_type) {
- if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
+ if ($type === 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
continue;
}
if ($fields = \Drupal::service('comment.manager')->getFields($type)) {
@@ -465,7 +465,7 @@ public function getViewsData() {
// Provide a relationship for each entity type except comment.
foreach ($entities_types as $type => $entity_type) {
- if ($type == 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
+ if ($type === 'comment' || !$entity_type->isFieldable() || !$entity_type->getBaseTable()) {
continue;
}
// This relationship does not use the 'field id' column, if the entity has
diff --git a/core/modules/comment/src/Controller/AdminController.php b/core/modules/comment/src/Controller/AdminController.php
index 4c1592f..0524de5 100644
--- a/core/modules/comment/src/Controller/AdminController.php
+++ b/core/modules/comment/src/Controller/AdminController.php
@@ -56,7 +56,7 @@ public function __construct(FormBuilderInterface $form_builder) {
* administration form.
*/
public function adminPage(Request $request, $type = 'new') {
- if ($request->request->get('operation') == 'delete' && $request->request->get('comments')) {
+ if ($request->request->get('operation') === 'delete' && $request->request->get('comments')) {
return $this->formBuilder->getForm('\Drupal\comment\Form\ConfirmDeleteMultiple', $request);
}
else {
diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php
index af415d0..06596fc 100644
--- a/core/modules/comment/src/Controller/CommentController.php
+++ b/core/modules/comment/src/Controller/CommentController.php
@@ -207,9 +207,9 @@ public function getReplyForm(Request $request, EntityInterface $entity, $field_n
}
// The user is not just previewing a comment.
- if ($request->request->get('op') != $this->t('Preview')) {
+ if ($request->request->get('op') !== $this->t('Preview')) {
$status = $entity->{$field_name}->status;
- if ($status != CommentItemInterface::OPEN) {
+ if ($status !== CommentItemInterface::OPEN) {
drupal_set_message($this->t("This discussion is closed: you can't post new comments."), 'error');
return new RedirectResponse($uri->toString());
}
@@ -224,7 +224,7 @@ public function getReplyForm(Request $request, EntityInterface $entity, $field_n
// Load the parent comment.
$comment = $this->entityManager()->getStorage('comment')->load($pid);
// Check if the parent comment is published and belongs to the entity.
- if (!$comment->isPublished() || ($comment->getCommentedEntityId() != $entity->id())) {
+ if (!$comment->isPublished() || ($comment->getCommentedEntityId() !== $entity->id())) {
drupal_set_message($this->t('The comment you are replying to does not exist.'), 'error');
return new RedirectResponse($uri->toString());
}
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index 9823f9f..78361dd 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -105,7 +105,7 @@ public function preSave(EntityStorageInterface $storage) {
// Get the max value in *this* thread.
$max = $storage->getMaxThreadPerThread($this);
- if ($max == '') {
+ if ($max === '') {
// First child of this parent. As the other two cases do an
// increment of the thread number before creating the thread
// string set this to -1 so it requires an increment too.
@@ -410,7 +410,7 @@ public function setAuthorName($name) {
public function getAuthorEmail() {
$mail = $this->get('mail')->value;
- if ($this->get('uid')->target_id != 0) {
+ if ($this->get('uid')->target_id !== 0) {
$mail = $this->get('uid')->entity->getEmail();
}
@@ -469,7 +469,7 @@ public function setCreatedTime($created) {
* {@inheritdoc}
*/
public function isPublished() {
- return $this->get('status')->value == CommentInterface::PUBLISHED;
+ return $this->get('status')->value === CommentInterface::PUBLISHED;
}
/**
diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php
index 723241a..ea982d6 100644
--- a/core/modules/comment/src/Form/CommentAdminOverview.php
+++ b/core/modules/comment/src/Form/CommentAdminOverview.php
@@ -111,7 +111,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = '
'#attributes' => array('class' => array('container-inline')),
);
- if ($type == 'approval') {
+ if ($type === 'approval') {
$options['publish'] = $this->t('Publish the selected comments');
}
else {
@@ -132,7 +132,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = '
);
// Load the comments that need to be displayed.
- $status = ($type == 'approval') ? CommentInterface::NOT_PUBLISHED : CommentInterface::PUBLISHED;
+ $status = ($type === 'approval') ? CommentInterface::NOT_PUBLISHED : CommentInterface::PUBLISHED;
$header = array(
'subject' => array(
'data' => $this->t('Subject'),
@@ -254,7 +254,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $type = '
public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state->setValue('comments', array_diff($form_state->getValue('comments'), array(0)));
// We can't execute any 'Update options' if no comments were selected.
- if (count($form_state->getValue('comments')) == 0) {
+ if (count($form_state->getValue('comments')) === 0) {
$form_state->setErrorByName('', $this->t('Select one or more comments to perform the update on.'));
}
}
@@ -269,12 +269,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($cids as $cid) {
// Delete operation handled in \Drupal\comment\Form\ConfirmDeleteMultiple
// see \Drupal\comment\Controller\AdminController::adminPage().
- if ($operation == 'unpublish') {
+ if ($operation === 'unpublish') {
$comment = $this->commentStorage->load($cid);
$comment->setPublished(FALSE);
$comment->save();
}
- elseif ($operation == 'publish') {
+ elseif ($operation === 'publish') {
$comment = $this->commentStorage->load($cid);
$comment->setPublished(TRUE);
$comment->save();
diff --git a/core/modules/comment/src/Form/CommentTypeDeleteForm.php b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
index 7ac7ce7..2a1d624 100644
--- a/core/modules/comment/src/Form/CommentTypeDeleteForm.php
+++ b/core/modules/comment/src/Form/CommentTypeDeleteForm.php
@@ -118,7 +118,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$caption = '';
foreach (array_keys($this->commentManager->getFields($entity_type)) as $field_name) {
/** @var \Drupal\field\FieldStorageConfigInterface $field_storage */
- if (($field_storage = FieldStorageConfig::loadByName($entity_type, $field_name)) && $field_storage->getSetting('comment_type') == $this->entity->id() && !$field_storage->deleted) {
+ if (($field_storage = FieldStorageConfig::loadByName($entity_type, $field_name)) && $field_storage->getSetting('comment_type') === $this->entity->id() && !$field_storage->deleted) {
$caption .= '' . $this->t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', array(
'%label' => $this->entity->label(),
'%field' => $field_storage->label(),
diff --git a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
index aa41d12..2c8398a 100644
--- a/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
+++ b/core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
@@ -139,7 +139,7 @@ public function viewElements(FieldItemListInterface $items) {
$status = $items->status;
- if ($status != CommentItemInterface::HIDDEN && empty($entity->in_preview) &&
+ if ($status !== CommentItemInterface::HIDDEN && empty($entity->in_preview) &&
// Comments are added to the search results and search index by
// comment_node_update_index() instead of by this formatter, so don't
// return anything if the view mode is search_index or search_result.
@@ -168,7 +168,7 @@ public function viewElements(FieldItemListInterface $items) {
// Append comment form if the comments are open and the form is set to
// display below the entity. Do not show the form for the print view mode.
- if ($status == CommentItemInterface::OPEN && $comment_settings['form_location'] == CommentItemInterface::FORM_BELOW && $this->viewMode != 'print') {
+ if ($status === CommentItemInterface::OPEN && $comment_settings['form_location'] === CommentItemInterface::FORM_BELOW && $this->viewMode !== 'print') {
// Only show the add comment form if the user has permission.
if ($this->currentUser->hasPermission('post comments')) {
// All users in the "anonymous" role can use the same form: it is fine
diff --git a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
index b54564a..39d4beb 100644
--- a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
+++ b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
@@ -166,7 +166,7 @@ public function instanceSettingsForm(array $form, FormStateInterface $form_state
* {@inheritdoc}
*/
public function __get($name) {
- if ($name == 'status' && !isset($this->values[$name])) {
+ if ($name === 'status' && !isset($this->values[$name])) {
// Get default value from field instance when no data saved in entity.
$field_default_values = $this->getFieldDefinition()->getDefaultValue($this->getEntity());
return $field_default_values[0]['status'];
@@ -198,7 +198,7 @@ public function settingsForm(array &$form, FormStateInterface $form_state, $has_
$options = array();
$entity_type = $this->getEntity()->getEntityTypeId();
foreach ($comment_types as $comment_type) {
- if ($comment_type->getTargetEntityTypeId() == $entity_type) {
+ if ($comment_type->getTargetEntityTypeId() === $entity_type) {
$options[$comment_type->id()] = $comment_type->label();
}
}
diff --git a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
index 87309c5..9ffc2e2 100644
--- a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
+++ b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
@@ -54,7 +54,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
// If the entity doesn't have any comments, the "hidden" option makes no
// sense, so don't even bother presenting it to the user unless this is the
// default value widget on the field settings form.
- if ($element['#field_parents'] != array('default_value_input') && !$items->comment_count) {
+ if ($element['#field_parents'] !== array('default_value_input') && !$items->comment_count) {
$element['status'][CommentItemInterface::HIDDEN]['#access'] = FALSE;
// Also adjust the description of the "closed" option.
$element['status'][CommentItemInterface::CLOSED]['#description'] = t('Users cannot post comments.');
@@ -73,7 +73,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#type' => 'details',
// Open the details when the selected value is different to the stored
// default values for the field instance.
- '#open' => ($items->status != $field_default_values[0]['status']),
+ '#open' => ($items->status !== $field_default_values[0]['status']),
'#group' => 'advanced',
'#attributes' => array(
'class' => array('comment-' . drupal_html_class($entity->getEntityTypeId()) . '-settings-form'),
diff --git a/core/modules/comment/src/Plugin/views/argument/UserUid.php b/core/modules/comment/src/Plugin/views/argument/UserUid.php
index 5e104bd..417eff8 100644
--- a/core/modules/comment/src/Plugin/views/argument/UserUid.php
+++ b/core/modules/comment/src/Plugin/views/argument/UserUid.php
@@ -77,7 +77,7 @@ protected function defaultActions($which = NULL) {
return $actions;
}
- if ($which != 'summary asc' && $which != 'summary desc') {
+ if ($which !== 'summary asc' && $which !== 'summary desc') {
return parent::defaultActions($which);
}
}
@@ -86,7 +86,7 @@ public function query($group_by = FALSE) {
$this->ensureMyTable();
// Use the table definition to correctly add this user ID condition.
- if ($this->table != 'comment') {
+ if ($this->table !== 'comment') {
$subselect = $this->database->select('comment', 'c');
$subselect->addField('c', 'cid');
$subselect->condition('c.uid', $this->argument);
diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php
index 1fde0a7..4bef13f 100644
--- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php
+++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php
@@ -43,7 +43,7 @@ protected function renderLink($data, ResultRow $values) {
$status = $this->getValue($values, 'status');
// Don't show an approve link on published comment.
- if ($status == CommentInterface::PUBLISHED) {
+ if ($status === CommentInterface::PUBLISHED) {
return;
}
diff --git a/core/modules/comment/src/Plugin/views/row/Rss.php b/core/modules/comment/src/Plugin/views/row/Rss.php
index 50354fb..a007cb7 100644
--- a/core/modules/comment/src/Plugin/views/row/Rss.php
+++ b/core/modules/comment/src/Plugin/views/row/Rss.php
@@ -88,7 +88,7 @@ public function render($row) {
}
$view_mode = $this->options['view_mode'];
- if ($view_mode == 'default') {
+ if ($view_mode === 'default') {
$view_mode = \Drupal::config('system.rss')->get('items.view_mode');
}
@@ -128,7 +128,7 @@ public function render($row) {
$this->view->style_plugin->namespaces = array_merge($this->view->style_plugin->namespaces, $comment->rss_namespaces);
}
- if ($view_mode != 'title') {
+ if ($view_mode !== 'title') {
// We render comment contents.
$item_text .= drupal_render($build);
}
diff --git a/core/modules/comment/src/Plugin/views/sort/Thread.php b/core/modules/comment/src/Plugin/views/sort/Thread.php
index a8bcad5..37e51c0 100644
--- a/core/modules/comment/src/Plugin/views/sort/Thread.php
+++ b/core/modules/comment/src/Plugin/views/sort/Thread.php
@@ -23,7 +23,7 @@ public function query() {
//Read comment_render() in comment.module for an explanation of the
//thinking behind this sort.
- if ($this->options['order'] == 'DESC') {
+ if ($this->options['order'] === 'DESC') {
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
}
else {
diff --git a/core/modules/comment/src/Tests/CommentCSSTest.php b/core/modules/comment/src/Tests/CommentCSSTest.php
index a3d8a61..97caa33 100644
--- a/core/modules/comment/src/Tests/CommentCSSTest.php
+++ b/core/modules/comment/src/Tests/CommentCSSTest.php
@@ -86,11 +86,11 @@ function testCommentClasses() {
$this->assertIdentical(1, count($this->xpath('//*[@data-history-node-id="' . $node->id() . '"]')), 'data-history-node-id attribute is set on node.');
// Verify classes if the comment is visible for the current user.
- if ($case['comment_status'] == CommentInterface::PUBLISHED || $case['user'] == 'admin') {
+ if ($case['comment_status'] === CommentInterface::PUBLISHED || $case['user'] === 'admin') {
// Verify the by-anonymous class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-anonymous")]');
- if ($case['comment_uid'] == 0) {
- $this->assertTrue(count($comments) == 1, 'by-anonymous class found.');
+ if ($case['comment_uid'] === 0) {
+ $this->assertTrue(count($comments) === 1, 'by-anonymous class found.');
}
else {
$this->assertFalse(count($comments), 'by-anonymous class not found.');
@@ -98,8 +98,8 @@ function testCommentClasses() {
// Verify the by-node-author class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "by-node-author")]');
- if ($case['comment_uid'] > 0 && $case['comment_uid'] == $case['node_uid']) {
- $this->assertTrue(count($comments) == 1, 'by-node-author class found.');
+ if ($case['comment_uid'] > 0 && $case['comment_uid'] === $case['node_uid']) {
+ $this->assertTrue(count($comments) === 1, 'by-node-author class found.');
}
else {
$this->assertFalse(count($comments), 'by-node-author class not found.');
@@ -115,8 +115,8 @@ function testCommentClasses() {
// Verify the unpublished class.
$comments = $this->xpath('//*[contains(@class, "comment") and contains(@class, "unpublished")]');
- if ($case['comment_status'] == CommentInterface::NOT_PUBLISHED && $case['user'] == 'admin') {
- $this->assertTrue(count($comments) == 1, 'unpublished class found.');
+ if ($case['comment_status'] === CommentInterface::NOT_PUBLISHED && $case['user'] === 'admin') {
+ $this->assertTrue(count($comments) === 1, 'unpublished class found.');
}
else {
$this->assertFalse(count($comments), 'unpublished class not found.');
@@ -126,7 +126,7 @@ function testCommentClasses() {
// drupal.comment-new-indicator library to add a "new" indicator to each
// comment that was created or changed after the last time the current
// user read the corresponding node.
- if ($case['comment_status'] == CommentInterface::PUBLISHED || $case['user'] == 'admin') {
+ if ($case['comment_status'] === CommentInterface::PUBLISHED || $case['user'] === 'admin') {
$this->assertIdentical(1, count($this->xpath('//*[contains(@class, "comment")]/*[@data-comment-timestamp="' . $comment->getChangedTime() . '"]')), 'data-comment-timestamp attribute is set on comment');
$expectedJS = ($case['user'] !== 'anonymous');
$this->assertIdentical($expectedJS, isset($settings['ajaxPageState']['js']['core/modules/comment/js/comment-new-indicator.js']), 'drupal.comment-new-indicator library is present.');
diff --git a/core/modules/comment/src/Tests/CommentInterfaceTest.php b/core/modules/comment/src/Tests/CommentInterfaceTest.php
index 94e423c..69bd28b 100644
--- a/core/modules/comment/src/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/src/Tests/CommentInterfaceTest.php
@@ -76,7 +76,7 @@ function testCommentInterface() {
// Test changing the comment author to "Anonymous".
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), array('name' => ''));
- $this->assertTrue($comment->getAuthorName() == t('Anonymous') && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.');
+ $this->assertTrue($comment->getAuthorName() === t('Anonymous') && $comment->getOwnerId() === 0, 'Comment author successfully changed to anonymous.');
// Test changing the comment author to an unverified user.
$random_name = $this->randomMachineName();
@@ -88,7 +88,7 @@ function testCommentInterface() {
// Test changing the comment author to a verified user.
$this->drupalGet('comment/' . $comment->id() . '/edit');
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), array('name' => $this->web_user->getUsername()));
- $this->assertTrue($comment->getAuthorName() == $this->web_user->getUsername() && $comment->getOwnerId() == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
+ $this->assertTrue($comment->getAuthorName() === $this->web_user->getUsername() && $comment->getOwnerId() === $this->web_user->id(), 'Comment author successfully changed to a registered user.');
$this->drupalLogout();
diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php
index 00484b6..82c569b 100644
--- a/core/modules/comment/src/Tests/CommentLinksTest.php
+++ b/core/modules/comment/src/Tests/CommentLinksTest.php
@@ -99,7 +99,7 @@ public function testCommentLinks() {
// In teaser view, a link containing the comment count is always
// expected.
- if ($path == 'node') {
+ if ($path === 'node') {
$this->assertLink(t('1 comment'));
}
$this->assertLink('Add new comment');
diff --git a/core/modules/comment/src/Tests/CommentNonNodeTest.php b/core/modules/comment/src/Tests/CommentNonNodeTest.php
index 85f0554..eb5d810 100644
--- a/core/modules/comment/src/Tests/CommentNonNodeTest.php
+++ b/core/modules/comment/src/Tests/CommentNonNodeTest.php
@@ -203,7 +203,7 @@ function performCommentOperation($comment, $operation, $approval = FALSE) {
$edit['comments[' . $comment->id() . ']'] = TRUE;
$this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
- if ($operation == 'delete') {
+ if ($operation === 'delete') {
$this->drupalPostForm(NULL, array(), t('Delete comments'));
$this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
}
diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php
index 05f139d..1be1086 100644
--- a/core/modules/comment/src/Tests/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/CommentTestBase.php
@@ -342,7 +342,7 @@ function performCommentOperation(CommentInterface $comment, $operation, $approva
$edit['comments[' . $comment->id() . ']'] = TRUE;
$this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
- if ($operation == 'delete') {
+ if ($operation === 'delete') {
$this->drupalPostForm(NULL, array(), t('Delete comments'));
$this->assertRaw(format_plural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), format_string('Operation "@operation" was performed on comment.', array('@operation' => $operation)));
}
diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php
index 14ea0db..051d41f 100644
--- a/core/modules/comment/src/Tests/CommentTranslationUITest.php
+++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php
@@ -77,7 +77,7 @@ function setupTestFields() {
* Overrides \Drupal\content_translation\Tests\ContentTranslationUITest::createEntity().
*/
protected function createEntity($values, $langcode, $comment_type = 'comment_article') {
- if ($comment_type == 'comment_article') {
+ if ($comment_type === 'comment_article') {
// This is the article node type, with the 'comment_article' field.
$node_type = 'article';
$field_name = 'comment_article';
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 2993f28..d19f1f5 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -145,11 +145,11 @@ public function testCommentLinkBuilder(NodeInterface $node, $context, $has_acces
else {
$this->assertSame($links, $expected);
}
- if ($context['view_mode'] == 'rss' && $node->get('comment')->status) {
+ if ($context['view_mode'] === 'rss' && $node->get('comment')->status) {
$found = FALSE;
if ($node->get('comment')->status) {
foreach ($node->rss_elements as $element) {
- if ($element['key'] == 'comments') {
+ if ($element['key'] === 'comments') {
$found = TRUE;
break;
}
@@ -216,7 +216,7 @@ public function getLinkCombinations() {
$expected = array();
// When comments are enabled in teaser mode, and comments exist, and the
// user has access - we can output the comment count.
- if ($combination['comments'] && $combination['view_mode'] == 'teaser' && $combination['comment_count'] && $combination['has_access_comments']) {
+ if ($combination['comments'] && $combination['view_mode'] === 'teaser' && $combination['comment_count'] && $combination['has_access_comments']) {
$expected['comment-comments'] = '1 comment';
// And if history module exists, we can show a 'new comments' link.
if ($combination['history_exists']) {
@@ -224,17 +224,17 @@ public function getLinkCombinations() {
}
}
// All view modes other than RSS.
- if ($combination['view_mode'] != 'rss') {
+ if ($combination['view_mode'] !== 'rss') {
// Where commenting is open.
- if ($combination['comments'] == CommentItemInterface::OPEN) {
+ if ($combination['comments'] === CommentItemInterface::OPEN) {
// And the user has post-comments permission.
if ($combination['has_post_comments']) {
// If the view mode is teaser, or the user can access comments and
// comments exist or the form is on a separate page.
- if ($combination['view_mode'] == 'teaser' || ($combination['has_access_comments'] && $combination['comment_count']) || $combination['form_location'] == CommentItemInterface::FORM_SEPARATE_PAGE) {
+ if ($combination['view_mode'] === 'teaser' || ($combination['has_access_comments'] && $combination['comment_count']) || $combination['form_location'] === CommentItemInterface::FORM_SEPARATE_PAGE) {
// There should be a add comment link.
$expected['comment-add'] = array('title' => 'Add new comment');
- if ($combination['form_location'] == CommentItemInterface::FORM_BELOW) {
+ if ($combination['form_location'] === CommentItemInterface::FORM_BELOW) {
// On the same page.
$expected['comment-add']['route_name'] = 'node.view';
}
diff --git a/core/modules/config/config.module b/core/modules/config/config.module
index e22b71b..76019a0 100644
--- a/core/modules/config/config.module
+++ b/core/modules/config/config.module
@@ -52,7 +52,7 @@ function config_permission() {
function config_file_download($uri) {
$scheme = file_uri_scheme($uri);
$target = file_uri_target($uri);
- if ($scheme == 'temporary' && $target == 'config.tar.gz') {
+ if ($scheme === 'temporary' && $target === 'config.tar.gz') {
return array(
'Content-disposition' => 'attachment; filename="config.tar.gz"',
);
diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php
index f73de96..a9661d4 100644
--- a/core/modules/config/src/Form/ConfigSync.php
+++ b/core/modules/config/src/Form/ConfigSync.php
@@ -218,7 +218,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['#attached']['library'][] = 'core/drupal.ajax';
foreach ($storage_comparer->getAllCollectionNames() as $collection) {
- if ($collection != StorageInterface::DEFAULT_COLLECTION) {
+ if ($collection !== StorageInterface::DEFAULT_COLLECTION) {
$form[$collection]['collection_heading'] = array(
'#type' => 'html_tag',
'#tag' => 'h2',
@@ -259,7 +259,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
);
foreach ($config_names as $config_name) {
- if ($config_change_type == 'rename') {
+ if ($config_change_type === 'rename') {
$names = $storage_comparer->extractRenameNames($config_name);
$route_options = array('source_name' => $names['old_name'], 'target_name' => $names['new_name']);
$config_name = $this->t('!source_name to !target_name', array('!source_name' => $names['old_name'], '!target_name' => $names['new_name']));
@@ -267,7 +267,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
else {
$route_options = array('source_name' => $config_name);
}
- if ($collection != StorageInterface::DEFAULT_COLLECTION) {
+ if ($collection !== StorageInterface::DEFAULT_COLLECTION) {
$route_options['collection'] = $collection;
$href = $this->urlGenerator->getPathFromRoute('config.diff_collection', $route_options);
}
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 442ada7..d476cd6 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -98,13 +98,13 @@ public function testExportImport() {
// Delete the custom field.
$field_instances = entity_load_multiple('field_instance_config');
foreach ($field_instances as $field_instance) {
- if ($field_instance->field_name == $this->fieldName) {
+ if ($field_instance->field_name === $this->fieldName) {
$field_instance->delete();
}
}
$field_storages = entity_load_multiple('field_storage_config');
foreach ($field_storages as $field_storage) {
- if ($field_storage->name == $this->fieldName) {
+ if ($field_storage->name === $this->fieldName) {
$field_storage->delete();
}
}
diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/src/Tests/ConfigImportAllTest.php
index 7b73631..a478b4e 100644
--- a/core/modules/config/src/Tests/ConfigImportAllTest.php
+++ b/core/modules/config/src/Tests/ConfigImportAllTest.php
@@ -46,7 +46,7 @@ public function testInstallUninstall() {
$all_modules = array_filter($all_modules, function ($module) {
// Filter hidden, already enabled modules and modules in the Testing
// package.
- if (!empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
+ if (!empty($module->info['hidden']) || $module->status === TRUE || $module->info['package'] === 'Testing') {
return FALSE;
}
return TRUE;
@@ -80,7 +80,7 @@ public function testInstallUninstall() {
$all_modules = system_rebuild_module_data();
$modules_to_uninstall = array_filter($all_modules, function ($module) {
// Filter required and not enabled modules.
- if (!empty($module->info['required']) || $module->status == FALSE) {
+ if (!empty($module->info['required']) || $module->status === FALSE) {
return FALSE;
}
return TRUE;
diff --git a/core/modules/config/src/Tests/ConfigSchemaTest.php b/core/modules/config/src/Tests/ConfigSchemaTest.php
index 5dbec35..2060e9e 100644
--- a/core/modules/config/src/Tests/ConfigSchemaTest.php
+++ b/core/modules/config/src/Tests/ConfigSchemaTest.php
@@ -285,19 +285,19 @@ function testSchemaData() {
// And test some ComplexDataInterface methods.
$properties = $list->getProperties();
- $this->assertTrue(count($properties) == 3 && $properties['front'] == $list['front'], 'Got the right properties for site page.');
+ $this->assertTrue(count($properties) === 3 && $properties['front'] === $list['front'], 'Got the right properties for site page.');
$values = $list->toArray();
- $this->assertTrue(count($values) == 3 && $values['front'] == 'user', 'Got the right property values for site page.');
+ $this->assertTrue(count($values) === 3 && $values['front'] === 'user', 'Got the right property values for site page.');
// Now let's try something more complex, with nested objects.
$wrapper = \Drupal::service('config.typed')->get('image.style.large');
$effects = $wrapper->get('effects');
// The function is_array() doesn't work with ArrayAccess, so we use count().
- $this->assertTrue(count($effects) == 1, 'Got an array with effects for image.style.large data');
+ $this->assertTrue(count($effects) === 1, 'Got an array with effects for image.style.large data');
$uuid = key($effects->getValue());
$effect = $effects[$uuid];
- $this->assertTrue(count($effect['data']) && $effect['id']->getValue() == 'image_scale', 'Got data for the image scale effect from metadata.');
+ $this->assertTrue(count($effect['data']) && $effect['id']->getValue() === 'image_scale', 'Got data for the image scale effect from metadata.');
$this->assertTrue($effect['data']['width'] instanceof IntegerInterface, 'Got the right type for the scale effect width.');
$this->assertEqual($effect['data']['width']->getValue(), 480, 'Got the right value for the scale effect width.' );
diff --git a/core/modules/config/tests/config_import_test/src/EventSubscriber.php b/core/modules/config/tests/config_import_test/src/EventSubscriber.php
index 0be4f97..fdfbaf2 100644
--- a/core/modules/config/tests/config_import_test/src/EventSubscriber.php
+++ b/core/modules/config/tests/config_import_test/src/EventSubscriber.php
@@ -58,13 +58,13 @@ public function onConfigImporterValidate(ConfigImporterEvent $event) {
*/
public function onConfigSave(ConfigCrudEvent $event) {
$config = $event->getConfig();
- if ($config->getName() == 'action.settings') {
+ if ($config->getName() === 'action.settings') {
$values = $this->state->get('ConfigImportUITest.action.settings.recursion_limit', array());
$values[] = $config->get('recursion_limit');
$this->state->set('ConfigImportUITest.action.settings.recursion_limit', $values);
}
- if ($config->getName() == 'core.extension') {
+ if ($config->getName() === 'core.extension') {
$installed = $this->state->get('ConfigImportUITest.core.extension.modules_installed', array());
$uninstalled = $this->state->get('ConfigImportUITest.core.extension.modules_uninstalled', array());
$original = $config->getOriginal('module');
@@ -90,7 +90,7 @@ public function onConfigSave(ConfigCrudEvent $event) {
*/
public function onConfigDelete(ConfigCrudEvent $event) {
$config = $event->getConfig();
- if ($config->getName() == 'action.settings') {
+ if ($config->getName() === 'action.settings') {
$value = $this->state->get('ConfigImportUITest.action.settings.delete', 0);
$this->state->set('ConfigImportUITest.action.settings.delete', $value + 1);
}
diff --git a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php
index b022cc6..7cf29c3 100644
--- a/core/modules/config/tests/config_test/src/Entity/ConfigTest.php
+++ b/core/modules/config/tests/config_test/src/Entity/ConfigTest.php
@@ -98,14 +98,14 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
// Used to test secondary writes during config sync.
- if ($this->id() == 'primary') {
+ if ($this->id() === 'primary') {
$secondary = $storage->create(array(
'id' => 'secondary',
'label' => 'Secondary Default',
));
$secondary->save();
}
- if ($this->id() == 'deleter') {
+ if ($this->id() === 'deleter') {
$deletee = $storage->load('deletee');
$deletee->delete();
}
@@ -117,7 +117,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
foreach ($entities as $entity) {
- if ($entity->id() == 'deleter') {
+ if ($entity->id() === 'deleter') {
$deletee = $storage->load('deletee');
$deletee->delete();
}
diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module
index 43aa754..a75ca19 100644
--- a/core/modules/config_translation/config_translation.module
+++ b/core/modules/config_translation/config_translation.module
@@ -89,10 +89,10 @@ function config_translation_entity_type_alter(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
foreach ($entity_types as $entity_type_id => $entity_type) {
if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface')) {
- if ($entity_type_id == 'block') {
+ if ($entity_type_id === 'block') {
$class = 'Drupal\config_translation\Controller\ConfigTranslationBlockListBuilder';
}
- elseif ($entity_type_id == 'field_instance_config') {
+ elseif ($entity_type_id === 'field_instance_config') {
$class = 'Drupal\config_translation\Controller\ConfigTranslationFieldInstanceListBuilder';
// Will be filled in dynamically, see \Drupal\field\Entity\FieldInstanceConfig::linkTemplates().
$entity_type->setLinkTemplate('drupal:config-translation-overview', 'config_translation.item.overview.');
diff --git a/core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php b/core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php
index da7f424..4d617cb 100644
--- a/core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php
+++ b/core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php
@@ -34,7 +34,7 @@ public function access(Route $route, Request $request, AccountInterface $account
$access =
!empty($target_language) &&
!$target_language->locked &&
- $target_language->id != $this->sourceLanguage->id;
+ $target_language->id !== $this->sourceLanguage->id;
return $base_access->andIf(AccessResult::allowedIf($access));
}
diff --git a/core/modules/config_translation/src/ConfigNamesMapper.php b/core/modules/config_translation/src/ConfigNamesMapper.php
index 57811d9..d887d70 100644
--- a/core/modules/config_translation/src/ConfigNamesMapper.php
+++ b/core/modules/config_translation/src/ConfigNamesMapper.php
@@ -425,7 +425,7 @@ public function getLanguageWithFallback() {
// 'Built-in English' because we assume such configuration is shipped with
// core and the modules and not custom created. (In the later case an
// English language configured on the site is assumed.)
- if (empty($language) && $langcode == 'en') {
+ if (empty($language) && $langcode === 'en') {
$language = new Language(array('id' => 'en', 'name' => $this->t('Built-in English')));
}
return $language;
diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationController.php b/core/modules/config_translation/src/Controller/ConfigTranslationController.php
index 646d3b8..dacd4ab 100644
--- a/core/modules/config_translation/src/Controller/ConfigTranslationController.php
+++ b/core/modules/config_translation/src/Controller/ConfigTranslationController.php
@@ -134,7 +134,7 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl
$original_langcode = $mapper->getLangcode();
if (!isset($languages[$original_langcode])) {
$language_name = $this->languageManager->getLanguageName($original_langcode);
- if ($original_langcode == 'en') {
+ if ($original_langcode === 'en') {
$language_name = $this->t('Built-in English');
}
// Create a dummy language object for this listing only.
@@ -162,7 +162,7 @@ public function itemPage(Request $request, RouteMatchInterface $route_match, $pl
// Prepare the language name and the operations depending on whether this
// is the original language or not.
- if ($langcode == $original_langcode) {
+ if ($langcode === $original_langcode) {
$language_name = '' . $this->t('@language (original)', array('@language' => $language->name)) . '';
// Check access for the path/route for editing, so we can decide to
diff --git a/core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php b/core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
index 9d94468..8c8b80f 100644
--- a/core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
+++ b/core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
@@ -88,7 +88,7 @@ public function getDefaultOperations(EntityInterface $entity) {
foreach (array_keys($operations) as $operation) {
// This is a translation UI for translators. Show the translation
// operation only.
- if (!($operation == 'translate')) {
+ if (!($operation === 'translate')) {
unset($operations[$operation]);
}
}
@@ -120,7 +120,7 @@ protected function sortRowsMultiple($a, $b, $keys) {
$a_value = (is_array($a) && isset($a[$key]['data'])) ? $a[$key]['data'] : '';
$b_value = (is_array($b) && isset($b[$key]['data'])) ? $b[$key]['data'] : '';
- if ($a_value == $b_value && !empty($keys)) {
+ if ($a_value === $b_value && !empty($keys)) {
return $this->sortRowsMultiple($a, $b, $keys);
}
diff --git a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
index d195d24..8d92594 100644
--- a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
+++ b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php
@@ -385,7 +385,7 @@ protected function setConfig(LanguageInterface $language, Config $base_config, L
// If we have a new translation or different from what is stored in
// locale before, save this as an updated customize translation.
- if ($translation->isNew() || $translation->getString() != $value['translation']) {
+ if ($translation->isNew() || $translation->getString() !== $value['translation']) {
$translation->setString($value['translation'])
->setCustomized()
->save();
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
index 690beee..41c80a2 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -317,7 +317,7 @@ public function testContactConfigEntityTranslation() {
// Check language specific auto reply text in email body.
foreach ($captured_emails as $email) {
- if ($email['id'] == 'contact_page_autoreply') {
+ if ($email['id'] === 'contact_page_autoreply') {
// Trim because we get an added newline for the body.
$this->assertEqual(trim($email['body']), 'Thank you for your mail - ' . $email['langcode']);
}
diff --git a/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module b/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
index eb41793..7971a08 100644
--- a/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
+++ b/core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module
@@ -13,7 +13,7 @@
*/
function config_translation_test_system_info_alter(array &$info, Extension $file, $type) {
// @see \Drupal\config_translation\Tests\ConfigTranslationUiThemeTest
- if ($file->getType() == 'theme' && $file->getName() == 'config_translation_test_theme') {
+ if ($file->getType() === 'theme' && $file->getName() === 'config_translation_test_theme') {
$info['hidden'] = FALSE;
}
}
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index 3a72233..48e74f4 100644
--- a/core/modules/contact/contact.module
+++ b/core/modules/contact/contact.module
@@ -79,7 +79,7 @@ function contact_entity_extra_field_info() {
'description' => t('Email'),
'weight' => -40,
);
- if ($bundle == 'personal') {
+ if ($bundle === 'personal') {
$fields['contact_message'][$bundle]['form']['recipient'] = array(
'label' => t('Recipient user name'),
'description' => t('User'),
diff --git a/core/modules/contact/src/Access/ContactPageAccess.php b/core/modules/contact/src/Access/ContactPageAccess.php
index 0a7eae7..ef9cc41 100644
--- a/core/modules/contact/src/Access/ContactPageAccess.php
+++ b/core/modules/contact/src/Access/ContactPageAccess.php
@@ -66,7 +66,7 @@ public function access(UserInterface $user, AccountInterface $account) {
}
// Users may not contact themselves.
- if ($account->id() == $contact_account->id()) {
+ if ($account->id() === $contact_account->id()) {
return AccessResult::forbidden()->cachePerUser();
}
diff --git a/core/modules/contact/src/ContactFormAccessControlHandler.php b/core/modules/contact/src/ContactFormAccessControlHandler.php
index 3af949a..b8e6a8e 100644
--- a/core/modules/contact/src/ContactFormAccessControlHandler.php
+++ b/core/modules/contact/src/ContactFormAccessControlHandler.php
@@ -23,11 +23,11 @@ class ContactFormAccessControlHandler extends EntityAccessControlHandler {
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
- if ($operation == 'view') {
+ if ($operation === 'view') {
// Do not allow access personal form via site-wide route.
return AccessResult::allowedIf($account->hasPermission('access site-wide contact form') && $entity->id() !== 'personal')->cachePerRole();
}
- elseif ($operation == 'delete' || $operation == 'update') {
+ elseif ($operation === 'delete' || $operation === 'update') {
// Do not allow the 'personal' form to be deleted, as it's used for
// the personal contact form.
return AccessResult::allowedIf($account->hasPermission('administer contact forms') && $entity->id() !== 'personal')->cachePerRole();
diff --git a/core/modules/contact/src/ContactFormEditForm.php b/core/modules/contact/src/ContactFormEditForm.php
index c07dbf2..b3849b2 100644
--- a/core/modules/contact/src/ContactFormEditForm.php
+++ b/core/modules/contact/src/ContactFormEditForm.php
@@ -98,7 +98,7 @@ public function save(array $form, FormStateInterface $form_state) {
$edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo());
- if ($status == SAVED_UPDATED) {
+ if ($status === SAVED_UPDATED) {
drupal_set_message($this->t('Contact form %label has been updated.', array('%label' => $contact_form->label())));
$this->logger('contact')->notice('Contact form %label has been updated.', array('%label' => $contact_form->label(), 'link' => $edit_link));
}
@@ -114,7 +114,7 @@ public function save(array $form, FormStateInterface $form_state) {
->save();
}
// If it was the default form, empty out the setting.
- elseif ($contact_settings->get('default_form') == $contact_form->id()) {
+ elseif ($contact_settings->get('default_form') === $contact_form->id()) {
$contact_settings
->set('default_form', NULL)
->save();
diff --git a/core/modules/contact/src/ContactFormListBuilder.php b/core/modules/contact/src/ContactFormListBuilder.php
index 883ad9a..22b5471 100644
--- a/core/modules/contact/src/ContactFormListBuilder.php
+++ b/core/modules/contact/src/ContactFormListBuilder.php
@@ -34,14 +34,14 @@ public function buildHeader() {
public function buildRow(EntityInterface $entity) {
$row['form'] = $this->getLabel($entity);
// Special case the personal form.
- if ($entity->id() == 'personal') {
+ if ($entity->id() === 'personal') {
$row['recipients'] = t('Selected user');
$row['selected'] = t('No');
}
else {
$row['recipients'] = String::checkPlain(implode(', ', $entity->getRecipients()));
$default_form = \Drupal::config('contact.settings')->get('default_form');
- $row['selected'] = ($default_form == $entity->id() ? t('Yes') : t('No'));
+ $row['selected'] = ($default_form === $entity->id() ? t('Yes') : t('No'));
}
return $row + parent::buildRow($entity);
}
diff --git a/core/modules/contact/src/Entity/Message.php b/core/modules/contact/src/Entity/Message.php
index 9d2269e..591c165 100644
--- a/core/modules/contact/src/Entity/Message.php
+++ b/core/modules/contact/src/Entity/Message.php
@@ -40,7 +40,7 @@ class Message extends ContentEntityBase implements MessageInterface {
* {@inheritdoc}
*/
public function isPersonal() {
- return $this->bundle() == 'personal';
+ return $this->bundle() === 'personal';
}
/**
diff --git a/core/modules/contact/src/MessageViewBuilder.php b/core/modules/contact/src/MessageViewBuilder.php
index 23e9b43..17fab1f 100644
--- a/core/modules/contact/src/MessageViewBuilder.php
+++ b/core/modules/contact/src/MessageViewBuilder.php
@@ -53,11 +53,11 @@ public function buildComponents(array &$build, array $entities, array $displays,
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
$build = parent::view($entity, $view_mode, $langcode);
- if ($view_mode == 'mail') {
+ if ($view_mode === 'mail') {
// Convert field labels into headings.
// @todo Improve drupal_html_to_text() to convert DIVs correctly.
foreach (Element::children($build) as $key) {
- if (isset($build[$key]['#label_display']) && $build[$key]['#label_display'] == 'above') {
+ if (isset($build[$key]['#label_display']) && $build[$key]['#label_display'] === 'above') {
$build[$key] += array('#prefix' => '');
$build[$key]['#prefix'] = $build[$key]['#title'] . ":\n";
$build[$key]['#label_display'] = 'hidden';
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index 436b2bf..0bf2123 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -234,7 +234,7 @@ function testSiteWideContact() {
// Find out in which row the form we want to add a field to is.
$i = 0;
foreach($this->xpath('//table/tbody/tr') as $row) {
- if (((string)$row->td[0]) == $label) {
+ if (((string)$row->td[0]) === $label) {
break;
}
$i++;
@@ -386,7 +386,7 @@ function submitContact($name, $mail, $subject, $id, $message) {
$edit['mail'] = $mail;
$edit['subject[0][value]'] = $subject;
$edit['message[0][value]'] = $message;
- if ($id == \Drupal::config('contact.settings')->get('default_form')) {
+ if ($id === \Drupal::config('contact.settings')->get('default_form')) {
$this->drupalPostForm('contact', $edit, t('Send message'));
}
else {
@@ -400,7 +400,7 @@ function submitContact($name, $mail, $subject, $id, $message) {
function deleteContactForms() {
$contact_forms = entity_load_multiple('contact_form');
foreach ($contact_forms as $id => $contact_form) {
- if ($id == 'personal') {
+ if ($id === 'personal') {
// Personal form could not be deleted.
$this->drupalGet("admin/structure/contact/manage/$id/delete");
$this->assertResponse(403);
diff --git a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
index 70311f1..54a8b80 100644
--- a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
+++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
@@ -11,7 +11,7 @@
* Implements hook_entity_base_field_info().
*/
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
- if ($entity_type->id() == 'contact_message') {
+ if ($entity_type->id() === 'contact_message') {
$fields = array();
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('Message ID'))
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index 529a325..1512d66 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -306,7 +306,7 @@ function content_translation_form_language_content_settings_submit(array $form,
$translatable = FALSE;
}
$field_config = $fields[$field_name]->getConfig($bundle);
- if ($field_config->isTranslatable() != $translatable) {
+ if ($field_config->isTranslatable() !== $translatable) {
$field_config
->setTranslatable($translatable)
->save();
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index f1a1b60..23f9aa9 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -457,7 +457,7 @@ function content_translation_language_fallback_candidates_entity_view_alter(&$ca
$entity = $context['data'];
$entity_type_id = $entity->getEntityTypeId();
$entity_type = $entity->getEntityType();
- $permission = $entity_type->getPermissionGranularity() == 'bundle' ? $permission = "translate {$entity->bundle()} $entity_type_id" : "translate $entity_type_id";
+ $permission = $entity_type->getPermissionGranularity() === 'bundle' ? $permission = "translate {$entity->bundle()} $entity_type_id" : "translate $entity_type_id";
$current_user = \Drupal::currentuser();
if (!$current_user->hasPermission('translate any entity') && !$current_user->hasPermission($permission)) {
foreach ($entity->getTranslationLanguages() as $langcode => $language) {
@@ -751,7 +751,7 @@ function content_translation_language_configuration_element_submit(array $form,
$context = $form_state->get(['language', $key]);
$enabled = $form_state->getValue(array($key, 'content_translation'));
- if (content_translation_enabled($context['entity_type'], $context['bundle']) != $enabled) {
+ if (content_translation_enabled($context['entity_type'], $context['bundle']) !== $enabled) {
content_translation_set_config($context['entity_type'], $context['bundle'], 'enabled', $enabled);
\Drupal::entityManager()->clearCachedDefinitions();
\Drupal::service('router.builder')->setRebuildNeeded();
diff --git a/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php
index 6c85edd..d162ac8 100644
--- a/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php
+++ b/core/modules/content_translation/src/Access/ContentTranslationManageAccessCheck.php
@@ -87,7 +87,7 @@ public function access(Route $route, Request $request, AccountInterface $account
case 'create':
$source_language = $this->languageManager->getLanguage($source) ?: $entity->language();
$target_language = $this->languageManager->getLanguage($target) ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
- $is_new_translation = ($source_language->getId() != $target_language->getId()
+ $is_new_translation = ($source_language->getId() !== $target_language->getId()
&& isset($languages[$source_language->getId()])
&& isset($languages[$target_language->getId()])
&& !isset($translations[$target_language->getId()]));
@@ -98,7 +98,7 @@ public function access(Route $route, Request $request, AccountInterface $account
case 'delete':
$language = $this->languageManager->getLanguage($language) ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT);
$has_translation = isset($languages[$language->getId()])
- && $language->getId() != $entity->getUntranslated()->language()->getId()
+ && $language->getId() !== $entity->getUntranslated()->language()->getId()
&& isset($translations[$language->getId()]);
return AccessResult::allowedIf($has_translation)->cachePerRole()->cacheUntilEntityChanges($entity)
->andIf($handler->getTranslationAccess($entity, $operation));
diff --git a/core/modules/content_translation/src/Access/ContentTranslationOverviewAccess.php b/core/modules/content_translation/src/Access/ContentTranslationOverviewAccess.php
index 13e240b..5fa739f 100644
--- a/core/modules/content_translation/src/Access/ContentTranslationOverviewAccess.php
+++ b/core/modules/content_translation/src/Access/ContentTranslationOverviewAccess.php
@@ -69,7 +69,7 @@ public function access(Request $request, AccountInterface $account) {
// Check per entity permission.
$permission = "translate {$entity_type}";
- if ($definition->getPermissionGranularity() == 'bundle') {
+ if ($definition->getPermissionGranularity() === 'bundle') {
$permission = "translate {$bundle} {$entity_type}";
}
return $access->allowIfHasPermission($account, $permission);
diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php
index b619036..b875c3d 100644
--- a/core/modules/content_translation/src/ContentTranslationHandler.php
+++ b/core/modules/content_translation/src/ContentTranslationHandler.php
@@ -53,7 +53,7 @@ public function retranslate(EntityInterface $entity, $langcode = NULL) {
$updated_langcode = !empty($langcode) ? $langcode : $entity->language()->id;
$translations = $entity->getTranslationLanguages();
foreach ($translations as $langcode => $language) {
- $entity->translation[$langcode]['outdated'] = $langcode != $updated_langcode;
+ $entity->translation[$langcode]['outdated'] = $langcode !== $updated_langcode;
}
}
@@ -69,7 +69,7 @@ public function getTranslationAccess(EntityInterface $entity, $op) {
// explicit translate permission.
$current_user = \Drupal::currentUser();
if (!$current_user->hasPermission('translate any entity') && $permission_granularity = $entity_type->getPermissionGranularity()) {
- $translate_permission = $current_user->hasPermission($permission_granularity == 'bundle' ? "translate {$entity->bundle()} {$entity->getEntityTypeId()}" : "translate {$entity->getEntityTypeId()}");
+ $translate_permission = $current_user->hasPermission($permission_granularity === 'bundle' ? "translate {$entity->bundle()} {$entity->getEntityTypeId()}" : "translate {$entity->getEntityTypeId()}");
}
return AccessResult::allowedIf($translate_permission && $current_user->hasPermission("$op content translations"))->cachePerRole();
}
@@ -108,7 +108,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
if (isset($languages[$form_langcode]) && ($has_translations || $new_translation)) {
$title = $this->entityFormTitle($entity);
// When editing the original values display just the entity label.
- if ($form_langcode != $entity_langcode) {
+ if ($form_langcode !== $entity_langcode) {
$t_args = array('%language' => $languages[$form_langcode]->name, '%title' => $entity->label());
$title = empty($source_langcode) ? $title . ' [' . t('%language translation', $t_args) . ']' : t('Create %language translation of %title', $t_args);
}
@@ -147,11 +147,11 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
// Disable languages for existing translations, so it is not possible to
// switch this node to some language which is already in the translation
// set.
- $language_widget = isset($form['langcode']) && $form['langcode']['#type'] == 'language_select';
+ $language_widget = isset($form['langcode']) && $form['langcode']['#type'] === 'language_select';
if ($language_widget && $has_translations) {
$form['langcode']['#options'] = array();
foreach (language_list(LanguageInterface::STATE_CONFIGURABLE) as $language) {
- if (empty($translations[$language->id]) || $language->id == $entity_langcode) {
+ if (empty($translations[$language->id]) || $language->id === $entity_langcode) {
$form['langcode']['#options'][$language->id] = $language->name;
}
}
diff --git a/core/modules/content_translation/src/Controller/ContentTranslationController.php b/core/modules/content_translation/src/Controller/ContentTranslationController.php
index 93b4887..dfb0a6b 100644
--- a/core/modules/content_translation/src/Controller/ContentTranslationController.php
+++ b/core/modules/content_translation/src/Controller/ContentTranslationController.php
@@ -70,7 +70,7 @@ public function overview(Request $request, $entity_type_id = NULL) {
// Show source-language column if there are non-original source langcodes.
$additional_source_langcodes = array_filter($entity->translation, function ($translation) use ($original) {
- return !empty($translation['source']) && $translation['source'] != $original;
+ return !empty($translation['source']) && $translation['source'] !== $original;
});
$show_source_column = !empty($additional_source_langcodes);
@@ -120,7 +120,7 @@ public function overview(Request $request, $entity_type_id = NULL) {
if (array_key_exists($langcode, $translations)) {
// Existing translation in the translation set: display status.
$source = isset($entity->translation[$langcode]['source']) ? $entity->translation[$langcode]['source'] : '';
- $is_original = $langcode == $original;
+ $is_original = $langcode === $original;
$label = $entity->getTranslation($langcode)->label();
$link = isset($links->links[$langcode]['href']) ? $links->links[$langcode] : array('href' => $entity->getSystemPath());
$link += array('language' => $language);
@@ -174,7 +174,7 @@ public function overview(Request $request, $entity_type_id = NULL) {
$row_title = $source_name = $this->t('n/a');
$source = $entity->language()->getId();
- if ($source != $langcode && $handler->getTranslationAccess($entity, 'create')->isAllowed()) {
+ if ($source !== $langcode && $handler->getTranslationAccess($entity, 'create')->isAllowed()) {
if ($translatable) {
$links['add'] = array(
'title' => $this->t('Add'),
diff --git a/core/modules/content_translation/src/FieldTranslationSynchronizer.php b/core/modules/content_translation/src/FieldTranslationSynchronizer.php
index 6715577..2336d6a 100644
--- a/core/modules/content_translation/src/FieldTranslationSynchronizer.php
+++ b/core/modules/content_translation/src/FieldTranslationSynchronizer.php
@@ -51,7 +51,7 @@ public function synchronizeFields(ContentEntityInterface $entity, $sync_langcode
// If the entity language is being changed there is nothing to synchronize.
$entity_type = $entity->getEntityTypeId();
$entity_unchanged = isset($entity->original) ? $entity->original : $this->entityManager->getStorage($entity_type)->loadUnchanged($entity->id());
- if ($entity->getUntranslated()->language()->id != $entity_unchanged->getUntranslated()->language()->id) {
+ if ($entity->getUntranslated()->language()->id !== $entity_unchanged->getUntranslated()->language()->id) {
return;
}
@@ -133,7 +133,7 @@ public function synchronizeItems(array &$values, array $unchanged_items, $sync_l
foreach ($translations as $langcode) {
// We need to synchronize only values different from the source ones.
- if ($langcode != $sync_langcode) {
+ if ($langcode !== $sync_langcode) {
// Reinitialize the change map as it is emptied while processing each
// language.
$change_map = $original_change_map;
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
index 5783ed8..2af181d 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncImageTest.php
@@ -192,7 +192,7 @@ function testImageFieldSync() {
$translation = $entity->getTranslation($langcode);
// Check that one value has been dropped from the original values.
- $assert = count($entity->{$this->fieldName}) == 2;
+ $assert = count($entity->{$this->fieldName}) === 2;
$this->assertTrue($assert, 'One item correctly removed from the synchronized field values.');
// Check that fids have been synchronized and translatable column values
@@ -201,7 +201,7 @@ function testImageFieldSync() {
foreach ($entity->{$this->fieldName} as $delta => $item) {
$value = $values[$default_langcode][$item->target_id];
$source_item = $translation->{$this->fieldName}->get($delta);
- $assert = $item->target_id == $source_item->target_id && $item->alt == $value['alt'] && $item->title == $value['title'];
+ $assert = $item->target_id === $source_item->target_id && $item->alt === $value['alt'] && $item->title === $value['title'];
$this->assertTrue($assert, format_string('Field item @fid has been successfully synchronized.', array('@fid' => $item->target_id)));
$fids[$item->target_id] = TRUE;
}
@@ -223,17 +223,17 @@ function testImageFieldSync() {
$translation = $entity->getTranslation($langcode);
// Check that the value has been added to the default language.
- $assert = count($entity->{$this->fieldName}->getValue()) == 3;
+ $assert = count($entity->{$this->fieldName}->getValue()) === 3;
$this->assertTrue($assert, 'One item correctly added to the synchronized field values.');
foreach ($entity->{$this->fieldName} as $delta => $item) {
// When adding an item its value is copied over all the target languages,
// thus in this case the source language needs to be used to check the
// values instead of the target one.
- $fid_langcode = $item->target_id != $removed_fid ? $default_langcode : $langcode;
+ $fid_langcode = $item->target_id !== $removed_fid ? $default_langcode : $langcode;
$value = $values[$fid_langcode][$item->target_id];
$source_item = $translation->{$this->fieldName}->get($delta);
- $assert = $item->target_id == $source_item->target_id && $item->alt == $value['alt'] && $item->title == $value['title'];
+ $assert = $item->target_id === $source_item->target_id && $item->alt === $value['alt'] && $item->title === $value['title'];
$this->assertTrue($assert, format_string('Field item @fid has been successfully synchronized.', array('@fid' => $item->target_id)));
}
}
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
index b05b446..1ba2158 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationSyncUnitTest.php
@@ -76,7 +76,7 @@ protected function setUp() {
foreach ($this->langcodes as $langcode) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
- $sync = in_array($column, $this->synchronized) && $langcode != $this->langcodes[0];
+ $sync = in_array($column, $this->synchronized) && $langcode !== $this->langcodes[0];
$value = $sync ? $this->unchangedFieldValues[$this->langcodes[0]][$delta][$column] : $langcode . '-' . $delta . '-' . $column;
$this->unchangedFieldValues[$langcode][$delta][$column] = $value;
}
@@ -104,12 +104,12 @@ public function testFieldSync() {
// Check that the old values are still in place.
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
- $result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] == $field_values[$langcode][$delta][$column]);
+ $result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] === $field_values[$langcode][$delta][$column]);
}
}
// Check that the new item is available in all languages.
foreach ($this->columns as $column) {
- $result = $result && ($field_values[$langcode][$delta][$column] == $field_values[$sync_langcode][$delta][$column]);
+ $result = $result && ($field_values[$langcode][$delta][$column] === $field_values[$sync_langcode][$delta][$column]);
}
}
$this->assertTrue($result, 'A new item has been correctly synchronized.');
@@ -130,9 +130,9 @@ public function testFieldSync() {
// Check that the old values are still in place.
for ($delta = 0; $delta < $this->cardinality; $delta++) {
// Skip the removed item.
- if ($delta != $sync_delta) {
+ if ($delta !== $sync_delta) {
foreach ($this->columns as $column) {
- $result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] == $field_values[$langcode][$new_delta][$column]);
+ $result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] === $field_values[$langcode][$new_delta][$column]);
}
$new_delta++;
}
@@ -162,12 +162,12 @@ public function testFieldSync() {
if (in_array($column, $this->synchronized)) {
// If we are dealing with a synchronize column the current value is
// supposed to be the same of the source items.
- $result = $result && $field_values[$sync_langcode][$delta][$column] == $value;
+ $result = $result && $field_values[$sync_langcode][$delta][$column] === $value;
}
else {
// Otherwise the values should be unchanged.
$old_delta = ($delta > 0 ? $delta : $this->cardinality) - 1;
- $result = $result && $this->unchangedFieldValues[$langcode][$old_delta][$column] == $value;
+ $result = $result && $this->unchangedFieldValues[$langcode][$old_delta][$column] === $value;
}
}
}
@@ -217,7 +217,7 @@ function($delta) { return $delta === 0 || $delta === 3; },
// synchronization process. The other ones are retained or synced
// depending on the logic implemented by the delta callback.
$value = $delta > 0 && $delta_callback($delta) ? $changed_items[0][$column] : $unchanged_items[$delta][$column];
- $result = $result && ($field_values[$langcode][$delta][$column] == $value);
+ $result = $result && ($field_values[$langcode][$delta][$column] === $value);
}
}
}
@@ -245,7 +245,7 @@ public function testDifferingSyncedColumns() {
foreach ($this->unchangedFieldValues as $langcode => $unchanged_items) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
- $result = $result && ($field_values[$langcode][$delta][$column] == $changed_items[$delta][$column]);
+ $result = $result && ($field_values[$langcode][$delta][$column] === $changed_items[$delta][$column]);
}
}
}
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
index f2fa13d..8e8b43a 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
@@ -119,7 +119,7 @@ protected function getTranslatorPermissions() {
protected function getTranslatePermission() {
$entity_type = \Drupal::entityManager()->getDefinition($this->entityTypeId);
if ($permission_granularity = $entity_type->getPermissionGranularity()) {
- return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}";
+ return $permission_granularity === 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}";
}
}
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
index 58d0c59..8bdbf73 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationUITest.php
@@ -147,10 +147,10 @@ protected function doTestOutdatedStatus() {
// Check that every translation has the correct "outdated" status.
foreach ($this->langcodes as $added_langcode) {
- $prefix = $added_langcode != $default_langcode ? $added_langcode . '/' : '';
+ $prefix = $added_langcode !== $default_langcode ? $added_langcode . '/' : '';
$path = $prefix . $edit_path;
$this->drupalGet($path);
- if ($added_langcode == $langcode) {
+ if ($added_langcode === $langcode) {
$this->assertFieldByXPath('//input[@name="content_translation[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.');
}
else {
@@ -242,7 +242,7 @@ protected function doTestTranslationDeletion() {
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
if ($this->assertTrue(is_object($entity), 'Entity found')) {
$translations = $entity->getTranslationLanguages();
- $this->assertTrue(count($translations) == 2 && empty($translations[$langcode]), 'Translation successfully deleted.');
+ $this->assertTrue(count($translations) === 2 && empty($translations[$langcode]), 'Translation successfully deleted.');
}
}
@@ -343,7 +343,7 @@ protected function getTranslation(EntityInterface $entity, $langcode) {
* The property value.
*/
protected function getValue(EntityInterface $translation, $property, $langcode) {
- $key = $property == 'user_id' ? 'target_id' : 'value';
+ $key = $property === 'user_id' ? 'target_id' : 'value';
return $translation->get($property)->{$key};
}
diff --git a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
index ccb3f80..8a1ad6a 100644
--- a/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
@@ -92,7 +92,7 @@ function testWorkflows() {
$this->drupalGet($translations_path);
foreach ($ops as $op => $label) {
- if ($op != $current_op) {
+ if ($op !== $current_op) {
$this->assertNoLink($label, format_string('No %op link found.', array('%op' => $label)));
}
else {
@@ -132,12 +132,12 @@ protected function assertWorkflows(UserInterface $user, $expected_status) {
// Check whether the user is allowed to create a translation.
$add_translation_path = $translations_path . "/add/$default_langcode/$langcode";
- if ($expected_status['add_translation'] == 200) {
+ if ($expected_status['add_translation'] === 200) {
$this->clickLink('Add');
$this->assertUrl($add_translation_path, $options, 'The translation overview points to the translation form when creating translations.');
// Check that the translation form does not contain shared elements for
// translators.
- if ($expected_status['edit'] == 403) {
+ if ($expected_status['edit'] === 403) {
$this->assertNoSharedElements();
}
}
@@ -150,9 +150,9 @@ protected function assertWorkflows(UserInterface $user, $expected_status) {
$langcode = $this->langcodes[2];
$edit_translation_path = $translations_path . "/edit/$langcode";
$options = array('language' => $languages[$langcode]);
- if ($expected_status['edit_translation'] == 200) {
+ if ($expected_status['edit_translation'] === 200) {
$this->drupalGet($translations_path, $options);
- $editor = $expected_status['edit'] == 200;
+ $editor = $expected_status['edit'] === 200;
if ($editor) {
$this->clickLink('Edit', 2);
diff --git a/core/modules/datetime/src/DateTimeComputed.php b/core/modules/datetime/src/DateTimeComputed.php
index 271cba9..fc4d81d 100644
--- a/core/modules/datetime/src/DateTimeComputed.php
+++ b/core/modules/datetime/src/DateTimeComputed.php
@@ -48,7 +48,7 @@ public function getValue($langcode = NULL) {
$item = $this->getParent();
$value = $item->{($this->definition->getSetting('date source'))};
- $storage_format = $item->getFieldDefinition()->getSetting('datetime_type') == 'date' ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT;
+ $storage_format = $item->getFieldDefinition()->getSetting('datetime_type') === 'date' ? DATETIME_DATE_STORAGE_FORMAT : DATETIME_DATETIME_STORAGE_FORMAT;
try {
$date = DrupalDateTime::createFromFormat($storage_format, $value, DATETIME_STORAGE_TIMEZONE);
if ($date instanceOf DrupalDateTime && !$date->hasErrors()) {
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
index f983c8d..e3533cb 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php
@@ -118,7 +118,7 @@ public function viewElements(FieldItemListInterface $items) {
// The formatted output will be in local time.
$date->setTimeZone(timezone_open(drupal_get_user_timezone()));
- if ($this->getFieldSetting('datetime_type') == 'date') {
+ if ($this->getFieldSetting('datetime_type') === 'date') {
// A date without time will pick up the current time, use the default.
datetime_date_default_time($date);
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
index 24fc69c..de0ca0b 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php
@@ -39,7 +39,7 @@ public function viewElements(FieldItemListInterface $items) {
$date = $item->date;
$date->setTimeZone(timezone_open(drupal_get_user_timezone()));
$format = DATETIME_DATETIME_STORAGE_FORMAT;
- if ($this->getFieldSetting('datetime_type') == 'date') {
+ if ($this->getFieldSetting('datetime_type') === 'date') {
// A date without time will pick up the current time, use the default.
datetime_date_default_time($date);
$format = DATETIME_DATE_STORAGE_FORMAT;
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
index e78a194..75dbd79 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php
@@ -52,7 +52,7 @@ public function defaultValuesForm(array &$form, FormStateInterface $form_state)
'#type' => 'textfield',
'#title' => t('Relative default value'),
'#description' => t("Describe a time by reference to the current day, like '+90 days' (90 days from the day the field is created) or '+1 Saturday' (the next Saturday). See !strtotime for more details.", array('!strtotime' => l('strtotime', 'http://www.php.net/manual/en/function.strtotime.php'))),
- '#default_value' => (isset($default_value[0]['default_date_type']) && $default_value[0]['default_date_type'] == static::DEFAULT_VALUE_CUSTOM) ? $default_value[0]['default_date'] : '',
+ '#default_value' => (isset($default_value[0]['default_date_type']) && $default_value[0]['default_date_type'] === static::DEFAULT_VALUE_CUSTOM) ? $default_value[0]['default_date'] : '',
'#states' => array(
'visible' => array(
':input[id="edit-default-value-input-default-date-type"]' => array('value' => static::DEFAULT_VALUE_CUSTOM),
@@ -69,7 +69,7 @@ public function defaultValuesForm(array &$form, FormStateInterface $form_state)
* {@inheritdoc}
*/
public function defaultValuesFormValidate(array $element, array &$form, FormStateInterface $form_state) {
- if ($form_state->getValue(['default_value_input', 'default_date_type']) == static::DEFAULT_VALUE_CUSTOM) {
+ if ($form_state->getValue(['default_value_input', 'default_date_type']) === static::DEFAULT_VALUE_CUSTOM) {
$is_strtotime = @strtotime($form_state->getValue(array('default_value_input', 'default_date')));
if (!$is_strtotime) {
$form_state->setErrorByName('default_value_input][default_date', t('The relative date value entered is invalid.'));
@@ -82,7 +82,7 @@ public function defaultValuesFormValidate(array $element, array &$form, FormStat
*/
public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state) {
if ($form_state->getValue(array('default_value_input', 'default_date_type'))) {
- if ($form_state->getValue(array('default_value_input', 'default_date_type')) == static::DEFAULT_VALUE_NOW) {
+ if ($form_state->getValue(array('default_value_input', 'default_date_type')) === static::DEFAULT_VALUE_NOW) {
$form_state->setValueForElement($element['default_date'], static::DEFAULT_VALUE_NOW);
}
return array($form_state->getValue('default_value_input'));
@@ -100,7 +100,7 @@ public static function processDefaultValue($default_value, ContentEntityInterfac
// A default value should be in the format and timezone used for date
// storage.
$date = new DrupalDateTime($default_value[0]['default_date'], DATETIME_STORAGE_TIMEZONE);
- $storage_format = $definition->getSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT: DATETIME_DATETIME_STORAGE_FORMAT;
+ $storage_format = $definition->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE ? DATETIME_DATE_STORAGE_FORMAT: DATETIME_DATETIME_STORAGE_FORMAT;
$value = $date->format($storage_format);
// We only provide a default value for the first item, as do all fields.
// Otherwise, there is no way to clear out unwanted values on multiple value
diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
index 4b37a3c..fb091b4 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
@@ -111,7 +111,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
// Just pick a date in the past year. No guidance is provided by this Field
// type.
$timestamp = REQUEST_TIME - mt_rand(0, 86400*365);
- if ($type == DateTimeItem::DATETIME_TYPE_DATE) {
+ if ($type === DateTimeItem::DATETIME_TYPE_DATE) {
$values['value'] = gmdate(DATETIME_DATE_STORAGE_FORMAT, $timestamp);
}
else {
@@ -135,7 +135,7 @@ public function onChange($property_name) {
parent::onChange($property_name);
// Enforce that the computed date is recalculated.
- if ($property_name == 'value') {
+ if ($property_name === 'value') {
$this->date = NULL;
}
}
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
index d460416..7bedafb 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeDatelistWidget.php
@@ -92,7 +92,7 @@ function settingsForm(array $form, FormStateInterface $form_state) {
'#options' => array('MDY' => t('Month/Day/Year'), 'DMY' => t('Day/Month/Year'), 'YMD' => t('Year/Month/Day')),
);
- if ($this->getFieldSetting('datetime_type') == 'datetime') {
+ if ($this->getFieldSetting('datetime_type') === 'datetime') {
$element['time_type'] = array(
'#type' => 'select',
'#title' => t('Time type'),
@@ -129,7 +129,7 @@ public function settingsSummary() {
$summary = array();
$summary[] = t('Date part order: !order', array('!order' => $this->getSetting('date_order')));
- if ($this->getFieldSetting('datetime_type') == 'datetime') {
+ if ($this->getFieldSetting('datetime_type') === 'datetime') {
$summary[] = t('Time type: !time_type', array('!time_type' => $this->getSetting('time_type')));
}
$summary[] = t('Time increments: !increment', array('!increment' => $this->getSetting('increment')));
diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
index 32d3668..375b870 100644
--- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
+++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
@@ -44,7 +44,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
// The date was created and verified during field_load(), so it is safe to
// use without further inspection.
$date->setTimezone(new \DateTimeZone($element['value']['#date_timezone']));
- if ($this->getFieldSetting('datetime_type') == DateTimeItem::DATETIME_TYPE_DATE) {
+ if ($this->getFieldSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
// A date without time will pick up the current time, use the default
// time.
datetime_date_default_time($date);
diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php
index 4dc37e4..1ce3053 100644
--- a/core/modules/dblog/src/Tests/DbLogTest.php
+++ b/core/modules/dblog/src/Tests/DbLogTest.php
@@ -86,7 +86,7 @@ private function verifyRowLimit($row_limit) {
// Check row limit variable.
$current_limit = \Drupal::config('dblog.settings')->get('row_limit');
- $this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
+ $this->assertTrue($current_limit === $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
}
/**
@@ -107,7 +107,7 @@ private function verifyCron($row_limit) {
// Verify that the database log row count equals the row limit plus one
// because cron adds a record after it runs.
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
- $this->assertTrue($count == $row_limit + 1, format_string('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
+ $this->assertTrue($count === $row_limit + 1, format_string('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
}
/**
@@ -154,28 +154,28 @@ private function verifyReports($response = 200) {
// View the database log help page.
$this->drupalGet('admin/help/dblog');
$this->assertResponse($response);
- if ($response == 200) {
+ if ($response === 200) {
$this->assertText(t('Database Logging'), 'DBLog help was displayed');
}
// View the database log report page.
$this->drupalGet('admin/reports/dblog');
$this->assertResponse($response);
- if ($response == 200) {
+ if ($response === 200) {
$this->assertText(t('Recent log messages'), 'DBLog report was displayed');
}
// View the database log page-not-found report page.
$this->drupalGet('admin/reports/page-not-found');
$this->assertResponse($response);
- if ($response == 200) {
+ if ($response === 200) {
$this->assertText("Top 'page not found' errors", 'DBLog page-not-found report was displayed');
}
// View the database log access-denied report page.
$this->drupalGet('admin/reports/access-denied');
$this->assertResponse($response);
- if ($response == 200) {
+ if ($response === 200) {
$this->assertText("Top 'access denied' errors", 'DBLog access-denied report was displayed');
}
@@ -183,7 +183,7 @@ private function verifyReports($response = 200) {
$wid = db_query('SELECT MIN(wid) FROM {watchdog}')->fetchField();
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertResponse($response);
- if ($response == 200) {
+ if ($response === 200) {
$this->assertText(t('Details'), 'DBLog event node was displayed');
}
@@ -236,7 +236,7 @@ private function doUser() {
$this->assertResponse(200);
// Retrieve the user object.
$user = user_load_by_name($name);
- $this->assertTrue($user != NULL, format_string('User @name was loaded', array('@name' => $name)));
+ $this->assertTrue($user !== NULL, format_string('User @name was loaded', array('@name' => $name)));
// pass_raw property is needed by drupalLogin.
$user->pass_raw = $pass;
// Login user.
@@ -279,7 +279,7 @@ private function doUser() {
// Found link with the message text.
$links = array_shift($links);
foreach ($links->attributes() as $attr => $value) {
- if ($attr == 'href') {
+ if ($attr === 'href') {
// Extract link to details page.
$link = drupal_substr($value, strpos($value, 'admin/reports/dblog/event/'));
$this->drupalGet($link);
@@ -322,7 +322,7 @@ private function doNode($type) {
$this->assertResponse(200);
// Retrieve the node object.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
+ $this->assertTrue($node !== NULL, format_string('Node @title was loaded', array('@title' => $title)));
// Edit the node.
$edit = $this->getContentUpdate($type);
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
@@ -492,7 +492,7 @@ protected function testFilter() {
// Count the number of entries of this type.
$type_count = 0;
foreach ($types as $type) {
- if ($type['type'] == $type_name) {
+ if ($type['type'] === $type_name) {
$type_count += $type['count'];
}
}
@@ -565,7 +565,7 @@ protected function getTypeCount(array $types) {
$count = array_fill(0, count($types), 0);
foreach ($entries as $entry) {
foreach ($types as $key => $type) {
- if ($entry['type'] == $type['type'] && $entry['severity'] == $type['severity']) {
+ if ($entry['type'] === $type['type'] && $entry['severity'] === $type['severity']) {
$count[$key]++;
break;
}
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 85f58fa..efdbd1a 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -214,7 +214,7 @@ function editor_form_filter_admin_format_submit($form, FormStateInterface $form_
// Delete the existing editor if disabling or switching between editors.
$format_id = $form_state->getFormObject()->getEntity()->id();
$original_editor = editor_load($format_id);
- if ($original_editor && $original_editor->getEditor() != $form_state->getValue('editor')) {
+ if ($original_editor && $original_editor->getEditor() !== $form_state->getValue('editor')) {
$original_editor->delete();
}
@@ -339,7 +339,7 @@ function editor_entity_update(EntityInterface $entity) {
// On new revisions, all files are considered to be a new usage and no
// deletion of previous file usages are necessary.
- if (!empty($entity->original) && $entity->getRevisionId() != $entity->original->getRevisionId()) {
+ if (!empty($entity->original) && $entity->getRevisionId() !== $entity->original->getRevisionId()) {
$referenced_files_by_field = _editor_get_file_uuids_by_field($entity);
foreach ($referenced_files_by_field as $field => $uuids) {
_editor_record_file_usage($uuids, $entity);
diff --git a/core/modules/editor/src/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/src/Plugin/InPlaceEditor/Editor.php
index d729943..248ea2c 100644
--- a/core/modules/editor/src/Plugin/InPlaceEditor/Editor.php
+++ b/core/modules/editor/src/Plugin/InPlaceEditor/Editor.php
@@ -29,7 +29,7 @@ public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items->getFieldDefinition();
// This editor is incompatible with multivalued fields.
- if ($field_definition->getFieldStorageDefinition()->getCardinality() != 1) {
+ if ($field_definition->getFieldStorageDefinition()->getCardinality() !== 1) {
return FALSE;
}
// This editor is compatible with processed ("rich") text fields; but only
diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module
index 2fcfecd..5aeb406 100644
--- a/core/modules/entity_reference/entity_reference.module
+++ b/core/modules/entity_reference/entity_reference.module
@@ -69,7 +69,7 @@ function entity_reference_field_widget_info_alter(&$info) {
* Reset the instance handler settings, when the target type is changed.
*/
function entity_reference_field_storage_config_update(FieldStorageConfigInterface $field_storage) {
- if ($field_storage->type != 'entity_reference') {
+ if ($field_storage->type !== 'entity_reference') {
// Only act on entity reference fields.
return;
}
@@ -79,7 +79,7 @@ function entity_reference_field_storage_config_update(FieldStorageConfigInterfac
return;
}
- if ($field_storage->getSetting('target_type') == $field_storage->original->getSetting('target_type')) {
+ if ($field_storage->getSetting('target_type') === $field_storage->original->getSetting('target_type')) {
// Target type didn't change.
return;
}
diff --git a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
index f4fd800..bbbe8d8 100644
--- a/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
+++ b/core/modules/entity_reference/src/ConfigurableEntityReferenceItem.php
@@ -94,7 +94,7 @@ public function getSettableOptions(AccountInterface $account = NULL) {
$return[$bundle_label] = $entity_ids;
}
- return count($return) == 1 ? reset($return) : $return;
+ return count($return) === 1 ? reset($return) : $return;
}
/**
diff --git a/core/modules/entity_reference/src/EntityReferenceController.php b/core/modules/entity_reference/src/EntityReferenceController.php
index 026b5d5..98c349a 100644
--- a/core/modules/entity_reference/src/EntityReferenceController.php
+++ b/core/modules/entity_reference/src/EntityReferenceController.php
@@ -79,7 +79,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
$field_definition = $definitions[$field_name];
$access_control_handler = $this->entityManager()->getAccessControlHandler($entity_type);
- if ($field_definition->getType() != 'entity_reference' || !$access_control_handler->fieldAccess('edit', $field_definition)) {
+ if ($field_definition->getType() !== 'entity_reference' || !$access_control_handler->fieldAccess('edit', $field_definition)) {
throw new AccessDeniedHttpException();
}
@@ -91,7 +91,7 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
$prefix = '';
// The user entered a comma-separated list of entity labels, so we generate
// a prefix.
- if ($type == 'tags' && !empty($last_item)) {
+ if ($type === 'tags' && !empty($last_item)) {
$prefix = count($items_typed) ? Tags::implode($items_typed) . ', ' : '';
}
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
index b289a06..f9c9063 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteTagsWidget.php
@@ -70,7 +70,7 @@ public function elementValidate($element, FormStateInterface $form_state, $form)
if ($match) {
$value[] = array('target_id' => $match);
}
- elseif ($auto_create && (count($this->getSelectionHandlerSetting('target_bundles')) == 1 || count($bundles) == 1)) {
+ elseif ($auto_create && (count($this->getSelectionHandlerSetting('target_bundles')) === 1 || count($bundles) === 1)) {
// Auto-create item. See
// \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave().
$value[] = array(
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
index ef9e6ea..2e2341c 100644
--- a/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldWidget/AutocompleteWidget.php
@@ -80,7 +80,7 @@ public function elementValidate($element, FormStateInterface $form_state, $form)
$value = $handler->validateAutocompleteInput($element['#value'], $element, $form_state, $form, !$auto_create);
}
- if (!$value && $auto_create && (count($this->getSelectionHandlerSetting('target_bundles')) == 1)) {
+ if (!$value && $auto_create && (count($this->getSelectionHandlerSetting('target_bundles')) === 1)) {
// Auto-create item. See
// \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::presave().
$value = array(
diff --git a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
index aba32fd..fefb7c7 100644
--- a/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/src/Plugin/entity_reference/selection/SelectionBase.php
@@ -86,10 +86,10 @@ public static function settingsForm(FieldDefinitionInterface $field_definition)
$target_bundles_title = t('Bundles');
// Default core entity types with sensible labels.
- if ($entity_type_id == 'node') {
+ if ($entity_type_id === 'node') {
$target_bundles_title = t('Content types');
}
- elseif ($entity_type_id == 'taxonomy_term') {
+ elseif ($entity_type_id === 'taxonomy_term') {
$target_bundles_title = t('Vocabularies');
}
@@ -151,7 +151,7 @@ public static function settingsForm(FieldDefinitionInterface $field_definition)
'#process' => array('_entity_reference_form_process_merge_parent'),
);
- if ($selection_handler_settings['sort']['field'] != '_none') {
+ if ($selection_handler_settings['sort']['field'] !== '_none') {
// Merge-in default values.
$selection_handler_settings['sort'] += array(
'direction' => 'ASC',
@@ -306,7 +306,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$handler_settings = $this->fieldDefinition->getSetting('handler_settings');
if (!empty($handler_settings['sort'])) {
$sort_settings = $handler_settings['sort'];
- if ($sort_settings['field'] != '_none') {
+ if ($sort_settings['field'] !== '_none') {
$query->sort($sort_settings['field'], $sort_settings['direction']);
}
}
diff --git a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php b/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php
index beeb095..6d32e58 100644
--- a/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php
+++ b/core/modules/entity_reference/src/Plugin/views/display/EntityReference.php
@@ -129,7 +129,7 @@ public function query() {
if (isset($options['match'])) {
$style_options = $this->getOption('style');
$value = db_like($options['match']) . '%';
- if ($options['match_operator'] != 'STARTS_WITH') {
+ if ($options['match_operator'] !== 'STARTS_WITH') {
$value = '%' . $value;
}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTest.php
index 22a3847..c6b2410 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTest.php
@@ -117,7 +117,7 @@ public function testReferencedEntitiesMultipleLoad() {
$reference_field[4]['target_id'] = NULL;
$target_entities[4] = NULL;
- // Attach the first created target entity as the sixth item ($delta == 5) of
+ // Attach the first created target entity as the sixth item ($delta === 5) of
// the parent entity field. We want to test the case when the same target
// entity is referenced twice (or more times) in the same entity reference
// field.
diff --git a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php b/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php
index a86adfd..fc51d6c 100644
--- a/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php
+++ b/core/modules/entity_reference/src/Tests/Views/EntityReferenceRelationshipTest.php
@@ -125,7 +125,7 @@ public function testRelationship() {
// The second and third entity refer to the first one.
// The value key on the result will be in the format
// BASE_TABLE_FIELD_NAME.
- $this->assertEqual($view->result[$index]->entity_test_entity_test__field_test_id, $index == 0 ? NULL : 1);
+ $this->assertEqual($view->result[$index]->entity_test_entity_test__field_test_id, $index === 0 ? NULL : 1);
if ($index > 0) {
// Test that the correct relationship entity is on the row.
@@ -139,7 +139,7 @@ public function testRelationship() {
foreach (array_keys($view->result) as $index) {
$this->assertEqual($view->result[$index]->id, $this->entities[$index + 1]->id());
// The second and third entity refer to the first one.
- $this->assertEqual($view->result[$index]->entity_test_entity_test__field_test_id, $index == 0 ? NULL : 1);
+ $this->assertEqual($view->result[$index]->entity_test_entity_test__field_test_id, $index === 0 ? NULL : 1);
}
}
diff --git a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php b/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
index dbfe0f6..9116642 100644
--- a/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
+++ b/core/modules/entity_reference/src/Tests/Views/SelectionTest.php
@@ -69,7 +69,7 @@ public function testSelectionHandler() {
$success = FALSE;
foreach ($result as $node_type => $values) {
foreach ($values as $nid => $label) {
- if (!$success = $nodes[$node_type][$nid] == trim(strip_tags($label))) {
+ if (!$success = $nodes[$node_type][$nid] === trim(strip_tags($label))) {
// There was some error, so break.
break;
}
diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php
index d905c69..011a8c2 100644
--- a/core/modules/field/field.api.php
+++ b/core/modules/field/field.api.php
@@ -163,7 +163,7 @@ function hook_field_widget_info_alter(array &$info) {
function hook_field_widget_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
// Add a css class to widget form elements for all fields of type mytype.
$field_definition = $context['items']->getFieldDefinition();
- if ($field_definition->getType() == 'mytype') {
+ if ($field_definition->getType() === 'mytype') {
// Be sure not to overwrite existing attributes.
$element['#attributes']['class'][] = 'myclass';
}
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index ec8d2b7..3ae5043 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -123,7 +123,7 @@ function field_cron() {
function field_system_info_alter(&$info, Extension $file, $type) {
// It is not safe to call entity_load_multiple_by_properties() during
// maintenance mode.
- if ($type == 'module' && !defined('MAINTENANCE_MODE')) {
+ if ($type === 'module' && !defined('MAINTENANCE_MODE')) {
$fields = entity_load_multiple_by_properties('field_storage_config', array('module' => $file->getName(), 'include_deleted' => TRUE));
if ($fields) {
$info['required'] = TRUE;
diff --git a/core/modules/field/field.purge.inc b/core/modules/field/field.purge.inc
index 2676952..af8055d 100644
--- a/core/modules/field/field.purge.inc
+++ b/core/modules/field/field.purge.inc
@@ -94,13 +94,13 @@ function field_purge_batch($batch_size, $field_storage_uuid = NULL) {
}
$count_purged = \Drupal::entityManager()->getStorage($entity_type)->purgeFieldData($instance, $batch_size);
- if ($count_purged < $batch_size || $count_purged == 0) {
+ if ($count_purged < $batch_size || $count_purged === 0) {
// No field data remains for the instance, so we can remove it.
field_purge_instance($instance);
}
$batch_size -= $count_purged;
// Only delete up to the maximum number of records.
- if ($batch_size == 0) {
+ if ($batch_size === 0) {
break;
}
}
@@ -110,7 +110,7 @@ function field_purge_batch($batch_size, $field_storage_uuid = NULL) {
$deleted_storages = \Drupal::state()->get('field.storage.deleted') ?: array();
foreach ($deleted_storages as $field_storage) {
$field_storage = new FieldStorageConfig($field_storage);
- if ($field_storage_uuid && $field_storage->uuid() != $field_storage_uuid) {
+ if ($field_storage_uuid && $field_storage->uuid() !== $field_storage_uuid) {
// If a specific UUID is provided, only purge the corresponding field.
continue;
}
diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc
index a01ee5c..3375d4f 100644
--- a/core/modules/field/field.views.inc
+++ b/core/modules/field/field.views.inc
@@ -245,7 +245,7 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
$table = $table_info['table'];
$table_alias = $table_info['alias'];
- if ($type == EntityStorageInterface::FIELD_LOAD_CURRENT) {
+ if ($type === EntityStorageInterface::FIELD_LOAD_CURRENT) {
$group = $group_name;
$field_alias = $field_name;
}
@@ -266,8 +266,8 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
$aliases = array();
$also_known = array();
foreach ($all_labels as $label_name => $true) {
- if ($type == EntityStorageInterface::FIELD_LOAD_CURRENT) {
- if ($label != $label_name) {
+ if ($type === EntityStorageInterface::FIELD_LOAD_CURRENT) {
+ if ($label !== $label_name) {
$aliases[] = array(
'base' => $base_table,
'group' => $group_name,
@@ -277,7 +277,7 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
$also_known[] = t('@group: @field', array('@group' => $group_name, '@field' => $label_name));
}
}
- elseif ($supports_revisions && $label != $label_name) {
+ elseif ($supports_revisions && $label !== $label_name) {
$aliases[] = array(
'base' => $table,
'group' => t('@group (historical data)', array('@group' => $group_name)),
@@ -305,7 +305,7 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
'entity_tables' => $entity_tables,
// Default the element type to div, let the UI change it if necessary.
'element type' => 'div',
- 'is revision' => $type == EntityStorageInterface::FIELD_LOAD_REVISION,
+ 'is revision' => $type === EntityStorageInterface::FIELD_LOAD_REVISION,
);
}
@@ -337,7 +337,7 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
break;
}
- if (count($field_columns) == 1 || $column == 'value') {
+ if (count($field_columns) === 1 || $column === 'value') {
$title = t('@label (!name)', array('@label' => $label, '!name' => $field_name));
$title_short = $label;
}
@@ -351,7 +351,7 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
$table = $table_info['table'];
$table_alias = $table_info['alias'];
- if ($type == EntityStorageInterface::FIELD_LOAD_CURRENT) {
+ if ($type === EntityStorageInterface::FIELD_LOAD_CURRENT) {
$group = $group_name;
}
else {
@@ -374,8 +374,8 @@ function field_views_field_default_views_data(FieldStorageConfigInterface $field
$aliases = array();
$also_known = array();
foreach ($all_labels as $label_name => $true) {
- if ($label != $label_name) {
- if (count($field_columns) == 1 || $column == 'value') {
+ if ($label !== $label_name) {
+ if (count($field_columns) === 1 || $column === 'value') {
$alias_title = t('@label (!name)', array('@label' => $label_name, '!name' => $field_name));
}
else {
@@ -477,11 +477,11 @@ function list_field_views_data(FieldStorageConfigInterface $field_storage) {
$data = field_views_field_default_views_data($field_storage);
foreach ($data as $table_name => $table_data) {
foreach ($table_data as $field_name => $field_data) {
- if (isset($field_data['filter']) && $field_name != 'delta') {
+ if (isset($field_data['filter']) && $field_name !== 'delta') {
$data[$table_name][$field_name]['filter']['id'] = 'field_list';
}
- if (isset($field_data['argument']) && $field_name != 'delta') {
- if ($field_storage->getType() == 'list_text') {
+ if (isset($field_data['argument']) && $field_name !== 'delta') {
+ if ($field_storage->getType() === 'list_text') {
$data[$table_name][$field_name]['argument']['id'] = 'field_list_string';
}
else {
diff --git a/core/modules/field/src/ConfigImporterFieldPurger.php b/core/modules/field/src/ConfigImporterFieldPurger.php
index f762954..39cd707 100644
--- a/core/modules/field/src/ConfigImporterFieldPurger.php
+++ b/core/modules/field/src/ConfigImporterFieldPurger.php
@@ -36,7 +36,7 @@ public static function process(array &$context, ConfigImporter $config_importer)
$field_storages = static::getFieldStoragesToPurge($context['sandbox']['field']['extensions'], $config_importer->getUnprocessedConfiguration('delete'));
// Get the first field storage to process.
$field_storage = reset($field_storages);
- if (!isset($context['sandbox']['field']['current_storage_id']) || $context['sandbox']['field']['current_storage_id'] != $field_storage->id()) {
+ if (!isset($context['sandbox']['field']['current_storage_id']) || $context['sandbox']['field']['current_storage_id'] !== $field_storage->id()) {
$context['sandbox']['field']['current_storage_id'] = $field_storage->id();
// If the storage has not been deleted yet we need to do that. This is the
// case when the storage deletion is staged.
@@ -47,7 +47,7 @@ public static function process(array &$context, ConfigImporter $config_importer)
field_purge_batch($context['sandbox']['field']['purge_batch_size'], $field_storage->uuid());
$context['sandbox']['field']['current_progress']++;
$fields_to_delete_count = count(static::getFieldStoragesToPurge($context['sandbox']['field']['extensions'], $config_importer->getUnprocessedConfiguration('delete')));
- if ($fields_to_delete_count == 0) {
+ if ($fields_to_delete_count === 0) {
$context['finished'] = 1;
}
else {
diff --git a/core/modules/field/src/Entity/FieldInstanceConfig.php b/core/modules/field/src/Entity/FieldInstanceConfig.php
index 4a4239d..1a2f8c1 100644
--- a/core/modules/field/src/Entity/FieldInstanceConfig.php
+++ b/core/modules/field/src/Entity/FieldInstanceConfig.php
@@ -146,13 +146,13 @@ public function preSave(EntityStorageInterface $storage) {
}
else {
// Some updates are always disallowed.
- if ($this->entity_type != $this->original->entity_type) {
+ if ($this->entity_type !== $this->original->entity_type) {
throw new FieldException("Cannot change an existing instance's entity_type.");
}
- if ($this->bundle != $this->original->bundle && empty($this->bundleRenameAllowed)) {
+ if ($this->bundle !== $this->original->bundle && empty($this->bundleRenameAllowed)) {
throw new FieldException("Cannot change an existing instance's bundle.");
}
- if ($storage_definition->uuid() != $this->original->getFieldStorageDefinition()->uuid()) {
+ if ($storage_definition->uuid() !== $this->original->getFieldStorageDefinition()->uuid()) {
throw new FieldException("Cannot change an existing instance's storage.");
}
// Set the default instance settings.
@@ -219,7 +219,7 @@ public static function postDelete(EntityStorageInterface $storage, array $instan
$storages_to_delete = array();
foreach ($instances as $instance) {
$storage_definition = $instance->getFieldStorageDefinition();
- if (!$instance->deleted && empty($instance->noFieldDelete) && !$instance->isUninstalling() && count($storage_definition->getBundles()) == 0) {
+ if (!$instance->deleted && empty($instance->noFieldDelete) && !$instance->isUninstalling() && count($storage_definition->getBundles()) === 0) {
// Key by field UUID to avoid deleting the same storage twice.
$storages_to_delete[$storage_definition->uuid()] = $storage_definition;
}
diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php
index 128ac01..4789273 100644
--- a/core/modules/field/src/Entity/FieldStorageConfig.php
+++ b/core/modules/field/src/Entity/FieldStorageConfig.php
@@ -319,10 +319,10 @@ protected function preSaveUpdated(EntityStorageInterface $storage) {
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
// Some updates are always disallowed.
- if ($this->type != $this->original->type) {
+ if ($this->type !== $this->original->type) {
throw new FieldException("Cannot change the field type for an existing field storage.");
}
- if ($this->entity_type != $this->original->entity_type) {
+ if ($this->entity_type !== $this->original->entity_type) {
throw new FieldException("Cannot change the entity type for an existing field storage.");
}
@@ -583,7 +583,7 @@ public function isRequired() {
*/
public function isMultiple() {
$cardinality = $this->getCardinality();
- return ($cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) || ($cardinality > 1);
+ return ($cardinality === FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) || ($cardinality > 1);
}
/**
diff --git a/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php b/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php
index eb4a37f..aabfe4c 100644
--- a/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php
+++ b/core/modules/field/src/FieldInstanceConfigAccessControlHandler.php
@@ -23,7 +23,7 @@ class FieldInstanceConfigAccessControlHandler extends EntityAccessControlHandler
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
- if ($operation == 'delete') {
+ if ($operation === 'delete') {
$field_storage_entity = $entity->getFieldStorageDefinition();
if ($field_storage_entity->isLocked()) {
return AccessResult::forbidden()->cacheUntilEntityChanges($field_storage_entity);
diff --git a/core/modules/field/src/FieldInstanceConfigStorage.php b/core/modules/field/src/FieldInstanceConfigStorage.php
index 2c4e5d1..7d2c64d 100644
--- a/core/modules/field/src/FieldInstanceConfigStorage.php
+++ b/core/modules/field/src/FieldInstanceConfigStorage.php
@@ -157,7 +157,7 @@ public function loadByProperties(array $conditions = array()) {
}
// Skip to the next instance as soon as one condition does not match.
- if ($checked_value != $value) {
+ if ($checked_value !== $value) {
continue 2;
}
}
diff --git a/core/modules/field/src/FieldStorageConfigStorage.php b/core/modules/field/src/FieldStorageConfigStorage.php
index 563deef..5ad10ea 100644
--- a/core/modules/field/src/FieldStorageConfigStorage.php
+++ b/core/modules/field/src/FieldStorageConfigStorage.php
@@ -150,7 +150,7 @@ public function loadByProperties(array $conditions = array()) {
}
// Skip to the next field as soon as one condition does not match.
- if ($checked_value != $value) {
+ if ($checked_value !== $value) {
continue 2;
}
}
diff --git a/core/modules/field/src/Plugin/views/field/Field.php b/core/modules/field/src/Plugin/views/field/Field.php
index 7788a5b..3f6b673 100644
--- a/core/modules/field/src/Plugin/views/field/Field.php
+++ b/core/modules/field/src/Plugin/views/field/Field.php
@@ -202,7 +202,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
// Otherwise, we only limit values if the user hasn't selected "all", 0, or
// the value matching field cardinality.
- if ((intval($this->options['delta_limit']) && ($this->options['delta_limit'] != $cardinality)) || intval($this->options['delta_offset'])) {
+ if ((intval($this->options['delta_limit']) && ($this->options['delta_limit'] !== $cardinality)) || intval($this->options['delta_offset'])) {
$this->limit_values = TRUE;
}
}
@@ -231,7 +231,7 @@ function get_base_table() {
// If the current field is under a relationship you can't be sure that the
// base table of the view is the base table of the current field.
// For example a field from a node author on a node view does have users as base table.
- if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') {
+ if (!empty($this->options['relationship']) && $this->options['relationship'] !== 'none') {
$relationships = $this->view->display_handler->getOption('relationships');
if (!empty($relationships[$this->options['relationship']])) {
$options = $relationships[$this->options['relationship']];
@@ -265,7 +265,7 @@ public function query($use_groupby = FALSE) {
if ($use_groupby) {
// Add the fields that we're actually grouping on.
$options = array();
- if ($this->options['group_column'] != 'entity_id') {
+ if ($this->options['group_column'] !== 'entity_id') {
$options = array($this->options['group_column'] => $this->options['group_column']);
}
$options += is_array($this->options['group_columns']) ? $this->options['group_columns'] : array();
@@ -373,7 +373,7 @@ protected function defineOptions() {
$column_names = array_keys($field_storage->getColumns());
$default_column = '';
// Try to determine a sensible default.
- if (count($column_names) == 1) {
+ if (count($column_names) === 1) {
$default_column = $column_names[0];
}
elseif (in_array('value', $column_names)) {
@@ -450,7 +450,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
}
// No need to ask the user anything if the field has only one column.
- if (count($field->getColumns()) == 1) {
+ if (count($field->getColumns()) === 1) {
$form['click_sort_column'] = array(
'#type' => 'value',
'#value' => isset($column_names[0]) ? $column_names[0] : '',
@@ -539,7 +539,7 @@ function multiple_options_form(&$form, FormStateInterface $form_state) {
// translating prefix and suffix separately.
list($prefix, $suffix) = explode('@count', t('Display @count value(s)'));
- if ($field->getCardinality() == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) {
+ if ($field->getCardinality() === FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) {
$type = 'textfield';
$options = NULL;
$size = 5;
@@ -698,7 +698,7 @@ protected function renderItems($items) {
}
return SafeMarkup::set($output);
}
- if ($this->options['multi_type'] == 'separator') {
+ if ($this->options['multi_type'] === 'separator') {
$output = '';
$separator = '';
$escaped_separator = Xss::filterAdmin($this->options['separator']);
@@ -853,7 +853,7 @@ function process_entity(EntityInterface $entity) {
// We should only get here in this case if there's an offset, and
// in that case we're limiting to all values after the offset.
- if ($delta_limit == 'all') {
+ if ($delta_limit === 'all') {
$delta_limit = count($all_values) - $offset;
}
}
@@ -869,9 +869,9 @@ function process_entity(EntityInterface $entity) {
// If first-last option was selected, only use the first and last values
if (!$delta_first_last
// Use the first value.
- || $new_delta == $offset
+ || $new_delta === $offset
// Use the last value.
- || $new_delta == ($delta_limit + $offset - 1)) {
+ || $new_delta === ($delta_limit + $offset - 1)) {
$new_values[] = $all_values[$new_delta];
}
}
diff --git a/core/modules/field/src/Tests/BulkDeleteTest.php b/core/modules/field/src/Tests/BulkDeleteTest.php
index d37d919..b8999b4 100644
--- a/core/modules/field/src/Tests/BulkDeleteTest.php
+++ b/core/modules/field/src/Tests/BulkDeleteTest.php
@@ -75,13 +75,13 @@ function checkHooksInvocations($expected_hooks, $actual_hooks) {
foreach ($actual_invocations as $actual_arguments) {
// The argument we are looking for is either an array of entities as
// the second argument or a single entity object as the first.
- if ($argument instanceof EntityInterface && $actual_arguments[0]->id() == $argument->id()) {
+ if ($argument instanceof EntityInterface && $actual_arguments[0]->id() === $argument->id()) {
$found = TRUE;
break;
}
// In case of an array, compare the array size and make sure it
// contains the same elements.
- elseif (is_array($argument) && count($actual_arguments[1]) == count($argument) && count(array_diff_key($actual_arguments[1], $argument)) == 0) {
+ elseif (is_array($argument) && count($actual_arguments[1]) === count($argument) && count(array_diff_key($actual_arguments[1], $argument)) === 0) {
$found = TRUE;
break;
}
diff --git a/core/modules/field/src/Tests/CrudTest.php b/core/modules/field/src/Tests/CrudTest.php
index ec9b4d7..4298c89 100644
--- a/core/modules/field/src/Tests/CrudTest.php
+++ b/core/modules/field/src/Tests/CrudTest.php
@@ -204,11 +204,11 @@ function testRead() {
// Check that 'single column' criteria works.
$fields = entity_load_multiple_by_properties('field_storage_config', array('field_name' => $field_storage_definition['name']));
- $this->assertTrue(count($fields) == 1 && isset($fields[$id]), 'The field was properly read.');
+ $this->assertTrue(count($fields) === 1 && isset($fields[$id]), 'The field was properly read.');
// Check that 'multi column' criteria works.
$fields = entity_load_multiple_by_properties('field_storage_config', array('field_name' => $field_storage_definition['name'], 'type' => $field_storage_definition['type']));
- $this->assertTrue(count($fields) == 1 && isset($fields[$id]), 'The field was properly read.');
+ $this->assertTrue(count($fields) === 1 && isset($fields[$id]), 'The field was properly read.');
$fields = entity_load_multiple_by_properties('field_storage_config', array('field_name' => $field_storage_definition['name'], 'type' => 'foo'));
$this->assertTrue(empty($fields), 'No field was found.');
diff --git a/core/modules/field/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php
index 978ea0e..3119cd9 100644
--- a/core/modules/field/src/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/src/Tests/FieldAttachOtherTest.php
@@ -269,7 +269,7 @@ function testEntityFormDisplayBuildForm() {
// Test generating widgets for all fields.
$display = entity_get_form_display($entity_type, $this->fieldTestData->instance->bundle, 'default');
foreach ($display->getComponents() as $name => $options) {
- if ($name != $this->fieldTestData->field_name_2) {
+ if ($name !== $this->fieldTestData->field_name_2) {
$display->removeComponent($name);
}
}
@@ -346,13 +346,13 @@ function testEntityFormDisplayExtractFormValues() {
$expected_values = array();
$expected_values_2 = array();
foreach ($weights as $key => $value) {
- if ($key != 1) {
+ if ($key !== 1) {
$expected_values[] = array('value' => $values[$key]['value']);
}
}
$this->assertIdentical($entity->{$this->fieldTestData->field_name}->getValue(), $expected_values, 'Submit filters empty values');
foreach ($weights_2 as $key => $value) {
- if ($key != 1) {
+ if ($key !== 1) {
$expected_values_2[] = array('value' => $values_2[$key]['value']);
}
}
@@ -360,7 +360,7 @@ function testEntityFormDisplayExtractFormValues() {
// Call EntityFormDisplayInterface::extractFormValues() for a single field (the second field).
foreach ($display->getComponents() as $name => $options) {
- if ($name != $this->fieldTestData->field_name_2) {
+ if ($name !== $this->fieldTestData->field_name_2) {
$display->removeComponent($name);
}
}
@@ -368,7 +368,7 @@ function testEntityFormDisplayExtractFormValues() {
$display->extractFormValues($entity, $form, $form_state);
$expected_values_2 = array();
foreach ($weights_2 as $key => $value) {
- if ($key != 1) {
+ if ($key !== 1) {
$expected_values_2[] = array('value' => $values_2[$key]['value']);
}
}
diff --git a/core/modules/field/src/Tests/FieldInstanceCrudTest.php b/core/modules/field/src/Tests/FieldInstanceCrudTest.php
index a59917a..15026f0 100644
--- a/core/modules/field/src/Tests/FieldInstanceCrudTest.php
+++ b/core/modules/field/src/Tests/FieldInstanceCrudTest.php
@@ -117,9 +117,9 @@ function testReadFieldInstance() {
// Read the instance back.
$instance = entity_load('field_instance_config', 'entity_test.' . $this->instanceDefinition['bundle'] . '.' . $this->instanceDefinition['field_name']);
- $this->assertTrue($this->instanceDefinition['field_name'] == $instance->getName(), 'The field was properly read.');
- $this->assertTrue($this->instanceDefinition['entity_type'] == $instance->entity_type, 'The field was properly read.');
- $this->assertTrue($this->instanceDefinition['bundle'] == $instance->bundle, 'The field was properly read.');
+ $this->assertTrue($this->instanceDefinition['field_name'] === $instance->getName(), 'The field was properly read.');
+ $this->assertTrue($this->instanceDefinition['entity_type'] === $instance->entity_type, 'The field was properly read.');
+ $this->assertTrue($this->instanceDefinition['bundle'] === $instance->bundle, 'The field was properly read.');
}
/**
diff --git a/core/modules/field/src/Tests/FieldValidationTest.php b/core/modules/field/src/Tests/FieldValidationTest.php
index 7795684..f3ecc56 100644
--- a/core/modules/field/src/Tests/FieldValidationTest.php
+++ b/core/modules/field/src/Tests/FieldValidationTest.php
@@ -80,7 +80,7 @@ function testFieldConstraints() {
$expected_violations = array();
for ($delta = 0; $delta < $cardinality; $delta++) {
// All deltas except '1' have incorrect values.
- if ($delta == 1) {
+ if ($delta === 1) {
$value = 1;
}
else {
diff --git a/core/modules/field/src/Tests/TranslationTest.php b/core/modules/field/src/Tests/TranslationTest.php
index f37bdf6..bcf348e 100644
--- a/core/modules/field/src/Tests/TranslationTest.php
+++ b/core/modules/field/src/Tests/TranslationTest.php
@@ -132,7 +132,7 @@ function testTranslatableFieldSaveLoad() {
foreach ($field_translations as $langcode => $items) {
$result = TRUE;
foreach ($items as $delta => $item) {
- $result = $result && $item['value'] == $entity->getTranslation($langcode)->{$this->field_name}[$delta]->value;
+ $result = $result && $item['value'] === $entity->getTranslation($langcode)->{$this->field_name}[$delta]->value;
}
$this->assertTrue($result, format_string('%language translation correctly handled.', array('%language' => $langcode)));
}
diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php
index f3b3ead..abb44c1 100644
--- a/core/modules/field/src/Tests/TranslationWebTest.php
+++ b/core/modules/field/src/Tests/TranslationWebTest.php
@@ -128,7 +128,7 @@ private function checkTranslationRevisions($id, $revision_id, $available_langcod
$field_name = $this->fieldStorage->getName();
$entity = entity_revision_load($this->entity_type, $revision_id);
foreach ($available_langcodes as $langcode => $value) {
- $passed = $entity->getTranslation($langcode)->{$field_name}->value == $value + 1;
+ $passed = $entity->getTranslation($langcode)->{$field_name}->value === $value + 1;
$this->assertTrue($passed, format_string('The @language translation for revision @revision was correctly stored', array('@language' => $langcode, '@revision' => $entity->getRevisionId())));
}
}
diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc
index d5614ac..9f0aa5a 100644
--- a/core/modules/field/tests/modules/field_test/field_test.entity.inc
+++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc
@@ -24,7 +24,7 @@ function field_test_entity_info_translatable($entity_type_id = NULL, $translatab
$entity_manager = \Drupal::entityManager();
$original = $entity_manager->getDefinition($entity_type_id);
$stored_value[$entity_type_id] = $translatable;
- if ($translatable != $original->isTranslatable()) {
+ if ($translatable !== $original->isTranslatable()) {
$entity_manager->clearCachedDefinitions();
$entity_type = $entity_manager->getDefinition($entity_type_id);
$entity_manager->onEntityTypeUpdate($entity_type, $original);
diff --git a/core/modules/field/tests/modules/field_test/field_test.field.inc b/core/modules/field/tests/modules/field_test/field_test.field.inc
index b1a5589..ec67267 100644
--- a/core/modules/field/tests/modules/field_test/field_test.field.inc
+++ b/core/modules/field/tests/modules/field_test/field_test.field.inc
@@ -24,7 +24,7 @@ function field_test_field_widget_info_alter(&$info) {
* Implements hook_field_storage_config_update_forbid().
*/
function field_test_field_storage_config_update_forbid(FieldStorageConfigInterface $field_storage, FieldStorageConfigInterface $prior_field_storage) {
- if ($field_storage->getType() == 'test_field' && $field_storage->getSetting('unchangeable') != $prior_field_storage->getSetting('unchangeable')) {
+ if ($field_storage->getType() === 'test_field' && $field_storage->getSetting('unchangeable') !== $prior_field_storage->getSetting('unchangeable')) {
throw new FieldStorageDefinitionUpdateForbiddenException("field_test 'unchangeable' setting cannot be changed'");
}
}
@@ -40,13 +40,13 @@ function field_test_default_value(ContentEntityInterface $entity, FieldDefinitio
* Implements hook_entity_field_access().
*/
function field_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
- if ($field_definition->getName() == "field_no_{$operation}_access") {
+ if ($field_definition->getName() === "field_no_{$operation}_access") {
return AccessResult::forbidden();
}
// Only grant view access to test_view_field fields when the user has
// 'view test_view_field content' permission.
- if ($field_definition->getName() == 'test_view_field' && $operation == 'view') {
+ if ($field_definition->getName() === 'test_view_field' && $operation === 'view') {
return AccessResult::forbiddenIf(!$account->hasPermission('view test_view_field content'))->cachePerRole();
}
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
index 24704e1..99e9bd2 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php
@@ -32,7 +32,7 @@ class TestFieldApplicableFormatter extends FormatterBase {
* {@inheritdoc}
*/
public static function isApplicable(FieldDefinitionInterface $field_definition) {
- return $field_definition->getName() != 'deny_applicable';
+ return $field_definition->getName() !== 'deny_applicable';
}
/**
diff --git a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
index be2ab05..c324921 100644
--- a/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
+++ b/core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php
@@ -103,7 +103,7 @@ public static function multipleValidate($element, FormStateInterface $form_state
*/
public static function isApplicable(FieldDefinitionInterface $field_definition) {
// Returns FALSE if machine name of the field equals field_onewidgetfield.
- return $field_definition->getName() != "field_onewidgetfield";
+ return $field_definition->getName() !== "field_onewidgetfield";
}
}
diff --git a/core/modules/field_ui/field_ui.api.php b/core/modules/field_ui/field_ui.api.php
index 4e44c3a..9f507c5 100644
--- a/core/modules/field_ui/field_ui.api.php
+++ b/core/modules/field_ui/field_ui.api.php
@@ -33,7 +33,7 @@ function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\Forma
$element = array();
// Add a 'my_setting' checkbox to the settings form for 'foo_formatter' field
// formatters.
- if ($plugin->getPluginId() == 'foo_formatter') {
+ if ($plugin->getPluginId() === 'foo_formatter') {
$element['my_setting'] = array(
'#type' => 'checkbox',
'#title' => t('My setting'),
@@ -66,7 +66,7 @@ function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetIn
$element = array();
// Add a 'my_setting' checkbox to the settings form for 'foo_widget' field
// widgets.
- if ($plugin->getPluginId() == 'foo_widget') {
+ if ($plugin->getPluginId() === 'foo_widget') {
$element['my_setting'] = array(
'#type' => 'checkbox',
'#title' => t('My setting'),
@@ -92,7 +92,7 @@ function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetIn
function hook_field_formatter_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_formatter has
// mysetting set to TRUE for the current view mode.
- if ($context['formatter']->getPluginId() == 'foo_formatter') {
+ if ($context['formatter']->getPluginId() === 'foo_formatter') {
if ($context['formatter']->getThirdPartySetting('my_module', 'my_setting')) {
$summary[] = t('My setting enabled.');
}
@@ -115,7 +115,7 @@ function hook_field_formatter_settings_summary_alter(&$summary, $context) {
function hook_field_widget_settings_summary_alter(&$summary, $context) {
// Append a message to the summary when an instance of foo_widget has
// mysetting set to TRUE for the current view mode.
- if ($context['widget']->getPluginId() == 'foo_widget') {
+ if ($context['widget']->getPluginId() === 'foo_widget') {
if ($context['widget']->getThirdPartySetting('my_module', 'my_setting')) {
$summary[] = t('My setting enabled.');
}
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index 9dbcbd2..d238f5f 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -293,7 +293,7 @@ function theme_field_ui_table($variables) {
foreach (Element::children($element) as $cell_key) {
$child = &$element[$cell_key];
// Do not render a cell for children of #type 'value'.
- if (!(isset($child['#type']) && $child['#type'] == 'value')) {
+ if (!(isset($child['#type']) && $child['#type'] === 'value')) {
$cell = array('data' => drupal_render($child));
if (isset($child['#cell_attributes'])) {
$cell += $child['#cell_attributes'];
diff --git a/core/modules/field_ui/src/Access/FormModeAccessCheck.php b/core/modules/field_ui/src/Access/FormModeAccessCheck.php
index 1b2d95d..607b26c 100644
--- a/core/modules/field_ui/src/Access/FormModeAccessCheck.php
+++ b/core/modules/field_ui/src/Access/FormModeAccessCheck.php
@@ -69,7 +69,7 @@ public function access(Route $route, Request $request, AccountInterface $account
}
$visibility = FALSE;
- if ($form_mode_name == 'default') {
+ if ($form_mode_name === 'default') {
$visibility = TRUE;
}
elseif ($entity_display = $this->entityManager->getStorage('entity_form_display')->load($entity_type_id . '.' . $bundle . '.' . $form_mode_name)) {
@@ -77,7 +77,7 @@ public function access(Route $route, Request $request, AccountInterface $account
}
$access = AccessResult::create();
- if ($form_mode_name != 'default' && $entity_display) {
+ if ($form_mode_name !== 'default' && $entity_display) {
$access->cacheUntilEntityChanges($entity_display);
}
diff --git a/core/modules/field_ui/src/Access/ViewModeAccessCheck.php b/core/modules/field_ui/src/Access/ViewModeAccessCheck.php
index 3c9c2be..b5c5989 100644
--- a/core/modules/field_ui/src/Access/ViewModeAccessCheck.php
+++ b/core/modules/field_ui/src/Access/ViewModeAccessCheck.php
@@ -69,7 +69,7 @@ public function access(Route $route, Request $request, AccountInterface $account
}
$visibility = FALSE;
- if ($view_mode_name == 'default') {
+ if ($view_mode_name === 'default') {
$visibility = TRUE;
}
elseif ($entity_display = $this->entityManager->getStorage('entity_view_display')->load($entity_type_id . '.' . $bundle . '.' . $view_mode_name)) {
@@ -77,7 +77,7 @@ public function access(Route $route, Request $request, AccountInterface $account
}
$access = AccessResult::create();
- if ($view_mode_name != 'default' && $entity_display) {
+ if ($view_mode_name !== 'default' && $entity_display) {
$access->cacheUntilEntityChanges($entity_display);
}
diff --git a/core/modules/field_ui/src/DisplayOverview.php b/core/modules/field_ui/src/DisplayOverview.php
index 2bc07c1..384eafe 100644
--- a/core/modules/field_ui/src/DisplayOverview.php
+++ b/core/modules/field_ui/src/DisplayOverview.php
@@ -150,7 +150,7 @@ protected function getEntityDisplay($mode) {
protected function getPlugin(FieldDefinitionInterface $field_definition, $configuration) {
$plugin = NULL;
- if ($configuration && $configuration['type'] != 'hidden') {
+ if ($configuration && $configuration['type'] !== 'hidden') {
$plugin = $this->pluginManager->getInstance(array(
'field_definition' => $field_definition,
'view_mode' => $this->mode,
diff --git a/core/modules/field_ui/src/DisplayOverviewBase.php b/core/modules/field_ui/src/DisplayOverviewBase.php
index 802d012..27f8d4c 100644
--- a/core/modules/field_ui/src/DisplayOverviewBase.php
+++ b/core/modules/field_ui/src/DisplayOverviewBase.php
@@ -183,7 +183,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t
$form['fields'] = $table;
// Custom display settings.
- if ($this->mode == 'default') {
+ if ($this->mode === 'default') {
// Only show the settings if there is at least one custom display mode.
if ($display_modes = $this->getDisplayModes()) {
$form['modes'] = array(
@@ -344,7 +344,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent
'#field_name' => $field_name,
);
- if ($form_state->get('plugin_settings_edit') == $field_name) {
+ if ($form_state->get('plugin_settings_edit') === $field_name) {
// We are currently editing this field's plugin settings. Display the
// settings form and submit buttons.
$field_row['plugin']['settings_edit_form'] = array();
@@ -513,7 +513,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// values.
$values = $form_values['fields'][$field_name];
- if ($values['type'] == 'hidden') {
+ if ($values['type'] === 'hidden') {
$display->removeComponent($field_name);
}
else {
@@ -565,7 +565,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Collect data for 'extra' fields.
foreach ($form['#extra'] as $name) {
- if ($form_values['fields'][$name]['type'] == 'hidden') {
+ if ($form_values['fields'][$name]['type'] === 'hidden') {
$display->removeComponent($name);
}
else {
@@ -579,7 +579,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$display->save();
// Handle the 'display modes' checkboxes if present.
- if ($this->mode == 'default' && !empty($form_values['display_modes_custom'])) {
+ if ($this->mode === 'default' && !empty($form_values['display_modes_custom'])) {
$display_modes = $this->getDisplayModes();
$current_statuses = $this->getDisplayStatuses();
@@ -711,7 +711,7 @@ public function multistepAjax($form, FormStateInterface $form_state) {
* @see \Drupal\Core\Entity\EntityManagerInterface::getExtraFields()
*/
protected function getExtraFields() {
- $context = $this->displayContext == 'view' ? 'display' : $this->displayContext;
+ $context = $this->displayContext === 'view' ? 'display' : $this->displayContext;
$extra_fields = $this->entityManager->getExtraFields($this->entity_type, $this->bundle);
return isset($extra_fields[$context]) ? $extra_fields[$context] : array();
}
@@ -790,7 +790,7 @@ public function getRowRegion($row) {
switch ($row['#row_type']) {
case 'field':
case 'extra_field':
- return ($row['plugin']['type']['#value'] == 'hidden' ? 'hidden' : 'content');
+ return ($row['plugin']['type']['#value'] === 'hidden' ? 'hidden' : 'content');
}
}
@@ -822,7 +822,7 @@ protected function getDisplays() {
foreach ($ids as $id) {
$config_id = str_replace($config_prefix . '.', '', $id);
list(,, $display_mode) = explode('.', $config_id);
- if ($display_mode != 'default') {
+ if ($display_mode !== 'default') {
$load_ids[] = $config_id;
}
}
diff --git a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php
index f52d721..dfa82f4 100644
--- a/core/modules/field_ui/src/EntityDisplayModeListBuilder.php
+++ b/core/modules/field_ui/src/EntityDisplayModeListBuilder.php
@@ -110,7 +110,7 @@ public function render() {
}
// Move content at the top.
- if ($entity_type == 'node') {
+ if ($entity_type === 'node') {
$table['#weight'] = -10;
}
diff --git a/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
index 9b7fdd2..5f26542 100644
--- a/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
+++ b/core/modules/field_ui/src/Form/EntityDisplayModeFormBase.php
@@ -109,7 +109,7 @@ public function form(array $form, FormStateInterface $form_state) {
*/
public function exists($entity_id, array $element) {
// Do not allow to add internal 'default' view mode.
- if ($entity_id == 'default') {
+ if ($entity_id === 'default') {
return TRUE;
}
return (bool) $this->queryFactory
diff --git a/core/modules/field_ui/src/Form/FieldStorageEditForm.php b/core/modules/field_ui/src/Form/FieldStorageEditForm.php
index edb6d22..d7c4aad 100644
--- a/core/modules/field_ui/src/Form/FieldStorageEditForm.php
+++ b/core/modules/field_ui/src/Form/FieldStorageEditForm.php
@@ -119,11 +119,11 @@ public function buildForm(array $form, FormStateInterface $form_state, FieldInst
'number' => $this->t('Limited'),
FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED => $this->t('Unlimited'),
),
- '#default_value' => ($cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 'number',
+ '#default_value' => ($cardinality === FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 'number',
);
$form['field']['cardinality_container']['cardinality_number'] = array(
'#type' => 'number',
- '#default_value' => $cardinality != FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ? $cardinality : 1,
+ '#default_value' => $cardinality !== FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ? $cardinality : 1,
'#min' => 1,
'#title' => $this->t('Limit'),
'#title_display' => 'invisible',
diff --git a/core/modules/field_ui/src/FormDisplayOverview.php b/core/modules/field_ui/src/FormDisplayOverview.php
index aacd423..daf9c9f 100644
--- a/core/modules/field_ui/src/FormDisplayOverview.php
+++ b/core/modules/field_ui/src/FormDisplayOverview.php
@@ -116,7 +116,7 @@ protected function getEntityDisplay($mode) {
protected function getPlugin(FieldDefinitionInterface $field_definition, $configuration) {
$plugin = NULL;
- if ($configuration && $configuration['type'] != 'hidden') {
+ if ($configuration && $configuration['type'] !== 'hidden') {
$plugin = $this->pluginManager->getInstance(array(
'field_definition' => $field_definition,
'form_mode' => $this->mode,
diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
index 1f4d3ea..babc12c 100644
--- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
+++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
@@ -70,7 +70,7 @@ public function testFieldUIRoutes() {
$this->drupalGet('admin/config/people/accounts/form-display/register');
$this->assertTitle('Manage form display | Drupal');
$this->assertLocalTasks();
- $this->assert(count($this->xpath('//ul/li[1]/a[contains(text(), :text)]', array(':text' => 'Default'))) == 1, 'Default secondary tab is in first position.');
+ $this->assert(count($this->xpath('//ul/li[1]/a[contains(text(), :text)]', array(':text' => 'Default'))) === 1, 'Default secondary tab is in first position.');
}
/**
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index c137308..6d4be1f 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -240,11 +240,11 @@ protected function deleteFieldInstance() {
function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') {
// Assert field storage settings.
$field_storage = FieldStorageConfig::loadByName($entity_type, $field_name);
- $this->assertTrue($field_storage->getSetting('test_field_storage_setting') == $string, 'Field storage settings were found.');
+ $this->assertTrue($field_storage->getSetting('test_field_storage_setting') === $string, 'Field storage settings were found.');
// Assert instance settings.
$instance = FieldInstanceConfig::loadByName($entity_type, $bundle, $field_name);
- $this->assertTrue($instance->getSetting('test_instance_setting') == $string, 'Field instance settings were found.');
+ $this->assertTrue($instance->getSetting('test_instance_setting') === $string, 'Field instance settings were found.');
}
/**
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 3e88433..f274d59 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -81,7 +81,7 @@ function template_preprocess_file_widget_multiple(&$variables) {
// "operations" column.
$operations_elements = array();
foreach (Element::children($widget) as $sub_key) {
- if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] == 'submit') {
+ if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] === 'submit') {
hide($widget[$sub_key]);
$operations_elements[] = &$widget[$sub_key];
}
@@ -171,7 +171,7 @@ function template_preprocess_file_upload_help(&$variables) {
$descriptions[] = Html::normalize($description);
}
if (isset($cardinality)) {
- if ($cardinality == -1) {
+ if ($cardinality === -1) {
$descriptions[] = t('Unlimited number of files can be uploaded to this field.');
}
else {
@@ -188,7 +188,7 @@ function template_preprocess_file_upload_help(&$variables) {
if (isset($upload_validators['file_validate_image_resolution'])) {
$max = $upload_validators['file_validate_image_resolution'][0];
$min = $upload_validators['file_validate_image_resolution'][1];
- if ($min && $max && $min == $max) {
+ if ($min && $max && $min === $max) {
$descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '' . $max . ''));
}
elseif ($min && $max) {
@@ -218,9 +218,9 @@ function template_preprocess_file_upload_help(&$variables) {
function file_field_find_file_reference_column(FieldDefinitionInterface $field) {
$schema = $field->getFieldStorageDefinition()->getSchema();
foreach ($schema['foreign keys'] as $data) {
- if ($data['table'] == 'file_managed') {
+ if ($data['table'] === 'file_managed') {
foreach ($data['columns'] as $field_column => $column) {
- if ($column == 'fid') {
+ if ($column === 'fid') {
return $field_column;
}
}
diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 8d13c03..2129476 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -66,7 +66,7 @@ function file_requirements($phase) {
$requirements = array();
// Check the server's ability to indicate upload progress.
- if ($phase == 'runtime') {
+ if ($phase === 'runtime') {
$implementation = file_progress_implementation();
$server_software = \Drupal::request()->server->get('SERVER_SOFTWARE');
$apache = strpos($server_software, 'Apache') !== FALSE;
@@ -88,11 +88,11 @@ function file_requirements($phase) {
$value = t('Not enabled');
$description = t('Your server is capable of displaying file upload progress, but does not have the required libraries. It is recommended to install the PECL uploadprogress library (preferred) or to install APC.', array('@uploadprogress_url' => 'http://pecl.php.net/package/uploadprogress', '@apc_url' => 'http://php.net/apc'));
}
- elseif ($implementation == 'apc') {
+ elseif ($implementation === 'apc') {
$value = t('Enabled (APC RFC1867)', array('@url' => 'http://php.net/manual/apc.configuration.php#ini.apc.rfc1867'));
$description = t('Your server is capable of displaying file upload progress using APC RFC1867. Note that only one upload at a time is supported. It is recommended to use the PECL uploadprogress library if possible.', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
}
- elseif ($implementation == 'uploadprogress') {
+ elseif ($implementation === 'uploadprogress') {
$value = t('Enabled (PECL uploadprogress)', array('@url' => 'http://pecl.php.net/package/uploadprogress'));
}
$requirements['file_progress'] = array(
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 03e10bf..11b1179 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -181,7 +181,7 @@ function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_E
// If we are replacing an existing file re-use its database record.
// @todo Do not create a new entity in order to update it, see
// https://drupal.org/node/2241865
- if ($replace == FILE_EXISTS_REPLACE) {
+ if ($replace === FILE_EXISTS_REPLACE) {
$existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
if (count($existing_files)) {
$existing = reset($existing_files);
@@ -192,7 +192,7 @@ function file_copy(FileInterface $source, $destination = NULL, $replace = FILE_E
}
// If we are renaming around an existing file (rather than a directory),
// use its basename for the filename.
- elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+ elseif ($replace === FILE_EXISTS_RENAME && is_file($destination)) {
$file->setFilename(drupal_basename($destination));
}
@@ -257,7 +257,7 @@ function file_move(FileInterface $source, $destination = NULL, $replace = FILE_E
$file = clone $source;
$file->setFileUri($uri);
// If we are replacing an existing file re-use its database record.
- if ($replace == FILE_EXISTS_REPLACE) {
+ if ($replace === FILE_EXISTS_REPLACE) {
$existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
if (count($existing_files)) {
$existing = reset($existing_files);
@@ -268,7 +268,7 @@ function file_move(FileInterface $source, $destination = NULL, $replace = FILE_E
}
// If we are renaming around an existing file (rather than a directory),
// use its basename for the filename.
- elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+ elseif ($replace === FILE_EXISTS_RENAME && is_file($destination)) {
$file->setFilename(drupal_basename($destination));
}
@@ -528,7 +528,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
// If we are replacing an existing file re-use its database record.
// @todo Do not create a new entity in order to update it, see
// https://drupal.org/node/2241865
- if ($replace == FILE_EXISTS_REPLACE) {
+ if ($replace === FILE_EXISTS_REPLACE) {
$existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
if (count($existing_files)) {
$existing = reset($existing_files);
@@ -539,7 +539,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
}
// If we are renaming around an existing file (rather than a directory),
// use its basename for the filename.
- elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
+ elseif ($replace === FILE_EXISTS_RENAME && is_file($destination)) {
$file->setFilename(drupal_basename($destination));
}
@@ -632,7 +632,7 @@ function file_file_download($uri) {
// temporary files where the host entity has not yet been saved (for example,
// an image preview on a node/add form) in which case, allow download by the
// file's owner.
- if (empty($references) && ($file->isPermanent() || $file->getOwnerId() != \Drupal::currentUser()->id())) {
+ if (empty($references) && ($file->isPermanent() || $file->getOwnerId() !== \Drupal::currentUser()->id())) {
return;
}
@@ -713,7 +713,7 @@ function file_cron() {
*
* @return
* Function returns array of files or a single file object if $delta
- * != NULL. Each file object contains the file information if the
+ * !== NULL. Each file object contains the file information if the
* upload succeeded or FALSE in the event of an error. Function
* returns NULL if no file was uploaded.
*
@@ -824,7 +824,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
// rename filename.php.foo and filename.php to filename.php.foo.txt and
// filename.php.txt, respectively). Don't rename if 'allow_insecure_uploads'
// evaluates to TRUE.
- if (!\Drupal::config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->getFilename()) && (substr($file->getFilename(), -4) != '.txt')) {
+ if (!\Drupal::config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->getFilename()) && (substr($file->getFilename(), -4) !== '.txt')) {
$file->setMimeType('text/plain');
// The destination filename will also later be used to create the URI.
$file->setFilename($file->getFilename() . '.txt');
@@ -851,7 +851,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
$file->source = $form_field_name;
// A file URI may already have a trailing slash or look like "public://".
- if (substr($destination, -1) != '/') {
+ if (substr($destination, -1) !== '/') {
$destination .= '/';
}
$file->destination = file_destination($destination . $file->getFilename(), $replace);
@@ -904,7 +904,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
// If we are replacing an existing file re-use its database record.
// @todo Do not create a new entity in order to update it, see
// https://drupal.org/node/2241865
- if ($replace == FILE_EXISTS_REPLACE) {
+ if ($replace === FILE_EXISTS_REPLACE) {
$existing_files = entity_load_multiple_by_properties('file', array('uri' => $file->getFileUri()));
if (count($existing_files)) {
$existing = reset($existing_files);
@@ -973,7 +973,7 @@ function file_tokens($type, $tokens, array $data = array(), array $options = arr
$replacements = array();
- if ($type == 'file' && !empty($data['file'])) {
+ if ($type === 'file' && !empty($data['file'])) {
/** @var \Drupal\file\FileInterface $file */
$file = $data['file'];
@@ -1150,7 +1150,7 @@ function file_managed_file_process($element, FormStateInterface $form_state, $fo
// Force the progress indicator for the remove button to be either 'none' or
// 'throbber', even if the upload button is using something else.
- $ajax_settings['progress']['type'] = ($element['#progress_indicator'] == 'none') ? 'none' : 'throbber';
+ $ajax_settings['progress']['type'] = ($element['#progress_indicator'] === 'none') ? 'none' : 'throbber';
$ajax_settings['progress']['message'] = NULL;
$ajax_settings['effect'] = 'none';
$element['remove_button'] = array(
@@ -1170,10 +1170,10 @@ function file_managed_file_process($element, FormStateInterface $form_state, $fo
);
// Add progress bar support to the upload if possible.
- if ($element['#progress_indicator'] == 'bar' && $implementation = file_progress_implementation()) {
+ if ($element['#progress_indicator'] === 'bar' && $implementation = file_progress_implementation()) {
$upload_progress_key = mt_rand();
- if ($implementation == 'uploadprogress') {
+ if ($implementation === 'uploadprogress') {
$element['UPLOAD_IDENTIFIER'] = array(
'#type' => 'hidden',
'#value' => $upload_progress_key,
@@ -1183,7 +1183,7 @@ function file_managed_file_process($element, FormStateInterface $form_state, $fo
'#weight' => -20,
);
}
- elseif ($implementation == 'apc') {
+ elseif ($implementation === 'apc') {
$element['APC_UPLOAD_PROGRESS'] = array(
'#type' => 'hidden',
'#value' => $upload_progress_key,
@@ -1332,7 +1332,7 @@ function file_managed_file_validate(&$element, FormStateInterface $form_state) {
// references. This prevents unmanaged files from being deleted if this
// item were to be deleted.
$clicked_button = end($form_state->getTriggeringElement()['#parents']);
- if ($clicked_button != 'remove_button' && !empty($element['fids']['#value'])) {
+ if ($clicked_button !== 'remove_button' && !empty($element['fids']['#value'])) {
$fids = $element['fids']['#value'];
foreach ($fids as $fid) {
if ($file = file_load($fid)) {
@@ -1376,7 +1376,7 @@ function file_managed_file_submit($form, FormStateInterface $form_state) {
// the form are processed by file_managed_file_value() regardless of which
// button was clicked. Action is needed here for the remove button, because we
// only remove a file in response to its remove button being clicked.
- if ($button_key == 'remove_button') {
+ if ($button_key === 'remove_button') {
$fids = array_keys($element['#files']);
// Get files that will be removed.
if ($element['#multiple']) {
@@ -1831,7 +1831,7 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
// The usage table contains usage of every revision. If we are looking
// for every revision or the entity does not support revisions then
// every usage is already a match.
- $match_entity_type = $age == EntityStorageInterface::FIELD_LOAD_REVISION || !$entity_type->hasKey('revision');
+ $match_entity_type = $age === EntityStorageInterface::FIELD_LOAD_REVISION || !$entity_type->hasKey('revision');
$entities = entity_load_multiple($entity_type_id, array_keys($entity_ids));
foreach ($entities as $entity) {
$bundle = $entity->bundle();
@@ -1859,7 +1859,7 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
// revision.
if (!$match && ($items = $entity->get($field_name))) {
foreach ($items as $item) {
- if ($file->id() == $item->{$field_column}) {
+ if ($file->id() === $item->{$field_column}) {
$match = TRUE;
break;
}
@@ -1880,7 +1880,7 @@ function file_get_file_references(FileInterface $file, FieldDefinitionInterface
foreach (array_keys($data) as $entity_type_id) {
$field_storage_definitions = \Drupal::entityManager()->getFieldStorageDefinitions($entity_type_id);
$current_field = $field_storage_definitions[$field_name];
- if (($field_type && $current_field->getType() != $field_type) || ($field && $field->uuid() != $current_field->uuid())) {
+ if (($field_type && $current_field->getType() !== $field_type) || ($field && $field->uuid() !== $current_field->uuid())) {
unset($return[$field_name][$entity_type_id]);
}
}
diff --git a/core/modules/file/src/Controller/FileWidgetAjaxController.php b/core/modules/file/src/Controller/FileWidgetAjaxController.php
index 1198672..80da7f4 100644
--- a/core/modules/file/src/Controller/FileWidgetAjaxController.php
+++ b/core/modules/file/src/Controller/FileWidgetAjaxController.php
@@ -99,14 +99,14 @@ public function progress($key) {
);
$implementation = file_progress_implementation();
- if ($implementation == 'uploadprogress') {
+ if ($implementation === 'uploadprogress') {
$status = uploadprogress_get_info($key);
if (isset($status['bytes_uploaded']) && !empty($status['bytes_total'])) {
$progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total'])));
$progress['percentage'] = round(100 * $status['bytes_uploaded'] / $status['bytes_total']);
}
}
- elseif ($implementation == 'apc') {
+ elseif ($implementation === 'apc') {
$status = apc_fetch('upload_' . $key);
if (isset($status['current']) && !empty($status['total'])) {
$progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['current']), '@total' => format_size($status['total'])));
diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php
index b21a182..6353af7 100644
--- a/core/modules/file/src/Entity/File.php
+++ b/core/modules/file/src/Entity/File.php
@@ -160,14 +160,14 @@ public function setOwner(UserInterface $account) {
* {@inheritdoc}
*/
public function isPermanent() {
- return $this->get('status')->value == FILE_STATUS_PERMANENT;
+ return $this->get('status')->value === FILE_STATUS_PERMANENT;
}
/**
* {@inheritdoc}
*/
public function isTemporary() {
- return $this->get('status')->value == 0;
+ return $this->get('status')->value === 0;
}
/**
diff --git a/core/modules/file/src/FileAccessControlHandler.php b/core/modules/file/src/FileAccessControlHandler.php
index cd87b19..cc55aa0 100644
--- a/core/modules/file/src/FileAccessControlHandler.php
+++ b/core/modules/file/src/FileAccessControlHandler.php
@@ -23,7 +23,7 @@ class FileAccessControlHandler extends EntityAccessControlHandler {
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
- if ($operation == 'download') {
+ if ($operation === 'download') {
foreach ($this->getFileReferences($entity) as $field_name => $entity_map) {
foreach ($entity_map as $referencing_entity_type => $referencing_entities) {
/** @var \Drupal\Core\Entity\EntityInterface $referencing_entity */
diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
index f8ee03c..2eefdeb 100644
--- a/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
+++ b/core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php
@@ -50,7 +50,7 @@ public function update() {
// On new revisions, all files are considered to be a new usage and no
// deletion of previous file usages are necessary.
- if (!empty($entity->original) && $entity->getRevisionId() != $entity->original->getRevisionId()) {
+ if (!empty($entity->original) && $entity->getRevisionId() !== $entity->original->getRevisionId()) {
foreach ($files as $file) {
\Drupal::service('file.usage')->add($file, 'file', $entity->getEntityTypeId(), $entity->id());
}
diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index f9becf4..ba21023 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -131,8 +131,8 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
}
}
- $empty_single_allowed = ($cardinality == 1 && $delta == 0);
- $empty_multiple_allowed = ($cardinality == FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED || $delta < $cardinality) && !$form_state->isProgrammed();
+ $empty_single_allowed = ($cardinality === 1 && $delta === 0);
+ $empty_multiple_allowed = ($cardinality === FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED || $delta < $cardinality) && !$form_state->isProgrammed();
// Add one more empty row for new uploads except when this is a programmed
// multiple form as it is not necessary.
@@ -143,7 +143,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
);
$element = $this->formSingleElement($items, $delta, $element, $form, $form_state);
if ($element) {
- $element['#required'] = ($element['#required'] && $delta == 0);
+ $element['#required'] = ($element['#required'] && $delta === 0);
$elements[$delta] = $element;
}
}
@@ -245,8 +245,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#cardinality' => $cardinality,
);
$element['#description'] = drupal_render($file_upload_help);
- $element['#multiple'] = $cardinality != 1 ? TRUE : FALSE;
- if ($cardinality != 1 && $cardinality != -1) {
+ $element['#multiple'] = $cardinality !== 1 ? TRUE : FALSE;
+ if ($cardinality !== 1 && $cardinality !== -1) {
$element['#element_validate'] = array(array(get_class($this), 'validateMultipleCount'));
}
}
@@ -378,7 +378,7 @@ public static function process($element, FormStateInterface $form_state, $form)
// Adjust the Ajax settings so that on upload and remove of any individual
// file, the entire group of file fields is updated together.
- if ($element['#cardinality'] != 1) {
+ if ($element['#cardinality'] !== 1) {
$parents = array_slice($element['#array_parents'], 0, -1);
$new_path = 'file/ajax';
$new_options = array(
@@ -425,7 +425,7 @@ public static function processMultiple($element, FormStateInterface $form_state,
$count = count($element_children);
foreach ($element_children as $delta => $key) {
- if ($key != $element['#file_upload_delta']) {
+ if ($key !== $element['#file_upload_delta']) {
$description = static::getDescriptionFromElement($element[$key]);
$element[$key]['_weight'] = array(
'#type' => 'weight',
diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index 92ba740..30c68c4 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -120,7 +120,7 @@ function testFileCreateUrl() {
'unclean' => 'index.php/',
);
foreach ($clean_url_settings as $clean_url_setting => $script_path) {
- $clean_urls = $clean_url_setting == 'clean';
+ $clean_urls = $clean_url_setting === 'clean';
$request = $this->prepareRequestForGenerator($clean_urls);
$base_path = $request->getSchemeAndHttpHost() . $request->getBasePath();
$this->checkUrl('public', '', $basename, $base_path . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . $basename_encoded);
@@ -156,14 +156,14 @@ private function checkUrl($scheme, $directory, $filename, $expected_url) {
$url = file_create_url($file->getFileUri());
$this->assertEqual($url, $expected_url, 'Generated URL matches expected URL.');
- if ($scheme == 'private') {
+ if ($scheme === 'private') {
// Tell the implementation of hook_file_download() in file_test.module
// that this file may be downloaded.
file_test_set_return('download', array('x-foo' => 'Bar'));
}
$this->drupalGet($url);
- if ($this->assertResponse(200) == 'pass') {
+ if ($this->assertResponse(200) === 'pass') {
$this->assertRaw(file_get_contents($file->getFileUri()), 'Contents of the file are correct.');
}
diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php
index fb9552a..9115bc3 100644
--- a/core/modules/file/src/Tests/FileFieldTestBase.php
+++ b/core/modules/file/src/Tests/FileFieldTestBase.php
@@ -161,7 +161,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE,
// Attach a file to the node.
$field_storage = FieldStorageConfig::loadByName('node', $field_name);
$name = 'files[' . $field_name . '_0]';
- if ($field_storage->getCardinality() != 1) {
+ if ($field_storage->getCardinality() !== 1) {
$name .= '[]';
}
$edit[$name] = drupal_realpath($file->getFileUri());
diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php
index 9ae0940..87d325a 100644
--- a/core/modules/file/src/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -136,7 +136,7 @@ function testMultiValuedWidget() {
foreach ($buttons as $i => $button) {
$key = $i >= $remaining ? $i - $remaining : $i;
$check_field_name = $field_name2;
- if ($current_field_name == $field_name && $i < $remaining) {
+ if ($current_field_name === $field_name && $i < $remaining) {
$check_field_name = $field_name;
}
@@ -155,7 +155,7 @@ function testMultiValuedWidget() {
// data, and since drupalPostForm() will result in $this being updated
// with a newly rebuilt form, this doesn't cause problems.
foreach ($buttons as $button) {
- if ($button['name'] != $button_name) {
+ if ($button['name'] !== $button_name) {
$button['value'] = 'DUMMY';
}
}
@@ -174,12 +174,12 @@ function testMultiValuedWidget() {
// correct name.
$upload_button_name = $current_field_name . '_' . $remaining . '_upload_button';
$buttons = $this->xpath('//input[@type="submit" and @value="Upload" and @name=:name]', array(':name' => $upload_button_name));
- $this->assertTrue(is_array($buttons) && count($buttons) == 1, format_string('The upload button is displayed with the correct name (JSMode=%type).', array('%type' => $type)));
+ $this->assertTrue(is_array($buttons) && count($buttons) === 1, format_string('The upload button is displayed with the correct name (JSMode=%type).', array('%type' => $type)));
// Ensure only at most one button per field is displayed.
$buttons = $this->xpath('//input[@type="submit" and @value="Upload"]');
- $expected = $current_field_name == $field_name ? 1 : 2;
- $this->assertTrue(is_array($buttons) && count($buttons) == $expected, format_string('After removing a file, only one "Upload" button for each possible field is displayed (JSMode=%type).', array('%type' => $type)));
+ $expected = $current_field_name === $field_name ? 1 : 2;
+ $this->assertTrue(is_array($buttons) && count($buttons) === $expected, format_string('After removing a file, only one "Upload" button for each possible field is displayed (JSMode=%type).', array('%type' => $type)));
}
}
diff --git a/core/modules/file/src/Tests/FileManagedTestBase.php b/core/modules/file/src/Tests/FileManagedTestBase.php
index 3147f73..41174f7 100644
--- a/core/modules/file/src/Tests/FileManagedTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedTestBase.php
@@ -76,10 +76,10 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
$actual_count = count(file_test_get_calls($hook));
if (!isset($message)) {
- if ($actual_count == $expected_count) {
+ if ($actual_count === $expected_count) {
$message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
}
- elseif ($expected_count == 0) {
+ elseif ($expected_count === 0) {
$message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
}
else {
@@ -98,13 +98,13 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
* File object to compare.
*/
function assertFileUnchanged(FileInterface $before, FileInterface $after) {
- $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
- $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
- $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
- $this->assertEqual($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', array('%file1' => $before->getFileUri(), '%file2' => $after->getFileUri())), 'File unchanged');
- $this->assertEqual($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->getMimeType(), '%file2' => $after->getMimeType())), 'File unchanged');
- $this->assertEqual($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', array('%file1' => $before->getSize(), '%file2' => $after->getSize())), 'File unchanged');
- $this->assertEqual($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', array('%file1' => $before->isPermanent(), '%file2' => $after->isPermanent())), 'File unchanged');
+ $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 === %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
+ $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 === %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
+ $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 === %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
+ $this->assertEqual($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 === %file2.', array('%file1' => $before->getFileUri(), '%file2' => $after->getFileUri())), 'File unchanged');
+ $this->assertEqual($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 === %file2.', array('%file1' => $before->getMimeType(), '%file2' => $after->getMimeType())), 'File unchanged');
+ $this->assertEqual($before->getSize(), $after->getSize(), t('File size is the same: %file1 === %file2.', array('%file1' => $before->getSize(), '%file2' => $after->getSize())), 'File unchanged');
+ $this->assertEqual($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 === %file2.', array('%file1' => $before->isPermanent(), '%file2' => $after->isPermanent())), 'File unchanged');
}
/**
@@ -116,8 +116,8 @@ function assertFileUnchanged(FileInterface $before, FileInterface $after) {
* File object to compare.
*/
function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
- $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
- $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
+ $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 !== %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
+ $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 !== %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
}
/**
@@ -129,8 +129,8 @@ function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
* File object to compare.
*/
function assertSameFile(FileInterface $file1, FileInterface $file2) {
- $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
- $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
+ $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 === %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
+ $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 === %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
}
/**
diff --git a/core/modules/file/src/Tests/FileManagedUnitTestBase.php b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
index 051601a..08d2929 100644
--- a/core/modules/file/src/Tests/FileManagedUnitTestBase.php
+++ b/core/modules/file/src/Tests/FileManagedUnitTestBase.php
@@ -88,10 +88,10 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
$actual_count = count(file_test_get_calls($hook));
if (!isset($message)) {
- if ($actual_count == $expected_count) {
+ if ($actual_count === $expected_count) {
$message = format_string('hook_file_@name was called correctly.', array('@name' => $hook));
}
- elseif ($expected_count == 0) {
+ elseif ($expected_count === 0) {
$message = format_plural($actual_count, 'hook_file_@name was not expected to be called but was actually called once.', 'hook_file_@name was not expected to be called but was actually called @count times.', array('@name' => $hook, '@count' => $actual_count));
}
else {
@@ -110,13 +110,13 @@ function assertFileHookCalled($hook, $expected_count = 1, $message = NULL) {
* File object to compare.
*/
function assertFileUnchanged(FileInterface $before, FileInterface $after) {
- $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
- $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
- $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
- $this->assertEqual($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', array('%file1' => $before->getFileUri(), '%file2' => $after->getFileUri())), 'File unchanged');
- $this->assertEqual($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->getMimeType(), '%file2' => $after->getMimeType())), 'File unchanged');
- $this->assertEqual($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', array('%file1' => $before->getSize(), '%file2' => $after->getSize())), 'File unchanged');
- $this->assertEqual($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', array('%file1' => $before->isPermanent(), '%file2' => $after->isPermanent())), 'File unchanged');
+ $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 === %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
+ $this->assertEqual($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 === %file2.', array('%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id())), 'File unchanged');
+ $this->assertEqual($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 === %file2.', array('%file1' => $before->getFilename(), '%file2' => $after->getFilename())), 'File unchanged');
+ $this->assertEqual($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 === %file2.', array('%file1' => $before->getFileUri(), '%file2' => $after->getFileUri())), 'File unchanged');
+ $this->assertEqual($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 === %file2.', array('%file1' => $before->getMimeType(), '%file2' => $after->getMimeType())), 'File unchanged');
+ $this->assertEqual($before->getSize(), $after->getSize(), t('File size is the same: %file1 === %file2.', array('%file1' => $before->getSize(), '%file2' => $after->getSize())), 'File unchanged');
+ $this->assertEqual($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 === %file2.', array('%file1' => $before->isPermanent(), '%file2' => $after->isPermanent())), 'File unchanged');
}
/**
@@ -128,8 +128,8 @@ function assertFileUnchanged(FileInterface $before, FileInterface $after) {
* File object to compare.
*/
function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
- $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
- $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
+ $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 !== %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
+ $this->assertNotEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 !== %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Different file');
}
/**
@@ -141,8 +141,8 @@ function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
* File object to compare.
*/
function assertSameFile(FileInterface $file1, FileInterface $file2) {
- $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
- $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
+ $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 === %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
+ $this->assertEqual($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 === %file2.', array('%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri())), 'Same file');
}
/**
diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module
index b1bdeb3..e4c5c77 100644
--- a/core/modules/file/tests/file_test/file_test.module
+++ b/core/modules/file/tests/file_test/file_test.module
@@ -223,7 +223,7 @@ function file_test_file_url_alter(&$uri) {
return;
}
// Test alteration of file URLs to use a CDN.
- elseif ($alter_mode == 'cdn') {
+ elseif ($alter_mode === 'cdn') {
$cdn_extensions = array('css', 'js', 'gif', 'jpg', 'jpeg', 'png');
// Most CDNs don't support private file transfers without a lot of hassle,
@@ -259,11 +259,11 @@ function file_test_file_url_alter(&$uri) {
}
}
// Test alteration of file URLs to use root-relative URLs.
- elseif ($alter_mode == 'root-relative') {
+ elseif ($alter_mode === 'root-relative') {
// Only serve shipped files and public created files with root-relative
// URLs.
$scheme = file_uri_scheme($uri);
- if (!$scheme || $scheme == 'public') {
+ if (!$scheme || $scheme === 'public') {
// Shipped files.
if (!$scheme) {
$path = $uri;
@@ -282,11 +282,11 @@ function file_test_file_url_alter(&$uri) {
}
}
// Test alteration of file URLs to use protocol-relative URLs.
- elseif ($alter_mode == 'protocol-relative') {
+ elseif ($alter_mode === 'protocol-relative') {
// Only serve shipped files and public created files with protocol-relative
// URLs.
$scheme = file_uri_scheme($uri);
- if (!$scheme || $scheme == 'public') {
+ if (!$scheme || $scheme === 'public') {
// Shipped files.
if (!$scheme) {
$path = $uri;
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index d31cca1..54c1f81 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -161,7 +161,7 @@ function filter_pre_render_text(array $element) {
$enabled = $filter->status === TRUE;
$type = $filter->getType();
// Prevent FilterInterface::TYPE_HTML_RESTRICTOR from being skipped.
- $filter_type_must_be_applied = $type == FilterInterface::TYPE_HTML_RESTRICTOR || !in_array($type, $filter_types_to_skip);
+ $filter_type_must_be_applied = $type === FilterInterface::TYPE_HTML_RESTRICTOR || !in_array($type, $filter_types_to_skip);
return $enabled && $filter_type_must_be_applied;
};
@@ -657,7 +657,7 @@ function filter_process_format($element) {
// Hide the text format selector and any other child element (such as text
// field's summary).
foreach (Element::children($element) as $key) {
- if ($key != 'value') {
+ if ($key !== 'value') {
$element[$key]['#access'] = FALSE;
}
}
@@ -704,7 +704,7 @@ function _filter_tips($format_id, $long = FALSE) {
$tips = array();
// If only listing one format, extract it from the $formats array.
- if ($format_id != -1) {
+ if ($format_id !== -1) {
$formats = array($formats[$format_id]);
}
@@ -925,9 +925,9 @@ function _filter_url($text, $filter) {
$open_tag = '';
for ($i = 0; $i < count($chunks); $i++) {
- if ($chunk_type == 'text') {
+ if ($chunk_type === 'text') {
// Only process this text if there are no unclosed $ignore_tags.
- if ($open_tag == '') {
+ if ($open_tag === '') {
// If there is a match, inject a link into this chunk via the callback
// function contained in $task.
$chunks[$i] = preg_replace_callback($pattern, $task, $chunks[$i]);
@@ -937,7 +937,7 @@ function _filter_url($text, $filter) {
}
else {
// Only process this tag if there are no unclosed $ignore_tags.
- if ($open_tag == '') {
+ if ($open_tag === '') {
// Check whether this tag is contained in $ignore_tags.
if (preg_match("`<($ignore_tags)(?:\s|>)`i", $chunks[$i], $matches)) {
$open_tag = $matches[1];
@@ -1086,14 +1086,14 @@ function _filter_autop($text) {
$output = '';
foreach ($chunks as $i => $chunk) {
if ($i % 2) {
- $comment = (substr($chunk, 0, 4) == '');
// If the size is zero, and there is no delimiter, the entire body is the summary.
- if ($size == 0 && $delimiter === FALSE) {
+ if ($size === 0 && $delimiter === FALSE) {
return $text;
}
diff --git a/core/modules/toolbar/src/Controller/ToolbarController.php b/core/modules/toolbar/src/Controller/ToolbarController.php
index b1de82d..ae89f19 100644
--- a/core/modules/toolbar/src/Controller/ToolbarController.php
+++ b/core/modules/toolbar/src/Controller/ToolbarController.php
@@ -43,7 +43,7 @@ public function subtreesJsonp() {
*/
public function checkSubTreeAccess(Request $request, $langcode) {
$hash = $request->get('hash');
- return AccessResult::allowedIf($this->currentUser()->hasPermission('access toolbar') && $hash == _toolbar_get_subtrees_hash($langcode))->cachePerRole();
+ return AccessResult::allowedIf($this->currentUser()->hasPermission('access toolbar') && $hash === _toolbar_get_subtrees_hash($langcode))->cachePerRole();
}
}
diff --git a/core/modules/tour/src/Entity/Tour.php b/core/modules/tour/src/Entity/Tour.php
index 55b94f1..765cf42 100644
--- a/core/modules/tour/src/Entity/Tour.php
+++ b/core/modules/tour/src/Entity/Tour.php
@@ -110,7 +110,7 @@ public function getTips() {
$tips[] = $this->getTip($id);
}
uasort($tips, function ($a, $b) {
- if ($a->getWeight() == $b->getWeight()) {
+ if ($a->getWeight() === $b->getWeight()) {
return 0;
}
return ($a->getWeight() < $b->getWeight()) ? -1 : 1;
diff --git a/core/modules/tour/tests/tour_test/tour_test.module b/core/modules/tour/tests/tour_test/tour_test.module
index 69a9a54..2e1d2ef 100644
--- a/core/modules/tour/tests/tour_test/tour_test.module
+++ b/core/modules/tour/tests/tour_test/tour_test.module
@@ -20,7 +20,7 @@ function tour_test_tour_load($entities) {
* Implements hook_ENTITY_TYPE_presave() for tour.
*/
function tour_test_tour_presave($entity) {
- if ($entity->id() == 'tour-entity-create-test-en') {
+ if ($entity->id() === 'tour-entity-create-test-en') {
$entity->set('label', $entity->label() . ' alter');
}
}
@@ -30,7 +30,7 @@ function tour_test_tour_presave($entity) {
*/
function tour_test_tour_tips_alter(array &$tour_tips, EntityInterface $entity) {
foreach ($tour_tips as $tour_tip) {
- if ($tour_tip->get('id') == 'tour-code-test-1') {
+ if ($tour_tip->get('id') === 'tour-code-test-1') {
$tour_tip->set('body', 'Altered by hook_tour_tips_alter');
}
}
diff --git a/core/modules/tour/tour.api.php b/core/modules/tour/tour.api.php
index 04049f5..0eff855 100644
--- a/core/modules/tour/tour.api.php
+++ b/core/modules/tour/tour.api.php
@@ -20,7 +20,7 @@
*/
function hook_tour_tips_alter(array &$tour_tips, Drupal\Core\Entity\EntityInterface $entity) {
foreach ($tour_tips as $tour_tip) {
- if ($tour_tip->get('id') == 'tour-code-test-1') {
+ if ($tour_tip->get('id') === 'tour-code-test-1') {
$tour_tip->set('body', 'Altered by hook_tour_tips_alter');
}
}
diff --git a/core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php b/core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php
index 097627c..617c198 100644
--- a/core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php
+++ b/core/modules/tracker/src/Access/ViewOwnTrackerAccessCheck.php
@@ -29,6 +29,7 @@ class ViewOwnTrackerAccessCheck implements AccessInterface {
* The access result.
*/
public function access(AccountInterface $account, UserInterface $user) {
- return AccessResult::allowedIf($user && $account->isAuthenticated() && ($user->id() == $account->id()))->cachePerUser();
+ return AccessResult::allowedIf($user && $account->isAuthenticated() && ($user->id() === $account->id()))->cachePerUser();
}
+
}
diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install
index 5f3e5a0..895e023 100644
--- a/core/modules/tracker/tracker.install
+++ b/core/modules/tracker/tracker.install
@@ -17,7 +17,7 @@ function tracker_uninstall() {
*/
function tracker_install() {
$max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField();
- if ($max_nid != 0) {
+ if ($max_nid !== 0) {
\Drupal::state()->set('tracker.index_nid', $max_nid);
// To avoid timing out while attempting to do a complete indexing, we
// simply call our cron job to remove stale records and begin the process.
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index fba29f8..95a4a73 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -146,7 +146,7 @@ function tracker_cron() {
*/
function _tracker_myrecent_access(AccountInterface $account) {
// This path is only allowed for authenticated users looking at their own content.
- return $account->id() && (\Drupal::currentUser()->id() == $account->id()) && $account->hasPermission('access content');
+ return $account->id() && (\Drupal::currentUser()->id() === $account->id()) && $account->hasPermission('access content');
}
/**
@@ -201,7 +201,7 @@ function tracker_node_predelete(EntityInterface $node, $arg = 0) {
* Implements hook_ENTITY_TYPE_update() for comment entities.
*/
function tracker_comment_update(CommentInterface $comment) {
- if ($comment->getCommentedEntityTypeId() == 'node') {
+ if ($comment->getCommentedEntityTypeId() === 'node') {
if ($comment->isPublished()) {
_tracker_add($comment->getCommentedEntityId(), $comment->getOwnerId(), $comment->getChangedTime());
}
@@ -215,7 +215,7 @@ function tracker_comment_update(CommentInterface $comment) {
* Implements hook_ENTITY_TYPE_insert() for comment entities.
*/
function tracker_comment_insert(CommentInterface $comment) {
- if ($comment->getCommentedEntityTypeId() == 'node' && $comment->isPublished()) {
+ if ($comment->getCommentedEntityTypeId() === 'node' && $comment->isPublished()) {
_tracker_add($comment->getCommentedEntityId(), $comment->getOwnerId(), $comment->getChangedTime());
}
}
@@ -224,7 +224,7 @@ function tracker_comment_insert(CommentInterface $comment) {
* Implements hook_ENTITY_TYPE_delete() for comment entities.
*/
function tracker_comment_delete(CommentInterface $comment) {
- if ($comment->getCommentedEntityTypeId() == 'node') {
+ if ($comment->getCommentedEntityTypeId() === 'node') {
_tracker_remove($comment->getCommentedEntityId(), $comment->getOwnerId(), $comment->getChangedTime());
}
}
@@ -316,7 +316,7 @@ function _tracker_remove($nid, $uid = NULL, $changed = NULL) {
// The user only keeps their subscription if the node exists.
if ($node) {
// And they are the author of the node.
- $keep_subscription = ($node->getOwnerId() == $uid);
+ $keep_subscription = ($node->getOwnerId() === $uid);
// Or if they have commented on the node.
if (!$keep_subscription) {
diff --git a/core/modules/update/src/Form/UpdateManagerInstall.php b/core/modules/update/src/Form/UpdateManagerInstall.php
index 3198a28..d4d921f 100644
--- a/core/modules/update/src/Form/UpdateManagerInstall.php
+++ b/core/modules/update/src/Form/UpdateManagerInstall.php
@@ -205,7 +205,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// install the code, there's no need to prompt for FTP/SSH credentials.
// Instead, we instantiate a Drupal\Core\FileTransfer\Local and invoke
// update_authorize_run_install() directly.
- if (fileowner($project_real_location) == fileowner(conf_path())) {
+ if (fileowner($project_real_location) === fileowner(conf_path())) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
$filetransfer = new Local(DRUPAL_ROOT);
call_user_func_array('update_authorize_run_install', array_merge(array($filetransfer), $arguments));
diff --git a/core/modules/update/src/Form/UpdateManagerUpdate.php b/core/modules/update/src/Form/UpdateManagerUpdate.php
index c90247f..8f6cf7c 100644
--- a/core/modules/update/src/Form/UpdateManagerUpdate.php
+++ b/core/modules/update/src/Form/UpdateManagerUpdate.php
@@ -105,7 +105,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$project_data = update_calculate_project_data($available);
foreach ($project_data as $name => $project) {
// Filter out projects which are up to date already.
- if ($project['status'] == UPDATE_CURRENT) {
+ if ($project['status'] === UPDATE_CURRENT) {
continue;
}
// The project name to display can vary based on the info we have.
@@ -123,7 +123,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
else {
$project_name = String::checkPlain($name);
}
- if ($project['project_type'] == 'theme' || $project['project_type'] == 'theme-disabled') {
+ if ($project['project_type'] === 'theme' || $project['project_type'] === 'theme-disabled') {
$project_name .= ' ' . $this->t('(Theme)');
}
@@ -135,7 +135,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$recommended_release = $project['releases'][$project['recommended']];
$recommended_version = $recommended_release['version'] . ' ' . l($this->t('(Release notes)'), $recommended_release['release_link'], array('attributes' => array('title' => $this->t('Release notes for @project_title', array('@project_title' => $project['title'])))));
- if ($recommended_release['version_major'] != $project['existing_major']) {
+ if ($recommended_release['version_major'] !== $project['existing_major']) {
$recommended_version .= '
' . $this->t('This update is a major version update which means that it may not be backwards compatible with your currently running version. It is recommended that you read the release notes and proceed at your own risk.') . '
';
}
@@ -180,7 +180,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$entry['#attributes'] = array('class' => array('update-' . $type));
// Drupal core needs to be upgraded manually.
- $needs_manual = $project['project_type'] == 'core';
+ $needs_manual = $project['project_type'] === 'core';
if ($needs_manual) {
// There are no checkboxes in the 'Manual updates' table so it will be
diff --git a/core/modules/update/src/Form/UpdateReady.php b/core/modules/update/src/Form/UpdateReady.php
index 66e94de..9a25e22 100644
--- a/core/modules/update/src/Form/UpdateReady.php
+++ b/core/modules/update/src/Form/UpdateReady.php
@@ -100,7 +100,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state) {
// Store maintenance_mode setting so we can restore it when done.
$_SESSION['maintenance_mode'] = $this->state->get('system.maintenance_mode');
- if ($form_state->getValue('maintenance_mode') == TRUE) {
+ if ($form_state->getValue('maintenance_mode') === TRUE) {
$this->state->set('system.maintenance_mode', TRUE);
}
@@ -131,7 +131,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// trying to install the code, there's no need to prompt for FTP/SSH
// credentials. Instead, we instantiate a Drupal\Core\FileTransfer\Local
// and invoke update_authorize_run_update() directly.
- if (fileowner($project_real_location) == fileowner(conf_path())) {
+ if (fileowner($project_real_location) === fileowner(conf_path())) {
$this->moduleHandler->loadInclude('update', 'inc', 'update.authorize');
$filetransfer = new Local(DRUPAL_ROOT);
update_authorize_run_update($filetransfer, $updates);
diff --git a/core/modules/update/src/UpdateSettingsForm.php b/core/modules/update/src/UpdateSettingsForm.php
index fb872b6..fbdf61a 100644
--- a/core/modules/update/src/UpdateSettingsForm.php
+++ b/core/modules/update/src/UpdateSettingsForm.php
@@ -90,7 +90,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
if (empty($invalid)) {
$form_state->set('notify_emails', $valid);
}
- elseif (count($invalid) == 1) {
+ elseif (count($invalid) === 1) {
$form_state->setErrorByName('update_notify_emails', $this->t('%email is not a valid email address.', array('%email' => reset($invalid))));
}
else {
@@ -108,7 +108,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('update.settings');
// See if the update_check_disabled setting is being changed, and if so,
// invalidate all update status data.
- if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) {
+ if ($form_state->getValue('update_check_disabled') !== $config->get('check.disabled_extensions')) {
update_storage_clear();
}
diff --git a/core/modules/update/update.api.php b/core/modules/update/update.api.php
index b5c8120..91f929b 100644
--- a/core/modules/update/update.api.php
+++ b/core/modules/update/update.api.php
@@ -86,7 +86,7 @@ function hook_update_status_alter(&$projects) {
$settings = \Drupal::config('update_advanced.settings')->get('projects');
foreach ($projects as $project => $project_info) {
if (isset($settings[$project]) && isset($settings[$project]['check']) &&
- ($settings[$project]['check'] == 'never' ||
+ ($settings[$project]['check'] === 'never' ||
(isset($project_info['recommended']) &&
$settings[$project]['check'] === $project_info['recommended']))) {
$projects[$project]['status'] = UPDATE_NOT_CHECKED;
diff --git a/core/modules/update/update.authorize.inc b/core/modules/update/update.authorize.inc
index 3bfdbcf..5f28202 100644
--- a/core/modules/update/update.authorize.inc
+++ b/core/modules/update/update.authorize.inc
@@ -198,7 +198,7 @@ function update_authorize_update_batch_finished($success, $results) {
_update_authorize_clear_update_status();
// Take the site out of maintenance mode if it was previously that way.
- if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
+ if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] === FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = array(
'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'),
@@ -260,7 +260,7 @@ function update_authorize_install_batch_finished($success, $results) {
$offline = \Drupal::state()->get('system.maintenance_mode');
if ($success) {
// Take the site out of maintenance mode if it was previously that way.
- if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
+ if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] === FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = array(
'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'),
diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc
index da6d63b..40a659a 100644
--- a/core/modules/update/update.compare.inc
+++ b/core/modules/update/update.compare.inc
@@ -334,7 +334,7 @@ function update_calculate_project_update_status(&$project_data, $available) {
// data we currently have (if any) is stale, and we've got a task queued
// up to (re)fetch the data. In that case, we mark it as such, merge in
// whatever data we have (e.g. project title and link), and move on.
- if (!empty($available['fetch_status']) && $available['fetch_status'] == UPDATE_FETCH_PENDING) {
+ if (!empty($available['fetch_status']) && $available['fetch_status'] === UPDATE_FETCH_PENDING) {
$project_data['status'] = UPDATE_FETCH_PENDING;
$project_data['reason'] = t('No available update data');
$project_data['fetch_status'] = $available['fetch_status'];
@@ -354,7 +354,7 @@ function update_calculate_project_update_status(&$project_data, $available) {
in_array('Insecure', $release['terms']['Release type'])) {
$project_data['status'] = UPDATE_NOT_SECURE;
}
- elseif ($release['status'] == 'unpublished') {
+ elseif ($release['status'] === 'unpublished') {
$project_data['status'] = UPDATE_REVOKED;
if (empty($project_data['extra'])) {
$project_data['extra'] = array();
@@ -380,7 +380,7 @@ function update_calculate_project_update_status(&$project_data, $available) {
}
// Otherwise, ignore unpublished, insecure, or unsupported releases.
- if ($release['status'] == 'unpublished' ||
+ if ($release['status'] === 'unpublished' ||
(isset($release['terms']['Release type']) &&
(in_array('Insecure', $release['terms']['Release type']) ||
in_array('Unsupported', $release['terms']['Release type'])))) {
@@ -415,16 +415,16 @@ function update_calculate_project_update_status(&$project_data, $available) {
// Look for the 'latest version' if we haven't found it yet. Latest is
// defined as the most recent version for the target major version.
if (!isset($project_data['latest_version'])
- && $release['version_major'] == $target_major) {
+ && $release['version_major'] === $target_major) {
$project_data['latest_version'] = $version;
$project_data['releases'][$version] = $release;
}
// Look for the development snapshot release for this branch.
if (!isset($project_data['dev_version'])
- && $release['version_major'] == $target_major
+ && $release['version_major'] === $target_major
&& isset($release['version_extra'])
- && $release['version_extra'] == 'dev') {
+ && $release['version_extra'] === 'dev') {
$project_data['dev_version'] = $version;
$project_data['releases'][$version] = $release;
}
@@ -432,13 +432,13 @@ function update_calculate_project_update_status(&$project_data, $available) {
// Look for the 'recommended' version if we haven't found it yet (see
// phpdoc at the top of this function for the definition).
if (!isset($project_data['recommended'])
- && $release['version_major'] == $target_major
+ && $release['version_major'] === $target_major
&& isset($release['version_patch'])) {
- if ($patch != $release['version_patch']) {
+ if ($patch !== $release['version_patch']) {
$patch = $release['version_patch'];
$release_patch_changed = $release;
}
- if (empty($release['version_extra']) && $patch == $release['version_patch']) {
+ if (empty($release['version_extra']) && $patch === $release['version_patch']) {
$project_data['recommended'] = $release_patch_changed['version'];
$project_data['releases'][$release_patch_changed['version']] = $release_patch_changed;
}
@@ -455,7 +455,7 @@ function update_calculate_project_update_status(&$project_data, $available) {
// differences between the datestamp in the .info.yml file and the
// timestamp of the tarball itself (which are usually off by 1 or 2
// seconds) so that we don't flag that as a new release.
- if ($project_data['install_type'] == 'dev') {
+ if ($project_data['install_type'] === 'dev') {
if (empty($project_data['datestamp'])) {
// We don't have current timestamp info, so we can't know.
continue;
@@ -505,7 +505,7 @@ function update_calculate_project_update_status(&$project_data, $available) {
// with the latest official version, and record the absolute latest in
// 'latest_dev' so we can correctly decide if there's a newer release
// than our current snapshot.
- if ($project_data['install_type'] == 'dev') {
+ if ($project_data['install_type'] === 'dev') {
if (isset($project_data['dev_version']) && $available['releases'][$project_data['dev_version']]['date'] > $available['releases'][$project_data['latest_version']]['date']) {
$project_data['latest_dev'] = $project_data['dev_version'];
}
diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc
index 7b71edb..6334184 100644
--- a/core/modules/update/update.fetch.inc
+++ b/core/modules/update/update.fetch.inc
@@ -78,11 +78,11 @@ function _update_cron_notify() {
module_load_install('update');
$status = update_requirements('runtime');
$params = array();
- $notify_all = ($update_config->get('notification.threshold') == 'all');
+ $notify_all = ($update_config->get('notification.threshold') === 'all');
foreach (array('core', 'contrib') as $report_type) {
$type = 'update_' . $report_type;
if (isset($status[$type]['severity'])
- && ($status[$type]['severity'] == REQUIREMENT_ERROR || ($notify_all && $status[$type]['reason'] == UPDATE_NOT_CURRENT))) {
+ && ($status[$type]['severity'] === REQUIREMENT_ERROR || ($notify_all && $status[$type]['reason'] === UPDATE_NOT_CURRENT))) {
$params[$report_type] = $status[$type]['reason'];
}
}
diff --git a/core/modules/update/update.install b/core/modules/update/update.install
index 7997ec8..6ba3624 100644
--- a/core/modules/update/update.install
+++ b/core/modules/update/update.install
@@ -27,7 +27,7 @@
*/
function update_requirements($phase) {
$requirements = array();
- if ($phase == 'runtime') {
+ if ($phase === 'runtime') {
if ($available = update_get_available(FALSE)) {
module_load_include('inc', 'update', 'update.compare');
$data = update_calculate_project_data($available);
@@ -96,14 +96,14 @@ function update_uninstall() {
*/
function _update_requirement_check($project, $type) {
$requirement = array();
- if ($type == 'core') {
+ if ($type === 'core') {
$requirement['title'] = t('Drupal core update status');
}
else {
$requirement['title'] = t('Module and theme update status');
}
$status = $project['status'];
- if ($status != UPDATE_CURRENT) {
+ if ($status !== UPDATE_CURRENT) {
$requirement['reason'] = $status;
$requirement['description'] = _update_message_text($type, $status, TRUE);
$requirement['severity'] = REQUIREMENT_ERROR;
@@ -131,7 +131,7 @@ function _update_requirement_check($project, $type) {
default:
$requirement_label = t('Up to date');
}
- if ($status != UPDATE_CURRENT && $type == 'core' && isset($project['recommended'])) {
+ if ($status !== UPDATE_CURRENT && $type === 'core' && isset($project['recommended'])) {
$requirement_label .= ' ' . t('(version @version available)', array('@version' => $project['recommended']));
}
$requirement['value'] = l($requirement_label, update_manager_access() ? 'admin/reports/updates/update' : 'admin/reports/updates');
diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc
index 1faf7fd..164f050 100644
--- a/core/modules/update/update.manager.inc
+++ b/core/modules/update/update.manager.inc
@@ -98,7 +98,7 @@ function _update_manager_check_backends(&$form, $operation) {
$available_backends = drupal_get_filetransfer_info();
if (empty($available_backends)) {
- if ($operation == 'update') {
+ if ($operation === 'update') {
$form['available_backends']['#markup'] = t('Your server does not support updating modules and themes from this interface. Instead, update modules and themes by uploading the new versions directly to the server, as described in the handbook.', array('@handbook_url' => 'http://drupal.org/getting-started/install-contrib'));
}
else {
@@ -111,7 +111,7 @@ function _update_manager_check_backends(&$form, $operation) {
foreach ($available_backends as $backend) {
$backend_names[] = $backend['title'];
}
- if ($operation == 'update') {
+ if ($operation === 'update') {
$form['available_backends']['#markup'] = format_plural(
count($available_backends),
'Updating modules and themes requires @backends access to your server. See the handbook for other update methods.',
diff --git a/core/modules/update/update.module b/core/modules/update/update.module
index 6529a48..2e7329c 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -132,10 +132,10 @@ function update_page_build() {
$type = 'update_' . $report_type;
if (!empty($verbose)) {
if (isset($status[$type]['severity'])) {
- if ($status[$type]['severity'] == REQUIREMENT_ERROR) {
+ if ($status[$type]['severity'] === REQUIREMENT_ERROR) {
drupal_set_message($status[$type]['description'], 'error');
}
- elseif ($status[$type]['severity'] == REQUIREMENT_WARNING) {
+ elseif ($status[$type]['severity'] === REQUIREMENT_WARNING) {
drupal_set_message($status[$type]['description'], 'warning');
}
}
@@ -337,7 +337,7 @@ function update_get_available($refresh = FALSE) {
// If we think this project needs to fetch, actually create the task now
// and remember that we think we're missing some data.
- if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) {
+ if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] === UPDATE_FETCH_PENDING) {
\Drupal::service('update.processor')->createFetchTask($project);
$needs_refresh = TRUE;
}
@@ -445,7 +445,7 @@ function update_mail($key, &$message, $params) {
$message['body'][] = t('You can automatically install your missing updates using the Update manager:', array(), array('langcode' => $langcode)) . "\n" . url('admin/reports/updates/update', array('absolute' => TRUE, 'language' => $language));
}
$settings_url = url('admin/reports/updates/settings', array('absolute' => TRUE));
- if (\Drupal::config('update.settings')->get('notification.threshold') == 'all') {
+ if (\Drupal::config('update.settings')->get('notification.threshold') === 'all') {
$message['body'][] = t('Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, !url.', array('!url' => $settings_url));
}
else {
@@ -478,7 +478,7 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan
$text = '';
switch ($msg_reason) {
case UPDATE_NOT_SECURE:
- if ($msg_type == 'core') {
+ if ($msg_type === 'core') {
$text = t('There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately!', array(), array('langcode' => $langcode));
}
else {
@@ -487,7 +487,7 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan
break;
case UPDATE_REVOKED:
- if ($msg_type == 'core') {
+ if ($msg_type === 'core') {
$text = t('Your version of Drupal has been revoked and is no longer available for download. Upgrading is strongly recommended!', array(), array('langcode' => $langcode));
}
else {
@@ -496,7 +496,7 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan
break;
case UPDATE_NOT_SUPPORTED:
- if ($msg_type == 'core') {
+ if ($msg_type === 'core') {
$text = t('Your version of Drupal is no longer supported. Upgrading is strongly recommended!', array(), array('langcode' => $langcode));
}
else {
@@ -505,7 +505,7 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan
break;
case UPDATE_NOT_CURRENT:
- if ($msg_type == 'core') {
+ if ($msg_type === 'core') {
$text = t('There are updates available for your version of Drupal. To ensure the proper functioning of your site, you should update as soon as possible.', array(), array('langcode' => $langcode));
}
else {
@@ -517,7 +517,7 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan
case UPDATE_NOT_CHECKED:
case UPDATE_NOT_FETCHED:
case UPDATE_FETCH_PENDING:
- if ($msg_type == 'core') {
+ if ($msg_type === 'core') {
$text = t('There was a problem checking available updates for Drupal.', array('@update-report' => url('admin/reports/updates')), array('langcode' => $langcode));
}
else {
@@ -621,7 +621,7 @@ function update_verify_update_archive($project, $archive_file, $directory) {
$info = \Drupal::service('info_parser')->parse($file->uri);
// If the module or theme is incompatible with Drupal core, set an error.
- if (empty($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) {
+ if (empty($info['core']) || $info['core'] !== \Drupal::CORE_COMPATIBILITY) {
$incompatible[] = !empty($info['name']) ? $info['name'] : t('Unknown');
}
else {
diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
index ad396c8..063ba99 100644
--- a/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -138,7 +138,7 @@ function template_preprocess_update_project_status(&$variables) {
$variables['url'] = (isset($project['link'])) ? url($project['link']) : NULL;
$variables['install_type'] = $project['install_type'];
- if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) {
+ if ($project['install_type'] === 'dev' && !empty($project['datestamp'])) {
$variables['datestamp'] = format_date($project['datestamp'], 'custom', 'Y-M-d');
}
@@ -148,14 +148,14 @@ function template_preprocess_update_project_status(&$variables) {
$security_class = array();
$version_class = array();
if (isset($project['recommended'])) {
- if ($project['status'] != UPDATE_CURRENT || $project['existing_version'] !== $project['recommended']) {
+ if ($project['status'] !== UPDATE_CURRENT || $project['existing_version'] !== $project['recommended']) {
// First, figure out what to recommend.
// If there's only 1 security update and it has the same version we're
// recommending, give it the same CSS class as if it was recommended,
// but don't print out a separate "Recommended" line for this project.
if (!empty($project['security updates'])
- && count($project['security updates']) == 1
+ && count($project['security updates']) === 1
&& $project['security updates'][0]['version'] === $project['recommended']
) {
$security_class[] = 'version-recommended';
@@ -167,7 +167,7 @@ function template_preprocess_update_project_status(&$variables) {
// version and anything else for an extra visual hint.
if ($project['recommended'] !== $project['latest_version']
|| !empty($project['also'])
- || ($project['install_type'] == 'dev'
+ || ($project['install_type'] === 'dev'
&& isset($project['dev_version'])
&& $project['latest_version'] !== $project['dev_version']
&& $project['recommended'] !== $project['dev_version'])
@@ -206,8 +206,8 @@ function template_preprocess_update_project_status(&$variables) {
'#attributes' => array('class' => array('version-latest')),
);
}
- if ($project['install_type'] == 'dev'
- && $project['status'] != UPDATE_CURRENT
+ if ($project['install_type'] === 'dev'
+ && $project['status'] !== UPDATE_CURRENT
&& isset($project['dev_version'])
&& $project['recommended'] !== $project['dev_version']) {
$versions_inner[] = array(
diff --git a/core/modules/user/src/Access/RegisterAccessCheck.php b/core/modules/user/src/Access/RegisterAccessCheck.php
index 0f0a3f5..c217097 100644
--- a/core/modules/user/src/Access/RegisterAccessCheck.php
+++ b/core/modules/user/src/Access/RegisterAccessCheck.php
@@ -27,6 +27,7 @@ class RegisterAccessCheck implements AccessInterface {
*/
public function access(AccountInterface $account) {
// @todo cacheable per role once https://www.drupal.org/node/2040135 lands.
- return AccessResult::allowedIf($account->isAnonymous() && \Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY)->setCacheable(FALSE);
+ return AccessResult::allowedIf($account->isAnonymous() && \Drupal::config('user.settings')->get('register') !== USER_REGISTER_ADMINISTRATORS_ONLY)->setCacheable(FALSE);
}
+
}
diff --git a/core/modules/user/src/AccountForm.php b/core/modules/user/src/AccountForm.php
index ba11c0e..d35bd49 100644
--- a/core/modules/user/src/AccountForm.php
+++ b/core/modules/user/src/AccountForm.php
@@ -108,7 +108,7 @@ public function form(array $form, FormStateInterface $form_state) {
'spellcheck' => 'false',
),
'#default_value' => (!$register ? $account->getUsername() : ''),
- '#access' => ($register || ($user->id() == $account->id() && $user->hasPermission('change own username')) || $admin),
+ '#access' => ($register || ($user->id() === $account->id() && $user->hasPermission('change own username')) || $admin),
);
// Display password field only for existing users or when user is allowed to
@@ -122,7 +122,7 @@ public function form(array $form, FormStateInterface $form_state) {
// To skip the current password field, the user must have logged in via a
// one-time link and have the token in the URL.
- $pass_reset = isset($_SESSION['pass_reset_' . $account->id()]) && (\Drupal::request()->query->get('pass-reset-token') == $_SESSION['pass_reset_' . $account->id()]);
+ $pass_reset = isset($_SESSION['pass_reset_' . $account->id()]) && (\Drupal::request()->query->get('pass-reset-token') === $_SESSION['pass_reset_' . $account->id()]);
$protected_values = array();
$current_pass_description = '';
@@ -137,7 +137,7 @@ public function form(array $form, FormStateInterface $form_state) {
}
// The user must enter their current password to change to a new one.
- if ($user->id() == $account->id()) {
+ if ($user->id() === $account->id()) {
$form['account']['current_pass_required_values'] = array(
'#type' => 'value',
'#value' => $protected_values,
@@ -171,7 +171,7 @@ public function form(array $form, FormStateInterface $form_state) {
// When not building the user registration form, prevent web browsers from
// autofilling/prefilling the email, username, and password fields.
- if ($this->getOperation() != 'register') {
+ if ($this->getOperation() !== 'register') {
foreach (array('mail', 'name', 'pass') as $key) {
if (isset($form['account'][$key])) {
$form['account'][$key]['#attributes']['autocomplete'] = 'off';
@@ -183,7 +183,7 @@ public function form(array $form, FormStateInterface $form_state) {
$status = $account->isActive();
}
else {
- $status = $register ? $config->get('register') == USER_REGISTER_VISITORS : $account->isActive();
+ $status = $register ? $config->get('register') === USER_REGISTER_VISITORS : $account->isActive();
}
$form['account']['status'] = array(
diff --git a/core/modules/user/src/AccountSettingsForm.php b/core/modules/user/src/AccountSettingsForm.php
index c03d17f..2ebf6eb 100644
--- a/core/modules/user/src/AccountSettingsForm.php
+++ b/core/modules/user/src/AccountSettingsForm.php
@@ -188,7 +188,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['email_admin_created'] = array(
'#type' => 'details',
'#title' => $this->t('Welcome (new user created by administrator)'),
- '#open' => $config->get('register') == USER_REGISTER_ADMINISTRATORS_ONLY,
+ '#open' => $config->get('register') === USER_REGISTER_ADMINISTRATORS_ONLY,
'#description' => $this->t('Edit the welcome email messages sent to new member accounts created by an administrator.') . ' ' . $email_token_help,
'#group' => 'email',
);
@@ -208,7 +208,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['email_pending_approval'] = array(
'#type' => 'details',
'#title' => $this->t('Welcome (awaiting approval)'),
- '#open' => $config->get('register') == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL,
+ '#open' => $config->get('register') === USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL,
'#description' => $this->t('Edit the welcome email messages sent to new members upon registering, when administrative approval is required.') . ' ' . $email_token_help,
'#group' => 'email',
);
@@ -228,7 +228,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['email_pending_approval_admin'] = array(
'#type' => 'details',
'#title' => $this->t('Admin (user awaiting approval)'),
- '#open' => $config->get('register') == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL,
+ '#open' => $config->get('register') === USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL,
'#description' => $this->t('Edit the email notifying the site administrator that there are new members awaiting administrative approval.') . ' ' . $email_token_help,
'#group' => 'email',
);
@@ -248,7 +248,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['email_no_approval_required'] = array(
'#type' => 'details',
'#title' => $this->t('Welcome (no approval required)'),
- '#open' => $config->get('register') == USER_REGISTER_VISITORS,
+ '#open' => $config->get('register') === USER_REGISTER_VISITORS,
'#description' => $this->t('Edit the welcome email messages sent to new members upon registering, when no administrator approval is required.') . ' ' . $email_token_help,
'#group' => 'email',
);
diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php
index be1b03d..2284933 100644
--- a/core/modules/user/src/Controller/UserController.php
+++ b/core/modules/user/src/Controller/UserController.php
@@ -80,7 +80,7 @@ public function resetPass($uid, $timestamp, $hash) {
// isn't already logged in.
if ($account->isAuthenticated()) {
// The current user is already logged in.
- if ($account->id() == $uid) {
+ if ($account->id() === $uid) {
drupal_set_message($this->t('You are logged in as %user. Change your password.', array('%user' => $account->getUsername(), '!user_edit' => $this->url('entity.user.edit_form', array('user' => $account->id())))));
}
// A different user is already logged in on the computer.
diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php
index eb46586..9598a40 100644
--- a/core/modules/user/src/Entity/User.php
+++ b/core/modules/user/src/Entity/User.php
@@ -88,7 +88,7 @@ public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
// Update the user password if it has changed.
- if ($this->isNew() || ($this->pass->value && $this->pass->value != $this->original->pass->value)) {
+ if ($this->isNew() || ($this->pass->value && $this->pass->value !== $this->original->pass->value)) {
// Allow alternate password hashing schemes.
$this->pass->value = \Drupal::service('password')->hash(trim($this->pass->value));
// Abort if the hashing failed and returned FALSE.
@@ -123,28 +123,28 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
$session_manager = \Drupal::service('session_manager');
// If the password has been changed, delete all open sessions for the
// user and recreate the current one.
- if ($this->pass->value != $this->original->pass->value) {
+ if ($this->pass->value !== $this->original->pass->value) {
$session_manager->delete($this->id());
- if ($this->id() == \Drupal::currentUser()->id()) {
+ if ($this->id() === \Drupal::currentUser()->id()) {
$session_manager->regenerate();
}
}
// Update user roles if changed.
- if ($this->getRoles() != $this->original->getRoles()) {
+ if ($this->getRoles() !== $this->original->getRoles()) {
$storage->deleteUserRoles(array($this->id()));
$storage->saveRoles($this);
}
// If the user was blocked, delete the user's sessions to force a logout.
- if ($this->original->status->value != $this->status->value && $this->status->value == 0) {
+ if ($this->original->status->value !== $this->status->value && $this->status->value === 0) {
$session_manager->delete($this->id());
}
// Send emails after we have the new user object.
- if ($this->status->value != $this->original->status->value) {
+ if ($this->status->value !== $this->original->status->value) {
// The user's status is changing; conditionally send notification email.
- $op = $this->status->value == 1 ? 'status_activated' : 'status_blocked';
+ $op = $this->status->value === 1 ? 'status_activated' : 'status_blocked';
_user_mail_notify($op, $this);
}
}
@@ -333,14 +333,14 @@ public function setLastLoginTime($timestamp) {
* {@inheritdoc}
*/
public function isActive() {
- return $this->get('status')->value == 1;
+ return $this->get('status')->value === 1;
}
/**
* {@inheritdoc}
*/
public function isBlocked() {
- return $this->get('status')->value == 0;
+ return $this->get('status')->value === 0;
}
/**
@@ -411,7 +411,7 @@ public function isAuthenticated() {
* {@inheritdoc}
*/
public function isAnonymous() {
- return $this->id() == 0;
+ return $this->id() === 0;
}
/**
diff --git a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
index f6aee69..d08a70b 100644
--- a/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php
@@ -66,19 +66,19 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
return;
}
- if ($this->account->isAnonymous() && $path == 'user') {
+ if ($this->account->isAnonymous() && $path === 'user') {
// Forward anonymous user to login page.
$event->setResponse(new RedirectResponse(url('user/login', array('absolute' => TRUE))));
return;
}
}
if ($this->account->isAuthenticated()) {
- if ($path == 'user/login') {
+ if ($path === 'user/login') {
// If user is logged in, redirect to 'user' instead of giving 403.
$event->setResponse(new RedirectResponse(url('user', array('absolute' => TRUE))));
return;
}
- if ($path == 'user/register') {
+ if ($path === 'user/register') {
// Authenticated user should be redirected to user edit page.
$event->setResponse(new RedirectResponse(url('user/' . $this->account->id() . '/edit', array('absolute' => TRUE))));
return;
diff --git a/core/modules/user/src/Form/UserCancelForm.php b/core/modules/user/src/Form/UserCancelForm.php
index 59ccf3a..b92297a 100644
--- a/core/modules/user/src/Form/UserCancelForm.php
+++ b/core/modules/user/src/Form/UserCancelForm.php
@@ -33,7 +33,7 @@ class UserCancelForm extends ContentEntityConfirmFormBase {
* {@inheritdoc}
*/
public function getQuestion() {
- if ($this->entity->id() == $this->currentUser()->id()) {
+ if ($this->entity->id() === $this->currentUser()->id()) {
return $this->t('Are you sure you want to cancel your account?');
}
return $this->t('Are you sure you want to cancel the account %name?', array('%name' => $this->entity->label()));
@@ -81,7 +81,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$admin_access = $user->hasPermission('administer users');
$form['user_cancel_method'] = array(
'#type' => 'radios',
- '#title' => ($this->entity->id() == $user->id() ? $this->t('When cancelling your account') : $this->t('When cancelling the account')),
+ '#title' => ($this->entity->id() === $user->id() ? $this->t('When cancelling your account') : $this->t('When cancelling the account')),
'#access' => $admin_access || $user->hasPermission('select account cancellation method'),
);
$form['user_cancel_method'] += $this->cancelMethods;
@@ -89,7 +89,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Allow user administrators to skip the account cancellation confirmation
// mail (by default), as long as they do not attempt to cancel their own
// account.
- $override_access = $admin_access && ($this->entity->id() != $user->id());
+ $override_access = $admin_access && ($this->entity->id() !== $user->id());
$form['user_cancel_confirm'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Require email confirmation to cancel account'),
@@ -122,7 +122,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// Cancel account immediately, if the current user has administrative
// privileges, no confirmation mail shall be sent, and the user does not
// attempt to cancel the own account.
- if ($this->currentUser()->hasPermission('administer users') && $form_state->isValueEmpty('user_cancel_confirm') && $this->entity->id() != $this->currentUser()->id()) {
+ if ($this->currentUser()->hasPermission('administer users') && $form_state->isValueEmpty('user_cancel_confirm') && $this->entity->id() !== $this->currentUser()->id()) {
user_cancel($form_state->getValues(), $this->entity->id(), $form_state->getValue('user_cancel_method'));
$form_state->setRedirect('user.admin_account');
diff --git a/core/modules/user/src/Form/UserLoginForm.php b/core/modules/user/src/Form/UserLoginForm.php
index e1275a4..f922bd4 100644
--- a/core/modules/user/src/Form/UserLoginForm.php
+++ b/core/modules/user/src/Form/UserLoginForm.php
@@ -206,7 +206,7 @@ public function validateFinal(array &$form, FormStateInterface $form_state) {
}
if ($flood_control_triggered = $form_state->get('flood_control_triggered')) {
- if ($flood_control_triggered == 'user') {
+ if ($flood_control_triggered === 'user') {
$form_state->setErrorByName('name', format_plural($flood_config->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or request a new password.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.', array('@url' => url('user/password'))));
}
else {
diff --git a/core/modules/user/src/Form/UserMultipleCancelConfirm.php b/core/modules/user/src/Form/UserMultipleCancelConfirm.php
index 9bcfd7b..bdccb5b 100644
--- a/core/modules/user/src/Form/UserMultipleCancelConfirm.php
+++ b/core/modules/user/src/Form/UserMultipleCancelConfirm.php
@@ -127,7 +127,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Output a notice that user 1 cannot be canceled.
if (isset($accounts[1])) {
- $redirect = (count($accounts) == 1);
+ $redirect = (count($accounts) === 1);
$message = $this->t('The user account %name cannot be canceled.', array('%name' => $accounts[1]->label()));
drupal_set_message($message, $redirect ? 'error' : 'warning');
// If only user 1 was selected, redirect to the overview.
@@ -181,7 +181,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
continue;
}
// Prevent user administrators from deleting themselves without confirmation.
- if ($uid == $current_user_id) {
+ if ($uid === $current_user_id) {
$admin_form_mock = array();
$admin_form_state = $form_state;
$admin_form_state->unsetValue('user_cancel_confirm');
diff --git a/core/modules/user/src/PermissionHandler.php b/core/modules/user/src/PermissionHandler.php
index 1cbe222..2562a60 100644
--- a/core/modules/user/src/PermissionHandler.php
+++ b/core/modules/user/src/PermissionHandler.php
@@ -199,7 +199,7 @@ protected function sortPermissions(array $all_permissions = array()) {
$modules = $this->getModuleNames();
uasort($all_permissions, function (array $permission_a, array $permission_b) use ($modules) {
- if ($modules[$permission_a['provider']] == $modules[$permission_b['provider']]) {
+ if ($modules[$permission_a['provider']] === $modules[$permission_b['provider']]) {
return $permission_a['title'] > $permission_b['title'];
}
else {
diff --git a/core/modules/user/src/Plugin/Block/UserLoginBlock.php b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
index 7b3727d..31e6625 100644
--- a/core/modules/user/src/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/src/Plugin/Block/UserLoginBlock.php
@@ -43,7 +43,7 @@ public function build() {
$form['#action'] = url(current_path(), array('query' => drupal_get_destination(), 'external' => FALSE));
// Build action links.
$items = array();
- if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) {
+ if (\Drupal::config('user.settings')->get('register') !== USER_REGISTER_ADMINISTRATORS_ONLY) {
$items['create_account'] = l(t('Create new account'), 'user/register', array(
'attributes' => array(
'title' => t('Create a new user account.'),
diff --git a/core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php b/core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php
index e30a0bf..4af3815 100644
--- a/core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php
+++ b/core/modules/user/src/Plugin/Field/FieldFormatter/AuthorFormatter.php
@@ -52,7 +52,7 @@ public function viewElements(FieldItemListInterface $items) {
* {@inheritdoc}
*/
public static function isApplicable(FieldDefinitionInterface $field_definition) {
- return $field_definition->getFieldStorageDefinition()->getSetting('target_type') == 'user';
+ return $field_definition->getFieldStorageDefinition()->getSetting('target_type') === 'user';
}
}
diff --git a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
index f2c99fe..0a7aa90 100644
--- a/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
+++ b/core/modules/user/src/Plugin/LanguageNegotiation/LanguageNegotiationUser.php
@@ -38,7 +38,7 @@ public function getLangcode(Request $request = NULL) {
$preferred_langcode = $this->currentUser->getPreferredLangcode();
$default_langcode = $this->languageManager->getDefaultLanguage()->id;
$languages = $this->languageManager->getLanguages();
- if (!empty($preferred_langcode) && $preferred_langcode != $default_langcode && isset($languages[$preferred_langcode])) {
+ if (!empty($preferred_langcode) && $preferred_langcode !== $default_langcode && isset($languages[$preferred_langcode])) {
$langcode = $preferred_langcode;
}
}
diff --git a/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php b/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php
index 5b788ca..14a21ef 100644
--- a/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php
+++ b/core/modules/user/src/Plugin/Validation/Constraint/UserNameConstraintValidator.php
@@ -24,10 +24,10 @@ public function validate($items, Constraint $constraint) {
return;
}
$name = $items->first()->value;
- if (substr($name, 0, 1) == ' ') {
+ if (substr($name, 0, 1) === ' ') {
$this->context->addViolation($constraint->spaceBeginMessage);
}
- if (substr($name, -1) == ' ') {
+ if (substr($name, -1) === ' ') {
$this->context->addViolation($constraint->spaceEndMessage);
}
if (strpos($name, ' ') !== FALSE) {
diff --git a/core/modules/user/src/Plugin/entity_reference/selection/UserSelection.php b/core/modules/user/src/Plugin/entity_reference/selection/UserSelection.php
index 3820628..b6d1770 100644
--- a/core/modules/user/src/Plugin/entity_reference/selection/UserSelection.php
+++ b/core/modules/user/src/Plugin/entity_reference/selection/UserSelection.php
@@ -57,7 +57,7 @@ public static function settingsForm(FieldDefinitionInterface $field_definition)
'#process' => array('_entity_reference_form_process_merge_parent'),
);
- if ($selection_handler_settings['filter']['type'] == 'role') {
+ if ($selection_handler_settings['filter']['type'] === 'role') {
// Merge in default values.
$selection_handler_settings['filter'] += array(
'role' => NULL,
@@ -135,7 +135,7 @@ public function entityQueryAlter(SelectInterface $query) {
// Add the filter by role option.
if (!empty($this->fieldDefinition->getSetting('handler_settings')['filter'])) {
$filter_settings = $this->fieldDefinition->getSetting('handler_settings')['filter'];
- if ($filter_settings['type'] == 'role') {
+ if ($filter_settings['type'] === 'role') {
$tables = $query->getTables();
$base_table = $tables['base_table']['alias'];
$query->join('users_roles', 'ur', $base_table . '.uid = ur.uid');
diff --git a/core/modules/user/src/Plugin/views/field/Mail.php b/core/modules/user/src/Plugin/views/field/Mail.php
index ad26317..390dba5 100644
--- a/core/modules/user/src/Plugin/views/field/Mail.php
+++ b/core/modules/user/src/Plugin/views/field/Mail.php
@@ -45,7 +45,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
protected function renderLink($data, ResultRow $values) {
parent::renderLink($data, $values);
- if ($this->options['link_to_user'] == 'mailto') {
+ if ($this->options['link_to_user'] === 'mailto') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "mailto:" . $data;
}
diff --git a/core/modules/user/src/Plugin/views/filter/Name.php b/core/modules/user/src/Plugin/views/filter/Name.php
index 391f238..4f83c58 100644
--- a/core/modules/user/src/Plugin/views/filter/Name.php
+++ b/core/modules/user/src/Plugin/views/filter/Name.php
@@ -92,7 +92,7 @@ public function validateExposed(&$form, FormStateInterface $form_state) {
$values = Tags::explode($input);
- if (!$this->options['is_grouped'] || ($this->options['is_grouped'] && ($input != 'All'))) {
+ if (!$this->options['is_grouped'] || ($this->options['is_grouped'] && ($input !== 'All'))) {
$uids = $this->validate_user_strings($form[$identifier], $form_state, $values);
}
else {
@@ -114,7 +114,7 @@ function validate_user_strings(&$form, FormStateInterface $form_state, $values)
$placeholders = array();
$args = array();
foreach ($values as $value) {
- if (strtolower($value) == 'anonymous') {
+ if (strtolower($value) === 'anonymous') {
$uids[] = 0;
}
else {
diff --git a/core/modules/user/src/ProfileForm.php b/core/modules/user/src/ProfileForm.php
index e119693..ff35129 100644
--- a/core/modules/user/src/ProfileForm.php
+++ b/core/modules/user/src/ProfileForm.php
@@ -38,7 +38,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$element['delete']['#type'] = 'submit';
$element['delete']['#value'] = $this->t('Cancel account');
$element['delete']['#submit'] = array('::editCancelSubmit');
- $element['delete']['#access'] = $account->id() > 1 && (($account->id() == $user->id() && $user->hasPermission('cancel account')) || $user->hasPermission('administer users'));
+ $element['delete']['#access'] = $account->id() > 1 && (($account->id() === $user->id() && $user->hasPermission('cancel account')) || $user->hasPermission('administer users'));
return $element;
}
diff --git a/core/modules/user/src/RoleAccessControlHandler.php b/core/modules/user/src/RoleAccessControlHandler.php
index 52f590d..20fa30a 100644
--- a/core/modules/user/src/RoleAccessControlHandler.php
+++ b/core/modules/user/src/RoleAccessControlHandler.php
@@ -25,7 +25,7 @@ class RoleAccessControlHandler extends EntityAccessControlHandler {
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
switch ($operation) {
case 'delete':
- if ($entity->id() == DRUPAL_ANONYMOUS_RID || $entity->id() == DRUPAL_AUTHENTICATED_RID) {
+ if ($entity->id() === DRUPAL_ANONYMOUS_RID || $entity->id() === DRUPAL_AUTHENTICATED_RID) {
return AccessResult::forbidden();
}
diff --git a/core/modules/user/src/RoleForm.php b/core/modules/user/src/RoleForm.php
index 55e0ccd..8e2a4ca 100644
--- a/core/modules/user/src/RoleForm.php
+++ b/core/modules/user/src/RoleForm.php
@@ -60,7 +60,7 @@ public function save(array $form, FormStateInterface $form_state) {
$status = $entity->save();
$edit_link = \Drupal::linkGenerator()->generateFromUrl($this->t('Edit'), $this->entity->urlInfo());
- if ($status == SAVED_UPDATED) {
+ if ($status === SAVED_UPDATED) {
drupal_set_message($this->t('Role %label has been updated.', array('%label' => $entity->label())));
$this->logger('user')->notice('Role %label has been updated.', array('%label' => $entity->label(), 'link' => $edit_link));
}
diff --git a/core/modules/user/src/TempStore.php b/core/modules/user/src/TempStore.php
index da87691..d9f0def 100644
--- a/core/modules/user/src/TempStore.php
+++ b/core/modules/user/src/TempStore.php
@@ -116,7 +116,7 @@ public function get($key) {
* The data associated with the key, or NULL if the key does not exist.
*/
public function getIfOwner($key) {
- if (($object = $this->storage->get($key)) && ($object->owner == $this->owner)) {
+ if (($object = $this->storage->get($key)) && ($object->owner === $this->owner)) {
return $object->data;
}
}
@@ -161,7 +161,7 @@ public function setIfOwner($key, $value) {
return TRUE;
}
- if (($object = $this->storage->get($key)) && ($object->owner == $this->owner)) {
+ if (($object = $this->storage->get($key)) && ($object->owner === $this->owner)) {
$this->set($key, $value);
return TRUE;
}
@@ -253,7 +253,7 @@ public function deleteIfOwner($key) {
if (!$object = $this->storage->get($key)) {
return TRUE;
}
- elseif ($object->owner == $this->owner) {
+ elseif ($object->owner === $this->owner) {
$this->delete($key);
return TRUE;
}
diff --git a/core/modules/user/src/Tests/UserAccountFormFieldsTest.php b/core/modules/user/src/Tests/UserAccountFormFieldsTest.php
index df01adc..d2b4075 100644
--- a/core/modules/user/src/Tests/UserAccountFormFieldsTest.php
+++ b/core/modules/user/src/Tests/UserAccountFormFieldsTest.php
@@ -132,7 +132,7 @@ protected function buildAccountForm($operation) {
// @see HtmlEntityFormController::getFormObject()
$entity_type = 'user';
$fields = array();
- if ($operation != 'register') {
+ if ($operation !== 'register') {
$fields['uid'] = 2;
}
$entity = $this->container->get('entity.manager')
diff --git a/core/modules/user/src/Tests/UserAdminListingTest.php b/core/modules/user/src/Tests/UserAdminListingTest.php
index 65e9ef3..e5fe02d 100644
--- a/core/modules/user/src/Tests/UserAdminListingTest.php
+++ b/core/modules/user/src/Tests/UserAdminListingTest.php
@@ -84,7 +84,7 @@ public function testUserListing() {
$this->assertFalse(array_diff(array_keys($result_accounts), array_keys($accounts)), 'Ensure all accounts are listed.');
foreach ($result_accounts as $name => $values) {
- $this->assertEqual($values['status'] == t('active'), $accounts[$name]->status->value, 'Ensure the status is displayed properly.');
+ $this->assertEqual($values['status'] === t('active'), $accounts[$name]->status->value, 'Ensure the status is displayed properly.');
}
$expected_roles = array('custom_role_1', 'custom_role_2');
diff --git a/core/modules/user/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php
index 714f8fb..be91a00 100644
--- a/core/modules/user/src/Tests/UserCancelTest.php
+++ b/core/modules/user/src/Tests/UserCancelTest.php
@@ -59,7 +59,7 @@ function testUserCancelWithoutPermission() {
// Confirm user's content has not been altered.
$test_node = node_load($node->id(), TRUE);
- $this->assertTrue(($test_node->getOwnerId() == $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.');
+ $this->assertTrue(($test_node->getOwnerId() === $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.');
}
/**
@@ -140,7 +140,7 @@ function testUserCancelInvalid() {
// Confirm user's content has not been altered.
$test_node = node_load($node->id(), TRUE);
- $this->assertTrue(($test_node->getOwnerId() == $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.');
+ $this->assertTrue(($test_node->getOwnerId() === $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.');
}
/**
@@ -284,11 +284,11 @@ function testUserAnonymize() {
// Confirm that user's content has been attributed to anonymous user.
$test_node = node_load($node->id(), TRUE);
- $this->assertTrue(($test_node->getOwnerId() == 0 && $test_node->isPublished()), 'Node of the user has been attributed to anonymous user.');
+ $this->assertTrue(($test_node->getOwnerId() === 0 && $test_node->isPublished()), 'Node of the user has been attributed to anonymous user.');
$test_node = node_revision_load($revision, TRUE);
- $this->assertTrue(($test_node->getRevisionAuthor()->id() == 0 && $test_node->isPublished()), 'Node revision of the user has been attributed to anonymous user.');
+ $this->assertTrue(($test_node->getRevisionAuthor()->id() === 0 && $test_node->isPublished()), 'Node revision of the user has been attributed to anonymous user.');
$test_node = node_load($revision_node->id(), TRUE);
- $this->assertTrue(($test_node->getOwnerId() != 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user.");
+ $this->assertTrue(($test_node->getOwnerId() !== 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user.");
// Confirm that the confirmation message made it through to the end user.
$this->assertRaw(t('%name has been deleted.', array('%name' => $account->getUsername())), "Confirmation message displayed to user.");
diff --git a/core/modules/user/src/Tests/UserDeleteTest.php b/core/modules/user/src/Tests/UserDeleteTest.php
index 747039e..1a639b3 100644
--- a/core/modules/user/src/Tests/UserDeleteTest.php
+++ b/core/modules/user/src/Tests/UserDeleteTest.php
@@ -49,7 +49,7 @@ function testUserDeleteMultiple() {
->countQuery()
->execute()
->fetchField();
- $this->assertTrue($roles_after_deletion == 0, 'Role assigments deleted along with users');
+ $this->assertTrue($roles_after_deletion === 0, 'Role assigments deleted along with users');
// Test if the users are deleted, user_load() will return FALSE.
$this->assertFalse(user_load($user_a->id()), format_string('User with id @uid deleted.', array('@uid' => $user_a->id())));
$this->assertFalse(user_load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
diff --git a/core/modules/user/src/Tests/UserLoginTest.php b/core/modules/user/src/Tests/UserLoginTest.php
index 15fd7ce..682a53b 100644
--- a/core/modules/user/src/Tests/UserLoginTest.php
+++ b/core/modules/user/src/Tests/UserLoginTest.php
@@ -155,7 +155,7 @@ function assertFailedLogin($account, $flood_trigger = NULL) {
$this->drupalPostForm('user', $edit, t('Log in'));
$this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.');
if (isset($flood_trigger)) {
- if ($flood_trigger == 'user') {
+ if ($flood_trigger === 'user') {
$this->assertRaw(format_plural(\Drupal::config('user.flood')->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or request a new password.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or request a new password.', array('@url' => url('user/password'))));
}
else {
diff --git a/core/modules/user/src/Tests/UserRegistrationTest.php b/core/modules/user/src/Tests/UserRegistrationTest.php
index cc025c8..53f1969 100644
--- a/core/modules/user/src/Tests/UserRegistrationTest.php
+++ b/core/modules/user/src/Tests/UserRegistrationTest.php
@@ -180,7 +180,7 @@ function testRegistrationDefaultValues() {
$this->assertEqual($new_user->getEmail(), $mail, 'Email address matches.');
$this->assertEqual($new_user->getSignature(), '', 'Correct signature field.');
$this->assertTrue(($new_user->getCreatedTime() > REQUEST_TIME - 20 ), 'Correct creation time.');
- $this->assertEqual($new_user->isActive(), $config_user_settings->get('register') == USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.');
+ $this->assertEqual($new_user->isActive(), $config_user_settings->get('register') === USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.');
$this->assertEqual($new_user->getTimezone(), $config_system_date->get('timezone.default'), 'Correct time zone field.');
$this->assertEqual($new_user->langcode->value, \Drupal::languageManager()->getDefaultLanguage()->id, 'Correct language field.');
$this->assertEqual($new_user->preferred_langcode->value, \Drupal::languageManager()->getDefaultLanguage()->id, 'Correct preferred language field.');
@@ -255,7 +255,7 @@ function testRegistrationWithUserFields() {
$value = rand(1, 255);
$edit = array();
$edit['test_user_field[0][value]'] = $value;
- if ($js == 'js') {
+ if ($js === 'js') {
$this->drupalPostAjaxForm(NULL, $edit, 'test_user_field_add_more');
$this->drupalPostAjaxForm(NULL, $edit, 'test_user_field_add_more');
}
diff --git a/core/modules/user/src/UserAccessControlHandler.php b/core/modules/user/src/UserAccessControlHandler.php
index aab5f3b..912625f 100644
--- a/core/modules/user/src/UserAccessControlHandler.php
+++ b/core/modules/user/src/UserAccessControlHandler.php
@@ -42,18 +42,18 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
return AccessResult::allowed()->cachePerRole()->cacheUntilEntityChanges($entity);
}
// Users can view own profiles at all times.
- else if ($account->id() == $entity->id()) {
+ else if ($account->id() === $entity->id()) {
return AccessResult::allowed()->cachePerUser();
}
break;
case 'update':
// Users can always edit their own account.
- return AccessResult::allowedIf($account->id() == $entity->id())->cachePerUser();
+ return AccessResult::allowedIf($account->id() === $entity->id())->cachePerUser();
case 'delete':
// Users with 'cancel account' permission can cancel their own account.
- return AccessResult::allowedIf($account->id() == $entity->id() && $account->hasPermission('cancel account'))->cachePerRole()->cachePerUser();
+ return AccessResult::allowedIf($account->id() === $entity->id() && $account->hasPermission('cancel account'))->cachePerRole()->cachePerUser();
}
// No opinion.
diff --git a/core/modules/user/src/UserStorage.php b/core/modules/user/src/UserStorage.php
index 9aa844e..4b50a2d 100644
--- a/core/modules/user/src/UserStorage.php
+++ b/core/modules/user/src/UserStorage.php
@@ -102,7 +102,7 @@ public function save(EntityInterface $entity) {
*/
protected function isColumnSerial($table_name, $schema_name) {
// User storage does not use a serial column for the user id.
- return $table_name == $this->revisionTable && $schema_name == $this->revisionKey;
+ return $table_name === $this->revisionTable && $schema_name === $this->revisionKey;
}
/**
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index eb3d5ae..3a5a21e 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -384,7 +384,7 @@ function user_password($length = 10) {
* for the given role.
*/
function user_role_permissions(array $roles) {
- if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
+ if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'update') {
return _user_role_permissions_update($roles);
}
$entities = entity_load_multiple('user_role', $roles);
@@ -504,7 +504,7 @@ function user_validate_current_pass(&$form, FormStateInterface $form_state) {
// form values like password_confirm that have their own validation
// that prevent them from being empty if they are changed.
$current_value = $account->hasField($key) ? $account->get($key)->value : $account->$key;
- if ((strlen(trim($form_state->getValue($key))) > 0) && ($form_state->getValue($key) != $current_value)) {
+ if ((strlen(trim($form_state->getValue($key))) > 0) && ($form_state->getValue($key) !== $current_value)) {
$current_pass_failed = $form_state->isValueEmpty('current_pass') || !\Drupal::service('password')->check($form_state->getValue('current_pass'), $account);
if ($current_pass_failed) {
$form_state->setErrorByName('current_pass', t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => $name)));
@@ -520,7 +520,7 @@ function user_validate_current_pass(&$form, FormStateInterface $form_state) {
* Implements hook_preprocess_HOOK() for block templates.
*/
function user_preprocess_block(&$variables) {
- if ($variables['configuration']['provider'] == 'user') {
+ if ($variables['configuration']['provider'] === 'user') {
switch ($variables['elements']['#plugin_id']) {
case 'user_login_block':
$variables['attributes']['role'] = 'form';
@@ -637,7 +637,7 @@ function template_preprocess_username(&$variables) {
function user_menu_breadcrumb_alter(&$active_trail, $item) {
// Remove "My account" from the breadcrumb when $item is descendant-or-self
// of system path user/%.
- if (isset($active_trail[1]['module']) && $active_trail[1]['machine_name'] == 'user.page' && strpos($item['path'], 'user/%') === 0) {
+ if (isset($active_trail[1]['module']) && $active_trail[1]['machine_name'] === 'user.page' && strpos($item['path'], 'user/%') === 0) {
array_splice($active_trail, 1, 1);
}
}
@@ -807,7 +807,7 @@ function user_cancel($edit, $uid, $method) {
// which invokes hook_ENTITY_TYPE_predelete() and hook_ENTITY_TYPE_delete()
// for the user entity. Modules should use those hooks to respond to the
// account deletion.
- if ($method != 'user_cancel_delete') {
+ if ($method !== 'user_cancel_delete') {
// Allow modules to add further sets to this batch.
\Drupal::moduleHandler()->invokeAll('user_cancel', array($edit, $account, $method));
}
@@ -821,7 +821,7 @@ function user_cancel($edit, $uid, $method) {
);
// After cancelling account, ensure that user is logged out.
- if ($account->id() == \Drupal::currentUser()->id()) {
+ if ($account->id() === \Drupal::currentUser()->id()) {
// Batch API stores data in the session, so use the finished operation to
// manipulate the current user's session id.
$batch['finished'] = '_user_cancel_session_regenerate';
@@ -875,7 +875,7 @@ function _user_cancel($edit, $account, $method) {
// their session though, as we might have information in it, and we can't
// regenerate it because batch API uses the session ID, we will regenerate it
// in _user_cancel_session_regenerate().
- if ($account->id() == $user->id()) {
+ if ($account->id() === $user->id()) {
$user = new AnonymousUserSession();
}
}
@@ -1335,7 +1335,7 @@ function user_role_revoke_permissions($rid, array $permissions = array()) {
function _user_mail_notify($op, $account, $langcode = NULL) {
// By default, we always notify except for canceled and blocked.
$notify = \Drupal::config('user.settings')->get('notify.' . $op);
- if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) {
+ if ($notify || ($op !== 'status_canceled' && $op !== 'status_blocked')) {
$params['account'] = $account;
$langcode = $langcode ? $langcode : $account->getPreferredLangcode();
// Get the custom site notification email to use as the from email address
@@ -1350,7 +1350,7 @@ function _user_mail_notify($op, $account, $langcode = NULL) {
$site_mail = ini_get('sendmail_from');
}
$mail = drupal_mail('user', $op, $account->getEmail(), $langcode, $params, $site_mail);
- if ($op == 'register_pending_approval') {
+ if ($op === 'register_pending_approval') {
// If a user registered requiring admin approval, notify the admin, too.
// We use the site default language for this.
drupal_mail('user', 'register_pending_approval_admin', $site_mail, \Drupal::languageManager()->getDefaultLanguage()->id, $params);
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index b548e3b..8d9c6df 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -49,7 +49,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
$account_data = \Drupal::service('user.data')->get('user', $account->id());
if (isset($account_data['cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) {
// Validate expiration and hashed password/login.
- if ($timestamp <= $current && $current - $timestamp < $timeout && $account->id() && $timestamp >= $account->getLastLoginTime() && $hashed_pass == user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime())) {
+ if ($timestamp <= $current && $current - $timestamp < $timeout && $account->id() && $timestamp >= $account->getLastLoginTime() && $hashed_pass === user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime())) {
$edit = array(
'user_cancel_notify' => isset($account_data['cancel_notify']) ? $account_data['cancel_notify'] : \Drupal::config('user.settings')->get('notify.status_canceled'),
);
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index 51579be..61cf9ff 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -78,7 +78,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
$replacements = array();
- if ($type == 'user' && !empty($data['user'])) {
+ if ($type === 'user' && !empty($data['user'])) {
$account = $data['user'];
foreach ($tokens as $name => $original) {
switch ($name) {
@@ -126,7 +126,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
}
}
- if ($type == 'current-user') {
+ if ($type === 'current-user') {
$account = user_load(\Drupal::currentUser()->id());
$replacements += $token_service->generate('user', $tokens, array('user' => $account), $options);
}
diff --git a/core/modules/views/src/Controller/ViewAjaxController.php b/core/modules/views/src/Controller/ViewAjaxController.php
index 840d1f2..3872d91 100644
--- a/core/modules/views/src/Controller/ViewAjaxController.php
+++ b/core/modules/views/src/Controller/ViewAjaxController.php
@@ -116,7 +116,7 @@ public function ajaxView(Request $request) {
// @see drupal_get_destination()
$origin_destination = $path;
$query = UrlHelper::buildQuery($request->query->all());
- if ($query != '') {
+ if ($query !== '') {
$origin_destination .= '?' . $query;
}
$destination = &drupal_static('drupal_get_destination');
diff --git a/core/modules/views/src/DisplayBag.php b/core/modules/views/src/DisplayBag.php
index a724745..415584d 100644
--- a/core/modules/views/src/DisplayBag.php
+++ b/core/modules/views/src/DisplayBag.php
@@ -96,7 +96,7 @@ protected function initializePlugin($display_id) {
$this->pluginInstances[$display_id]->initDisplay($this->view, $display);
// If this is not the default display handler, let it know which is since
// it may well utilize some data from the default.
- if ($display_id != 'default') {
+ if ($display_id !== 'default') {
$this->pluginInstances[$display_id]->default_display = $this->pluginInstances['default'];
}
}
diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php
index 1ad685a..5ef0eef 100644
--- a/core/modules/views/src/Entity/View.php
+++ b/core/modules/views/src/Entity/View.php
@@ -217,7 +217,7 @@ public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL) {
protected function generateDisplayId($plugin_id) {
// 'default' is singular and is unique, so just go with 'default'
// for it. For all others, start counting.
- if ($plugin_id == 'default') {
+ if ($plugin_id === 'default') {
return 'default';
}
// Initial ID.
@@ -254,7 +254,7 @@ public function calculateDependencies() {
// @todo Entity base tables are no longer registered in hook_schema(). Once
// we automate the views data for entity types add the entity type
// type provider as a dependency. See https://drupal.org/node/1740492.
- if ($schema && $this->module != $schema['module']) {
+ if ($schema && $this->module !== $schema['module']) {
$this->addDependency('module', $schema['module']);
}
@@ -375,7 +375,7 @@ public function mergeDefaultDisplaysOptions() {
}
// Sort the displays.
uasort($displays, function ($display1, $display2) {
- if ($display1['position'] != $display2['position']) {
+ if ($display1['position'] !== $display2['position']) {
return $display1['position'] < $display2['position'] ? -1 : 1;
}
return 0;
diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php
index b2859d0..cd65ab5 100644
--- a/core/modules/views/src/EntityViewsData.php
+++ b/core/modules/views/src/EntityViewsData.php
@@ -374,11 +374,11 @@ protected function mapSingleFieldViewsData($table, $data_type, $schema_field_nam
*/
protected function processViewsDataForLanguage($table, FieldDefinitionInterface $field_definition, array &$views_field) {
// Apply special titles for the langcode field.
- if ($field_definition->getName() == 'langcode') {
- if ($table == $this->entityType->getDataTable() || $table == $this->entityType->getBaseTable()) {
+ if ($field_definition->getName() === 'langcode') {
+ if ($table === $this->entityType->getDataTable() || $table === $this->entityType->getBaseTable()) {
$views_field['title'] = $this->t('Translation language');
}
- if ($table == $this->entityType->getRevisionDataTable() || $table == $this->entityType->getRevisionTable()) {
+ if ($table === $this->entityType->getRevisionDataTable() || $table === $this->entityType->getRevisionTable()) {
$views_field['title'] = $this->t('Original language');
}
}
@@ -418,7 +418,7 @@ protected function processViewsDataForEntityReference($table, FieldDefinitionInt
}
}
- if ($field_definition->getName() == $this->entityType->getKey('bundle')) {
+ if ($field_definition->getName() === $this->entityType->getKey('bundle')) {
// @todo Use the other bundle handlers, once
// https://www.drupal.org/node/2322949 is in.
$views_field['filter']['id'] = 'bundle';
diff --git a/core/modules/views/src/Form/ViewsForm.php b/core/modules/views/src/Form/ViewsForm.php
index c1296b2..71f5075 100644
--- a/core/modules/views/src/Form/ViewsForm.php
+++ b/core/modules/views/src/Form/ViewsForm.php
@@ -137,7 +137,7 @@ public function buildForm(array $form, FormStateInterface $form_state, ViewExecu
// Tell the preprocessor whether it should hide the header, footer, pager...
$form['show_view_elements'] = array(
'#type' => 'value',
- '#value' => ($step == 'views_form_views_form') ? TRUE : FALSE,
+ '#value' => ($step === 'views_form_views_form') ? TRUE : FALSE,
);
$form_object = $this->getFormObject($form_state);
diff --git a/core/modules/views/src/ManyToOneHelper.php b/core/modules/views/src/ManyToOneHelper.php
index 12bfc35..ad1232a 100644
--- a/core/modules/views/src/ManyToOneHelper.php
+++ b/core/modules/views/src/ManyToOneHelper.php
@@ -89,11 +89,11 @@ public function addTable($join = NULL, $alias = NULL) {
// Cycle through the joins. This isn't as error-safe as the normal
// ensurePath logic. Perhaps it should be.
$r_join = clone $join;
- while ($r_join->leftTable != $base_table) {
+ while ($r_join->leftTable !== $base_table) {
$r_join = HandlerBase::getTableJoin($r_join->leftTable, $base_table);
}
// If we found that there are tables in between, add the relationship.
- if ($r_join->table != $join->table) {
+ if ($r_join->table !== $join->table) {
$relationship = $this->handler->query->addRelationship($this->handler->table . '_' . $r_join->table, $r_join, $r_join->table, $this->handler->relationship);
}
@@ -162,7 +162,7 @@ public function ensureMyTable() {
// Case 1: Operator is an 'or' and we're not reducing duplicates.
// We hence get the absolute simplest:
$field = $this->handler->relationship . '_' . $this->handler->table . '.' . $this->handler->field;
- if ($this->handler->operator == 'or' && empty($this->handler->options['reduce_duplicates'])) {
+ if ($this->handler->operator === 'or' && empty($this->handler->options['reduce_duplicates'])) {
if (empty($this->handler->options['add_table']) && empty($this->handler->view->many_to_one_tables[$field])) {
// query optimization, INNER joins are slightly faster, so use them
// when we know we can.
@@ -197,12 +197,12 @@ public function ensureMyTable() {
// Case 2: it's an 'and' or an 'or'.
// We do one join per selected value.
- if ($this->handler->operator != 'not') {
+ if ($this->handler->operator !== 'not') {
// Clone the join for each table:
$this->handler->tableAliases = array();
foreach ($this->handler->value as $value) {
$join = $this->getJoin();
- if ($this->handler->operator == 'and') {
+ if ($this->handler->operator === 'and') {
$join->type = 'INNER';
}
$join->extra = array(
@@ -277,12 +277,12 @@ public function addFilter() {
// add_condition determines whether a single expression is enough(FALSE) or the
// conditions should be added via an db_or()/db_and() (TRUE).
$add_condition = TRUE;
- if ($operator == 'not') {
+ if ($operator === 'not') {
$value = NULL;
$operator = 'IS NULL';
$add_condition = FALSE;
}
- elseif ($operator == 'or' && empty($options['reduce_duplicates'])) {
+ elseif ($operator === 'or' && empty($options['reduce_duplicates'])) {
if (count($value) > 1) {
$operator = 'IN';
}
@@ -296,7 +296,7 @@ public function addFilter() {
if (!$add_condition) {
if ($formula) {
$placeholder = $this->placeholder();
- if ($operator == 'IN') {
+ if ($operator === 'IN') {
$operator = "$operator IN($placeholder)";
}
else {
@@ -320,7 +320,7 @@ public function addFilter() {
if ($add_condition) {
$field = $this->handler->realField;
- $clause = $operator == 'or' ? db_or() : db_and();
+ $clause = $operator === 'or' ? db_or() : db_and();
foreach ($this->handler->tableAliases as $value => $alias) {
$clause->condition("$alias.$field", $value);
}
diff --git a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php
index cec9895..9cc31b3 100644
--- a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php
+++ b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php
@@ -92,7 +92,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
$desc = $display->getOption('block_description');
if (empty($desc)) {
- if ($display->display['display_title'] == $display->definition['title']) {
+ if ($display->display['display_title'] === $display->definition['title']) {
$desc = t('!view', array('!view' => $view->label()));
}
else {
diff --git a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php
index ef531b4..adcdc76 100644
--- a/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php
+++ b/core/modules/views/src/Plugin/Derivative/ViewsLocalTask.php
@@ -75,7 +75,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
// Don't add a local task for views which override existing routes.
// @todo Alternative it could just change the existing entry.
- if ($route_name != $plugin_id) {
+ if ($route_name !== $plugin_id) {
continue;
}
@@ -86,7 +86,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
) + $base_plugin_definition;
// Default local tasks have themselves as root tab.
- if ($menu['type'] == 'default tab') {
+ if ($menu['type'] === 'default tab') {
$this->derivatives[$plugin_id]['base_route'] = $route_name;
}
}
@@ -113,7 +113,7 @@ public function alterLocalTasks(&$local_tasks) {
$view_route_name = $view_route_names[$executable->storage->id() . '.' . $display_id];
// Don't add a local task for views which override existing routes.
- if ($view_route_name != $plugin_id) {
+ if ($view_route_name !== $plugin_id) {
unset($local_tasks[$plugin_id]);
continue;
}
diff --git a/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php b/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php
index a07862f..3ac4495 100644
--- a/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php
+++ b/core/modules/views/src/Plugin/Menu/ViewsMenuLink.php
@@ -140,7 +140,7 @@ public function updateLink(array $new_definition_values, $persist) {
// Just save the title to the original view.
$changed = FALSE;
foreach ($new_definition_values as $key => $new_definition_value) {
- if (isset($display['display_options']['menu'][$key]) && $display['display_options']['menu'][$key] != $new_definition_values[$key]) {
+ if (isset($display['display_options']['menu'][$key]) && $display['display_options']['menu'][$key] !== $new_definition_values[$key]) {
$display['display_options']['menu'][$key] = $new_definition_values[$key];
$changed = TRUE;
}
diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php
index e7e1c89..fc1fbaa 100644
--- a/core/modules/views/src/Plugin/ViewsHandlerManager.php
+++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php
@@ -53,7 +53,7 @@ class ViewsHandlerManager extends DefaultPluginManager {
public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($handler_type);
$plugin_interface = 'Drupal\views\Plugin\views\ViewsHandlerInterface';
- if ($handler_type == 'join') {
+ if ($handler_type === 'join') {
$plugin_interface = 'Drupal\views\Plugin\views\join\JoinPluginInterface';
}
parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name);
diff --git a/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php b/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php
index 2152393..e43eae6 100644
--- a/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php
+++ b/core/modules/views/src/Plugin/entity_reference/selection/ViewsSelection.php
@@ -68,7 +68,7 @@ public static function settingsForm(FieldDefinitionInterface $field_definition)
$options = array();
foreach ($displays as $data) {
list($view, $display_id) = $data;
- if ($view->storage->get('base_table') == $entity_type->getBaseTable()) {
+ if ($view->storage->get('base_table') === $entity_type->getBaseTable()) {
$name = $view->storage->get('id');
$display = $view->storage->get('display');
$options[$name . ':' . $display_id] = $name . ' - ' . $display[$display_id]['display_title'];
diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php
index 964ce9c..884a779 100644
--- a/core/modules/views/src/Plugin/views/HandlerBase.php
+++ b/core/modules/views/src/Plugin/views/HandlerBase.php
@@ -518,7 +518,7 @@ public function setRelationship() {
$this->relationship = NULL;
// Don't process non-existant relationships.
- if (empty($this->options['relationship']) || $this->options['relationship'] == 'none') {
+ if (empty($this->options['relationship']) || $this->options['relationship'] === 'none') {
return;
}
@@ -702,7 +702,7 @@ public static function getTableJoin($table, $base_table) {
public function getEntityType() {
// If the user has configured a relationship on the handler take that into
// account.
- if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') {
+ if (!empty($this->options['relationship']) && $this->options['relationship'] !== 'none') {
$views_data = $this->getViewsData()->get($this->view->relationship->table);
}
else {
@@ -738,7 +738,7 @@ public static function breakString($str, $force_int = FALSE) {
// Filter any empty matches (Like from '++' in a string) and reset the
// array keys. 'strlen' is used as the filter callback so we do not lose
- // 0 values (would otherwise evaluate == FALSE).
+ // 0 values (would otherwise evaluate === FALSE).
$value = array_values(array_filter($value, 'strlen'));
if ($force_int) {
diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php
index a92027d..78ba0a6 100644
--- a/core/modules/views/src/Plugin/views/PluginBase.php
+++ b/core/modules/views/src/Plugin/views/PluginBase.php
@@ -407,7 +407,7 @@ protected function listLanguages($flags = LanguageInterface::STATE_ALL) {
// languages below.
$languages = $manager->getLanguages($flags);
foreach ($languages as $id => $language) {
- if ($id == 'site_default') {
+ if ($id === 'site_default') {
$id = '***LANGUAGE_' . $id . '***';
}
$list[$id] = t($language->name);
diff --git a/core/modules/views/src/Plugin/views/area/AreaPluginBase.php b/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
index 1269638..5206668 100644
--- a/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
+++ b/core/modules/views/src/Plugin/views/area/AreaPluginBase.php
@@ -46,7 +46,7 @@
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
- if ($this->areaType == 'empty') {
+ if ($this->areaType === 'empty') {
$this->options['empty'] = TRUE;
}
}
@@ -85,7 +85,7 @@ public function adminSummary() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
- if ($form_state->get('type') != 'empty') {
+ if ($form_state->get('type') !== 'empty') {
$form['empty'] = array(
'#type' => 'checkbox',
'#title' => t('Display even if view has no result'),
diff --git a/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php b/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php
index 9cf0988..01ce2b7 100644
--- a/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php
+++ b/core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php
@@ -81,7 +81,7 @@ public function tokenForm(&$form, FormStateInterface $form_state) {
if (!empty($options[$type])) {
$items = array();
foreach ($options[$type] as $key => $value) {
- $items[] = $key . ' == ' . $value;
+ $items[] = $key . ' === ' . $value;
}
$form['tokens']['tokens'] = array(
'#theme' => 'item_list',
diff --git a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
index da87ade..6e3a803 100644
--- a/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
+++ b/core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
@@ -291,7 +291,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
continue;
}
foreach ((array) $info['type'] as $type) {
- if ($type == $this->definition['validate type']) {
+ if ($type === $this->definition['validate type']) {
$valid = TRUE;
break;
}
@@ -302,7 +302,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if ($valid) {
$plugin = $this->getPlugin('argument_validator', $id);
if ($plugin) {
- if ($plugin->access() || $this->options['validate']['type'] == $id) {
+ if ($plugin->access() || $this->options['validate']['type'] === $id) {
// Sanitize ID for js.
$sanitized_id = static::encodeValidatorId($id);
$form['validate']['options'][$sanitized_id] = array(
@@ -509,7 +509,7 @@ public function defaultArgumentForm(&$form, FormStateInterface $form_state) {
}
$plugin = $this->getPlugin('argument_default', $id);
if ($plugin) {
- if ($plugin->access() || $this->options['default_argument_type'] == $id) {
+ if ($plugin->access() || $this->options['default_argument_type'] === $id) {
$form['argument_default']['#argument_option'] = 'default';
$form['argument_default'][$id] = array(
'#prefix' => '',
@@ -733,7 +733,7 @@ public function getDefaultArgument() {
* the URL.
*/
public function processSummaryArguments(&$args) {
- if ($this->options['validate']['type'] != 'none') {
+ if ($this->options['validate']['type'] !== 'none') {
if (isset($this->validator) || $this->validator = $this->getPlugin('argument_validator')) {
$this->validator->processSummaryArguments($args);
}
@@ -801,7 +801,7 @@ protected function summaryNameField() {
if (isset($this->name_table)) {
// if the alias is different then we're probably added, not ensured,
// so look up the join and add it instead.
- if ($this->tableAlias != $this->name_table) {
+ if ($this->tableAlias !== $this->name_table) {
$j = HandlerBase::getTableJoin($this->name_table, $this->table);
if ($j) {
$join = clone $j;
@@ -980,7 +980,7 @@ public function getValue() {
// Find the position of this argument within the view.
$position = 0;
foreach ($this->view->argument as $id => $argument) {
- if ($id == $this->options['id']) {
+ if ($id === $this->options['id']) {
break;
}
$position++;
@@ -1031,7 +1031,7 @@ public function getPlugin($type = 'argument_default', $name = NULL) {
// we only fetch the options if we're fetching the plugin actually
// in use.
- if ($name == $plugin_name) {
+ if ($name === $plugin_name) {
$options = $this->options[$options_name];
}
diff --git a/core/modules/views/src/Plugin/views/argument/Date.php b/core/modules/views/src/Plugin/views/argument/Date.php
index 3a3db7f..9a98e8b 100644
--- a/core/modules/views/src/Plugin/views/argument/Date.php
+++ b/core/modules/views/src/Plugin/views/argument/Date.php
@@ -62,7 +62,7 @@ public function defaultArgumentForm(&$form, FormStateInterface $form_state) {
* formatted appropriately for this argument.
*/
public function getDefaultArgument($raw = FALSE) {
- if (!$raw && $this->options['default_argument_type'] == 'date') {
+ if (!$raw && $this->options['default_argument_type'] === 'date') {
return date($this->argFormat, REQUEST_TIME);
}
elseif (!$raw && in_array($this->options['default_argument_type'], array('node_created', 'node_changed'))) {
@@ -71,10 +71,10 @@ public function getDefaultArgument($raw = FALSE) {
if (!($node instanceof NodeInterface)) {
return parent::getDefaultArgument();
}
- elseif ($this->options['default_argument_type'] == 'node_created') {
+ elseif ($this->options['default_argument_type'] === 'node_created') {
return date($this->argFormat, $node->getCreatedTime());
}
- elseif ($this->options['default_argument_type'] == 'node_changed') {
+ elseif ($this->options['default_argument_type'] === 'node_changed') {
return date($this->argFormat, $node->getChangedTime());
}
}
diff --git a/core/modules/views/src/Plugin/views/argument/ManyToOne.php b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
index 669c944..5736fde 100644
--- a/core/modules/views/src/Plugin/views/argument/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/argument/ManyToOne.php
@@ -155,7 +155,7 @@ function title() {
return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
}
- return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
+ return implode($this->operator === 'or' ? ' + ' : ', ', $this->titleQuery());
}
protected function summaryQuery() {
diff --git a/core/modules/views/src/Plugin/views/argument/Numeric.php b/core/modules/views/src/Plugin/views/argument/Numeric.php
index 3051790..b59a7bc 100644
--- a/core/modules/views/src/Plugin/views/argument/Numeric.php
+++ b/core/modules/views/src/Plugin/views/argument/Numeric.php
@@ -84,7 +84,7 @@ function title() {
return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
}
- return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
+ return implode($this->operator === 'or' ? ' + ' : ', ', $this->titleQuery());
}
/**
diff --git a/core/modules/views/src/Plugin/views/argument/String.php b/core/modules/views/src/Plugin/views/argument/String.php
index a900d0d..f7a230f 100644
--- a/core/modules/views/src/Plugin/views/argument/String.php
+++ b/core/modules/views/src/Plugin/views/argument/String.php
@@ -225,7 +225,7 @@ public function query($group_by = FALSE) {
if ($formula) {
$placeholder = $this->placeholder();
- if ($operator == 'IN') {
+ if ($operator === 'IN') {
$field .= " IN($placeholder)";
}
else {
@@ -278,7 +278,7 @@ function title() {
return !empty($this->definition['invalid input']) ? $this->definition['invalid input'] : t('Invalid input');
}
- return implode($this->operator == 'or' ? ' + ' : ', ', $this->titleQuery());
+ return implode($this->operator === 'or' ? ' + ' : ', ', $this->titleQuery());
}
/**
diff --git a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php
index 82bf1fa..846e3ed 100644
--- a/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php
+++ b/core/modules/views/src/Plugin/views/argument_default/QueryParameter.php
@@ -71,7 +71,7 @@ public function getArgument() {
if ($current_request->query->has($this->options['query_param'])) {
$param = $current_request->query->get($this->options['query_param']);
if (is_array($param)) {
- $conjunction = ($this->options['multiple'] == 'and') ? ',' : '+';
+ $conjunction = ($this->options['multiple'] === 'and') ? ',' : '+';
$param = implode($conjunction, $param);
}
diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
index d747283..ed98132 100644
--- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
@@ -305,7 +305,7 @@ public function generateResultsKey() {
$key_data = array(
'build_info' => $build_info,
'roles' => $user->getRoles(),
- 'super-user' => $user->id() == 1, // special caching for super user.
+ 'super-user' => $user->id() === 1, // special caching for super user.
'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id,
'base_url' => $GLOBALS['base_url'],
);
@@ -333,7 +333,7 @@ public function generateOutputKey() {
$key_data = array(
'result' => $this->view->result,
'roles' => $user->getRoles(),
- 'super-user' => $user->id() == 1, // special caching for super user.
+ 'super-user' => $user->id() === 1, // special caching for super user.
'theme' => \Drupal::theme()->getActiveTheme()->getName(),
'langcode' => \Drupal::languageManager()->getCurrentLanguage()->id,
'base_url' => $GLOBALS['base_url'],
diff --git a/core/modules/views/src/Plugin/views/cache/Time.php b/core/modules/views/src/Plugin/views/cache/Time.php
index 037219c..ce42280 100644
--- a/core/modules/views/src/Plugin/views/cache/Time.php
+++ b/core/modules/views/src/Plugin/views/cache/Time.php
@@ -128,7 +128,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$custom_fields = array('output_lifespan', 'results_lifespan');
foreach ($custom_fields as $field) {
$cache_options = $form_state->getValue('cache_options');
- if ($cache_options[$field] == 'custom' && !is_numeric($cache_options[$field . '_custom'])) {
+ if ($cache_options[$field] === 'custom' && !is_numeric($cache_options[$field . '_custom'])) {
$form_state->setError($form[$field .'_custom'], t('Custom time values must be numeric.'));
}
}
@@ -141,7 +141,7 @@ public function summaryTitle() {
}
protected function getLifespan($type) {
- $lifespan = $this->options[$type . '_lifespan'] == 'custom' ? $this->options[$type . '_lifespan_custom'] : $this->options[$type . '_lifespan'];
+ $lifespan = $this->options[$type . '_lifespan'] === 'custom' ? $this->options[$type . '_lifespan_custom'] : $this->options[$type . '_lifespan'];
return $lifespan;
}
diff --git a/core/modules/views/src/Plugin/views/display/Attachment.php b/core/modules/views/src/Plugin/views/display/Attachment.php
index 21577cc..57fdbd1 100644
--- a/core/modules/views/src/Plugin/views/display/Attachment.php
+++ b/core/modules/views/src/Plugin/views/display/Attachment.php
@@ -89,7 +89,7 @@ public function optionsSummary(&$categories, &$options) {
if (count($displays) > 1) {
$attach_to = t('Multiple displays');
}
- elseif (count($displays) == 1) {
+ elseif (count($displays) === 1) {
$display = array_shift($displays);
if ($display = $this->view->storage->getDisplay($display)) {
$attach_to = String::checkPlain($display['display_title']);
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index 22e8d16..33d62ce 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -384,7 +384,7 @@ public function useMoreText() {
public function acceptAttachments() {
// To be able to accept attachments this display have to be able to use
// attachments but at the same time, you cannot attach a display to itself.
- if (!$this->usesAttachments() || ($this->definition['id'] == $this->view->current_display)) {
+ if (!$this->usesAttachments() || ($this->definition['id'] === $this->view->current_display)) {
return FALSE;
}
@@ -857,7 +857,7 @@ public function getPlugin($type) {
}
// Query plugins allow specifying a specific query class per base table.
- if ($type == 'query') {
+ if ($type === 'query') {
$views_data = Views::viewsData()->get($this->view->storage->get('base_table'));
$name = isset($views_data['table']['base']['query_id']) ? $views_data['table']['base']['query_id'] : 'views_query';
}
@@ -914,7 +914,7 @@ public function getHandlers($type) {
$info = $this->view->temporary_options[$type][$id];
}
- if ($info['id'] != $id) {
+ if ($info['id'] !== $id) {
$info['id'] = $id;
}
@@ -1114,7 +1114,7 @@ public function optionsSummary(&$categories, &$options) {
),
);
- if ($this->display['id'] != 'default') {
+ if ($this->display['id'] !== 'default') {
$options['display_id'] = array(
'category' => 'other',
'title' => t('Machine Name'),
@@ -1310,7 +1310,7 @@ public function optionsSummary(&$categories, &$options) {
$link_display_option = $this->getOption('link_display');
$link_display = $this->t('None');
- if ($link_display_option == 'custom_url') {
+ if ($link_display_option === 'custom_url') {
$link_display = $this->t('Custom URL');
}
elseif (!empty($link_display_option)) {
@@ -1748,7 +1748,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if (!empty($options[$type])) {
$items = array();
foreach ($options[$type] as $key => $value) {
- $items[] = $key . ' == ' . $value;
+ $items[] = $key . ' === ' . $value;
}
$item_list = array(
'#theme' => 'item_list',
@@ -1887,7 +1887,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
}
foreach ($this->view->displayHandlers as $id => $display) {
- if ($id != $this->view->current_display && ($form_state->getValue('display_id') == $id || (isset($display->new_id) && $form_state->getValue('display_id') == $display->new_id))) {
+ if ($id !== $this->view->current_display && ($form_state->getValue('display_id') === $id || (isset($display->new_id) && $form_state->getValue('display_id') === $display->new_id))) {
$form_state->setError($form['display_id'], t('Display id should be unique.'));
}
}
@@ -1979,7 +1979,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
$plugin_type = $section;
$plugin_options = $this->getOption($plugin_type);
$type = $form_state->getValue(array($plugin_type, 'type'));
- if ($plugin_options['type'] != $type) {
+ if ($plugin_options['type'] !== $type) {
$plugin = Views::pluginManager($plugin_type)->createInstance($type);
if ($plugin) {
$plugin->init($this->view, $this, $plugin_options['options']);
@@ -2093,7 +2093,7 @@ public function renderMoreLink() {
if ($this->isMoreEnabled() && ($this->useMoreAlways() || (!empty($this->view->pager) && $this->view->pager->hasMoreRecords()))) {
$path = $this->getPath();
- if ($this->getOption('link_display') == 'custom_url' && $override_path = $this->getOption('link_url')) {
+ if ($this->getOption('link_display') === 'custom_url' && $override_path = $this->getOption('link_url')) {
$tokens = $this->getArgumentsTokens();
$path = strtr($override_path, $tokens);
}
@@ -2204,7 +2204,7 @@ public function elementPreRender(array $element) {
$form = \Drupal::formBuilder()->getForm($form_object, $view, $output);
// The form is requesting that all non-essential views elements be hidden,
// usually because the rendered step is not a view result.
- if ($form['show_view_elements']['#value'] == FALSE) {
+ if ($form['show_view_elements']['#value'] === FALSE) {
$element['#header'] = array();
$element['#exposed'] = array();
$element['#pager'] = array();
@@ -2408,12 +2408,12 @@ public function isIdentifierUnique($id, $identifier) {
foreach ($this->getHandlers($type) as $key => $handler) {
if ($handler->canExpose() && $handler->isExposed()) {
if ($handler->isAGroup()) {
- if ($id != $key && $identifier == $handler->options['group_info']['identifier']) {
+ if ($id !== $key && $identifier === $handler->options['group_info']['identifier']) {
return FALSE;
}
}
else {
- if ($id != $key && $identifier == $handler->options['expose']['identifier']) {
+ if ($id !== $key && $identifier === $handler->options['expose']['identifier']) {
return FALSE;
}
}
diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php
index cf556e1..14e4a51 100644
--- a/core/modules/views/src/Plugin/views/display/Feed.php
+++ b/core/modules/views/src/Plugin/views/display/Feed.php
@@ -120,7 +120,7 @@ public function defaultableSections($section = NULL) {
}
// Tell views our sitename_title option belongs in the title section.
- if ($section == 'title') {
+ if ($section === 'title') {
$sections[] = 'sitename_title';
}
elseif (!$section) {
@@ -172,7 +172,7 @@ public function optionsSummary(&$categories, &$options) {
if (count($displays) > 1) {
$attach_to = t('Multiple displays');
}
- elseif (count($displays) == 1) {
+ elseif (count($displays) === 1) {
$display = array_shift($displays);
$displays = $this->view->storage->get('display');
if (!empty($displays[$display])) {
diff --git a/core/modules/views/src/Plugin/views/display/Page.php b/core/modules/views/src/Plugin/views/display/Page.php
index cd06df0..f230d3e 100644
--- a/core/modules/views/src/Plugin/views/display/Page.php
+++ b/core/modules/views/src/Plugin/views/display/Page.php
@@ -141,7 +141,7 @@ public function optionsSummary(&$categories, &$options) {
// This adds a 'Settings' link to the style_options setting if the style
// has options.
- if ($menu['type'] == 'default tab') {
+ if ($menu['type'] === 'default tab') {
$options['menu']['setting'] = t('Parent menu item');
$options['menu']['links']['tab_options'] = t('Change settings for the parent menu');
}
@@ -383,22 +383,22 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
- if ($form_state->get('section') == 'menu') {
+ if ($form_state->get('section') === 'menu') {
$path = $this->getOption('path');
$menu_type = $form_state->getValue(array('menu', 'type'));
- if ($menu_type == 'normal' && strpos($path, '%') !== FALSE) {
+ if ($menu_type === 'normal' && strpos($path, '%') !== FALSE) {
$form_state->setError($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.'));
}
- if ($menu_type == 'default tab' || $menu_type == 'tab') {
+ if ($menu_type === 'default tab' || $menu_type === 'tab') {
$bits = explode('/', $path);
$last = array_pop($bits);
- if ($last == '%') {
+ if ($last === '%') {
$form_state->setError($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.'));
}
}
- if ($menu_type != 'none' && $form_state->isValueEmpty(array('menu', 'title'))) {
+ if ($menu_type !== 'none' && $form_state->isValueEmpty(array('menu', 'title'))) {
$form_state->setError($form['menu']['title'], t('Title is required for this menu type.'));
}
}
@@ -416,7 +416,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
list($menu['menu_name'], $menu['parent']) = explode(':', $menu['parent'], 2);
$this->setOption('menu', $menu);
// send ajax form to options page if we use it.
- if ($form_state->getValue(array('menu', 'type')) == 'default tab') {
+ if ($form_state->getValue(array('menu', 'type')) === 'default tab') {
$form_state->get('view')->addFormToStack('display', $this->display['id'], 'tab_options');
}
break;
@@ -433,13 +433,13 @@ public function validate() {
$errors = parent::validate();
$menu = $this->getOption('menu');
- if (!empty($menu['type']) && $menu['type'] != 'none' && empty($menu['title'])) {
+ if (!empty($menu['type']) && $menu['type'] !== 'none' && empty($menu['title'])) {
$errors[] = t('Display @display is set to use a menu but the menu link text is not set.', array('@display' => $this->display['display_title']));
}
- if ($menu['type'] == 'default tab') {
+ if ($menu['type'] === 'default tab') {
$tab_options = $this->getOption('tab_options');
- if (!empty($tab_options['type']) && $tab_options['type'] != 'none' && empty($tab_options['title'])) {
+ if (!empty($tab_options['type']) && $tab_options['type'] !== 'none' && empty($tab_options['title'])) {
$errors[] = t('Display @display is set to use a parent menu but the parent menu link text is not set.', array('@display' => $this->display['display_title']));
}
}
diff --git a/core/modules/views/src/Plugin/views/display/PathPluginBase.php b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
index 2400ac0..e6cbb4b 100644
--- a/core/modules/views/src/Plugin/views/display/PathPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/PathPluginBase.php
@@ -102,7 +102,7 @@ public function getPath() {
protected function isDefaultTabPath() {
$menu = $this->getOption('menu');
$tab_options = $this->getOption('tab_options');
- return $menu['type'] == 'default tab' && !empty($tab_options['type']) && $tab_options['type'] != 'none';
+ return $menu['type'] === 'default tab' && !empty($tab_options['type']) && $tab_options['type'] !== 'none';
}
/**
@@ -150,7 +150,7 @@ protected function getRoute($view_id, $display_id) {
// routes (defined via {}). As a name for the parameter use arg_$key, so
// it can be pulled in the views controller from the request.
foreach ($bits as $pos => $bit) {
- if ($bit == '%') {
+ if ($bit === '%') {
// Generate the name of the parameter using the key of the argument
// handler.
$arg_id = 'arg_' . $arg_counter++;
@@ -232,7 +232,7 @@ public function alterRoutes(RouteCollection $collection) {
$route_path = RouteCompiler::getPatternOutline($route_path);
// Ensure that we don't override a route which is already controlled by
// views.
- if (!$route->hasDefault('view_id') && ('/' . $view_path == $route_path)) {
+ if (!$route->hasDefault('view_id') && ('/' . $view_path === $route_path)) {
$parameters = $route->compile()->getPathVariables();
// @todo Figure out whether we need to merge some settings (like
@@ -285,7 +285,7 @@ public function getMenuLinks() {
// Replace % with %views_arg for menu autoloading and add to the
// page arguments so the argument actually comes through.
foreach ($bits as $pos => $bit) {
- if ($bit == '%') {
+ if ($bit === '%') {
// If a view requires any arguments we cannot create a static menu link.
return array();
}
@@ -301,7 +301,7 @@ public function getMenuLinks() {
if ($path) {
$menu = $this->getOption('menu');
- if (!empty($menu['type']) && $menu['type'] == 'normal') {
+ if (!empty($menu['type']) && $menu['type'] === 'normal') {
$links[$menu_link_id] = array();
// Some views might override existing paths, so we have to set the route
// name based upon the altering.
@@ -409,7 +409,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
- if ($form_state->get('section') == 'path') {
+ if ($form_state->get('section') === 'path') {
$errors = $this->validatePath($form_state->getValue('path'));
foreach ($errors as $error) {
$form_state->setError($form['path'], $error);
@@ -426,7 +426,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
- if ($form_state->get('section') == 'path') {
+ if ($form_state->get('section') === 'path') {
$this->setOption('path', $form_state->getValue('path'));
}
}
diff --git a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
index 121fb94..a0a1cfd 100644
--- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
+++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
@@ -174,7 +174,7 @@ public function query() {
if (!$sort->isExposed()) {
$sort->query();
}
- elseif ($key == $sort_by) {
+ elseif ($key === $sort_by) {
if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], array('ASC', 'DESC'))) {
$sort->options['order'] = $exposed_data['sort_order'];
}
@@ -297,7 +297,7 @@ public function exposedFormValidate(&$form, FormStateInterface $form_state) {
* $view->exposed_raw_input
*/
public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {
- if (!$form_state->isValueEmpty('op') && $form_state->getValue('op') == $this->options['reset_button_label']) {
+ if (!$form_state->isValueEmpty('op') && $form_state->getValue('op') === $this->options['reset_button_label']) {
$this->resetForm($form, $form_state);
}
if ($pager_plugin = $form_state->get('pager_plugin')) {
diff --git a/core/modules/views/src/Plugin/views/field/Boolean.php b/core/modules/views/src/Plugin/views/field/Boolean.php
index 13b5858..6eafed8 100644
--- a/core/modules/views/src/Plugin/views/field/Boolean.php
+++ b/core/modules/views/src/Plugin/views/field/Boolean.php
@@ -111,7 +111,7 @@ public function render(ResultRow $values) {
$value = !$value;
}
- if ($this->options['type'] == 'custom') {
+ if ($this->options['type'] === 'custom') {
return $value ? UtilityXss::filterAdmin($this->options['type_custom_true']) : UtilityXss::filterAdmin($this->options['type_custom_false']);
}
elseif (isset($this->formats[$this->options['type']])) {
diff --git a/core/modules/views/src/Plugin/views/field/Date.php b/core/modules/views/src/Plugin/views/field/Date.php
index c1a47c3..aa59ee5 100644
--- a/core/modules/views/src/Plugin/views/field/Date.php
+++ b/core/modules/views/src/Plugin/views/field/Date.php
@@ -159,7 +159,7 @@ public function render(ResultRow $values) {
case 'time span':
return t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => $this->dateFormatter->formatInterval(abs($time_diff), is_numeric($custom_format) ? $custom_format : 2)));
case 'custom':
- if ($custom_format == 'r') {
+ if ($custom_format === 'r') {
return format_date($value, $format, $custom_format, $timezone, 'en');
}
return format_date($value, $format, $custom_format, $timezone);
diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 51eebc4..f14d3b4 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -118,7 +118,7 @@ protected function allowAdvancedRender() {
public function query() {
$this->ensureMyTable();
// Add the field.
- $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
+ $params = $this->options['group_type'] !== 'group' ? array('function' => $this->options['group_type']) : array();
$this->field_alias = $this->query->addField($this->tableAlias, $this->realField, NULL, $params);
$this->addAdditionalFields();
@@ -144,7 +144,7 @@ protected function addAdditionalFields($fields = NULL) {
}
$group_params = array();
- if ($this->options['group_type'] != 'group') {
+ if ($this->options['group_type'] !== 'group') {
$group_params = array(
'function' => $this->options['group_type'],
);
@@ -188,7 +188,7 @@ public function clickSort($order) {
if (isset($this->field_alias)) {
// Since fields should always have themselves already added, just
// add a sort on the field.
- $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
+ $params = $this->options['group_type'] !== 'group' ? array('function' => $this->options['group_type']) : array();
$this->query->addOrderBy(NULL, NULL, $order, $this->field_alias, $params);
}
}
@@ -388,7 +388,7 @@ public function elementWrapperClasses($row_index = NULL) {
*/
public function getEntity(ResultRow $values) {
$relationship_id = $this->options['relationship'];
- if ($relationship_id == 'none') {
+ if ($relationship_id === 'none') {
return $values->_entity;
}
else {
@@ -566,7 +566,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['element_type_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Customize field HTML'),
- '#default_value' => !empty($this->options['element_type']) || (string) $this->options['element_type'] == '0' || !empty($this->options['element_class']) || (string) $this->options['element_class'] == '0',
+ '#default_value' => !empty($this->options['element_type']) || (string) $this->options['element_type'] === '0' || !empty($this->options['element_class']) || (string) $this->options['element_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_type'] = array(
@@ -591,7 +591,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
':input[name="options[element_type_enable]"]' => array('checked' => TRUE),
),
),
- '#default_value' => !empty($this->options['element_class']) || (string) $this->options['element_class'] == '0',
+ '#default_value' => !empty($this->options['element_class']) || (string) $this->options['element_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_class'] = array(
@@ -611,7 +611,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['element_label_type_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Customize label HTML'),
- '#default_value' => !empty($this->options['element_label_type']) || (string) $this->options['element_label_type'] == '0' || !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
+ '#default_value' => !empty($this->options['element_label_type']) || (string) $this->options['element_label_type'] === '0' || !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_label_type'] = array(
@@ -635,7 +635,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
':input[name="options[element_label_type_enable]"]' => array('checked' => TRUE),
),
),
- '#default_value' => !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] == '0',
+ '#default_value' => !empty($this->options['element_label_class']) || (string) $this->options['element_label_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_label_class'] = array(
@@ -655,7 +655,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['element_wrapper_type_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Customize field and label wrapper HTML'),
- '#default_value' => !empty($this->options['element_wrapper_type']) || (string) $this->options['element_wrapper_type'] == '0' || !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] == '0',
+ '#default_value' => !empty($this->options['element_wrapper_type']) || (string) $this->options['element_wrapper_type'] === '0' || !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_wrapper_type'] = array(
@@ -680,7 +680,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
':input[name="options[element_wrapper_type_enable]"]' => array('checked' => TRUE),
),
),
- '#default_value' => !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] == '0',
+ '#default_value' => !empty($this->options['element_wrapper_class']) || (string) $this->options['element_wrapper_class'] === '0',
'#fieldset' => 'style_settings',
);
$form['element_wrapper_class'] = array(
@@ -892,7 +892,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
if (!empty($options[$type])) {
$items = array();
foreach ($options[$type] as $key => $value) {
- $items[] = $key . ' == ' . $value;
+ $items[] = $key . ' === ' . $value;
}
$item_list = array(
'#theme' => 'item_list',
@@ -1251,12 +1251,12 @@ public function renderText($alter) {
// First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE).
// For numeric values you can specify whether "0"/0 should be empty.
if ((($this->options['hide_empty'] && empty($value))
- || ($alter['phase'] != static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty))
+ || ($alter['phase'] !== static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty))
&& $this->isValueEmpty($value, $this->options['empty_zero'], FALSE)) {
return '';
}
// Only in empty phase.
- if ($alter['phase'] == static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) {
+ if ($alter['phase'] === static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) {
// If we got here then $alter contains the value of "No results text"
// and so there is nothing left to do.
return $value;
@@ -1349,13 +1349,13 @@ protected function renderAsLink($alter, $text, $tokens) {
$path = $alter['path'];
// strip_tags() removes
, so check whether its different to front.
- if ($path != '') {
+ if ($path !== '') {
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
// were removed by String::checkPlain().
$path = strip_tags(decode_entities(strtr($path, $tokens)));
- if (!empty($alter['path_case']) && $alter['path_case'] != 'none') {
+ if (!empty($alter['path_case']) && $alter['path_case'] !== 'none') {
$path = $this->caseTransform($path, $this->options['alter']['path_case']);
}
@@ -1399,7 +1399,7 @@ protected function renderAsLink($alter, $text, $tokens) {
// Remove query parameters that were assigned a query string replacement
// token for which there is no value available.
foreach ($url['query'] as $param => $val) {
- if ($val == '%' . $param) {
+ if ($val === '%' . $param) {
unset($url['query'][$param]);
}
// Replace any empty query params from URL parsing with NULL. So the
@@ -1416,7 +1416,7 @@ protected function renderAsLink($alter, $text, $tokens) {
if (isset($url['fragment'])) {
$path = strtr($path, array('#' . $url['fragment'] => ''));
// If the path is empty we want to have a fragment for the current site.
- if ($path == '') {
+ if ($path === '') {
$options['external'] = TRUE;
}
$options['fragment'] = $url['fragment'];
@@ -1424,7 +1424,7 @@ protected function renderAsLink($alter, $text, $tokens) {
$alt = strtr($alter['alt'], $tokens);
// Set the title attribute of the link only if it improves accessibility
- if ($alt && $alt != $text) {
+ if ($alt && $alt !== $text) {
$options['attributes']['title'] = decode_entities($alt);
}
@@ -1529,7 +1529,7 @@ public function getRenderTokens($item) {
}
// We only use fields up to (and including) this one.
- if ($field == $this->options['id']) {
+ if ($field === $this->options['id']) {
break;
}
}
@@ -1652,7 +1652,7 @@ public function themeFunctions() {
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['id'];
$themes[] = $hook . '__' . $display['id'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $display['id'];
- if ($display['id'] != $display['display_plugin']) {
+ if ($display['id'] !== $display['display_plugin']) {
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['display_plugin'] . '__' . $this->options['id'];
$themes[] = $hook . '__' . $this->view->storage->id() . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $display['display_plugin'] . '__' . $this->options['id'];
diff --git a/core/modules/views/src/Plugin/views/field/PrerenderList.php b/core/modules/views/src/Plugin/views/field/PrerenderList.php
index c309879..64d8e1f 100644
--- a/core/modules/views/src/Plugin/views/field/PrerenderList.php
+++ b/core/modules/views/src/Plugin/views/field/PrerenderList.php
@@ -75,7 +75,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
*/
protected function renderItems($items) {
if (!empty($items)) {
- if ($this->options['type'] == 'separator') {
+ if ($this->options['type'] === 'separator') {
return implode($this->sanitizeValue($this->options['separator'], 'xss_admin'), $items);
}
else {
diff --git a/core/modules/views/src/Plugin/views/field/Serialized.php b/core/modules/views/src/Plugin/views/field/Serialized.php
index 6432c7e..4a9e5b4 100644
--- a/core/modules/views/src/Plugin/views/field/Serialized.php
+++ b/core/modules/views/src/Plugin/views/field/Serialized.php
@@ -56,7 +56,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
// Require a key if the format is key.
- if ($form_state->getValue(array('options', 'format')) == 'key' && $form_state->getValue(array('options', 'key')) == '') {
+ if ($form_state->getValue(array('options', 'format')) === 'key' && $form_state->getValue(array('options', 'key')) === '') {
$form_state->setError($form['key'], t('You have to enter a key if you want to display a key of the data.'));
}
}
@@ -67,10 +67,10 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
public function render(ResultRow $values) {
$value = $values->{$this->field_alias};
- if ($this->options['format'] == 'unserialized') {
+ if ($this->options['format'] === 'unserialized') {
return String::checkPlain(print_r(unserialize($value), TRUE));
}
- elseif ($this->options['format'] == 'key' && !empty($this->options['key'])) {
+ elseif ($this->options['format'] === 'key' && !empty($this->options['key'])) {
$value = (array) unserialize($value);
return String::checkPlain($value[$this->options['key']]);
}
diff --git a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
index 7a87faa..cb48f25 100644
--- a/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
+++ b/core/modules/views/src/Plugin/views/filter/BooleanOperator.php
@@ -107,13 +107,13 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
*/
public function getValueOptions() {
if (isset($this->definition['type'])) {
- if ($this->definition['type'] == 'yes-no') {
+ if ($this->definition['type'] === 'yes-no') {
$this->value_options = array(1 => t('Yes'), 0 => t('No'));
}
- if ($this->definition['type'] == 'on-off') {
+ if ($this->definition['type'] === 'on-off') {
$this->value_options = array(1 => t('On'), 0 => t('Off'));
}
- if ($this->definition['type'] == 'enabled-disabled') {
+ if ($this->definition['type'] === 'enabled-disabled') {
$this->value_options = array(1 => t('Enabled'), 0 => t('Disabled'));
}
}
@@ -166,7 +166,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
protected function valueValidate($form, FormStateInterface $form_state) {
- if ($form_state->getValue(array('options', 'value')) == 'All' && !$form_state->isValueEmpty(array('options', 'expose', 'required'))) {
+ if ($form_state->getValue(array('options', 'value')) === 'All' && !$form_state->isValueEmpty(array('options', 'expose', 'required'))) {
$form_state->setErrorByName('value', t('You must select a value unless this is an non-required exposed filter.'));
}
}
diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php
index 7751027..71ce77d 100644
--- a/core/modules/views/src/Plugin/views/filter/Combine.php
+++ b/core/modules/views/src/Plugin/views/filter/Combine.php
@@ -132,7 +132,7 @@ protected function opRegex($expression) {
}
protected function opEmpty($expression) {
- if ($this->operator == 'empty') {
+ if ($this->operator === 'empty') {
$operator = "IS NULL";
}
else {
diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php
index 8f0778a..0f68550 100644
--- a/core/modules/views/src/Plugin/views/filter/Date.php
+++ b/core/modules/views/src/Plugin/views/filter/Date.php
@@ -84,19 +84,19 @@ public function validateExposed(&$form, FormStateInterface $form_state) {
public function validateValidTime(&$form, FormStateInterface $form_state, $operator, $value) {
$operators = $this->operators();
- if ($operators[$operator]['values'] == 1) {
+ if ($operators[$operator]['values'] === 1) {
$convert = strtotime($value['value']);
- if (!empty($form['value']) && ($convert == -1 || $convert === FALSE)) {
+ if (!empty($form['value']) && ($convert === -1 || $convert === FALSE)) {
$form_state->setError($form['value'], t('Invalid date format.'));
}
}
- elseif ($operators[$operator]['values'] == 2) {
+ elseif ($operators[$operator]['values'] === 2) {
$min = strtotime($value['min']);
- if ($min == -1 || $min === FALSE) {
+ if ($min === -1 || $min === FALSE) {
$form_state->setError($form['min'], t('Invalid date format.'));
}
$max = strtotime($value['max']);
- if ($max == -1 || $max === FALSE) {
+ if ($max === -1 || $max === FALSE) {
$form_state->setError($form['max'], t('Invalid date format.'));
}
}
@@ -114,7 +114,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) {
if (empty($group['remove'])) {
// Check if the title is defined but value wasn't defined.
if (!empty($group['title'])) {
- if ((!is_array($group['value']) && empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) == 1)) {
+ if ((!is_array($group['value']) && empty($group['value'])) || (is_array($group['value']) && count(array_filter($group['value'])) === 1)) {
$form_state->setError($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.'));
}
}
@@ -148,13 +148,13 @@ public function acceptExposedInput($input) {
$operator = $this->operator;
}
- if ($operators[$operator]['values'] == 1) {
- if ($this->value['value'] == '') {
+ if ($operators[$operator]['values'] === 1) {
+ if ($this->value['value'] === '') {
return FALSE;
}
}
else {
- if ($this->value['min'] == '' || $this->value['max'] == '') {
+ if ($this->value['min'] === '' || $this->value['max'] === '') {
return FALSE;
}
}
@@ -168,7 +168,7 @@ protected function opBetween($field) {
$a = intval(strtotime($this->value['min'], 0));
$b = intval(strtotime($this->value['max'], 0));
- if ($this->value['type'] == 'offset') {
+ if ($this->value['type'] === 'offset') {
$a = '***CURRENT_TIME***' . sprintf('%+d', $a); // keep sign
$b = '***CURRENT_TIME***' . sprintf('%+d', $b); // keep sign
}
@@ -180,7 +180,7 @@ protected function opBetween($field) {
protected function opSimple($field) {
$value = intval(strtotime($this->value['value'], 0));
- if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
+ if (!empty($this->value['type']) && $this->value['type'] === 'offset') {
$value = '***CURRENT_TIME***' . sprintf('%+d', $value); // keep sign
}
// This is safe because we are manually scrubbing the value.
diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
index aaaede0..584070b 100644
--- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
+++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
@@ -622,7 +622,7 @@ public function validateExposeForm($form, FormStateInterface $form_state) {
if (empty($identifier)) {
$form_state->setError($form['expose']['identifier'], t('The identifier is required if the filter is exposed.'));
}
- elseif ($identifier == 'value') {
+ elseif ($identifier === 'value') {
$form_state->setError($form['expose']['identifier'], t('This identifier is not allowed.'));
}
@@ -641,7 +641,7 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) {
$form_state->setError($form['group_info']['identifier'], t('The identifier is required if the filter is exposed.'));
}
- elseif ($identifier == 'value') {
+ elseif ($identifier === 'value') {
$form_state->setError($form['group_info']['identifier'], t('This identifier is not allowed.'));
}
@@ -658,14 +658,14 @@ protected function buildGroupValidate($form, FormStateInterface $form_state) {
// Check if the title is defined but value wasn't defined.
if (!empty($group['title']) && $operators[$group['operator']]['values'] > 0) {
- if ((!is_array($group['value']) && trim($group['value']) == "") ||
- (is_array($group['value']) && count(array_filter($group['value'], 'static::arrayFilterZero')) == 0)) {
+ if ((!is_array($group['value']) && trim($group['value']) === "") ||
+ (is_array($group['value']) && count(array_filter($group['value'], 'static::arrayFilterZero')) === 0)) {
$form_state->setError($form['group_info']['group_items'][$id]['value'], t('The value is required if title for this item is defined.'));
}
}
// Check if the value is defined but title wasn't defined.
- if ((!is_array($group['value']) && trim($group['value']) != "") ||
+ if ((!is_array($group['value']) && trim($group['value']) !== "") ||
(is_array($group['value']) && count(array_filter($group['value'], 'static::arrayFilterZero')) > 0)) {
if (empty($group['title'])) {
$form_state->setError($form['group_info']['group_items'][$id]['title'], t('The title is required if value for this item is defined.'));
@@ -695,13 +695,13 @@ protected function buildGroupSubmit($form, FormStateInterface $form_state) {
unset($group['weight']);
$groups[$new_id] = $group;
- if ($form_state->getValue(array('options', 'group_info', 'default_group')) == $id) {
+ if ($form_state->getValue(array('options', 'group_info', 'default_group')) === $id) {
$new_default = $new_id;
}
}
$new_id++;
}
- if ($new_default != 'All') {
+ if ($new_default !== 'All') {
$form_state->setValue(array('options', 'group_info', 'default_group'), $new_default);
}
$filter_default_multiple = $form_state->getValue(array('options', 'group_info', 'default_group_multiple'));
@@ -754,7 +754,7 @@ public function groupForm(&$form, FormStateInterface $form_state) {
}
foreach ($this->options['group_info']['group_items'] as $id => $group) {
if (!empty($group['title'])) {
- $groups[$id] = $id != 'All' ? t($group['title']) : $group['title'];
+ $groups[$id] = $id !== 'All' ? t($group['title']) : $group['title'];
}
}
@@ -816,21 +816,21 @@ public function buildExposedForm(&$form, FormStateInterface $form_state) {
$this->valueForm($form, $form_state);
$form[$value] = $form['value'];
- if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') {
+ if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] !== 'checkbox') {
unset($form[$value]['#title']);
}
$this->exposedTranslate($form[$value], 'value');
- if (!empty($form['#type']) && ($form['#type'] == 'checkboxes' || ($form['#type'] == 'select' && !empty($form['#multiple'])))) {
+ if (!empty($form['#type']) && ($form['#type'] === 'checkboxes' || ($form['#type'] === 'select' && !empty($form['#multiple'])))) {
unset($form[$value]['#default_value']);
}
- if (!empty($form['#type']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
+ if (!empty($form['#type']) && $form['#type'] === 'select' && empty($form['#multiple'])) {
$form[$value]['#default_value'] = 'All';
}
- if ($value != 'value') {
+ if ($value !== 'value') {
unset($form['value']);
}
}
@@ -952,7 +952,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form
$groups = array('All' => t('- Any -')); // The string '- Any -' will not be rendered see @theme_views_ui_build_group_filter_form
// Provide 3 options to start when we are in a new group.
- if (count($this->options['group_info']['group_items']) == 0) {
+ if (count($this->options['group_info']['group_items']) === 0) {
$this->options['group_info']['group_items'] = array_fill(1, 3, array());
}
@@ -1011,7 +1011,7 @@ protected function buildExposedFiltersGroupForm(&$form, FormStateInterface $form
}
if ($without_children) {
- if (isset($this->options['group_info']['group_items'][$item_id]['value']) && $this->options['group_info']['group_items'][$item_id]['value'] != '') {
+ if (isset($this->options['group_info']['group_items'][$item_id]['value']) && $this->options['group_info']['group_items'][$item_id]['value'] !== '') {
$row['value']['#default_value'] = $this->options['group_info']['group_items'][$item_id]['value'];
}
}
@@ -1133,11 +1133,11 @@ protected function exposedTranslate(&$form, $type) {
return;
}
- if ($form['#type'] == 'radios') {
+ if ($form['#type'] === 'radios') {
$form['#type'] = 'select';
}
// Checkboxes don't work so well in exposed forms due to GET conversions.
- if ($form['#type'] == 'checkboxes') {
+ if ($form['#type'] === 'checkboxes') {
if (empty($form['#no_convert']) || empty($this->options['expose']['multiple'])) {
$form['#type'] = 'select';
}
@@ -1151,11 +1151,11 @@ protected function exposedTranslate(&$form, $type) {
}
// Cleanup in case the translated element's (radios or checkboxes) display value contains html.
- if ($form['#type'] == 'select') {
+ if ($form['#type'] === 'select') {
$this->prepareFilterSelectOptions($form['#options']);
}
- if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
+ if ($type === 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] === 'select' && empty($form['#multiple'])) {
$form['#options'] = array('All' => t('- Any -')) + $form['#options'];
$form['#default_value'] = 'All';
}
@@ -1246,17 +1246,17 @@ public function convertExposedInput(&$input, $selected_group_id = NULL) {
else {
$selected_group = $input[$this->options['group_info']['identifier']];
}
- if ($selected_group == 'All' && !empty($this->options['group_info']['optional'])) {
+ if ($selected_group === 'All' && !empty($this->options['group_info']['optional'])) {
return NULL;
}
- if ($selected_group != 'All' && empty($this->options['group_info']['group_items'][$selected_group])) {
+ if ($selected_group !== 'All' && empty($this->options['group_info']['group_items'][$selected_group])) {
return FALSE;
}
if (isset($selected_group) && isset($this->options['group_info']['group_items'][$selected_group])) {
$input[$this->options['expose']['operator']] = $this->options['group_info']['group_items'][$selected_group]['operator'];
// Value can be optional, For example for 'empty' and 'not empty' filters.
- if (isset($this->options['group_info']['group_items'][$selected_group]['value']) && $this->options['group_info']['group_items'][$selected_group]['value'] != '') {
+ if (isset($this->options['group_info']['group_items'][$selected_group]['value']) && $this->options['group_info']['group_items'][$selected_group]['value'] !== '') {
$input[$this->options['expose']['identifier']] = $this->options['group_info']['group_items'][$selected_group]['value'];
}
$this->options['expose']['use_operator'] = TRUE;
@@ -1348,12 +1348,12 @@ public function acceptExposedInput($input) {
// Various ways to check for the absence of non-required input.
if (empty($this->options['expose']['required'])) {
- if (($this->operator == 'empty' || $this->operator == 'not empty') && $value === '') {
+ if (($this->operator === 'empty' || $this->operator === 'not empty') && $value === '') {
$value = ' ';
}
- if ($this->operator != 'empty' && $this->operator != 'not empty') {
- if ($value == 'All' || $value === array()) {
+ if ($this->operator !== 'empty' && $this->operator !== 'not empty') {
+ if ($value === 'All' || $value === array()) {
return FALSE;
}
}
@@ -1464,7 +1464,7 @@ public function canGroup() {
* TRUE if the value is equal to an empty string, FALSE otherwise.
*/
protected static function arrayFilterZero($var) {
- return trim($var) != '';
+ return trim($var) !== '';
}
}
diff --git a/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php b/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
index 9bd321b..98c90a6 100644
--- a/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
+++ b/core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
@@ -28,7 +28,7 @@ public function query() {
protected function opBetween($field) {
$placeholder_min = $this->placeholder();
$placeholder_max = $this->placeholder();
- if ($this->operator == 'between') {
+ if ($this->operator === 'between') {
$this->query->addHavingExpression($this->options['group'], "$field >= $placeholder_min", array($placeholder_min => $this->value['min']));
$this->query->addHavingExpression($this->options['group'], "$field <= $placeholder_max", array($placeholder_max => $this->value['max']));
}
@@ -43,7 +43,7 @@ protected function opSimple($field) {
}
protected function opEmpty($field) {
- if ($this->operator == 'empty') {
+ if ($this->operator === 'empty') {
$operator = "IS NULL";
}
else {
diff --git a/core/modules/views/src/Plugin/views/filter/InOperator.php b/core/modules/views/src/Plugin/views/filter/InOperator.php
index 4d442b8..adc799e 100644
--- a/core/modules/views/src/Plugin/views/filter/InOperator.php
+++ b/core/modules/views/src/Plugin/views/filter/InOperator.php
@@ -158,7 +158,7 @@ public function operatorOptions($which = 'title') {
protected function operatorValues($values = 1) {
$options = array();
foreach ($this->operators() as $id => $info) {
- if (isset($info['values']) && $info['values'] == $values) {
+ if (isset($info['values']) && $info['values'] === $values) {
$options[] = $id;
}
}
@@ -218,7 +218,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
}
- if ($which == 'all' || $which == 'value') {
+ if ($which === 'all' || $which === 'value') {
$form['value'] = array(
'#type' => $this->valueFormType,
'#title' => $this->value_title,
@@ -234,7 +234,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
$form_state->setUserInput($user_input);
}
- if ($which == 'all') {
+ if ($which === 'all') {
if (!$exposed && (in_array($this->valueFormType, ['checkbox', 'checkboxes', 'radios', 'select']))) {
$form['value']['#prefix'] = '';
$form['value']['#suffix'] = '
';
@@ -291,7 +291,7 @@ public function acceptExposedInput($input) {
// participate, but using the default settings, *if* 'limit is true.
if (empty($this->options['expose']['multiple']) && empty($this->options['expose']['required']) && !empty($this->options['expose']['limit'])) {
$identifier = $this->options['expose']['identifier'];
- if ($input[$identifier] == 'All') {
+ if ($input[$identifier] === 'All') {
return TRUE;
}
}
@@ -337,10 +337,10 @@ public function adminSummary() {
}
}
// Choose different kind of ouput for 0, a single and multiple values.
- if (count($this->value) == 0) {
+ if (count($this->value) === 0) {
$values = t('Unknown');
}
- else if (count($this->value) == 1) {
+ else if (count($this->value) === 1) {
// If any, use the 'single' short name of the operator instead.
if (isset($info[$this->operator]['short_single'])) {
$operator = UtilityString::checkPlain($info[$this->operator]['short_single']);
@@ -394,7 +394,7 @@ protected function opSimple() {
protected function opEmpty() {
$this->ensureMyTable();
- if ($this->operator == 'empty') {
+ if ($this->operator === 'empty') {
$operator = "IS NULL";
}
else {
@@ -437,11 +437,11 @@ public function validate() {
}
}
// Choose different kind of ouput for 0, a single and multiple values.
- if (count($this->value) == 0) {
+ if (count($this->value) === 0) {
$errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->adminLabel(TRUE)));
}
}
- elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) {
+ elseif (!empty($this->value) && ($this->operator === 'in' || $this->operator === 'not in')) {
$errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => var_export($this->value), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE)));
}
return $errors;
diff --git a/core/modules/views/src/Plugin/views/filter/ManyToOne.php b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
index bd5c1ee..670534b 100644
--- a/core/modules/views/src/Plugin/views/filter/ManyToOne.php
+++ b/core/modules/views/src/Plugin/views/filter/ManyToOne.php
@@ -123,7 +123,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
public function ensureMyTable() {
// Defer to helper if the operator specifies it.
$info = $this->operators();
- if (isset($info[$this->operator]['ensure_my_table']) && $info[$this->operator]['ensure_my_table'] == 'helper') {
+ if (isset($info[$this->operator]['ensure_my_table']) && $info[$this->operator]['ensure_my_table'] === 'helper') {
return $this->helper->ensureMyTable();
}
diff --git a/core/modules/views/src/Plugin/views/filter/Numeric.php b/core/modules/views/src/Plugin/views/filter/Numeric.php
index 5579158..22cbc8d 100644
--- a/core/modules/views/src/Plugin/views/filter/Numeric.php
+++ b/core/modules/views/src/Plugin/views/filter/Numeric.php
@@ -130,7 +130,7 @@ public function operatorOptions($which = 'title') {
protected function operatorValues($values = 1) {
$options = array();
foreach ($this->operators() as $id => $info) {
- if ($info['values'] == $values) {
+ if ($info['values'] === $values) {
$options[] = $id;
}
}
@@ -165,7 +165,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
$user_input = $form_state->getUserInput();
- if ($which == 'all') {
+ if ($which === 'all') {
$form['value']['value'] = array(
'#type' => 'textfield',
'#title' => !$exposed ? t('Value') : '',
@@ -183,7 +183,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
$form_state->setUserInput($user_input);
}
}
- elseif ($which == 'value') {
+ elseif ($which === 'value') {
// When exposed we drop the value-value and just do value if
// the operator is locked.
$form['value'] = array(
@@ -198,7 +198,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
}
- if ($which == 'all' || $which == 'minmax') {
+ if ($which === 'all' || $which === 'minmax') {
$form['value']['min'] = array(
'#type' => 'textfield',
'#title' => !$exposed ? t('Min') : '',
@@ -211,7 +211,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
'#size' => 30,
'#default_value' => $this->value['max'],
);
- if ($which == 'all') {
+ if ($which === 'all') {
$states = array();
// Setup #states for all operators with two values.
foreach ($this->operatorValues(2) as $operator) {
@@ -250,7 +250,7 @@ public function query() {
}
protected function opBetween($field) {
- if ($this->operator == 'between') {
+ if ($this->operator === 'between') {
$this->query->addWhere($this->options['group'], $field, array($this->value['min'], $this->value['max']), 'BETWEEN');
}
else {
@@ -263,7 +263,7 @@ protected function opSimple($field) {
}
protected function opEmpty($field) {
- if ($this->operator == 'empty') {
+ if ($this->operator === 'empty') {
$operator = "IS NULL";
}
else {
diff --git a/core/modules/views/src/Plugin/views/filter/String.php b/core/modules/views/src/Plugin/views/filter/String.php
index a93c907..b3bf85c 100644
--- a/core/modules/views/src/Plugin/views/filter/String.php
+++ b/core/modules/views/src/Plugin/views/filter/String.php
@@ -173,7 +173,7 @@ public function adminSummary() {
protected function operatorValues($values = 1) {
$options = array();
foreach ($this->operators() as $id => $info) {
- if (isset($info['values']) && $info['values'] == $values) {
+ if (isset($info['values']) && $info['values'] === $values) {
$options[] = $id;
}
}
@@ -205,7 +205,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
}
- if ($which == 'all' || $which == 'value') {
+ if ($which === 'all' || $which === 'value') {
$form['value'] = array(
'#type' => 'textfield',
'#title' => t('Value'),
@@ -218,7 +218,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
$form_state->setUserInput($user_input);
}
- if ($which == 'all') {
+ if ($which === 'all') {
// Setup #states for all operators with one value.
foreach ($this->operatorValues(1) as $operator) {
$form['value']['#states']['visible'][] = array(
@@ -238,7 +238,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) {
}
function operator() {
- return $this->operator == '=' ? 'LIKE' : 'NOT LIKE';
+ return $this->operator === '=' ? 'LIKE' : 'NOT LIKE';
}
/**
@@ -267,7 +267,7 @@ protected function opContains($field) {
}
protected function opContainsWord($field) {
- $where = $this->operator == 'word' ? db_or() : db_and();
+ $where = $this->operator === 'word' ? db_or() : db_and();
// Don't filter on empty strings.
if (empty($this->value)) {
@@ -278,7 +278,7 @@ protected function opContainsWord($field) {
foreach ($matches as $match) {
$phrase = FALSE;
// Strip off phrase quotes
- if ($match[2]{0} == '"') {
+ if ($match[2]{0} === '"') {
$match[2] = substr($match[2], 1, -1);
$phrase = TRUE;
}
@@ -339,7 +339,7 @@ protected function opRegex($field) {
}
protected function opEmpty($field) {
- if ($this->operator == 'empty') {
+ if ($this->operator === 'empty') {
$operator = "IS NULL";
}
else {
diff --git a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php
index d282f39..38647b0 100644
--- a/core/modules/views/src/Plugin/views/join/JoinPluginBase.php
+++ b/core/modules/views/src/Plugin/views/join/JoinPluginBase.php
@@ -221,7 +221,7 @@ public function buildJoin($select_query, $table, $view_query) {
elseif (isset($info['table'])) {
// If we're aware of a table alias for this table, use the table
// alias instead of the table name.
- if (isset($left) && $left['table'] == $info['table']) {
+ if (isset($left) && $left['table'] === $info['table']) {
$join_table = $left['alias'] . '.';
}
else {
@@ -231,12 +231,12 @@ public function buildJoin($select_query, $table, $view_query) {
// Convert a single-valued array of values to the single-value case,
// and transform from IN() notation to = notation
- if (is_array($info['value']) && count($info['value']) == 1) {
+ if (is_array($info['value']) && count($info['value']) === 1) {
if (empty($info['operator'])) {
$operator = '=';
}
else {
- $operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
+ $operator = $info['operator'] === 'NOT IN' ? '!=' : '=';
}
$info['value'] = array_shift($info['value']);
}
@@ -270,7 +270,7 @@ public function buildJoin($select_query, $table, $view_query) {
}
if ($extras) {
- if (count($extras) == 1) {
+ if (count($extras) === 1) {
$condition .= ' AND ' . array_shift($extras);
}
else {
diff --git a/core/modules/views/src/Plugin/views/join/Subquery.php b/core/modules/views/src/Plugin/views/join/Subquery.php
index 69b25f3..052ee5e 100644
--- a/core/modules/views/src/Plugin/views/join/Subquery.php
+++ b/core/modules/views/src/Plugin/views/join/Subquery.php
@@ -76,9 +76,9 @@ public function buildJoin($select_query, $table, $view_query) {
if (is_array($info['value'])) {
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
// Transform from IN() notation to = notation if just one value.
- if (count($info['value']) == 1) {
+ if (count($info['value']) === 1) {
$info['value'] = array_shift($info['value']);
- $operator = $operator == 'NOT IN' ? '!=' : '=';
+ $operator = $operator === 'NOT IN' ? '!=' : '=';
}
}
else {
@@ -90,7 +90,7 @@ public function buildJoin($select_query, $table, $view_query) {
}
if ($extras) {
- if (count($extras) == 1) {
+ if (count($extras) === 1) {
$condition .= ' AND ' . array_shift($extras);
}
else {
diff --git a/core/modules/views/src/Plugin/views/pager/SqlBase.php b/core/modules/views/src/Plugin/views/pager/SqlBase.php
index 8a4a8e5..d9fb4c3 100644
--- a/core/modules/views/src/Plugin/views/pager/SqlBase.php
+++ b/core/modules/views/src/Plugin/views/pager/SqlBase.php
@@ -188,7 +188,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$options = explode(',', $exposed_options);
if (!$error && is_array($options)) {
foreach ($options as $option) {
- if (!is_numeric($option) || intval($option) == 0) {
+ if (!is_numeric($option) || intval($option) === 0) {
$error = TRUE;
}
}
@@ -218,7 +218,7 @@ public function query() {
if ($items_per_page > 0) {
$this->options['items_per_page'] = $items_per_page;
}
- elseif ($items_per_page == 'All' && $this->options['expose']['items_per_page_options_all']) {
+ elseif ($items_per_page === 'All' && $this->options['expose']['items_per_page_options_all']) {
$this->options['items_per_page'] = 0;
}
}
diff --git a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
index 4097efa..2253148 100644
--- a/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
+++ b/core/modules/views/src/Plugin/views/query/QueryPluginBase.php
@@ -278,7 +278,7 @@ public function getEntityTableInfo() {
// Determine which of the tables are revision tables.
foreach ($entity_tables as $table_alias => $table) {
$entity_type = \Drupal::entityManager()->getDefinition($table['entity_type']);
- if ($entity_type->getRevisionTable() == $table['base']) {
+ if ($entity_type->getRevisionTable() === $table['base']) {
$entity_tables[$table_alias]['revision'] = TRUE;
}
}
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index c52ccac..717aa0b 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -404,8 +404,8 @@ public function queueTable($table, $relationship = NULL, JoinPluginBase $join =
return FALSE;
}
- if (!$alias && $join && $relationship && !empty($join->adjusted) && $table != $join->table) {
- if ($relationship == $this->view->storage->get('base_table')) {
+ if (!$alias && $join && $relationship && !empty($join->adjusted) && $table !== $join->table) {
+ if ($relationship === $this->view->storage->get('base_table')) {
$alias = $table;
}
else {
@@ -428,7 +428,7 @@ public function queueTable($table, $relationship = NULL, JoinPluginBase $join =
// If this is a relationship based table, add a marker with
// the relationship as a primary table for the alias.
- if ($table != $alias) {
+ if ($table !== $alias) {
$this->markTable($alias, $this->view->storage->get('base_table'), $alias);
}
@@ -458,7 +458,7 @@ protected function markTable($table, $relationship, $alias) {
if (empty($this->tables[$relationship][$table])) {
if (!isset($alias)) {
$alias = '';
- if ($relationship != $this->view->storage->get('base_table')) {
+ if ($relationship !== $this->view->storage->get('base_table')) {
// double underscore will help prevent accidental name
// space collisions.
$alias = $relationship . '__';
@@ -505,7 +505,7 @@ public function ensureTable($table, $relationship = NULL, JoinPluginBase $join =
// link back from an alias. We store all aliases along with the primary table
// to detect this state, because eventually it'll hit a table we already
// have and that's when we want to stop.
- if ($relationship == $this->view->storage->get('base_table') && !empty($this->tables[$relationship][$table])) {
+ if ($relationship === $this->view->storage->get('base_table') && !empty($this->tables[$relationship][$table])) {
return $this->tables[$relationship][$table]['alias'];
}
@@ -513,7 +513,7 @@ public function ensureTable($table, $relationship = NULL, JoinPluginBase $join =
return FALSE;
}
- if ($table == $this->relationships[$relationship]['base']) {
+ if ($table === $this->relationships[$relationship]['base']) {
return $relationship;
}
@@ -555,10 +555,10 @@ public function ensureTable($table, $relationship = NULL, JoinPluginBase $join =
// There are a couple possible "improvements" but we should do
// some performance testing before picking one.
foreach ($this->tableQueue as $queued_table) {
- // In PHP 4 and 5, the == operation returns TRUE for two objects
+ // In PHP 4 and 5, the === operation returns TRUE for two objects
// if they are instances of the same class and have the same
// attributes and values.
- if ($queued_table['relationship'] == $relationship && $queued_table['join'] == $join) {
+ if ($queued_table['relationship'] === $relationship && $queued_table['join'] === $join) {
return $queued_table['alias'];
}
}
@@ -595,8 +595,8 @@ protected function ensurePath($table, $relationship = NULL, $join = NULL, $trace
// Does a table along this path exist?
if (isset($this->tables[$relationship][$table]) ||
- ($join && $join->leftTable == $relationship) ||
- ($join && $join->leftTable == $this->relationships[$relationship]['table'])) {
+ ($join && $join->leftTable === $relationship) ||
+ ($join && $join->leftTable === $this->relationships[$relationship]['table'])) {
// Make sure that we're linking to the correct table for our relationship.
foreach (array_reverse($add) as $table => $path_join) {
@@ -636,7 +636,7 @@ protected function adjustJoin($join, $relationship) {
}
// Adjusts the left table for our relationship.
- if ($relationship != $this->view->storage->get('base_table')) {
+ if ($relationship !== $this->view->storage->get('base_table')) {
// If we're linking to the primary table, the relationship to use will
// be the prior relationship. Unless it's a direct link.
@@ -644,14 +644,14 @@ protected function adjustJoin($join, $relationship) {
$join = clone $join;
// Do we need to try to ensure a path?
- if ($join->leftTable != $this->relationships[$relationship]['table'] &&
- $join->leftTable != $this->relationships[$relationship]['base'] &&
+ if ($join->leftTable !== $this->relationships[$relationship]['table'] &&
+ $join->leftTable !== $this->relationships[$relationship]['base'] &&
!isset($this->tables[$relationship][$join->leftTable]['alias'])) {
$this->ensureTable($join->leftTable, $relationship);
}
// First, if this is our link point/anchor table, just use the relationship
- if ($join->leftTable == $this->relationships[$relationship]['table']) {
+ if ($join->leftTable === $this->relationships[$relationship]['table']) {
$join->leftTable = $relationship;
}
// then, try the base alias.
@@ -732,7 +732,7 @@ public function getTableInfo($table) {
*/
public function addField($table, $field, $alias = '', $params = array()) {
// We check for this specifically because it gets a special alias.
- if ($table == $this->view->storage->get('base_table') && $field == $this->view->storage->get('base_field') && empty($alias)) {
+ if ($table === $this->view->storage->get('base_table') && $field === $this->view->storage->get('base_field') && empty($alias)) {
$alias = $this->view->storage->get('base_field');
}
@@ -765,7 +765,7 @@ public function addField($table, $field, $alias = '', $params = array()) {
// to do some automatic alias collision detection:
$base = $alias;
$counter = 0;
- while (!empty($this->fields[$alias]) && $this->fields[$alias] != $field_info) {
+ while (!empty($this->fields[$alias]) && $this->fields[$alias] !== $field_info) {
$field_info['alias'] = $alias = $base . '_' . ++$counter;
}
@@ -938,7 +938,7 @@ public function addHavingExpression($group, $snippet, $args = array()) {
public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
// Only ensure the table if it's not the special random key.
// @todo: Maybe it would make sense to just add an addOrderByRand or something similar.
- if ($table && $table != 'rand') {
+ if ($table && $table !== 'rand') {
$this->ensureTable($table);
}
@@ -1024,12 +1024,12 @@ protected function buildCondition($where = 'where') {
$has_filter = FALSE;
$main_group = db_and();
- $filter_group = $this->groupOperator == 'OR' ? db_or() : db_and();
+ $filter_group = $this->groupOperator === 'OR' ? db_or() : db_and();
foreach ($this->$where as $group => $info) {
if (!empty($info['conditions'])) {
- $sub_group = $info['type'] == 'OR' ? db_or() : db_and();
+ $sub_group = $info['type'] === 'OR' ? db_or() : db_and();
foreach ($info['conditions'] as $clause) {
// DBTNG doesn't support to add the same subquery twice to the main
// query and the count query, so clone the subquery to have two instances
@@ -1037,7 +1037,7 @@ protected function buildCondition($where = 'where') {
if (is_object($clause['value']) && $clause['value'] instanceof SelectQuery) {
$clause['value'] = clone $clause['value'];
}
- if ($clause['operator'] == 'formula') {
+ if ($clause['operator'] === 'formula') {
$has_condition = TRUE;
$sub_group->where($clause['field'], $clause['value']);
}
@@ -1048,7 +1048,7 @@ protected function buildCondition($where = 'where') {
}
// Add the item to the filter group.
- if ($group != 0) {
+ if ($group !== 0) {
$has_filter = TRUE;
$filter_group->condition($sub_group);
}
@@ -1283,7 +1283,7 @@ public function query($get_count = FALSE) {
// we only add the orderby if we're not counting.
if ($this->orderby) {
foreach ($this->orderby as $order) {
- if ($order['field'] == 'rand_') {
+ if ($order['field'] === 'rand_') {
$query->orderRandom();
}
else {
@@ -1483,7 +1483,7 @@ function loadEntities(&$results) {
foreach ($results as $index => $result) {
// Store the entity id if it was found.
- if (isset($result->{$id_alias}) && $result->{$id_alias} != '') {
+ if (isset($result->{$id_alias}) && $result->{$id_alias} !== '') {
$ids_by_type[$entity_type][$index] = $result->$id_alias;
}
}
@@ -1516,7 +1516,7 @@ function loadEntities(&$results) {
$entity = NULL;
}
- if ($relationship_id == 'none') {
+ if ($relationship_id === 'none') {
$results[$index]->_entity = $entity;
}
else {
@@ -1667,10 +1667,10 @@ public function setupTimezone() {
$offset = '+00:00';
static $already_set = FALSE;
if (!$already_set) {
- if ($db_type == 'pgsql') {
+ if ($db_type === 'pgsql') {
Database::getConnection()->query("SET TIME ZONE INTERVAL '$offset' HOUR TO MINUTE");
}
- elseif ($db_type == 'mysql') {
+ elseif ($db_type === 'mysql') {
Database::getConnection()->query("SET @@session.time_zone = '$offset'");
}
diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
index e6d67f6..19afcd8 100644
--- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
+++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
@@ -127,10 +127,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
// Only get views that are suitable:
// - base must the base that our relationship joins towards
// - must have fields.
- if ($view->base_table == $this->definition['base'] && !empty($view->display['default']['display_options']['fields'])) {
+ if ($view->base_table === $this->definition['base'] && !empty($view->display['default']['display_options']['fields'])) {
// TODO: check the field is the correct sort?
// or let users hang themselves at this stage and check later?
- if ($view->type == 'Default') {
+ if ($view->type === 'Default') {
$views[t('Default Views')][$view->storage->id()] = $view->storage->id();
}
else {
@@ -246,7 +246,7 @@ protected function leftQuery($options) {
$fields = &$subquery->getFields();
foreach (array_keys($fields) as $field_name) {
// The base id for this subquery is stored in our definition.
- if ($field_name != $this->definition['field']) {
+ if ($field_name !== $this->definition['field']) {
unset($fields[$field_name]);
}
}
diff --git a/core/modules/views/src/Plugin/views/row/OpmlFields.php b/core/modules/views/src/Plugin/views/row/OpmlFields.php
index 2e936f5..84d93b0 100644
--- a/core/modules/views/src/Plugin/views/row/OpmlFields.php
+++ b/core/modules/views/src/Plugin/views/row/OpmlFields.php
@@ -157,7 +157,7 @@ public function validate() {
$errors[] = $this->t('Row style plugin requires specifying which views field to use for OPML text attribute.');
}
if (!empty($this->options['type_field'])) {
- if ($this->options['type_field'] == 'rss') {
+ if ($this->options['type_field'] === 'rss') {
if (empty($this->options['xml_url_field'])) {
$errors[] = $this->t('Row style plugin requires specifying which views field to use for XML URL attribute.');
}
@@ -182,7 +182,7 @@ public function render($row) {
$item['created'] = $this->getField($row_index, $this->options['created_field']);
if ($this->options['type_field']) {
$item['type'] = $this->options['type_field'];
- if ($item['type'] == 'rss') {
+ if ($item['type'] === 'rss') {
$item['description'] = $this->getField($row_index, $this->options['description_field']);
$item['language'] = $this->getField($row_index, $this->options['language_field']);
$item['xmlUrl'] = $this->getField($row_index, $this->options['xml_url_field']);
diff --git a/core/modules/views/src/Plugin/views/row/RowPluginBase.php b/core/modules/views/src/Plugin/views/row/RowPluginBase.php
index 459a768..ebefcd0 100644
--- a/core/modules/views/src/Plugin/views/row/RowPluginBase.php
+++ b/core/modules/views/src/Plugin/views/row/RowPluginBase.php
@@ -95,7 +95,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
// If this relationship is valid for this type, add it to the list.
$data = Views::viewsData()->get($relationship['table']);
$base = $data[$relationship['field']]['relationship']['base'];
- if ($base == $this->base_table) {
+ if ($base === $this->base_table) {
$relationship_handler->init($executable, $relationship);
$relationship_options[$relationship['id']] = $relationship_handler->adminLabel();
}
diff --git a/core/modules/views/src/Plugin/views/style/Table.php b/core/modules/views/src/Plugin/views/style/Table.php
index 92012fe..6ae87ab 100644
--- a/core/modules/views/src/Plugin/views/style/Table.php
+++ b/core/modules/views/src/Plugin/views/style/Table.php
@@ -90,7 +90,7 @@ protected function defineOptions() {
*/
public function buildSort() {
$order = $this->view->getRequest()->query->get('order');
- if (!isset($order) && ($this->options['default'] == -1 || empty($this->view->field[$this->options['default']]))) {
+ if (!isset($order) && ($this->options['default'] === -1 || empty($this->view->field[$this->options['default']]))) {
return TRUE;
}
@@ -135,7 +135,7 @@ public function buildSortPost() {
}
// Ensure $this->order is valid.
- if ($this->order != 'asc' && $this->order != 'desc') {
+ if ($this->order !== 'asc' && $this->order !== 'desc') {
$this->order = 'asc';
}
@@ -190,7 +190,7 @@ public function sanitizeColumns($columns, $fields = NULL) {
// If the field is the column, mark it so, or the column
// it's set to is a column, that's ok
- if ($field == $column || $columns[$column] == $column && !empty($sanitized[$column])) {
+ if ($field === $column || $columns[$column] === $column && !empty($sanitized[$column])) {
$sanitized[$field] = $column;
}
// Since we set the field to itself initially, ignoring
diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
index a989be7..17e838a 100644
--- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
@@ -135,7 +135,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
$entity_types = \Drupal::entityManager()->getDefinitions();
foreach ($entity_types as $entity_type_id => $entity_type) {
- if ($this->base_table == $entity_type->getBaseTable()) {
+ if ($this->base_table === $entity_type->getBaseTable()) {
$this->entityType = $entity_type;
$this->entityTypeId = $entity_type_id;
}
@@ -526,7 +526,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/
public static function getSelected(FormStateInterface $form_state, $parents, $default_value, $element) {
// For now, don't trust this to work on anything but a #select element.
- if (!isset($element['#type']) || $element['#type'] != 'select' || !isset($element['#options'])) {
+ if (!isset($element['#type']) || $element['#type'] !== 'select' || !isset($element['#options'])) {
return $default_value;
}
@@ -585,7 +585,7 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state,
);
// For the block display, the default value should be "titles (linked)",
// if it's available (since that's the most common use case).
- $block_with_linked_titles_available = ($type == 'block' && isset($options['titles_linked']));
+ $block_with_linked_titles_available = ($type === 'block' && isset($options['titles_linked']));
$default_value = $block_with_linked_titles_available ? 'titles_linked' : key($options);
$style_form['row_plugin']['#default_value'] = static::getSelected($form_state, array($type, 'style', 'row_plugin'), $default_value, $style_form['row_plugin']);
// Changing this dropdown updates the individual row options via AJAX.
@@ -918,7 +918,7 @@ protected function defaultDisplayFilters($form, FormStateInterface $form_state)
protected function defaultDisplayFiltersUser(array $form, FormStateInterface $form_state) {
$filters = array();
- if (($type = $form_state->getValue(array('show', 'type'))) && $type != 'all') {
+ if (($type = $form_state->getValue(array('show', 'type'))) && $type !== 'all') {
$bundle_key = $this->entityType->getKey('bundle');
// Figure out the table where $bundle_key lives. It may not be the same as
// the base table for the view; the taxonomy vocabulary machine_name, for
@@ -940,7 +940,7 @@ protected function defaultDisplayFiltersUser(array $form, FormStateInterface $fo
// If the 'in' operator is being used, map the values to an array.
$handler = $table_data[$bundle_key]['filter']['id'];
$handler_definition = Views::pluginManager('filter')->getDefinition($handler);
- if ($handler == 'in_operator' || is_subclass_of($handler_definition['class'], 'Drupal\\views\\Plugin\\views\\filter\\InOperator')) {
+ if ($handler === 'in_operator' || is_subclass_of($handler_definition['class'], 'Drupal\\views\\Plugin\\views\\filter\\InOperator')) {
$value = array($type => $type);
}
// Otherwise, use just a single value.
@@ -1005,7 +1005,7 @@ protected function defaultDisplaySortsUser($form, FormStateInterface $form_state
// Don't add a sort if there is no form value or the user set the sort to
// 'none'.
- if (($sort_type = $form_state->getValue(array('show', 'sort'))) && $sort_type != 'none') {
+ if (($sort_type = $form_state->getValue(array('show', 'sort'))) && $sort_type !== 'none') {
list($column, $sort) = explode(':', $sort_type);
// Column either be a column-name or the table-columnn-ame.
$column = explode('-', $column);
diff --git a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
index f53b53e..6f2a5f4 100644
--- a/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
+++ b/core/modules/views/src/Tests/Entity/RowEntityRenderersTest.php
@@ -87,7 +87,7 @@ public function testRenderers() {
// Ensure we have a predictable result order.
$values[$i][$langcode] = $i . '-' . $langcode . '-' . $this->randomMachineName();
- if ($langcode != $default_langcode) {
+ if ($langcode !== $default_langcode) {
$node->addTranslation($langcode, array('title' => $values[$i][$langcode]));
}
else {
diff --git a/core/modules/views/src/Tests/Handler/AreaEntityTest.php b/core/modules/views/src/Tests/Handler/AreaEntityTest.php
index af44b44..271b2ba 100644
--- a/core/modules/views/src/Tests/Handler/AreaEntityTest.php
+++ b/core/modules/views/src/Tests/Handler/AreaEntityTest.php
@@ -80,7 +80,7 @@ public function testEntityArea() {
$entity_test = $this->container->get('entity.manager')->getStorage('entity_test')->create($data);
$entity_test->save();
$entities[] = $entity_test;
- \Drupal::state()->set('entity_test_entity_access.view.' . $entity_test->id(), $i != 2);
+ \Drupal::state()->set('entity_test_entity_access.view.' . $entity_test->id(), $i !== 2);
}
$view = Views::getView('test_entity_area');
diff --git a/core/modules/views/src/Tests/Handler/HandlerAllTest.php b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
index ba83c54..d9d374d 100644
--- a/core/modules/views/src/Tests/Handler/HandlerAllTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
@@ -66,7 +66,7 @@ public function testHandlers() {
// Go through all fields and there through all handler types.
foreach ($info as $field => $field_info) {
// Table is a reserved key for the metainformation.
- if ($field != 'table' && !in_array("$base_table:$field", $exclude)) {
+ if ($field !== 'table' && !in_array("$base_table:$field", $exclude)) {
$item = array(
'table' => $base_table,
'field' => $field,
@@ -74,7 +74,7 @@ public function testHandlers() {
foreach ($object_types as $type) {
if (isset($field_info[$type]['id'])) {
$options = array();
- if ($type == 'filter') {
+ if ($type === 'filter') {
$handler = $this->container->get("plugin.manager.views.$type")->getHandler($item);
if ($handler instanceof InOperator) {
$options['value'] = array(1);
diff --git a/core/modules/views/src/Tests/Handler/HandlerTest.php b/core/modules/views/src/Tests/Handler/HandlerTest.php
index b182dee..7df2a3d 100644
--- a/core/modules/views/src/Tests/Handler/HandlerTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerTest.php
@@ -226,7 +226,7 @@ protected function assertEqualValue($expected, $handler, $message = '', $group =
$message = t('Comparing @first and @second', array('@first' => implode(',', $expected), '@second' => implode(',', $handler->value)));
}
- return $this->assert($expected == $handler->value, $message, $group);
+ return $this->assert($expected === $handler->value, $message, $group);
}
/**
diff --git a/core/modules/views/src/Tests/Handler/RelationshipTest.php b/core/modules/views/src/Tests/Handler/RelationshipTest.php
index d361a39..a55fe94 100644
--- a/core/modules/views/src/Tests/Handler/RelationshipTest.php
+++ b/core/modules/views/src/Tests/Handler/RelationshipTest.php
@@ -121,7 +121,7 @@ public function testRelationshipQuery() {
// Alter the expected result to contain the right uids.
foreach ($expected_result as &$row) {
// Only John has an existing author.
- if ($row['name'] == 'John') {
+ if ($row['name'] === 'John') {
$row['uid'] = 1;
}
else {
diff --git a/core/modules/views/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php
index fd7f628..59cd5ed 100644
--- a/core/modules/views/src/Tests/ViewExecutableTest.php
+++ b/core/modules/views/src/Tests/ViewExecutableTest.php
@@ -120,7 +120,7 @@ public function testInitMethods() {
$handler_types = array_keys(ViewExecutable::getHandlerTypes());
foreach ($handler_types as $type) {
// The views_test integration doesn't have relationships.
- if ($type == 'relationship') {
+ if ($type === 'relationship') {
continue;
}
$this->assertTrue(count($view->$type), format_string('Make sure a %type instance got instantiated.', array('%type' => $type)));
@@ -395,7 +395,7 @@ public function testGetHandlerTypes() {
// @todo The key on the display should be footers, headers and empties
// or something similar instead of the singular, but so long check for
// this special case.
- if (isset($types[$type]['type']) && $types[$type]['type'] == 'area') {
+ if (isset($types[$type]['type']) && $types[$type]['type'] === 'area') {
$this->assertEqual($types[$type]['plural'], $type);
}
else {
diff --git a/core/modules/views/src/Tests/ViewTestBase.php b/core/modules/views/src/Tests/ViewTestBase.php
index 82e42e2..2f5dfbb 100644
--- a/core/modules/views/src/Tests/ViewTestBase.php
+++ b/core/modules/views/src/Tests/ViewTestBase.php
@@ -195,7 +195,7 @@ protected function assertIdenticalResultsetHelper(ViewExecutable $view, $expecte
protected function orderResultSet($result_set, $column, $reverse = FALSE) {
$order = $reverse ? -1 : 1;
usort($result_set, function ($a, $b) use ($column, $order) {
- if ($a[$column] == $b[$column]) {
+ if ($a[$column] === $b[$column]) {
return 0;
}
return $order * (($a[$column] < $b[$column]) ? -1 : 1);
diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php
index fa14ec9..a5ba302 100644
--- a/core/modules/views/src/Tests/ViewUnitTestBase.php
+++ b/core/modules/views/src/Tests/ViewUnitTestBase.php
@@ -205,7 +205,7 @@ protected function assertIdenticalResultsetHelper($view, $expected_result, $colu
protected function orderResultSet($result_set, $column, $reverse = FALSE) {
$order = $reverse ? -1 : 1;
usort($result_set, function ($a, $b) use ($column, $order) {
- if ($a[$column] == $b[$column]) {
+ if ($a[$column] === $b[$column]) {
return 0;
}
return $order * (($a[$column] < $b[$column]) ? -1 : 1);
diff --git a/core/modules/views/src/ViewAccessControlHandler.php b/core/modules/views/src/ViewAccessControlHandler.php
index 96d130e..64bfc13 100644
--- a/core/modules/views/src/ViewAccessControlHandler.php
+++ b/core/modules/views/src/ViewAccessControlHandler.php
@@ -23,7 +23,7 @@ class ViewAccessControlHandler extends EntityAccessControlHandler {
* {@inheritdoc}
*/
public function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
- if ($operation == 'view') {
+ if ($operation === 'view') {
return AccessResult::allowed();
}
else {
diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php
index 34f7500..f009bbf 100644
--- a/core/modules/views/src/ViewExecutable.php
+++ b/core/modules/views/src/ViewExecutable.php
@@ -698,7 +698,7 @@ public function setDisplay($display_id = NULL) {
// Reset if the display has changed. It could be called multiple times for
// the same display, especially in the UI.
- if ($this->current_display != $display_id) {
+ if ($this->current_display !== $display_id) {
// Set the current display.
$this->current_display = $display_id;
@@ -1012,7 +1012,7 @@ public function getQuery() {
public function initQuery() {
if (!empty($this->query)) {
$class = get_class($this->query);
- if ($class && $class != 'stdClass') {
+ if ($class && $class !== 'stdClass') {
// return if query is already initialized.
return TRUE;
}
@@ -1409,7 +1409,7 @@ public function render($display_id = NULL) {
* If you simply want to view the display, use View::preview() instead.
*/
public function executeDisplay($display_id = NULL, $args = array()) {
- if (empty($this->current_display) || $this->current_display != $this->chooseDisplay($display_id)) {
+ if (empty($this->current_display) || $this->current_display !== $this->chooseDisplay($display_id)) {
if (!$this->setDisplay($display_id)) {
return NULL;
}
@@ -1437,7 +1437,7 @@ public function executeDisplay($display_id = NULL, $args = array()) {
* views_embed_view() instead.
*/
public function preview($display_id = NULL, $args = array()) {
- if (empty($this->current_display) || ((!empty($display_id)) && $this->current_display != $display_id)) {
+ if (empty($this->current_display) || ((!empty($display_id)) && $this->current_display !== $display_id)) {
if (!$this->setDisplay($display_id)) {
return FALSE;
}
@@ -1699,7 +1699,7 @@ public function getUrl($args = NULL, $path = NULL) {
$argument_keys = isset($this->argument) ? array_keys($this->argument) : array();
$id = current($argument_keys);
foreach (explode('/', $path) as $piece) {
- if ($piece != '%') {
+ if ($piece !== '%') {
$pieces[] = $piece;
}
else {
@@ -2119,7 +2119,7 @@ public function buildThemeFunctions($hook) {
$themes[] = $hook . '__' . preg_replace('/[^a-z0-9]/', '_', strtolower($tag));
}
- if ($display['id'] != $display['display_plugin']) {
+ if ($display['id'] !== $display['display_plugin']) {
$themes[] = $hook . '__' . $id . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $display['display_plugin'];
}
diff --git a/core/modules/views/src/Views.php b/core/modules/views/src/Views.php
index 525177f..f917021 100644
--- a/core/modules/views/src/Views.php
+++ b/core/modules/views/src/Views.php
@@ -335,13 +335,13 @@ public static function getViewsAsOptions($views_only = FALSE, $filter = 'all', $
foreach ($views as $view) {
$id = $view->id();
// Return only views.
- if ($views_only && $id != $exclude_view_name) {
+ if ($views_only && $id !== $exclude_view_name) {
$options[$id] = $view->label();
}
// Return views with display ids.
else {
foreach ($view->get('display') as $display_id => $display) {
- if (!($id == $exclude_view_name && $display_id == $exclude_view_display)) {
+ if (!($id === $exclude_view_name && $display_id === $exclude_view_display)) {
if ($optgroup) {
$options[$id][$id . ':' . $display['id']] = t('@view : @display', array('@view' => $id, '@display' => $display['id']));
}
@@ -376,7 +376,7 @@ public static function pluginList() {
foreach (static::getEnabledViews() as $view) {
foreach ($view->get('display') as $display) {
foreach ($plugin_data as $type => $info) {
- if ($type == 'display' && isset($display['display_plugin'])) {
+ if ($type === 'display' && isset($display['display_plugin'])) {
$name = $display['display_plugin'];
}
elseif (isset($display['display_options']["{$type}_plugin"])) {
@@ -517,7 +517,7 @@ public static function getPluginTypes($type = NULL) {
}
return array_keys(array_filter(static::$plugins, function($plugin_type) use ($type) {
- return $plugin_type == $type;
+ return $plugin_type === $type;
}));
}
diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php
index bd65aa8..b5bb211 100644
--- a/core/modules/views/src/ViewsData.php
+++ b/core/modules/views/src/ViewsData.php
@@ -291,10 +291,10 @@ public function fetchBaseTables() {
// Sorts by the 'weight' and then by 'title' element.
uasort($tables, function ($a, $b) {
- if ($a['weight'] != $b['weight']) {
+ if ($a['weight'] !== $b['weight']) {
return $a['weight'] < $b['weight'] ? -1 : 1;
}
- if ($a['title'] != $b['title']) {
+ if ($a['title'] !== $b['title']) {
return $a['title'] < $b['title'] ? -1 : 1;
}
return 0;
diff --git a/core/modules/views/src/ViewsDataHelper.php b/core/modules/views/src/ViewsDataHelper.php
index b986746..231b5ef 100644
--- a/core/modules/views/src/ViewsDataHelper.php
+++ b/core/modules/views/src/ViewsDataHelper.php
@@ -74,7 +74,7 @@ public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) {
$skip_bases = array();
foreach ($table_data as $field => $info) {
// Collect table data from this table
- if ($field == 'table') {
+ if ($field === 'table') {
// calculate what tables this table can join to.
if (!empty($info['join'])) {
$bases = array_keys($info['join']);
@@ -115,7 +115,7 @@ public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) {
$strings[$field][$key][$string] = $table_data['table'][$string];
}
else {
- if ($string != 'base' && $string != 'base') {
+ if ($string !== 'base' && $string !== 'base') {
$strings[$field][$key][$string] = String::format("Error: missing @component", array('@component' => $string));
}
}
@@ -172,13 +172,13 @@ public function fetchFields($base, $type, $grouping = FALSE, $sub_type = NULL) {
protected static function fetchedFieldSort($a, $b) {
$a_group = Unicode::strtolower($a['group']);
$b_group = Unicode::strtolower($b['group']);
- if ($a_group != $b_group) {
+ if ($a_group !== $b_group) {
return $a_group < $b_group ? -1 : 1;
}
$a_title = Unicode::strtolower($a['title']);
$b_title = Unicode::strtolower($b['title']);
- if ($a_title != $b_title) {
+ if ($a_title !== $b_title) {
return $a_title < $b_title ? -1 : 1;
}
diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
index 5a1b61b..92c3503 100644
--- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
+++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
@@ -139,7 +139,7 @@ public function match($element, $condition) {
$value = $element[$condition['field']];
switch ($condition['operator']) {
case '=':
- return $value == $condition['value'];
+ return $value === $condition['value'];
case 'IN':
return in_array($value, $condition['value']);
}
diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.module b/core/modules/views/tests/modules/views_test_data/views_test_data.module
index 61c7fdb..0264e1b 100644
--- a/core/modules/views/tests/modules/views_test_data/views_test_data.module
+++ b/core/modules/views/tests/modules/views_test_data/views_test_data.module
@@ -59,7 +59,7 @@ function views_test_data_handler_test_access_callback_argument($argument = FALSE
* Implements hook_preprocess_HOOK() for views table templates.
*/
function views_test_data_preprocess_views_view_table(&$variables) {
- if ($variables['view']->storage->id() == 'test_view_render') {
+ if ($variables['view']->storage->id() === 'test_view_render') {
$views_render_test = \Drupal::state()->get('views_render.test');
$views_render_test++;
\Drupal::state()->set('views_render.test', $views_render_test);
diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc b/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc
index 1675be5..050dc8a 100644
--- a/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc
+++ b/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc
@@ -46,7 +46,7 @@ function views_test_data_field_views_data_alter(&$data, FieldStorageConfigInterf
function views_test_data_views_pre_render(ViewExecutable $view) {
\Drupal::state()->set('views_hook_test_views_pre_render', TRUE);
- if (isset($view) && ($view->storage->id() == 'test_cache_header_storage')) {
+ if (isset($view) && ($view->storage->id() === 'test_cache_header_storage')) {
$path = drupal_get_path('module', 'views_test_data');
$view->element['#attached']['js'][] = "$path/views_cache.test.js";
$view->element['#attached']['css'][] = "$path/views_cache.test.css";
@@ -75,11 +75,11 @@ function views_test_data_views_pre_build(ViewExecutable $view) {
function views_test_data_views_post_build(ViewExecutable $view) {
\Drupal::state()->set('views_hook_test_views_post_build', TRUE);
- if (isset($view) && ($view->storage->id() == 'test_page_display')) {
- if ($view->current_display == 'page_1') {
+ if (isset($view) && ($view->storage->id() === 'test_page_display')) {
+ if ($view->current_display === 'page_1') {
$view->build_info['denied'] = TRUE;
}
- elseif ($view->current_display == 'page_2') {
+ elseif ($view->current_display === 'page_2') {
$view->build_info['fail'] = TRUE;
}
}
diff --git a/core/modules/views/tests/src/Unit/Entity/ViewTest.php b/core/modules/views/tests/src/Unit/Entity/ViewTest.php
index 8af4e6d..ea01a09 100644
--- a/core/modules/views/tests/src/Unit/Entity/ViewTest.php
+++ b/core/modules/views/tests/src/Unit/Entity/ViewTest.php
@@ -74,7 +74,7 @@ class TestView extends View {
*/
protected function drupalGetSchema($table = NULL, $rebuild = FALSE) {
$result = array();
- if ($table == 'node') {
+ if ($table === 'node') {
$result['module'] = 'node';
}
return $result;
diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php
index 5534df6..a85886f 100644
--- a/core/modules/views/views.api.php
+++ b/core/modules/views/views.api.php
@@ -81,7 +81,7 @@
function hook_views_analyze(Drupal\views\ViewExecutable $view) {
$messages = array();
- if ($view->display_handler->options['pager']['type'] == 'none') {
+ if ($view->display_handler->options['pager']['type'] === 'none') {
$messages[] = Drupal\views\Analyzer::formatMessage(t('This view has no pager. This could cause performance issues when the view contains many items.'), 'warning');
}
@@ -616,7 +616,7 @@ function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// Modify contextual filters for my_special_view if user has 'my special permission'.
$account = \Drupal::currentUser();
- if ($view->name == 'my_special_view' && $account->hasPermission('my special permission') && $display_id == 'public_display') {
+ if ($view->name === 'my_special_view' && $account->hasPermission('my special permission') && $display_id === 'public_display') {
$args[0] = 'custom value';
}
}
@@ -636,7 +636,7 @@ function hook_views_pre_build(ViewExecutable $view) {
// Because of some unexplicable business logic, we should remove all
// attachments from all views on Mondays.
// (This alter could be done later in the execution process as well.)
- if (date('D') == 'Mon') {
+ if (date('D') === 'Mon') {
unset($view->attachment_before);
unset($view->attachment_after);
}
@@ -659,7 +659,7 @@ function hook_views_post_build(ViewExecutable $view) {
// assumptions about both exposed filter settings and the fields in the view.
// Also note that this alter could be done at any point before the view being
// rendered.)
- if ($view->name == 'my_view' && isset($view->exposed_raw_input['type']) && $view->exposed_raw_input['type'] != 'All') {
+ if ($view->name === 'my_view' && isset($view->exposed_raw_input['type']) && $view->exposed_raw_input['type'] !== 'All') {
// 'Type' should be interpreted as content type.
if (isset($view->field['type'])) {
$view->field['type']->options['exclude'] = TRUE;
@@ -790,13 +790,13 @@ function hook_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
// (Example assuming a view with an exposed filter on node title.)
// If the input for the title filter is a positive integer, filter against
// node ID instead of node title.
- if ($view->name == 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
+ if ($view->name === 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
// Traverse through the 'where' part of the query.
foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {
// If this is the part of the query filtering on title, chang the
// condition to filter on node ID.
- if ($condition['field'] == 'node.title') {
+ if ($condition['field'] === 'node.title') {
$condition = array(
'field' => 'node.nid',
'value' => $view->exposed_raw_input['title'],
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 3ba93f5..725640e 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -188,7 +188,7 @@ function views_theme($existing, $type, $theme, $path) {
);
// For the views module we ensure views.theme.inc is included.
- if ($def['provider'] == 'views') {
+ if ($def['provider'] === 'views') {
$def['theme_file'] = 'views.theme.inc';
}
// We always use the module directory as base dir.
@@ -255,7 +255,7 @@ function views_preprocess_node(&$variables) {
// prevent drupal from accidentally setting the $page variable:
if (!empty($variables['view']->current_display)
&& $variables['page']
- && $variables['view_mode'] == 'full'
+ && $variables['view_mode'] === 'full'
&& !$variables['view']->display_handler->hasPath()) {
$variables['page'] = FALSE;
}
@@ -428,7 +428,7 @@ function views_add_contextual_links(&$render_element, $location, ViewExecutable
if (!isset($plugin['contextual_links_locations'])) {
$plugin['contextual_links_locations'] = array('view');
}
- elseif ($plugin['contextual_links_locations'] == array() || $plugin['contextual_links_locations'] == array('')) {
+ elseif ($plugin['contextual_links_locations'] === array() || $plugin['contextual_links_locations'] === array('')) {
$plugin['contextual_links_locations'] = array();
}
else {
diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc
index 81df6a1..7192234 100644
--- a/core/modules/views/views.theme.inc
+++ b/core/modules/views/views.theme.inc
@@ -450,12 +450,12 @@ function template_preprocess_views_view_table(&$variables) {
// Create a second variable so we can easily find what fields we have and
// what the CSS classes should be.
$variables['fields'][$field] = drupal_clean_css_identifier($field);
- if ($active == $field) {
+ if ($active === $field) {
$variables['fields'][$field] .= ' active';
}
// Render the header labels.
- if ($field == $column && empty($fields[$field]->options['exclude'])) {
+ if ($field === $column && empty($fields[$field]->options['exclude'])) {
$label = String::checkPlain(!empty($fields[$field]) ? $fields[$field]->label() : '');
if (empty($options['info'][$field]['sortable']) || !$fields[$field]->clickSortable()) {
$variables['header'][$field]['content'] = $label;
@@ -463,12 +463,12 @@ function template_preprocess_views_view_table(&$variables) {
else {
$initial = !empty($options['info'][$field]['default_sort_order']) ? $options['info'][$field]['default_sort_order'] : 'asc';
- if ($active == $field) {
- $initial = ($order == 'asc') ? 'desc' : 'asc';
+ if ($active === $field) {
+ $initial = ($order === 'asc') ? 'desc' : 'asc';
}
$title = t('sort by @s', array('@s' => $label));
- if ($active == $field) {
+ if ($active === $field) {
$tablesort_indicator = array(
'#theme' => 'tablesort_indicator',
'#style' => $initial,
@@ -756,7 +756,7 @@ function template_preprocess_views_view_grid(&$variables) {
// Increase, decrease or reset appropriate integers.
if ($horizontal) {
- if ($col == 0 && $col != ($options['columns'] - 1)) {
+ if ($col === 0 && $col !== ($options['columns'] - 1)) {
$col++;
}
elseif ($col >= ($options['columns'] - 1)) {
@@ -769,11 +769,11 @@ function template_preprocess_views_view_grid(&$variables) {
}
else {
$row++;
- if (!$remainders && $row == $num_rows) {
+ if (!$remainders && $row === $num_rows) {
$row = 0;
$col++;
}
- elseif ($remainders && $row == $num_rows + 1) {
+ elseif ($remainders && $row === $num_rows + 1) {
$row = 0;
$col++;
$remainders--;
@@ -897,7 +897,7 @@ function template_preprocess_views_view_rss(&$variables) {
// Compare the link to the default home page; if it's the default home page,
// just use $base_url.
- if ($path == $config->get('page.front')) {
+ if ($path === $config->get('page.front')) {
$path = '';
}
diff --git a/core/modules/views/views.tokens.inc b/core/modules/views/views.tokens.inc
index f6e2539..b6667a1 100644
--- a/core/modules/views/views.tokens.inc
+++ b/core/modules/views/views.tokens.inc
@@ -79,7 +79,7 @@ function views_tokens($type, $tokens, array $data = array(), array $options = ar
$replacements = array();
- if ($type == 'view' && !empty($data['view'])) {
+ if ($type === 'view' && !empty($data['view'])) {
$view = $data['view'];
foreach ($tokens as $name => $original) {
diff --git a/core/modules/views/views.views.inc b/core/modules/views/views.views.inc
index 34167b0..2a9022f 100644
--- a/core/modules/views/views.views.inc
+++ b/core/modules/views/views.views.inc
@@ -142,7 +142,7 @@ function views_views_data() {
// Registers an action bulk form per entity.
foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) {
$actions = array_filter(\Drupal::entityManager()->getStorage('action')->loadMultiple(), function (ActionConfigEntityInterface $action) use ($entity_type) {
- return $action->getType() == $entity_type;
+ return $action->getType() === $entity_type;
});
if (empty($actions)) {
continue;
diff --git a/core/modules/views_ui/admin.inc b/core/modules/views_ui/admin.inc
index b8b758d..fcfb31c 100644
--- a/core/modules/views_ui/admin.inc
+++ b/core/modules/views_ui/admin.inc
@@ -143,7 +143,7 @@ function views_ui_add_limited_validation($element, FormStateInterface $form_stat
// as we did to the element itself, to ensure that #limit_validation_errors
// will actually be set in the correct place.
$clicked_button = &$form_state->getTriggeringElement();
- if ($clicked_button && $clicked_button['#name'] == $element['#name'] && $clicked_button['#value'] == $element['#value']) {
+ if ($clicked_button && $clicked_button['#name'] === $element['#name'] && $clicked_button['#value'] === $element['#value']) {
$clicked_button['#limit_validation_errors'] = $element['#limit_validation_errors'];
}
diff --git a/core/modules/views_ui/src/Form/Ajax/AddHandler.php b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
index afcfa43..e24f97c 100644
--- a/core/modules/views_ui/src/Form/Ajax/AddHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/AddHandler.php
@@ -176,7 +176,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Remove the default submit function.
$form['actions']['submit']['#submit'] = array_filter($form['actions']['submit']['#submit'], function($var) {
- return !(is_array($var) && isset($var[1]) && $var[1] == 'standardSubmit');
+ return !(is_array($var) && isset($var[1]) && $var[1] === 'standardSubmit');
});
$form['actions']['submit']['#submit'][] = array($view, 'submitItemAdd');
diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
index 90de6d9..15b1553 100644
--- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
+++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
@@ -93,7 +93,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
foreach ($relationships as $relationship) {
// relationships can't link back to self. But also, due to ordering,
// relationships can only link to prior relationships.
- if ($type == 'relationship' && $id == $relationship['id']) {
+ if ($type === 'relationship' && $id === $relationship['id']) {
break;
}
$relationship_handler = Views::handlerManager('relationship')->getHandler($relationship);
@@ -274,7 +274,7 @@ public function remove(&$form, FormStateInterface $form_state) {
list($was_defaulted, $is_defaulted) = $view->getOverrideValues($form, $form_state);
$executable = $view->getExecutable();
// If the display selection was changed toggle the override value.
- if ($was_defaulted != $is_defaulted) {
+ if ($was_defaulted !== $is_defaulted) {
$display = &$executable->displayHandlers->get($display_id);
$display->optionsOverride($form, $form_state);
}
diff --git a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
index 58f869a..dd53788 100644
--- a/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
+++ b/core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
@@ -118,7 +118,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
);
$form['remove_groups'][$id] = array(); // to prevent a notice
- if ($id != 1) {
+ if ($id !== 1) {
$form['remove_groups'][$id] = array(
'#type' => 'submit',
'#value' => $this->t('Remove group @group', array('@group' => $id)),
@@ -129,7 +129,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#group' => $id,
);
}
- $group_options[$id] = $id == 1 ? $this->t('Default group') : $this->t('Group @group', array('@group' => $id));
+ $group_options[$id] = $id === 1 ? $this->t('Default group') : $this->t('Group @group', array('@group' => $id));
$form['#group_renders'][$id] = array();
}
@@ -152,7 +152,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// If not grouping and the handler is set ungroupable, move it back to
// the default group to prevent weird errors from having it be in its
// own group:
- if (!$grouping && $field['group'] == 'ungroupable') {
+ if (!$grouping && $field['group'] === 'ungroupable') {
$field['group'] = 1;
}
@@ -260,7 +260,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
// either adding or removing a group, not actually updating the filters.
$clicked_button = $form_state->get('clicked_button');
if (!empty($clicked_button['#group'])) {
- if ($clicked_button['#group'] == 'add') {
+ if ($clicked_button['#group'] === 'add') {
// Add a new group
$groups['groups'][] = 'AND';
}
diff --git a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
index 173202c..97aa3b1 100644
--- a/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
+++ b/core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php
@@ -50,7 +50,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Sort the displays.
uasort($displays, function ($display1, $display2) {
- if ($display1['position'] != $display2['position']) {
+ if ($display1['position'] !== $display2['position']) {
return $display1['position'] < $display2['position'] ? -1 : 1;
}
return 0;
diff --git a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
index 9ab629c..7fa1702 100644
--- a/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
+++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
@@ -106,7 +106,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
list($key, $top) = each($view->stack);
unset($view->stack[$key]);
- if (array_shift($top) != $identifier) {
+ if (array_shift($top) !== $identifier) {
$view->stack = array();
}
}
@@ -114,7 +114,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
// Automatically remove the form cache if it is set and the key does
// not match. This way navigating away from the form without hitting
// update will work.
- if (isset($view->form_cache) && $view->form_cache['key'] != $key) {
+ if (isset($view->form_cache) && $view->form_cache['key'] !== $key) {
unset($view->form_cache);
}
diff --git a/core/modules/views_ui/src/Tests/DisplayFeedTest.php b/core/modules/views_ui/src/Tests/DisplayFeedTest.php
index 7dd358b..e44407b 100644
--- a/core/modules/views_ui/src/Tests/DisplayFeedTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayFeedTest.php
@@ -60,7 +60,7 @@ protected function checkFeedViewUi($view_name) {
$options = array();
foreach ($result as $value) {
foreach ($value->input->attributes() as $attribute => $value) {
- if ($attribute == 'value') {
+ if ($attribute === 'value') {
$options[] = (string) $value;
}
}
diff --git a/core/modules/views_ui/src/Tests/FieldUITest.php b/core/modules/views_ui/src/Tests/FieldUITest.php
index fac6e46..0b1b9c5 100644
--- a/core/modules/views_ui/src/Tests/FieldUITest.php
+++ b/core/modules/views_ui/src/Tests/FieldUITest.php
@@ -43,20 +43,20 @@ public function testFieldUI() {
$edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/age';
$this->drupalGet($edit_handler_url);
$result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li');
- $this->assertEqual((string) $result[0], '[age] == Age');
+ $this->assertEqual((string) $result[0], '[age] === Age');
$edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/id';
$this->drupalGet($edit_handler_url);
$result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li');
- $this->assertEqual((string) $result[0], '[age] == Age');
- $this->assertEqual((string) $result[1], '[id] == ID');
+ $this->assertEqual((string) $result[0], '[age] === Age');
+ $this->assertEqual((string) $result[1], '[id] === ID');
$edit_handler_url = 'admin/structure/views/nojs/handler/test_view/default/field/name';
$this->drupalGet($edit_handler_url);
$result = $this->xpath('//details[@id="edit-options-alter-help"]/div[@class="details-wrapper"]/div[@class="item-list"]/fields/li');
- $this->assertEqual((string) $result[0], '[age] == Age');
- $this->assertEqual((string) $result[1], '[id] == ID');
- $this->assertEqual((string) $result[2], '[name] == Name');
+ $this->assertEqual((string) $result[0], '[age] === Age');
+ $this->assertEqual((string) $result[1], '[id] === ID');
+ $this->assertEqual((string) $result[2], '[name] === Name');
}
/**
diff --git a/core/modules/views_ui/src/Tests/HandlerTest.php b/core/modules/views_ui/src/Tests/HandlerTest.php
index 034106d..7f97f18 100644
--- a/core/modules/views_ui/src/Tests/HandlerTest.php
+++ b/core/modules/views_ui/src/Tests/HandlerTest.php
@@ -79,7 +79,7 @@ public function testUICRUD() {
$id = 'area';
$edit_handler_url = "admin/structure/views/nojs/handler/test_view_empty/default/$type/$id";
}
- elseif ($type == 'relationship') {
+ elseif ($type === 'relationship') {
$this->drupalPostForm($add_handler_url, array('name[views_test_data.uid]' => TRUE), t('Add and configure @handler', array('@handler' => $type_info['ltitle'])));
$id = 'uid';
$edit_handler_url = "admin/structure/views/nojs/handler/test_view_empty/default/$type/$id";
diff --git a/core/modules/views_ui/src/Tests/PreviewTest.php b/core/modules/views_ui/src/Tests/PreviewTest.php
index c681ec4..ab6a857 100644
--- a/core/modules/views_ui/src/Tests/PreviewTest.php
+++ b/core/modules/views_ui/src/Tests/PreviewTest.php
@@ -111,7 +111,7 @@ public function testPreviewWithPagersUI() {
$this->assertTrue(!empty($elements), 'Full pager found.');
// Verify elements and links to pages.
- // We expect to find 5 elements: current page == 1, links to pages 2 and
+ // We expect to find 5 elements: current page === 1, links to pages 2 and
// and 3, links to 'next >' and 'last >>' pages.
$this->assertClass($elements[0], 'pager-current', 'Element for current page has .pager-current class.');
$this->assertFalse(isset($elements[0]->a), 'Element for current page has no link.');
@@ -138,7 +138,7 @@ public function testPreviewWithPagersUI() {
// Verify elements and links to pages.
// We expect to find 7 elements: links to '<< first' and '< previous'
- // pages, link to page 1, current page == 2, link to page 3 and links
+ // pages, link to page 1, current page === 2, link to page 3 and links
// to 'next >' and 'last >>' pages.
$this->assertClass($elements[0], 'pager-first', "Element for next page has .pager-first class.");
$this->assertTrue($elements[0]->a, "Link to first page found.");
diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php
index eda64cc..8e57a9d 100644
--- a/core/modules/views_ui/src/ViewEditForm.php
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -317,7 +317,7 @@ public function save(array $form, FormStateInterface $form_state) {
continue;
}
- if (($display->getPluginId() == 'page') && ($old_path == $destination) && ($old_path != $view->getExecutable()->displayHandlers->get($id)->getOption('path'))) {
+ if (($display->getPluginId() === 'page') && ($old_path === $destination) && ($old_path !== $view->getExecutable()->displayHandlers->get($id)->getOption('path'))) {
$destination = $view->getExecutable()->displayHandlers->get($id)->getOption('path');
$query->remove('destination');
}
@@ -390,11 +390,11 @@ public function getDisplayDetails($view, $display) {
$is_display_deleted = !empty($display['deleted']);
// The master display cannot be duplicated.
- $is_default = $display['id'] == 'default';
+ $is_default = $display['id'] === 'default';
// @todo: Figure out why getOption doesn't work here.
$is_enabled = $view->getExecutable()->displayHandlers->get($display['id'])->isEnabled();
- if ($display['id'] != 'default') {
+ if ($display['id'] !== 'default') {
$build['top']['#theme_wrappers'] = array('container');
$build['top']['#attributes']['id'] = 'edit-display-settings-top';
$build['top']['#attributes']['class'] = array('views-ui-display-tab-actions', 'views-ui-display-tab-bucket', 'clearfix');
@@ -455,7 +455,7 @@ public function getDisplayDetails($view, $display) {
);
foreach (Views::fetchPluginNames('display', NULL, array($view->get('storage')->get('base_table'))) as $type => $label) {
- if ($type == $display['display_plugin']) {
+ if ($type === $display['display_plugin']) {
continue;
}
@@ -724,8 +724,8 @@ public function renderDisplayTop(ViewUI $view) {
// Let other modules add additional links here.
\Drupal::moduleHandler()->alter('views_ui_display_top_links', $element['extra_actions']['#links'], $view, $display_id);
- if (isset($view->type) && $view->type != $this->t('Default')) {
- if ($view->type == $this->t('Overridden')) {
+ if (isset($view->type) && $view->type !== $this->t('Default')) {
+ if ($view->type === $this->t('Overridden')) {
$element['extra_actions']['#links']['revert'] = array(
'title' => $this->t('Revert view'),
'href' => "admin/structure/views/view/{$view->id()}/revert",
@@ -1000,7 +1000,7 @@ public function getFormBucket(ViewUI $view, $type, $display) {
);
if ($count_handlers > 0) {
// Create the rearrange text variable for the rearrange action.
- $rearrange_text = $type == 'filter' ? $this->t('And/Or Rearrange filter criteria') : $this->t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
+ $rearrange_text = $type === 'filter' ? $this->t('And/Or Rearrange filter criteria') : $this->t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
$actions['rearrange'] = array(
'title' => $rearrange_text,
@@ -1040,12 +1040,12 @@ public function getFormBucket(ViewUI $view, $type, $display) {
// Filters can now be grouped so we do a little bit extra:
$groups = array();
$grouping = FALSE;
- if ($type == 'filter') {
+ if ($type === 'filter') {
$group_info = $executable->display_handler->getOption('filter_groups');
// If there is only one group but it is using the "OR" filter, we still
// treat it as a group for display purposes, since we want to display the
// "OR" label next to items within the group.
- if (!empty($group_info['groups']) && (count($group_info['groups']) > 1 || current($group_info['groups']) == 'OR')) {
+ if (!empty($group_info['groups']) && (count($group_info['groups']) > 1 || current($group_info['groups']) === 'OR')) {
$grouping = TRUE;
$groups = array(0 => array());
}
@@ -1102,7 +1102,7 @@ public function getFormBucket(ViewUI $view, $type, $display) {
}
// If using grouping, re-order fields so that they show up properly in the list.
- if ($type == 'filter' && $grouping) {
+ if ($type === 'filter' && $grouping) {
$store = $build['fields'];
$build['fields'] = array();
foreach ($groups as $gid => $contents) {
@@ -1111,15 +1111,15 @@ public function getFormBucket(ViewUI $view, $type, $display) {
$build['fields'][] = array(
'#theme' => 'views_ui_display_tab_setting',
'#class' => array('views-group-text'),
- '#link' => ($group_info['operator'] == 'OR' ? $this->t('OR') : $this->t('AND')),
+ '#link' => ($group_info['operator'] === 'OR' ? $this->t('OR') : $this->t('AND')),
);
}
// Display an operator between each pair of filters within the group.
$keys = array_keys($contents);
$last = end($keys);
foreach ($contents as $key => $pid) {
- if ($key != $last) {
- $store[$pid]['#link'] .= ' ' . ($group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND'));
+ if ($key !== $last) {
+ $store[$pid]['#link'] .= ' ' . ($group_info['groups'][$gid] === 'OR' ? $this->t('OR') : $this->t('AND'));
}
$build['fields'][$pid] = $store[$pid];
}
diff --git a/core/modules/views_ui/src/ViewFormBase.php b/core/modules/views_ui/src/ViewFormBase.php
index 9544040..43ff8cd 100644
--- a/core/modules/views_ui/src/ViewFormBase.php
+++ b/core/modules/views_ui/src/ViewFormBase.php
@@ -134,7 +134,7 @@ public function getDisplayTabs(ViewUI $view) {
}
// If the default display isn't supposed to be shown, don't display its tab, unless it's the only display.
- if ((!$this->isDefaultDisplayShown($view) && $display_id != 'default') && count($tabs) > 1) {
+ if ((!$this->isDefaultDisplayShown($view) && $display_id !== 'default') && count($tabs) > 1) {
$tabs['default']['#access'] = FALSE;
}
@@ -161,7 +161,7 @@ public function isDefaultDisplayShown(ViewUI $view) {
$advanced_mode = \Drupal::config('views.settings')->get('ui.show.master_display');
// For other users, show the default display only if there are no others, and
// hide it if there's at least one "real" display.
- $additional_displays = (count($view->getExecutable()->displayHandlers) == 1);
+ $additional_displays = (count($view->getExecutable()->displayHandlers) === 1);
return $advanced_mode || $additional_displays;
}
@@ -173,7 +173,7 @@ public function isDefaultDisplayShown(ViewUI $view) {
*/
public function getDisplayLabel(ViewUI $view, $display_id, $check_changed = TRUE) {
$display = $view->get('display');
- $title = $display_id == 'default' ? $this->t('Master') : $display[$display_id]['display_title'];
+ $title = $display_id === 'default' ? $this->t('Master') : $display[$display_id]['display_title'];
$title = views_ui_truncate($title, 25);
if ($check_changed && !empty($view->changed_display[$display_id])) {
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index 7e1bc27..5ba74c2 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -822,7 +822,7 @@ public function cacheSet() {
* TRUE if the view is locked, FALSE otherwise.
*/
public function isLocked() {
- return is_object($this->lock) && ($this->lock->owner != \Drupal::currentUser()->id());
+ return is_object($this->lock) && ($this->lock->owner !== \Drupal::currentUser()->id());
}
/**
diff --git a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
index c31306a..2a919dd 100644
--- a/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
+++ b/core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php
@@ -43,7 +43,7 @@ public function testEntityDecoration() {
// ConfigEntityInterface::calculateDependencies() are only used for
// dependency management.
if (!in_array($reflection_method->getName(), ['isNew', 'isSyncing', 'isUninstalling', 'getConfigDependencyName', 'calculateDependencies'])) {
- if (count($reflection_method->getParameters()) == 0) {
+ if (count($reflection_method->getParameters()) === 0) {
$method_args[$reflection_method->getName()] = array();
}
}
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index 3960294..32abce5 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -317,7 +317,7 @@ function views_ui_views_analyze(ViewExecutable $view) {
}
if ($display->hasPath() && $path = $display->getOption('path')) {
$normal_path = \Drupal::service('path.alias_manager')->getPathByAlias($path);
- if ($path != $normal_path) {
+ if ($path !== $normal_path) {
$ret[] = Analyzer::formatMessage(t('You have configured display %display with a path which is an path alias as well. This might lead to unwanted effects so better use an internal path.', array('%display' => $display->display['display_title'])), 'warning');
}
}
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index ce5bcd1..9180e83 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -152,7 +152,7 @@ function theme_views_ui_build_group_filter_form($variables) {
drupal_render($form['default_group']['All']),
'',
array(
- 'data' => \Drupal::config('views.settings')->get('ui.exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -'),
+ 'data' => \Drupal::config('views.settings')->get('ui.exposed_filter_any_label') === 'old_any' ? t('<Any>') : t('- Any -'),
'colspan' => 4,
'class' => array('class' => 'any-default-radios-row'),
),
@@ -250,7 +250,7 @@ function template_preprocess_views_ui_rearrange_filter_form(&$variables) {
// When JavaScript is enabled, the button for removing the group (if it's
// present) should be hidden, since it will be replaced by a link on the
// client side.
- if (!empty($form['remove_groups'][$group_id]['#type']) && $form['remove_groups'][$group_id]['#type'] == 'submit') {
+ if (!empty($form['remove_groups'][$group_id]['#type']) && $form['remove_groups'][$group_id]['#type'] === 'submit') {
$form['remove_groups'][$group_id]['#attributes']['class'][] = 'js-hide';
}
$row[] = array(
diff --git a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
index bb2d27a3..4916d28 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/JsonTest.php
@@ -84,9 +84,9 @@ public function testEncodingLength() {
public function testEncodingStartEnd() {
$json = Json::encode($this->string);
// The first and last characters should be ", and no others.
- $this->assertTrue($json[0] == '"', 'A JSON encoded string begins with ".');
- $this->assertTrue($json[strlen($json) - 1] == '"', 'A JSON encoded string ends with ".');
- $this->assertTrue(substr_count($json, '"') == 2, 'A JSON encoded string contains exactly two ".');
+ $this->assertTrue($json[0] === '"', 'A JSON encoded string begins with ".');
+ $this->assertTrue($json[strlen($json) - 1] === '"', 'A JSON encoded string ends with ".');
+ $this->assertTrue(substr_count($json, '"') === 2, 'A JSON encoded string contains exactly two ".');
}
/**
diff --git a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
index cda119e..24705cb 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
@@ -162,7 +162,7 @@ public function testRandomStringValidator() {
public function _RandomStringValidate($string) {
// Return FALSE for the first generated string and any string that is the
// same, as the test expects a different string to be returned.
- if (empty($this->firstStringGenerated) || $string == $this->firstStringGenerated) {
+ if (empty($this->firstStringGenerated) || $string === $this->firstStringGenerated) {
$this->firstStringGenerated = $string;
return FALSE;
}
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
index 4465c49..dfacf7f 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
@@ -186,7 +186,7 @@ public function testSetChecksWithDynamicAccessChecker() {
->method('applies')
->with($this->isInstanceOf('Symfony\Component\Routing\Route'))
->will($this->returnCallback(function (Route $route) {
- return $route->getRequirement('_bar') == 2;
+ return $route->getRequirement('_bar') === 2;
}));
$this->accessManager->setChecks($collection);
diff --git a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
index 73cd223..93cea8c 100644
--- a/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
@@ -108,7 +108,7 @@ public function accessDeny() {
}
public function accessParameter($parameter) {
- return AccessResult::allowedIf($parameter == 'TRUE');
+ return AccessResult::allowedIf($parameter === 'TRUE');
}
}
diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseRendererTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseRendererTest.php
index 035c1e4..ff209c3 100644
--- a/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseRendererTest.php
+++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxResponseRendererTest.php
@@ -117,7 +117,7 @@ protected function drupalRender(&$elements, $is_recursive_call = FALSE) {
* {@inheritdoc}
*/
protected function elementInfo($type) {
- if ($type == 'ajax') {
+ if ($type === 'ajax') {
return array(
'#header' => TRUE,
'#commands' => array(),
diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
index a2653bb..ba87a4b 100644
--- a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
+++ b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php
@@ -65,7 +65,7 @@ public function testFormatInterval($interval, $granularity, $expected, $langcode
->method('formatPlural')
->with($this->anything(), $this->anything(), $this->anything(), array(), array('langcode' => $langcode))
->will($this->returnCallback(function($count, $one, $multiple) {
- return $count == 1 ? $one : str_replace('@count', $count, $multiple);
+ return $count === 1 ? $one : str_replace('@count', $count, $multiple);
}));
// Check if the granularity is specified.
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 60d5838..0cdd595 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -274,11 +274,11 @@ public function testIsTranslatable() {
$this->languageManager->expects($this->any())
->method('isMultilingual')
->will($this->returnValue(TRUE));
- $this->assertTrue($this->entity->language()->id == 'en');
+ $this->assertTrue($this->entity->language()->id === 'en');
$this->assertFalse($this->entity->language()->locked);
$this->assertTrue($this->entity->isTranslatable());
- $this->assertTrue($this->entityUnd->language()->id == LanguageInterface::LANGCODE_NOT_SPECIFIED);
+ $this->assertTrue($this->entityUnd->language()->id === LanguageInterface::LANGCODE_NOT_SPECIFIED);
$this->assertTrue($this->entityUnd->language()->locked);
$this->assertFalse($this->entityUnd->isTranslatable());
}
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
index a324bf8..c033dc7 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
@@ -436,7 +436,7 @@ protected function setupEntityTypes() {
$this->entityManager->expects($this->any())
->method('getDefinition')
->will($this->returnCallback(function ($entity_type) use ($definition) {
- if ($entity_type == 'entity_test') {
+ if ($entity_type === 'entity_test') {
return $definition;
}
else {
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
index 3109adc..cdbb32f 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php
@@ -794,10 +794,10 @@ protected function setUpEntitySchemaHandler(array $expected = array()) {
->method('createTable')
->with(
$this->callback(function($table_name) use (&$invocation_count, $expected_table_names) {
- return $expected_table_names[$invocation_count] == $table_name;
+ return $expected_table_names[$invocation_count] === $table_name;
}),
$this->callback(function($table_schema) use (&$invocation_count, $expected_table_schemas) {
- return $expected_table_schemas[$invocation_count] == $table_schema;
+ return $expected_table_schemas[$invocation_count] === $table_schema;
})
)
->will($this->returnCallback(function() use (&$invocation_count) {
diff --git a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
index 269674b..b9928ac 100644
--- a/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
+++ b/core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
@@ -116,7 +116,7 @@ public function providerTestLog() {
// No request or account.
$cases [] = array(
function ($context) {
- return $context['channel'] == 'test' && empty($contex['uid']) && empty($context['ip']);
+ return $context['channel'] === 'test' && empty($contex['uid']) && empty($context['ip']);
},
);
// With account but not request. Since the request is not available the
diff --git a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
index c436d6f..d9429e8 100644
--- a/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php
@@ -175,7 +175,7 @@ public function testDeleteOverrides($ids, array $old_definitions, array $new_def
->will($this->returnValue($old_definitions));
// Only save if the definitions changes.
- if ($old_definitions != $new_definitions) {
+ if ($old_definitions !== $new_definitions) {
$config->expects($this->at(1))
->method('set')
->with('definitions', $new_definitions)
diff --git a/core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php b/core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php
index f2305db..93072c7 100644
--- a/core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php
+++ b/core/tests/Drupal/Tests/Core/Page/HtmlPageTest.php
@@ -27,7 +27,7 @@ public function testMetatagAlterability() {
$metatags = $page->getMetaElements();
foreach ($metatags as $tag) {
- if ($tag->getName() == 'example') {
+ if ($tag->getName() === 'example') {
$tag->setContent('hello');
}
}
@@ -47,7 +47,7 @@ public function testMetatagRemovability() {
$metatags =& $page->getMetaElements();
foreach ($metatags as $key => $tag) {
- if ($tag->getName() == 'example') {
+ if ($tag->getName() === 'example') {
unset($metatags[$key]);
}
}
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
index 36919a6..f0fabf7 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
@@ -54,7 +54,7 @@ public function testApplies(array $definition, $name, Route $route, $applies) {
$this->entityManager->expects($this->any())
->method('hasDefinition')
->willReturnCallback(function($entity_type) {
- return 'entity_test' == $entity_type;
+ return 'entity_test' === $entity_type;
});
$this->assertEquals($applies, $this->entityConverter->applies($definition, $name, $route));
}
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
index 5e96ec4..5bab98e 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginBagTest.php
@@ -81,7 +81,7 @@ public function providerTestSortHelper() {
*/
public function testSortHelper($plugin_id_1, $plugin_id_2, $expected) {
$this->setupPluginBag($this->any());
- if ($expected != 0) {
+ if ($expected !== 0) {
$expected = $expected > 0 ? 1 : -1;
}
$this->assertEquals($expected, $this->defaultPluginBag->sortHelper($plugin_id_1, $plugin_id_2));
diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
index aff98962..edece35 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
@@ -208,7 +208,7 @@ public function testRebuildWithProviderBasedRoutes() {
->method('getControllerFromDefinition')
->will($this->returnCallback(function ($controller) use ($container) {
$count = substr_count($controller, ':');
- if ($count == 1) {
+ if ($count === 1) {
list($service, $method) = explode(':', $controller, 2);
$object = $container->get($service);
}
diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
index d53d984..a9ee72a 100644
--- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php
@@ -288,27 +288,27 @@ public function testPathBasedURLGeneration() {
$base = ($absolute ? $base_url . '/' : $base_path . '/') . $script_path;
$url = $base . 'node/123';
$result = $this->generator->generateFromPath('node/123', array('absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
$url = $base . 'node/123#foo';
$result = $this->generator->generateFromPath('node/123', array('fragment' => 'foo', 'absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
$url = $base . 'node/123?foo';
$result = $this->generator->generateFromPath('node/123', array('query' => array('foo' => NULL), 'absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
$url = $base . 'node/123?foo=bar&bar=baz';
$result = $this->generator->generateFromPath('node/123', array('query' => array('foo' => 'bar', 'bar' => 'baz'), 'absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
$url = $base . 'node/123?foo#bar';
$result = $this->generator->generateFromPath('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
$url = $base;
$result = $this->generator->generateFromPath('', array('absolute' => $absolute));
- $this->assertEquals($url, $result, "$url == $result");
+ $this->assertEquals($url, $result, "$url === $result");
}
}
}
diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
index 9f2cb50..e210e1a 100644
--- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php
@@ -195,11 +195,11 @@ public function testIterate() {
$counter = 0;
foreach ($attribute as $key => $value) {
- if ($counter == 0) {
+ if ($counter === 0) {
$this->assertEquals('class', $key);
$this->assertEquals(new AttributeArray('class', array('example-class')), $value);
}
- if ($counter == 1) {
+ if ($counter === 1) {
$this->assertEquals('id', $key);
$this->assertEquals(new AttributeString('id', 'example-id'), $value);
}
diff --git a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
index eb8881d..7bbdc35 100644
--- a/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
+++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php
@@ -115,7 +115,7 @@ protected function init($theme_name = NULL) {
}
protected function getPath($module) {
- if ($module == 'theme_test') {
+ if ($module === 'theme_test') {
return 'core/modules/system/tests/modules/theme_test';
}
}
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index 133a73c..aa90663 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -121,7 +121,7 @@ public function testCreateFromPath() {
*/
protected function getRequestConstraint($path) {
return $this->callback(function (Request $request) use ($path) {
- return $request->getPathInfo() == $path;
+ return $request->getPathInfo() === $path;
});
}
diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index 27f8973..740009b 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -129,7 +129,7 @@ function bartik_preprocess_node(&$variables) {
*/
function bartik_preprocess_block(&$variables) {
// Add a clearfix class to system branding blocks.
- if ($variables['plugin_id'] == 'system_branding_block') {
+ if ($variables['plugin_id'] === 'system_branding_block') {
$variables['attributes']['class'][] = 'clearfix';
}
}
@@ -157,9 +157,9 @@ function bartik_menu_tree__shortcut_default($variables) {
*/
function bartik_preprocess_field(&$variables) {
$element = $variables['element'];
- if ($element['#field_type'] == 'taxonomy_term_reference') {
+ if ($element['#field_type'] === 'taxonomy_term_reference') {
$variables['title_attributes']['class'][] = 'field-label';
- if ($variables['element']['#label_display'] == 'inline') {
+ if ($variables['element']['#label_display'] === 'inline') {
$variables['title_attributes']['class'][] = 'inline';
}
}
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine
index e0cfcc2..d10f902 100644
--- a/core/themes/engines/twig/twig.engine
+++ b/core/themes/engines/twig/twig.engine
@@ -88,7 +88,7 @@ function twig_render_template($template_file, $variables) {
}
foreach ($suggestions as &$suggestion) {
$template = strtr($suggestion, '_', '-') . $extension;
- $prefix = ($template == $current_template) ? 'x' : '*';
+ $prefix = ($template === $current_template) ? 'x' : '*';
$suggestion = $prefix . ' ' . $template;
}
$output['debug_info'] .= "\n";
@@ -126,7 +126,7 @@ function twig_render_var($arg) {
}
// Return early for NULL and also true for empty arrays.
- if ($arg == NULL) {
+ if ($arg === NULL) {
return NULL;
}
@@ -212,7 +212,7 @@ function twig_drupal_escape_filter(\Twig_Environment $env, $string, $strategy =
}
// Return early for NULL or an empty array.
- if ($string == NULL) {
+ if ($string === NULL) {
return NULL;
}
@@ -242,7 +242,7 @@ function twig_drupal_escape_filter(\Twig_Environment $env, $string, $strategy =
}
// Drupal only supports the HTML escaping strategy, so provide a
// fallback for other strategies.
- if ($strategy == 'html') {
+ if ($strategy === 'html') {
return String::checkPlain($return);
}
return twig_escape_filter($env, $return, $strategy, $charset, $autoescape);