Skip to content

Commit

Permalink
[TASK] Use null comparison instead of is_null
Browse files Browse the repository at this point in the history
Resolves: #84091
Releases: master
Change-Id: I61c24937b919ec54c6547c07d1c4460186725c96
Reviewed-on: https://review.typo3.org/55950
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
wouter90 authored and lolli42 committed Mar 1, 2018
1 parent 56e1be6 commit 48eec02
Show file tree
Hide file tree
Showing 43 changed files with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ public function languageSwitch($table, $uid, $pid = null)
&& $languageField
&& $transOrigPointerField
) {
if (is_null($pid)) {
if ($pid === null) {
$row = BackendUtility::getRecord($table, $uid, 'pid');
$pid = $row['pid'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,25 @@ protected function formatValue($format, $itemValue, $formatOptions = [])
break;
case 'datetime':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && !is_null($itemValue)) {
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = date('H:i d-m-Y', (int)$itemValue);
}
break;
case 'time':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && !is_null($itemValue)) {
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = gmdate('H:i', (int)$itemValue);
}
break;
case 'timesec':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && !is_null($itemValue)) {
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = gmdate('H:i:s', (int)$itemValue);
}
break;
case 'year':
// compatibility with "eval" (type "input")
if ($itemValue !== '' && !is_null($itemValue)) {
if ($itemValue !== '' && $itemValue !== null) {
$itemValue = date('Y', (int)$itemValue);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ protected function isUserAllowedToModify($fieldConfig)
*/
protected function addInlineFirstPid(array $result)
{
if (is_null($result['inlineFirstPid'])) {
if ($result['inlineFirstPid'] === null) {
$table = $result['tableName'];
$row = $result['databaseRow'];
// If the parent is a page, use the uid(!) of the (new?) page as pid for the child records:
if ($table === 'pages') {
$liveVersionId = BackendUtility::getLiveVersionIdOfRecord('pages', $row['uid']);
$pid = is_null($liveVersionId) ? $row['uid'] : $liveVersionId;
$pid = $liveVersionId === null ? $row['uid'] : $liveVersionId;
} elseif ($row['pid'] < 0) {
$prevRec = BackendUtility::getRecord($table, abs($row['pid']));
$pid = $prevRec['pid'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static function overrideFieldConf($fieldConfig, $TSconfig)
public static function getTSconfigForTableRow($table, $row, $field = '')
{
static $cache;
if (is_null($cache)) {
if ($cache === null) {
$cache = [];
}
$cacheIdentifier = $table . ':' . $row['uid'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function addUserPermissionsToCategoryTreeData(DatabaseTreeDataProvider $d

foreach ($categoryMountPoints as $categoryMountPoint) {
$treeNode = $this->lookUpCategoryMountPointInTreeNodes((int)$categoryMountPoint, $treeNodeCollection);
if (!is_null($treeNode)) {
if ($treeNode !== null) {
$securedTreeNodeCollection->append($treeNode);
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ protected function lookUpCategoryMountPointInTreeNodes($categoryMountPoint, Tree

/** @var TreeNode $node */
$node = $this->lookUpCategoryMountPointInTreeNodes($categoryMountPoint, $treeNode->getChildNodes());
if (!is_null($node)) {
if ($node !== null) {
$result = $node;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions typo3/sysext/backend/Classes/Utility/BackendUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ public static function thumbCode(
}
} else {
// Find uploaddir automatically
if (is_null($uploaddir)) {
if ($uploaddir === null) {
$uploaddir = $GLOBALS['TCA'][$table]['columns'][$field]['config']['uploadfolder'];
}
$uploaddir = rtrim($uploaddir, '/');
Expand Down Expand Up @@ -2770,7 +2770,7 @@ public static function getModTSconfig($id, $TSref)
$beUser = static::getBackendUserAuthentication();
$pageTS_modOptions = $beUser->getTSConfig($TSref, static::getPagesTSconfig($id));
$BE_USER_modOptions = $beUser->getTSConfig($TSref);
if (is_null($BE_USER_modOptions['value'])) {
if ($BE_USER_modOptions['value'] === null) {
unset($BE_USER_modOptions['value']);
}
ArrayUtility::mergeRecursiveWithOverrule($pageTS_modOptions, $BE_USER_modOptions);
Expand Down Expand Up @@ -4130,7 +4130,7 @@ public static function getWorkspaceWhereClause($table, $workspaceId = null)
{
$whereClause = '';
if (self::isTableWorkspaceEnabled($table)) {
if (is_null($workspaceId)) {
if ($workspaceId === null) {
$workspaceId = static::getBackendUserAuthentication()->workspace;
}
$workspaceId = (int)$workspaceId;
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Classes/View/BackendLayoutView.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function getSelectedBackendLayout($pageId)

$backendLayout = $this->getDataProviderCollection()->getBackendLayout($selectedCombinedIdentifier, $pageId);
// If backend layout is not found available anymore, use default
if (is_null($backendLayout)) {
if ($backendLayout === null) {
$selectedCombinedIdentifier = 'default';
$backendLayout = $this->getDataProviderCollection()->getBackendLayout($selectedCombinedIdentifier, $pageId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function set($entryIdentifier, $data, array $tags = [], $lifetime = null)
1236518298
);
}
if (is_null($lifetime)) {
if ($lifetime === null) {
$lifetime = $this->defaultLifetime;
}
if ($lifetime === 0 || $lifetime > $this->maximumLifetime) {
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Configuration/Richtext.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function convertPlainArrayToTypoScriptArray(array $plainArray)
}
$typoScriptArray[$key . '.'] = $this->convertPlainArrayToTypoScriptArray($value);
} else {
$typoScriptArray[$key] = is_null($value) ? '' : $value;
$typoScriptArray[$key] = $value === null ? '' : $value;
}
}
return $typoScriptArray;
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Core/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function __clone()
*/
public static function getInstance()
{
if (is_null(static::$instance)) {
if (static::$instance === null) {
$applicationContext = getenv('TYPO3_CONTEXT') ?: (getenv('REDIRECT_TYPO3_CONTEXT') ?: 'Production');
self::$instance = new static($applicationContext);
self::$instance->defineTypo3RequestTypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ public function substituteMarkerArrayCached($content, array $markContentArray =
{
$runtimeCache = $this->getRuntimeCache();
// If not arrays then set them
if (is_null($markContentArray)) {
if ($markContentArray === null) {
// Plain markers
$markContentArray = [];
}
if (is_null($subpartContentArray)) {
if ($subpartContentArray === null) {
// Subparts being directly substituted
$subpartContentArray = [];
}
if (is_null($wrappedSubpartContentArray)) {
if ($wrappedSubpartContentArray === null) {
// Subparts being wrapped
$wrappedSubpartContentArray = [];
}
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Type/File/ImageInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getHeight()
*/
protected function getImageSizes()
{
if (is_null($this->imageSizes)) {
if ($this->imageSizes === null) {
$this->imageSizes = getimagesize($this->getPathname());

// Fallback to IM identify
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Utility/ArrayUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public static function arrayExport(array $array = [], $level = 0)
}
} elseif (is_int($value) || is_float($value)) {
$lines .= $value . ',' . LF;
} elseif (is_null($value)) {
} elseif ($value === null) {
$lines .= 'null' . ',' . LF;
} elseif (is_bool($value)) {
$lines .= $value ? 'true' : 'false';
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Utility/GeneralUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -4045,7 +4045,7 @@ public static function quoteJSvalue($value)
*/
public static function presetApplicationContext(ApplicationContext $applicationContext)
{
if (is_null(static::$applicationContext)) {
if (static::$applicationContext === null) {
static::$applicationContext = $applicationContext;
} else {
throw new \RuntimeException('Trying to override applicationContext which has already been defined!', 1376084316);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ protected function insertRelationInRelationtable(\TYPO3\CMS\Extbase\DomainObject
$row = [
$columnMap->getParentKeyFieldName() => (int)$parentUid,
$columnMap->getChildKeyFieldName() => (int)$object->getUid(),
$columnMap->getChildSortByFieldName() => !is_null($sortingPosition) ? (int)$sortingPosition : 0
$columnMap->getChildSortByFieldName() => $sortingPosition !== null ? (int)$sortingPosition : 0
];
$relationTableName = $columnMap->getRelationTableName();
if ($columnMap->getRelationTablePageIdColumnName() !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function count()
$this->initialize();
$numberOfElements = count($this->storage);
}
if (is_null($numberOfElements)) {
if ($numberOfElements === null) {
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception('The number of elements could not be determined.', 1252514486);
}
return $numberOfElements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ public function getPlainValue($input, $columnMap = null)
} elseif (is_int($input)) {
$parameter = $input;
} elseif ($input instanceof \DateTime) {
if (!is_null($columnMap) && !is_null($columnMap->getDateTimeStorageFormat())) {
if ($columnMap !== null && $columnMap->getDateTimeStorageFormat() !== null) {
$storageFormat = $columnMap->getDateTimeStorageFormat();
$timeZoneToStore = clone $input;
// set to UTC to store in database
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/extbase/Classes/Service/ImageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getImageUri(FileInterface $image, $absolute = false)
*/
public function getImage($src, $image, $treatIdAsReference)
{
if (is_null($image)) {
if ($image === null) {
$image = $this->getImageFromSourceString($src, $treatIdAsReference);
} elseif (is_callable([$image, 'getOriginalResource'])) {
// We have a domain model, so we need to fetch the FAL resource object from there
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/extbase/Classes/Utility/DebuggerUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected static function renderDump($value, $level, $plainText, $ansiColors)
$dump = sprintf('%s (%s)', self::ansiEscapeWrap($value, '35', $ansiColors), gettype($value));
} elseif (is_bool($value)) {
$dump = $value ? self::ansiEscapeWrap('TRUE', '32', $ansiColors) : self::ansiEscapeWrap('FALSE', '32', $ansiColors);
} elseif (is_null($value) || is_resource($value)) {
} elseif ($value === null || is_resource($value)) {
$dump = gettype($value);
} elseif (is_array($value)) {
$dump = self::renderArray($value, $level + 1, $plainText, $ansiColors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ protected static function flattenTypoScriptLabelArray(array $labelValues, $paren
*/
protected static function getConfigurationManager()
{
if (!is_null(static::$configurationManager)) {
if (static::$configurationManager !== null) {
return static::$configurationManager;
}
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function getStateString()
public function getDefaultState($state = null)
{
$defaultState = '';
if (is_null($state)) {
if ($state === null) {
$defaultState = self::$defaultStates;
} else {
if (is_string($state)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Mirrors extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
public function setSelect($mirrorId = null)
{
if (is_null($mirrorId)) {
if ($mirrorId === null) {
$this->isRandomSelection = true;
} else {
if (is_int($mirrorId) && $mirrorId >= 1 && $mirrorId <= count($this->mirrors)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function getMainRepositoryStatus()
/** @var $mainRepository \TYPO3\CMS\Extensionmanager\Domain\Model\Repository */
$mainRepository = $this->repositoryRepository->findOneTypo3OrgRepository();

if (is_null($mainRepository) === true) {
if ($mainRepository === null) {
$value = $this->languageService->getLL('report.status.mainRepository.notFound.value');
$message = $this->languageService->getLL('report.status.mainRepository.notFound.message');
$severity = \TYPO3\CMS\Reports\Status::ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function __construct()
*/
public function import($localExtensionListFile, $repositoryUid = null)
{
if (!is_null($repositoryUid) && is_int($repositoryUid)) {
if ($repositoryUid !== null && is_int($repositoryUid)) {
$this->repositoryUid = $repositoryUid;
}
$zlibStream = 'compress.zlib://';
Expand Down Expand Up @@ -192,11 +192,11 @@ protected function loadIntoDatabase(AbstractExtensionXmlParser &$subject)
0,
(int)$subject->getAlldownloadcounter(),
(int)$subject->getDownloadcounter(),
!is_null($subject->getTitle()) ? $subject->getTitle() : '',
$subject->getTitle() !== null ? $subject->getTitle() : '',
$subject->getOwnerusername(),
!is_null($subject->getAuthorname()) ? $subject->getAuthorname() : '',
!is_null($subject->getAuthoremail()) ? $subject->getAuthoremail() : '',
!is_null($subject->getAuthorcompany()) ? $subject->getAuthorcompany() : '',
$subject->getAuthorname() !== null ? $subject->getAuthorname() : '',
$subject->getAuthoremail() !== null ? $subject->getAuthoremail() : '',
$subject->getAuthorcompany() !== null ? $subject->getAuthorcompany() : '',
(int)$subject->getLastuploaddate(),
$subject->getT3xfilemd5(),
$this->repositoryUid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function getRemoteMirrorListFile()
public function getMirrors($forcedUpdateFromRemote = true)
{
$assignedMirror = $this->repository->getMirrors();
if ($forcedUpdateFromRemote || is_null($assignedMirror) || !is_object($assignedMirror)) {
if ($forcedUpdateFromRemote || $assignedMirror === null || !is_object($assignedMirror)) {
if ($forcedUpdateFromRemote || !is_file($this->getLocalMirrorListFile())) {
$this->fetchMirrorListFile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected function isSelected($value)
return true;
}
if ($this->hasArgument('multiple')) {
if (is_null($selectedValue) && $this->arguments['selectAllByDefault'] === true) {
if ($selectedValue === null && $this->arguments['selectAllByDefault'] === true) {
return true;
}
if (is_array($selectedValue) && in_array($value, $selectedValue)) {
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function initializeArguments()
*/
public function render()
{
if ((is_null($this->arguments['src']) && is_null($this->arguments['image'])) || (!is_null($this->arguments['src']) && !is_null($this->arguments['image']))) {
if (($this->arguments['src'] === null && $this->arguments['image'] === null) || ($this->arguments['src'] !== null && $this->arguments['image'] !== null)) {
throw new Exception('You must either specify a string src or a File object.', 1382284106);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
$cropString = $arguments['crop'];
$absolute = $arguments['absolute'];

if ((is_null($src) && is_null($image)) || (!is_null($src) && !is_null($image))) {
if (($src === null && $image === null) || ($src !== null && $image !== null)) {
throw new Exception('You must either specify a string src or a File object.', 1460976233);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function getVariable($var)
{
$vars = explode(':', $var, 2);
$val = $this->getVariableCommon($vars);
if (is_null($val)) {
if ($val === null) {
$splitAgain = explode('|', $vars[1], 2);
$k = trim($splitAgain[0]);
if ($k) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7007,7 +7007,7 @@ public function getQueryMarkers($table, $conf)
// Handle float
$markerValues[$marker] = (float)$tempValue;
}
} elseif (is_null($tempValue)) {
} elseif ($tempValue === null) {
// It represents NULL
$markerValues[$marker] = 'NULL';
} elseif (!empty($conf['markers.'][$dottedMarker]['commaSeparatedList'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ public function checkEnableFields($row, $bypassGroupCheck = false)
*/
public function checkPageGroupAccess($row, $groupList = null)
{
if (is_null($groupList)) {
if ($groupList === null) {
$groupList = $this->gr_list;
}
if (!is_array($groupList)) {
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/frontend/Classes/Utility/EidUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static function getTSFE()
{
// Cached instance
static $tsfe = null;
if (is_null($tsfe)) {
if ($tsfe === null) {
$tsfe = GeneralUtility::makeInstance(TypoScriptFrontendController::class, null, 0, 0);
}
return $tsfe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected function isWindowsOs()
*/
protected function getRelativePathBelowSiteRoot($path = null)
{
if (is_null($path)) {
if ($path === null) {
$path = $this->getAbsolutePath();
}
$pathSiteWithoutTrailingSlash = substr(PATH_site, 0, -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DirectoryNode extends AbstractNode implements NodeInterface
*/
public function __construct(array $structure, NodeInterface $parent = null)
{
if (is_null($parent)) {
if ($parent === null) {
throw new Exception\InvalidArgumentException(
'Node must have parent',
1366222203
Expand Down

0 comments on commit 48eec02

Please sign in to comment.