Pull merge.
[yaffs-website] / web / core / modules / views / src / Plugin / views / PluginBase.php
index e523ebafaffe6e2f8a20446e795afd4059254e5f..d5614c68df8cb04887801f66807e2e80047d1c03 100644 (file)
@@ -155,7 +155,9 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
    * @return array
    *   Returns the options of this handler/plugin.
    */
-  protected function defineOptions() { return []; }
+  protected function defineOptions() {
+    return [];
+  }
 
   /**
    * Fills up the options of the plugin with defaults.
@@ -271,17 +273,17 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
   /**
    * {@inheritdoc}
    */
-  public function validateOptionsForm(&$form, FormStateInterface $form_state) { }
+  public function validateOptionsForm(&$form, FormStateInterface $form_state) {}
 
   /**
    * {@inheritdoc}
    */
-  public function submitOptionsForm(&$form, FormStateInterface $form_state) { }
+  public function submitOptionsForm(&$form, FormStateInterface $form_state) {}
 
   /**
    * {@inheritdoc}
    */
-  public function query() { }
+  public function query() {}
 
   /**
    * {@inheritdoc}
@@ -293,7 +295,9 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
   /**
    * {@inheritdoc}
    */
-  public function validate() { return []; }
+  public function validate() {
+    return [];
+  }
 
   /**
    * {@inheritdoc}
@@ -351,7 +355,7 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
     foreach ($tokens as $token => $replacement) {
       // Twig wants a token replacement array stripped of curly-brackets.
       // Some Views tokens come with curly-braces, others do not.
-      //@todo: https://www.drupal.org/node/2544392
+      // @todo: https://www.drupal.org/node/2544392
       if (strpos($token, '{{') !== FALSE) {
         // Twig wants a token replacement array stripped of curly-brackets.
         $token = trim(str_replace(['{{', '}}'], '', $token));
@@ -364,17 +368,17 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
         // We need to validate tokens are valid Twig variables. Twig uses the
         // same variable naming rules as PHP.
         // @see http://php.net/manual/language.variables.basics.php
-        assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $token) === 1', 'Tokens need to be valid Twig variables.');
+        assert(preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $token) === 1, 'Tokens need to be valid Twig variables.');
         $twig_tokens[$token] = $replacement;
       }
       else {
         $parts = explode('.', $token);
         $top = array_shift($parts);
-        assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $top) === 1', 'Tokens need to be valid Twig variables.');
+        assert(preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $top) === 1, 'Tokens need to be valid Twig variables.');
         $token_array = [array_pop($parts) => $replacement];
         foreach (array_reverse($parts) as $key) {
           // The key could also be numeric (array index) so allow that.
-          assert('is_numeric($key) || (preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1)', 'Tokens need to be valid Twig variables.');
+          assert(is_numeric($key) || preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $key) === 1, 'Tokens need to be valid Twig variables.');
           $token_array = [$key => $token_array];
         }
         if (!isset($twig_tokens[$top])) {
@@ -396,7 +400,7 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
         '#post_render' => [
           function ($children, $elements) {
             return Xss::filterAdmin($children);
-          }
+          },
         ],
       ];