Skip to content
Snippets Groups Projects
Commit 4b09f4e6 authored by Nikolay Shapovalov's avatar Nikolay Shapovalov Committed by Sascha Grossenbacher
Browse files

Issue #3411804 by Nikolay Shapovalov: Fix phpcs Drupal.Classes,...

Issue #3411804 by Nikolay Shapovalov: Fix phpcs Drupal.Classes, DrupalPractice.FunctionCalls, SlevomatCodingStandard.PHP, Drupal.Semantics
parent 94e00930
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ function pathauto_update_8100() {
$language = NULL;
preg_match('/^(.*)_([a-z-]*)$/', $bundle, $matches);
if (count($matches) == 3) {
list(, $extracted_bundle, $langcode) = $matches;
[, $extracted_bundle, $langcode] = $matches;
$language = $language_manager->getLanguage($langcode);
}
// Validate bundle, langcode and language.
......
......@@ -171,7 +171,7 @@ function pathauto_pattern_validate($element, FormStateInterface $form_state) {
}
if (preg_match('/(\s$)+/', $element['#value'])) {
$form_state->setError($element, t('The %element-title doesn\'t allow the patterns ending with whitespace.', ['%element-title' => $title]));
$form_state->setError($element, t("The %element-title doesn't allow the patterns ending with whitespace.", ['%element-title' => $title]));
}
}
......
......@@ -415,7 +415,7 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
return $contexts[$token];
}
else {
list($base, $property_path) = explode(':', $token, 2);
[$base, $property_path] = explode(':', $token, 2);
// A base must always be set. This method recursively calls itself
// setting bases for this reason.
if (!empty($contexts[$base])) {
......
......@@ -95,7 +95,7 @@ class PathautoPattern extends DrupalSqlBase {
$row->setSourceProperty('id', $entity_type);
$row->setSourceProperty('label', (string) $definition->getLabel() . ' - default');
$row->setSourceProperty('type', 'canonical_entities:' . $entity_type);
$row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value')));
$row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'), ['allowed_classes' => FALSE]));
return parent::prepareRow($row);
}
elseif (strpos($name, 'pathauto_' . $entity_type . '_') === 0) {
......@@ -114,7 +114,7 @@ class PathautoPattern extends DrupalSqlBase {
$row->setSourceProperty('id', $entity_type . '_' . $bundle);
$row->setSourceProperty('label', (string) $definition->getLabel() . ' - ' . $bundles[$bundle]['label']);
$row->setSourceProperty('type', 'canonical_entities:' . $entity_type);
$row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value')));
$row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'), ['allowed_classes' => FALSE]));
$selection_criteria = [
'id' => 'entity_bundle:' . $entity_type,
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\pathauto\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\pathauto\PathautoGeneratorInterface;
use Drupal\pathauto\PathautoState;
use Drupal\Tests\BrowserTestBase;
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\pathauto\FunctionalJavascript;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\pathauto\Entity\PathautoPattern;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment