} catch (DatabaseQueryExecutionException $e) {
// Error code 23000 = duplicate key
if ($e->getCode() == '23000' && $e->getDriverCode() == '1062') {
- return;
+ return null;
}
throw $e;
}
if (empty($this->objects)) {
- return;
+ return null;
}
return \reset($this->objects);
}
if ($this->image === null || !$this->image->isAccessible()) {
- return;
+ return null;
}
return $this->image;
}
if ($this->teaserImage === null || !$this->teaserImage->isAccessible()) {
- return;
+ return null;
}
return $this->teaserImage;
/**
* Returns media provider callback instance.
*
- * @return IBBCodeMediaProvider
+ * @return IBBCodeMediaProvider|null
*/
public function getCallback()
{
if (!$this->className) {
- return;
+ return null;
}
if ($this->callback === null) {
public function getImage()
{
if ($this->boxType === 'menu') {
- return;
+ return null;
}
if ($this->image === null) {
}
if ($this->image === null || !$this->image->isAccessible()) {
- return;
+ return null;
}
return $this->image;
{
$response = new CommentResponse($responseID);
if (!$response->responseID) {
- return;
+ return null;
}
// prepare structured response
public function getLanguage()
{
if ($this->languageID === null) {
- return;
+ return null;
}
return LanguageFactory::getInstance()->getLanguage($this->languageID);
{
$packageID = $this->getPackageID($package);
if ($packageID === null) {
- return;
+ return null;
}
return $this->getPackage($packageID);
return $this->current();
} catch (SystemException $e) {
- return;
+ return null;
}
}
* Returns the id of a user option.
*
* @param string $name
- * @return int id
+ * @return int|null
*/
public static function getUserOptionID($name)
{
}
if (!isset(self::$userOptions[$name])) {
- return;
+ return null;
}
return self::$userOptions[$name]->optionID;
* @param int $objectTypeID
* @param int $userID
* @param int $objectID
- * @return UserObjectWatch
+ * @return UserObjectWatch|null
*/
public static function getUserObjectWatch($objectTypeID, $userID, $objectID)
{
$statement->execute([$objectTypeID, $userID, $objectID]);
$row = $statement->fetch();
if (!$row) {
- return;
+ return null;
}
return new self(null, $row);
/**
* Returns the spider object
*
- * @return Spider
+ * @return Spider|null
*/
public function getSpider()
{
if (!$this->spiderID) {
- return;
+ return null;
}
if ($this->spider === null) {
* Returns an instance of UserOptionCategory by name.
*
* @param string $categoryName
- * @return UserOptionCategory
+ * @return UserOptionCategory|null
*/
public static function getCategoryByName($categoryName)
{
$statement->execute([$categoryName]);
$row = $statement->fetchArray();
if ($row === false) {
- return;
+ return null;
}
return new self(null, $row);
public static function getActivePage()
{
if (self::getActiveRequest() === null) {
- return;
+ return null;
}
if (self::getActiveRequest()->getClassName() === CmsPage::class) {
return PageCache::getInstance()->getPage($metaData['cms']['pageID']);
}
- return;
+ return null;
}
return PageCache::getInstance()->getPageByController(self::getActiveRequest()->getClassName());
// get objects
$this->loadMarkedItems();
if (empty($this->markedItems)) {
- return;
+ return null;
}
$this->pageClasses = $pages;
public function getDatabaseConfig()
{
if (!isset($this->configuration['setup']) || !isset($this->configuration['setup']['database'])) {
- return;
+ return null;
}
// dirname return a single backslash on Windows if there are no parent directories
}
if ($dateTime === false) {
- return;
+ return null;
}
return $dateTime;
*
* @param string $type
* @param mixed $oldID
- * @return int $newID
+ * @return int|null
*/
public function getNewID($type, $oldID)
{
if (!$oldID) {
- return;
+ return null;
}
$objectTypeID = $this->objectTypes[$type]->objectTypeID;
* Returns a Language object for the language with the given id.
*
* @param int $languageID
- * @return Language
+ * @return Language|null
*/
public function getLanguage($languageID)
{
if (!isset($this->languages[$languageID])) {
if (!isset($this->cache['languages'][$languageID])) {
- return;
+ return null;
}
$this->languages[$languageID] = $this->cache['languages'][$languageID];
* Returns the first visible menu item.
*
* @param int $userID
- * @return UserProfileMenuItem
+ * @return UserProfileMenuItem|null
*/
public function getActiveMenuItem($userID = 0)
{
if (empty($this->menuItems)) {
- return;
+ return null;
}
if ($this->activeMenuItem === null) {
* Prompts for a text input for package directory (applies for applications only)
*
* @param string $applicationDirectory
- * @return FormDocument
+ * @return FormDocument|null
*/
protected function promptPackageDir($applicationDirectory)
{
FileUtil::makeWritable($packageDir);
}
- return;
+ return null;
}
}
if ($row === false) {
// PHP <7.4 _silently_ returns `null` when attempting to read an array index
// when the source value equals `false`.
- return;
+ return null;
}
return $row['queueID'];
*
* @param string $tableName
* @param string $columnName
- * @return int package id
+ * @return int|null package id
*/
protected function getColumnOwnerID($tableName, $columnName)
{
} elseif (isset($this->knownTables[$tableName])) {
return $this->knownTables[$tableName];
} else {
- return;
+ return null;
}
}
$controller = $data[1];
if ($application === 'wcf' && empty($controller)) {
- return;
+ return null;
} elseif (\preg_match('~^__WCF_CMS__(?P<pageID>\d+)$~', $controller, $matches)) {
$cmsPageData = $this->lookupCmsPage($matches['pageID'], 0);
if ($cmsPageData === null) {
if ($pageType === 'action' && $application !== 'wcf') {
$className = 'wcf\\' . ($isAcpRequest ? 'acp\\' : '') . $pageType . '\\' . $controller . \ucfirst($pageType);
if (!\class_exists($className)) {
- return;
+ return null;
}
} else {
- return;
+ return null;
}
}
// check for abstract classes
$reflectionClass = new \ReflectionClass($className);
if ($reflectionClass->isAbstract()) {
- return;
+ return null;
}
return [
{
$existingTags = $this->getObjectTags($objectType, $objectID);
if (empty($existingTags)) {
- return;
+ return null;
}
$languageIDs = [];
*
* @param string $templateName
* @param string $filename
- * @return array
+ * @return array|null
*/
protected function getMetaData($templateName, $filename)
{
if (!\file_exists($filename) || !\is_readable($filename)) {
- return;
+ return null;
}
// get file contents
// find first newline
$position = \strpos($contents, "\n");
if ($position === false) {
- return;
+ return null;
}
// cut contents
// read serializes data
$data = @\unserialize($contents);
if ($data === false || !\is_array($data)) {
- return;
+ return null;
}
return $data;
*
* @param string $objectType
* @param string $eventName
- * @return IUserNotificationEvent
+ * @return IUserNotificationEvent|null
*/
public function getEvent($objectType, $eventName)
{
if (!isset($this->availableEvents[$objectType][$eventName])) {
- return;
+ return null;
}
return $this->availableEvents[$objectType][$eventName];
public static function getParentBefore(\DOMNode $node, \DOMElement $ancestor)
{
if ($node->parentNode === $ancestor) {
- return;
+ return null;
}
$parents = self::getParents($node);