From 7f52863456cd96551476ccfa80b3d610ea09283f Mon Sep 17 00:00:00 2001 From: xjm <xjm@65776.no-reply.drupal.org> Date: Wed, 17 Oct 2012 07:29:25 -0500 Subject: [PATCH] Issue #1614186 follow-up by xjm: Use \ rather than 'use' statements for native PHP classes. --- lib/Drupal/views/Plugin/views/HandlerBase.php | 6 ++---- lib/Drupal/views/Plugin/views/wizard/WizardException.php | 4 +--- lib/Drupal/views/Tests/Handler/FieldTest.php | 3 +-- lib/Drupal/views/Tests/Plugin/StyleTestBase.php | 4 +--- lib/Drupal/views/Tests/PluginInstanceTest.php | 4 +--- lib/Views/node/Plugin/views/row/Rss.php | 3 +-- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/Drupal/views/Plugin/views/HandlerBase.php b/lib/Drupal/views/Plugin/views/HandlerBase.php index 08280ac4fe3c..e67614e057fa 100644 --- a/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -11,8 +11,6 @@ use Drupal\views\Plugin\views\PluginBase; use Drupal\views\ViewExecutable; use Drupal\Core\Database\Database; -use DateTimeZone; -use DateTime; abstract class HandlerBase extends PluginBase { @@ -714,8 +712,8 @@ public function getSQLDateField() { $db_type = Database::getConnection()->databaseType(); $offset = $this->getTimezone(); if (isset($offset) && !is_numeric($offset)) { - $dtz = new DateTimeZone($offset); - $dt = new DateTime('now', $dtz); + $dtz = new \DateTimeZone($offset); + $dt = new \DateTime('now', $dtz); $offset_seconds = $dtz->getOffset($dt); } diff --git a/lib/Drupal/views/Plugin/views/wizard/WizardException.php b/lib/Drupal/views/Plugin/views/wizard/WizardException.php index e7a70bf451de..2c188da9e5fc 100644 --- a/lib/Drupal/views/Plugin/views/wizard/WizardException.php +++ b/lib/Drupal/views/Plugin/views/wizard/WizardException.php @@ -7,11 +7,9 @@ namespace Drupal\views\Plugin\views\wizard; -use Exception; - /** * A custom exception class for our errors. */ -class WizardException extends Exception { +class WizardException extends \Exception { } diff --git a/lib/Drupal/views/Tests/Handler/FieldTest.php b/lib/Drupal/views/Tests/Handler/FieldTest.php index 1f54db3322fe..967eae8890fc 100644 --- a/lib/Drupal/views/Tests/Handler/FieldTest.php +++ b/lib/Drupal/views/Tests/Handler/FieldTest.php @@ -12,7 +12,6 @@ * * @see Drupal\views\Plugin\views\field\FieldPluginBase */ -use DOMDocument; class FieldTest extends HandlerTestBase { @@ -170,7 +169,7 @@ protected function assertNotSubString($haystack, $needle, $message = '', $group * An array containing simplexml objects. */ protected function parseContent($content) { - $htmlDom = new DOMDocument(); + $htmlDom = new \DOMDocument(); @$htmlDom->loadHTML('<?xml encoding="UTF-8">' . $content); $elements = simplexml_import_dom($htmlDom); diff --git a/lib/Drupal/views/Tests/Plugin/StyleTestBase.php b/lib/Drupal/views/Tests/Plugin/StyleTestBase.php index 20fb2d65cdf1..e60c217769ae 100644 --- a/lib/Drupal/views/Tests/Plugin/StyleTestBase.php +++ b/lib/Drupal/views/Tests/Plugin/StyleTestBase.php @@ -7,8 +7,6 @@ namespace Drupal\views\Tests\Plugin; -use DOMDocument; - /** * Tests some general style plugin related functionality. */ @@ -31,7 +29,7 @@ protected function setUp() { * Stores a view output in the elements. */ function storeViewPreview($output) { - $htmlDom = new DOMDocument(); + $htmlDom = new \DOMDocument(); @$htmlDom->loadHTML($output); if ($htmlDom) { // It's much easier to work with simplexml than DOM, luckily enough diff --git a/lib/Drupal/views/Tests/PluginInstanceTest.php b/lib/Drupal/views/Tests/PluginInstanceTest.php index b9187727c946..5880136b8f2e 100644 --- a/lib/Drupal/views/Tests/PluginInstanceTest.php +++ b/lib/Drupal/views/Tests/PluginInstanceTest.php @@ -7,8 +7,6 @@ namespace Drupal\views\Tests; -use ReflectionClass; - /** * Checks general plugin data and instances for all plugin types. */ @@ -93,7 +91,7 @@ public function testPluginInstances() { foreach ($plugins as $definition) { // Get a reflection class for this plugin. // We only want to test true plugins, i.e. They extend PluginBase. - $reflection = new ReflectionClass($definition['class']); + $reflection = new \ReflectionClass($definition['class']); if ($reflection->isSubclassOf('Drupal\views\Plugin\views\PluginBase')) { // Create a plugin instance and check what it is. This is not just // good to check they can be created but for throwing any notices for diff --git a/lib/Views/node/Plugin/views/row/Rss.php b/lib/Views/node/Plugin/views/row/Rss.php index d0a58eb4db8a..0d5a8df31bfc 100644 --- a/lib/Views/node/Plugin/views/row/Rss.php +++ b/lib/Views/node/Plugin/views/row/Rss.php @@ -10,7 +10,6 @@ use Drupal\Core\Annotation\Plugin; use Drupal\Core\Annotation\Translation; use Drupal\views\Plugin\views\row\RowPluginBase; -use stdClass; /** * Plugin which performs a node_view on the resulting object @@ -165,7 +164,7 @@ function render($row) { $item_text .= drupal_render($build); } - $item = new stdClass(); + $item = new \stdClass(); $item->description = $item_text; $item->title = $node->label(); $item->link = $node->link; -- GitLab