Skip to content
Snippets Groups Projects
Commit 128827d8 authored by omkar podey's avatar omkar podey Committed by Ted Bowman
Browse files

Issue #3321282 by omkar.podey, Wim Leers, tedbow: Add 'declare(strict_types = 1)' where needed

parent 3891174c
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 2 deletions
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\Core\StreamWrapper\LocalStream; use Drupal\Core\StreamWrapper\LocalStream;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\PathExcluder; namespace Drupal\package_manager\PathExcluder;
use Drupal\package_manager\Event\CollectIgnoredPathsEvent; use Drupal\package_manager\Event\CollectIgnoredPathsEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Composer\Autoload\ClassLoader; use Composer\Autoload\ClassLoader;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Composer\Semver\Comparator; use Composer\Semver\Comparator;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\update\ProjectRelease; use Drupal\update\ProjectRelease;
use Drupal\Core\Extension\ExtensionVersion; use Drupal\Core\Extension\ExtensionVersion;
use Drupal\update\UpdateManagerInterface; use Drupal\update\UpdateManagerInterface;
...@@ -143,8 +146,25 @@ final class ProjectInfo { ...@@ -143,8 +146,25 @@ final class ProjectInfo {
* the project information is not available. * the project information is not available.
*/ */
public function getInstalledVersion(): ?string { public function getInstalledVersion(): ?string {
if ($project_data = $this->getProjectInfo()) { $project_data = $this->getProjectInfo();
return $project_data['existing_version'] ?? NULL; if ($project_data && array_key_exists('existing_version', $project_data)) {
$existing_version = $project_data['existing_version'];
// Treat an unknown version the same as a project whose project
// information is not available, so return NULL.
// @see \update_process_project_info()
if ($existing_version instanceof TranslatableMarkup && $existing_version->getUntranslatedString() === 'Unknown') {
return NULL;
}
// TRICKY: Since this is relying on data coming from
// \Drupal\update\UpdateManager::getProjects(), we cannot be certain that
// we are actually receiving strings.
// @see \Drupal\update\UpdateManager::getProjects()
if (!is_string($existing_version)) {
return NULL;
}
return $existing_version;
} }
return NULL; return NULL;
} }
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Drupal\Component\Datetime\TimeInterface; use Drupal\Component\Datetime\TimeInterface;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Drupal\automatic_updates\Event\ReadinessCheckEvent; use Drupal\automatic_updates\Event\ReadinessCheckEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager; namespace Drupal\package_manager;
use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Composer\Semver\Semver; use Composer\Semver\Semver;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Drupal\package_manager\Event\PreCreateEvent; use Drupal\package_manager\Event\PreCreateEvent;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\StringTranslationTrait;
......
<?php <?php
declare(strict_types = 1);
namespace Drupal\package_manager\Validator; namespace Drupal\package_manager\Validator;
use Drupal\Core\Link; use Drupal\Core\Link;
......
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