Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Classes/Service/AssetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ protected function buildAssetsChunk(array $assets): string
$chunk = [];
foreach ($spooledAssets as $name => $asset) {
$assetSettings = $this->extractAssetSettings($asset);
$standalone = (boolean) $assetSettings['standalone'];
$external = (boolean) $assetSettings['external'];
$rewrite = (boolean) $assetSettings['rewrite'];
$standalone = (bool) $assetSettings['standalone'];
$external = (bool) $assetSettings['external'];
$rewrite = (bool) $assetSettings['rewrite'];
$path = $assetSettings['path'];
if (!$standalone) {
$chunk[$name] = $asset;
Expand Down Expand Up @@ -674,7 +674,7 @@ protected function assertAssetAllowedInFooter($asset): bool
if ($asset instanceof AssetInterface) {
return $asset->assertAllowedInFooter();
}
return (boolean) ($asset['movable'] ?? true);
return (bool) ($asset['movable'] ?? true);
}

/**
Expand Down
28 changes: 14 additions & 14 deletions Classes/Service/PageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getMenu(
): array {
$pageRepository = $this->getPageRepository();
$pageConstraints = $this->getPageConstraints($excludePages, $includeNotInMenu, $includeMenuSeparator);
$cacheKey = md5($pageUid . $pageConstraints . (integer) $disableGroupAccessCheck);
$cacheKey = md5($pageUid . $pageConstraints . (int) $disableGroupAccessCheck);
if (!isset(static::$cachedMenus[$cacheKey])) {
if ($disableGroupAccessCheck
&& version_compare(VersionNumberUtility::getCurrentTypo3Version(), '12.1', '<=')
Expand All @@ -65,7 +65,7 @@ function ($page) use ($includeNotInMenu) {

public function getPage(int $pageUid, bool $disableGroupAccessCheck = false): array
{
$cacheKey = md5($pageUid . (integer) $disableGroupAccessCheck);
$cacheKey = md5($pageUid . (int) $disableGroupAccessCheck);
if (!isset(static::$cachedPages[$cacheKey])) {
static::$cachedPages[$cacheKey] = $this->getPageRepository()->getPage($pageUid, $disableGroupAccessCheck);
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public function hidePageForLanguageUid($page = null, int $languageUid = -1, bool
$pageUid = $page['uid'];
$pageRecord = $page;
} else {
$pageUid = (0 === (integer) $page) ? $GLOBALS['TSFE']->id : (integer) $page;
$pageUid = (0 === (int) $page) ? $GLOBALS['TSFE']->id : (int) $page;
$pageRecord = $this->getPage($pageUid);
}
if (-1 === $languageUid) {
Expand All @@ -165,8 +165,8 @@ public function hidePageForLanguageUid($page = null, int $languageUid = -1, bool
$hideIfNotTranslated = $visibilityBitSet->shouldHideTranslationIfNoTranslatedRecordExists();
$hideIfDefaultLanguage = $visibilityBitSet->shouldBeHiddenInDefaultLanguage();
} else {
$hideIfNotTranslated = (boolean) GeneralUtility::hideIfNotTranslated($l18nCfg);
$hideIfDefaultLanguage = (boolean) GeneralUtility::hideIfDefaultLanguage($l18nCfg);
$hideIfNotTranslated = (bool) GeneralUtility::hideIfNotTranslated($l18nCfg);
$hideIfDefaultLanguage = (bool) GeneralUtility::hideIfDefaultLanguage($l18nCfg);
}

$pageOverlay = [];
Expand All @@ -184,7 +184,7 @@ public function hidePageForLanguageUid($page = null, int $languageUid = -1, bool
public function getItemLink(array $page, bool $forceAbsoluteUrl = false): string
{
$parameter = $page['uid'];
if ((integer) $page['doktype'] === PageRepository::DOKTYPE_LINK) {
if ((int) $page['doktype'] === PageRepository::DOKTYPE_LINK) {
$redirectTo = $page['url'] ?? '';
if (!empty($redirectTo)) {
$uI = parse_url($redirectTo);
Expand Down Expand Up @@ -212,7 +212,7 @@ public function getItemLink(array $page, bool $forceAbsoluteUrl = false): string

public function isAccessProtected(array $page): bool
{
return (0 !== (integer) $page['fe_group']);
return (0 !== (int) $page['fe_group']);
}

public function isAccessGranted(array $page): bool
Expand All @@ -235,14 +235,14 @@ public function isAccessGranted(array $page): bool

public function isCurrent(int $pageUid): bool
{
return ($pageUid === (integer) $GLOBALS['TSFE']->id);
return ($pageUid === (int) $GLOBALS['TSFE']->id);
}

public function isActive(int $pageUid): bool
{
$rootLineData = $this->getRootLine();
foreach ($rootLineData as $page) {
if ((integer) $page['uid'] === $pageUid) {
if ((int) $page['uid'] === $pageUid) {
return true;
}
}
Expand All @@ -252,19 +252,19 @@ public function isActive(int $pageUid): bool

public function shouldUseShortcutTarget(array $arguments): bool
{
$useShortcutTarget = (boolean) $arguments['useShortcutData'];
$useShortcutTarget = (bool) $arguments['useShortcutData'];
if (array_key_exists('useShortcutTarget', $arguments)) {
$useShortcutTarget = (boolean) $arguments['useShortcutTarget'];
$useShortcutTarget = (bool) $arguments['useShortcutTarget'];
}

return $useShortcutTarget;
}

public function shouldUseShortcutUid(array $arguments): bool
{
$useShortcutUid = (boolean) $arguments['useShortcutData'];
$useShortcutUid = (bool) $arguments['useShortcutData'];
if (array_key_exists('useShortcutUid', $arguments)) {
$useShortcutUid = (boolean) $arguments['useShortcutUid'];
$useShortcutUid = (bool) $arguments['useShortcutUid'];
}

return $useShortcutUid;
Expand All @@ -277,7 +277,7 @@ public function shouldUseShortcutUid(array $arguments): bool
*/
public function getShortcutTargetPage(array $page): ?array
{
$dokType = (integer) ($page['doktype'] ?? PageRepository::DOKTYPE_DEFAULT);
$dokType = (int) ($page['doktype'] ?? PageRepository::DOKTYPE_DEFAULT);
if ($dokType !== PageRepository::DOKTYPE_SHORTCUT) {
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/Traits/SlideViewHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function getSlideRecords(int $pageUid, ?int $limit = null): array
$limit = $limit ?? $this->arguments['limit'];
/** @var int $slide */
$slide = $this->arguments['slide'];
$slideCollectReverse = (boolean) $this->arguments['slideCollectReverse'];
$slideCollectReverse = (bool) $this->arguments['slideCollectReverse'];
/** @var int $slideCollect */
$slideCollect = $this->arguments['slideCollect'];

Expand All @@ -106,14 +106,14 @@ protected function getSlideRecords(int $pageUid, ?int $limit = null): array

$storagePageUids = [];
foreach ($rootLine as $page) {
$storagePageUids[] = (integer) $page['uid'];
$storagePageUids[] = (int) $page['uid'];
}

// select records, respecting slide and slideCollect.
$records = [];
$limitRemaining = $limit;
while (!empty($storagePageUids) && ($limitRemaining > 0 || !$limit)) {
$storagePageUid = (integer) array_shift($storagePageUids);
$storagePageUid = (int) array_shift($storagePageUids);
$recordsFromPageUid = $this->getSlideRecordsFromPage($storagePageUid, $limitRemaining);
$numberOfReturnedRecords = count($recordsFromPageUid);
if ($numberOfReturnedRecords > $limitRemaining && $limitRemaining !== null) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Traits/SourceSetViewHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function addSourceSet(TagBuilder $tag, string $src): array
$quality = $this->arguments['quality'];
/** @var string|null $crop */
$crop = $this->arguments['crop'];
$treatIdAsReference = (boolean) $this->arguments['treatIdAsReference'];
$treatIdAsReference = (bool) $this->arguments['treatIdAsReference'];
if ($treatIdAsReference) {
/** @var string $src */
$src = $this->arguments['src'];
Expand Down
2 changes: 1 addition & 1 deletion Classes/Traits/TagViewHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function renderTag(
array $nonEmptyAttributes = ['id', 'class']
): string {
$trimmedContent = trim((string) $content);
$forceClosingTag = (boolean) ($this->arguments['forceClosingTag'] ?? false);
$forceClosingTag = (bool) ($this->arguments['forceClosingTag'] ?? false);
if (empty($trimmedContent) && ($this->arguments['hideIfEmpty'] ?? false)) {
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/ErrorUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public static function throwViewHelperException(
?int $code = null,
?\Throwable $previous = null
): void {
throw new Exception((string) $message, (integer) $code, $previous);
throw new Exception((string) $message, (int) $code, $previous);
}
}
8 changes: 4 additions & 4 deletions Classes/ViewHelpers/Condition/Iterator/ContainsViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected static function assertHaystackIsQueryResultAndHasNeedle($haystack, $ne
* @var DomainObjectInterface $candidate
*/
foreach ($haystack as $index => $candidate) {
if ($candidate->getUid() === (integer) $needle) {
if ($candidate->getUid() === (int) $needle) {
return $index;
}
}
Expand All @@ -129,12 +129,12 @@ protected static function assertHaystackIsObjectStorageAndHasNeedle($haystack, $
{
$index = 0;
if ($needle instanceof DomainObjectInterface) {
$needle = (integer) $needle->getUid();
$needle = (int) $needle->getUid();
}

/** @var DomainObjectInterface $candidate */
foreach ($haystack as $candidate) {
if ($candidate->getUid() === (integer) $needle) {
if ($candidate->getUid() === (int) $needle) {
return $index;
}
$index++;
Expand All @@ -160,7 +160,7 @@ protected static function assertHaystackIsArrayAndHasNeedle($haystack, $needle,
return $result;
} else {
foreach ($haystack as $index => $straw) {
if ((integer) $straw->getUid() === (integer) $needle->getUid()) {
if ((int) $straw->getUid() === (int) $needle->getUid()) {
return $index;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Classes/ViewHelpers/Condition/Page/HasSubpagesViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public static function verdict(array $arguments, RenderingContextInterface $rend
{
/** @var int $pageUid */
$pageUid = $arguments['pageUid'];
$includeHiddenInMenu = (boolean) $arguments['includeHiddenInMenu'];
$includeAccessProtected = (boolean) $arguments['includeAccessProtected'];
$includeHiddenInMenu = (bool) $arguments['includeHiddenInMenu'];
$includeAccessProtected = (bool) $arguments['includeAccessProtected'];

if (empty($pageUid) || 0 === (integer) $pageUid) {
if (empty($pageUid) || 0 === (int) $pageUid) {
$pageUid = $GLOBALS['TSFE']->id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static function verdict(array $arguments, RenderingContextInterface $rend
{
/** @var int $pageUid */
$pageUid = $arguments['pageUid'];
$respectSiteRoot = (boolean) $arguments['respectSiteRoot'];
$respectSiteRoot = (bool) $arguments['respectSiteRoot'];

if (empty($pageUid)) {
/** @var int $pageUid */
Expand Down
12 changes: 6 additions & 6 deletions Classes/ViewHelpers/Content/AbstractContentViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getContentRecords(): array

$pageUid = $this->getPageUid();

if ((integer) $slide === 0) {
if ((int) $slide === 0) {
$contentRecords = $this->getSlideRecordsFromPage($pageUid, $limit);
} else {
$contentRecords = $this->getSlideRecords($pageUid, $limit);
Expand Down Expand Up @@ -129,15 +129,15 @@ protected function getSlideRecordsFromPage(int $pageUid, ?int $limit): array
'max' => $limit,
// Note: pidInList must not use $pageUid which defaults to current PID. Use argument-passed pageUid!
// A value of zero here removes the "pid" from the condition generated by ContentObjectRenderer.
'pidInList' => (integer)$pageUid,
'pidInList' => (int)$pageUid,
'includeRecordsWithoutDefaultTranslation' => !$this->arguments['hideUntranslated']
]
);
}

$conditions = '1=1';
if (is_numeric($this->arguments['column'])) {
$conditions = sprintf('colPos = %d', (integer) $this->arguments['column']);
$conditions = sprintf('colPos = %d', (int) $this->arguments['column']);
}
if ($this->arguments['sectionIndexOnly']) {
$conditions .= ' AND sectionIndex = 1';
Expand Down Expand Up @@ -174,12 +174,12 @@ protected function getPageUid(): int
/** @var int $pageUid */
$pageUid = $this->arguments['pageUid'];

$pageUid = (integer) $pageUid;
$pageUid = (int) $pageUid;
if (1 > $pageUid) {
$pageUid = (integer) ($GLOBALS['TSFE']->page['content_from_pid'] ?? 0);
$pageUid = (int) ($GLOBALS['TSFE']->page['content_from_pid'] ?? 0);
}
if (1 > $pageUid) {
$pageUid = (integer) ($GLOBALS['TSFE']->id ?? 0);
$pageUid = (int) ($GLOBALS['TSFE']->id ?? 0);
}
return $pageUid;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Count/BytesViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ public static function renderStatic(
) {
/** @var string $encoding */
$encoding = $arguments['encoding'];
return (integer) mb_strlen($renderChildrenClosure(), $encoding);
return (int) mb_strlen($renderChildrenClosure(), $encoding);
}
}
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/DebugViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* Path: {domainObject}
* Value type: object
* Accessible properties on {domainObject}:
* {form.uid} (integer)
* {form.uid} (int)
* {form.title} (string)
* ```
*
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/Format/DateRangeViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static function renderStatic(
$output = null;
$return = $arguments['return'];
if (null === $return) {
$spaceGlue = (boolean) $arguments['spaceGlue'];
$spaceGlue = (bool) $arguments['spaceGlue'];
/** @var string $glue */
$glue = $arguments['glue'];
/** @var string $startFormat */
Expand Down Expand Up @@ -241,7 +241,7 @@ protected static function enforceDateTime($date): \DateTime
protected static function formatDate(\DateTime $date, string $format = 'Y-m-d'): string
{
if (false !== strpos($format, '%')) {
return (string) strftime($format, (integer) $date->format('U'));
return (string) strftime($format, (int) $date->format('U'));
}
return $date->format($format);
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/ViewHelpers/Format/EliminateViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ public static function renderStatic(
$content = static::eliminateCharacters(
$content,
$arguments['characters'],
(boolean) $arguments['caseSensitive']
(bool) $arguments['caseSensitive']
);
}
if (isset($arguments['strings'])) {
$content = static::eliminateStrings($content, $arguments['strings'], (boolean) $arguments['caseSensitive']);
$content = static::eliminateStrings($content, $arguments['strings'], (bool) $arguments['caseSensitive']);
}
if ($arguments['whitespace']) {
$content = static::eliminateWhitespace($content);
Expand All @@ -113,10 +113,10 @@ public static function renderStatic(
$content = static::eliminateDigits($content);
}
if ($arguments['letters']) {
$content = static::eliminateLetters($content, (boolean) $arguments['caseSensitive']);
$content = static::eliminateLetters($content, (bool) $arguments['caseSensitive']);
}
if ($arguments['nonAscii']) {
$content = static::eliminateNonAscii($content, (boolean) $arguments['caseSensitive']);
$content = static::eliminateNonAscii($content, (bool) $arguments['caseSensitive']);
}
return $content;
}
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/Format/Json/EncodeViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public static function renderStatic(
RenderingContextInterface $renderingContext
) {
$value = $renderChildrenClosure();
$useTraversableKeys = (boolean) $arguments['useTraversableKeys'];
$preventRecursion = (boolean) $arguments['preventRecursion'];
$useTraversableKeys = (bool) $arguments['useTraversableKeys'];
$preventRecursion = (bool) $arguments['preventRecursion'];
/** @var string $recursionMarker */
$recursionMarker = $arguments['recursionMarker'] ?? '**recursion**';
/** @var string|null $dateTimeFormat */
Expand Down
4 changes: 2 additions & 2 deletions Classes/ViewHelpers/Format/MarkdownViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public static function renderStatic(
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
$trim = (boolean) $arguments['trim'];
$htmlentities = (boolean) $arguments['htmlentities'];
$trim = (bool) $arguments['trim'];
$htmlentities = (bool) $arguments['htmlentities'];
$text = $renderChildrenClosure();
if (null === $text) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Format/ReplaceViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function renderStatic(
$replacement = is_scalar($replacement) ? (string) $replacement : (array) $replacement;

$count = 0;
$caseSensitive = (boolean) $arguments['caseSensitive'];
$caseSensitive = (bool) $arguments['caseSensitive'];
$function = $caseSensitive ? 'str_replace' : 'str_ireplace';
$replaced = $function($substring, $replacement, $content, $count);
if ($arguments['returnCount'] ?? false) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Iterator/AbstractLoopViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected static function renderIteration(
) {
if (!empty($iterationArgument)) {
$variableProvider = $renderingContext->getVariableProvider();
$cycle = (integer) (($i - $from) / $step) + 1;
$cycle = (int) (($i - $from) / $step) + 1;
$iteration = [
'index' => $i,
'cycle' => $cycle,
Expand Down
Loading
Loading