Commit c4ac4d9a authored by David Suissa's avatar David Suissa
Browse files

Issue #3517506 by dydave: PHPSTAN: Raised validation level from 0 (min) to 6.

parent 4dc4d910
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,11 @@ variables:
  OPT_IN_TEST_NEXT_MINOR: 1
  OPT_IN_TEST_NEXT_MAJOR: 1
  OPT_IN_TEST_MAX_PHP: 1
  # Speed up the execution of the Tests.
  _PHPUNIT_CONCURRENT: 1
  # # Convenient for debugging: Enable in issue forks for testing.
  # _SHOW_ENVIRONMENT_VARIABLES: 1


#
# PHPCS overrides and configuration.
+4 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@ function toolbar_tools_menu_navigation_links(array $tree) {
    $link = $element->link;
    // Get the non-localized title to make the icon class.
    $definition = $link->getPluginDefinition();
    // Prevent PHPSTAN error due to incorrect type hinting as an array of
    // strings (string[]) for property 'options' of class 'MenuLinkTreeElement'
    // in Core, preventing the assignment of an associative array of options.
    // @phpstan-ignore offsetAssign.dimType
    $element->options['attributes']['class'][] = 'toolbar-icon';
    $string = strtolower(str_replace(['.', ' ', '_'], ['-', '-', '-'], $definition['id']));
    $element->options['attributes']['class'][] = Html::cleanCssIdentifier('toolbar-icon-' . $string);
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ function admin_toolbar_links_access_filter_filter_non_accessible_links(array &$i
      elseif (!empty($item['url'])) {
        /** @var \Drupal\Core\Url $url */
        $url = $item['url'];
        // @phpstan-ignore variable.undefined
        if ($url->isExternal() || !$original_link->getUrlObject()->isRouted()) {
          // Do not filter external URL at all.
          continue;
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ class AdminToolbarSearchController extends ControllerBase {

  /**
   * Return additional search links.
   *
   * @return \Symfony\Component\HttpFoundation\JsonResponse
   *   A JSON response with the search links.
   */
  public function search() {
    return new JsonResponse($this->links->getLinks());
+19 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ class AdminToolbarSearchSettingsForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   *
   * @return array<string>
   *   An array of configuration names that this form is responsible for.
   */
  protected function getEditableConfigNames() {
    return ['admin_toolbar_search.settings'];
@@ -26,6 +29,14 @@ class AdminToolbarSearchSettingsForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   *
   * @param array<string, mixed> $form
   *   The form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state.
   *
   * @return array<string, mixed>
   *   The form array with the form elements.
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['display_menu_item'] = [
@@ -39,6 +50,14 @@ class AdminToolbarSearchSettingsForm extends ConfigFormBase {

  /**
   * {@inheritdoc}
   *
   * @param array<mixed> $form
   *   The form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state.
   *
   * @return void
   *   Nothing to return.
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->config('admin_toolbar_search.settings')
Loading