Skip to content

Commit

Permalink
TASK: Add icons list to template (#3452)
Browse files Browse the repository at this point in the history
* TASK: Add icons list to template

Resolves: #3449

* [ci-review] Rector Rectify

---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
sabbelasichon and actions-user authored Aug 10, 2023
1 parent 49616c3 commit 719fdee
Show file tree
Hide file tree
Showing 139 changed files with 358 additions and 355 deletions.
8 changes: 4 additions & 4 deletions src/FileProcessor/FlexForms/FlexFormsProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function process(File $file, Configuration $configuration): array
}

$xml = $domDocument->saveXML($domDocument->documentElement, LIBXML_NOEMPTYTAG);
if (false === $xml) {
if ($xml === false) {
throw new UnexpectedValueException('Could not convert to xml');
}

Expand All @@ -89,7 +89,7 @@ public function process(File $file, Configuration $configuration): array
public function supports(File $file, Configuration $configuration): bool
{
// avoid empty run
if ([] === $this->flexFormRectors) {
if ($this->flexFormRectors === []) {
return false;
}

Expand All @@ -107,11 +107,11 @@ public function supports(File $file, Configuration $configuration): bool
return false;
}

if (false === $xml) {
if ($xml === false) {
return false;
}

return 'T3DataStructure' === $xml->getName();
return $xml->getName() === 'T3DataStructure';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function transform(DOMDocument $domDocument): bool
continue;
}

if ('select' !== $type->textContent) {
if ($type->textContent !== 'select') {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/FileProcessor/Fluid/FluidFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(array $fluidRectors, FileDiffFactory $fileDiffFactor

public function supports(File $file, Configuration $configuration): bool
{
if ([] === $this->fluidRectors) {
if ($this->fluidRectors === []) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ private function shouldSkip(File $file): bool
return true;
}

if ('constants.txt' === $smartFileInfo->getBasename()) {
if ($smartFileInfo->getBasename() === 'constants.txt') {
return false;
}

return 'setup.txt' !== $smartFileInfo->getBasename();
return $smartFileInfo->getBasename() !== 'setup.txt';
}

private function shouldSkipInTestMode(SmartFileInfo $smartFileInfo): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ private function shouldSkip(File $file): bool
return true;
}

if ('ext_typoscript_setup.txt' === $smartFileInfo->getBasename()) {
if ($smartFileInfo->getBasename() === 'ext_typoscript_setup.txt') {
return false;
}

if ('ext_typoscript_constants.txt' === $smartFileInfo->getBasename()) {
if ($smartFileInfo->getBasename() === 'ext_typoscript_constants.txt') {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/FileProcessor/Resources/Icons/IconsFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ private function shouldSkip(string $filenameWithoutExtension): bool
return false;
}

return self::EXT_ICON_NAME !== $filenameWithoutExtension;
return $filenameWithoutExtension !== self::EXT_ICON_NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function change(string $condition): ?string

$value = (int) $matches['value'];

if (1 === $value) {
if ($value === 1) {
return 'backend.user.isAdmin';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function shouldApply(string $condition): bool
return false;
}

return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition);
return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1;
}

private function isRegularExpression(string $regularExpression): bool
{
return false !== @preg_match($regularExpression, '');
return @preg_match($regularExpression, '') !== false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function refactorGetPost(string $property, string $operator, string $val
$value = sprintf("'%s'", $value);
}

if (1 === count($parameters)) {
if (count($parameters) === 1) {
return sprintf(
'request.getQueryParams()[\'%1$s\'] %2$s %3$s',
$parameters[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function change(string $condition): ?string
foreach ($keys as $key) {
[, , $operator] = explode('.', $key);

if ('=' === $operator && is_countable($conditions[$key]) && count($conditions[$key]) > 1) {
if ($operator === '=' && is_countable($conditions[$key]) && count($conditions[$key]) > 1) {
$values = [];
$condition = '';
foreach ($conditions[$key] as $value) {
Expand Down Expand Up @@ -122,15 +122,15 @@ public function shouldApply(string $condition): bool

private function refactorGetPost(string $property, string $operator, string $value): string
{
if ('L' === $property) {
if ($property === 'L') {
return sprintf('siteLanguage("languageId") %s "%s"', self::OPERATOR_MAPPING[$operator], $value);
}

$normalizedValue = $this->normalizeValue($value);

$parameters = $this->explodeParameters($property);

if (1 === count($parameters)) {
if (count($parameters) === 1) {
return sprintf(
'request.getQueryParams()[\'%1$s\'] %2$s %3$s',
$parameters[0],
Expand All @@ -139,7 +139,7 @@ private function refactorGetPost(string $property, string $operator, string $val
);
}

if ('_POST' === $property) {
if ($property === '_POST') {
return sprintf(
'traverse(request.getParsedBody(), \'%1$s\') %2$s %3$s) %2$s %3$s',
implode('/', $parameters),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public function shouldApply(string $condition): bool
return false;
}

return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition);
return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function change(string $condition): ?string
return $condition;
}

if (! isset($matches[1]) || '' === $matches[1]) {
if (! isset($matches[1]) || $matches[1] === '') {
return 'loginUser("*") == false';
}

Expand All @@ -33,6 +33,6 @@ public function change(string $condition): ?string

public function shouldApply(string $condition): bool
{
return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=#', $condition);
return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=#', $condition) === 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public function change(string $condition): ?string

public function shouldApply(string $condition): bool
{
return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '\|#', $condition);
return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '\|#', $condition) === 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function change(string $condition): ?string
$operator = $operatorAndValueMatches['operator'] ?? '';
$value = $operatorAndValueMatches['value'] ?? '';

if ('' === $operator) {
if ($operator === '') {
$operator = '=';
}

Expand All @@ -79,6 +79,6 @@ public function change(string $condition): ?string

public function shouldApply(string $condition): bool
{
return null !== Strings::match($condition, '#' . self::ALLOWED_TIME_CONSTANTS . '#Ui');
return Strings::match($condition, '#' . self::ALLOWED_TIME_CONSTANTS . '#Ui') !== null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function change(string $condition): ?string
return $condition;
}

if (! isset($matches[1]) || '' === $matches[1]) {
if (! isset($matches[1]) || $matches[1] === '') {
return "usergroup('*') == false";
}

Expand All @@ -33,6 +33,6 @@ public function change(string $condition): ?string

public function shouldApply(string $condition): bool
{
return 1 === preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition);
return preg_match('#^' . self::TYPE . self::ZERO_ONE_OR_MORE_WHITESPACES . '=[^=]#', $condition) === 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function getRuleDefinition(): RuleDefinition

public function convert(): ?AddedFileWithContent
{
if ([] === self::$persistenceArray) {
if (self::$persistenceArray === []) {
return null;
}

Expand Down Expand Up @@ -188,7 +188,7 @@ public function configure(array $configuration): void
{
$filename = $configuration[self::FILENAME] ?? null;

if (null !== $filename) {
if ($filename !== null) {
$this->filename = $filename;
}
}
Expand Down Expand Up @@ -242,11 +242,11 @@ private function extractColumns(array $paths, Assignment $statement): void
return;
}

if (isset($paths[4]) && 'config' === $paths[4]) {
if (isset($paths[4]) && $paths[4] === 'config') {
return;
}

if (isset($paths[5]) && 'type' === $paths[5]) {
if (isset($paths[5]) && $paths[5] === 'type') {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function enterNode(Statement $statement): void
return;
}

if ('TEMPLATE' !== $statement->value->value) {
if ($statement->value->value !== 'TEMPLATE') {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function enterNode(Statement $statement): void
return;
}

if ('config.disableCharsetHeader' !== $statement->object->absoluteName) {
if ($statement->object->absoluteName !== 'config.disableCharsetHeader') {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ public function enterNode(Statement $statement): void
return;
}

if ('lib.fluidContent' === $statement->object->relativeName) {
if ($statement->object->relativeName === 'lib.fluidContent') {
$this->hasChanged = true;
$statement->object->relativeName = 'lib.contentElement';

return;
}

if ('fluidContent' === $statement->object->relativeName) {
if ($statement->object->relativeName === 'fluidContent') {
$this->hasChanged = true;
$statement->object->relativeName = 'contentElement';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function enterNode(Statement $statement): void
return;
}

if (null !== $statement->condition) {
if ($statement->condition !== null) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function enterNode(Statement $statement): void

$changedCondition = $conditionMatcher->change($condition);
$applied = true;
if (null !== $changedCondition) {
if ($changedCondition !== null) {
$newConditions[] = $changedCondition;
}
}
Expand All @@ -90,19 +90,19 @@ public function enterNode(Statement $statement): void
$file->addRectorClassWithLine(new RectorWithLineChange($this, $statement->sourceLine));
}

if ([] === $newConditions) {
if ($newConditions === []) {
$statement->condition = '';

return;
}

if (1 === count($newConditions)) {
if (count($newConditions) === 1) {
$statement->condition = sprintf('[%s]', $newConditions[0]);

return;
}

if ([] === $operators) {
if ($operators === []) {
$statement->condition = sprintf('[%s]', implode(' || ', $newConditions));

return;
Expand All @@ -119,7 +119,7 @@ public function enterNode(Statement $statement): void
$newCondition = '';
foreach ($newConditions as $key => $value) {
$operator = $operators[$key];
if ('' === $operator) {
if ($operator === '') {
$newCondition .= $value;
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/FileProcessor/TypoScript/TypoScriptFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function __construct(

public function supports(File $file, Configuration $configuration): bool
{
if ([] === $this->typoScriptRectors) {
if ($this->typoScriptRectors === []) {
return false;
}

Expand Down Expand Up @@ -205,7 +205,7 @@ private function processFile(File $file): void
static fn (AbstractTypoScriptRector $typoScriptRector) => $typoScriptRector->hasChanged()
);

if ([] === $typoscriptRectorsWithChange) {
if ($typoscriptRectorsWithChange === []) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/FileProcessor/Yaml/Form/FormYamlFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function process(File $file, Configuration $configuration): array
public function supports(File $file, Configuration $configuration): bool
{
// Prevent unnecessary processing
if ([] === $this->transformer) {
if ($this->transformer === []) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ private function refactorFinishers(array $finishers, &$yamlToModify): bool
continue;
}

if ('replyToAddress' === $optionKey) {
if ($optionKey === 'replyToAddress') {
$yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['replyToRecipients'][] = $optionValue;
} elseif ('carbonCopyAddress' === $optionKey) {
} elseif ($optionKey === 'carbonCopyAddress') {
$yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['carbonCopyRecipients'][] = $optionValue;
} elseif ('blindCarbonCopyAddress' === $optionKey) {
} elseif ($optionKey === 'blindCarbonCopyAddress') {
$yamlToModify[self::FINISHERS][$finisherKey][self::OPTIONS]['blindCarbonCopyRecipients'][] = $optionValue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Helper/ArrayUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function trimExplode(
bool $removeEmptyValues = false,
int $limit = 0
): array {
if ('' === $delimiter) {
if ($delimiter === '') {
throw new InvalidArgumentException('Please define a correct delimiter');
}

Expand All @@ -26,7 +26,7 @@ public static function trimExplode(
if ($removeEmptyValues) {
$temp = [];
foreach ($result as $value) {
if ('' !== trim($value)) {
if (trim($value) !== '') {
$temp[] = $value;
}
}
Expand Down
Loading

0 comments on commit 719fdee

Please sign in to comment.