Skip to content

Commit d262f20

Browse files
committed
Enable Rector php 8.0 set
1 parent 475eb76 commit d262f20

File tree

210 files changed

+308
-1050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+308
-1050
lines changed

lib/ar-softdelete/src/SoftDeleteBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ private function detectRestoreAttributeValues()
532532
} elseif (!is_scalar($value) && is_callable($value)) {
533533
$restoreValue = null;
534534
} else {
535-
throw new InvalidConfigException('Unable to automatically determine restore attribute values, "' . get_class($this) . '::$restoreAttributeValues" should be explicitly set.');
535+
throw new InvalidConfigException('Unable to automatically determine restore attribute values, "' . static::class . '::$restoreAttributeValues" should be explicitly set.');
536536
}
537537
$restoreAttributeValues[$name] = $restoreValue;
538538
}

lib/ar-softdelete/src/SoftDeleteQueryBehavior.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function notDeleted()
183183
* @param mixed $deleted filter value.
184184
* @return \yii\db\ActiveQueryInterface|static
185185
*/
186-
public function filterDeleted($deleted)
186+
public function filterDeleted(mixed $deleted)
187187
{
188188
if ($deleted === '' || $deleted === null || $deleted === []) {
189189
return $this->notDeleted();
@@ -259,7 +259,7 @@ protected function defaultNotDeletedCondition()
259259
} elseif (!is_scalar($value) && is_callable($value)) {
260260
$restoreValue = null;
261261
} else {
262-
throw new InvalidConfigException('Unable to automatically determine not delete condition, "' . get_class($this) . '::$notDeletedCondition" should be explicitly set.');
262+
throw new InvalidConfigException('Unable to automatically determine not delete condition, "' . static::class . '::$notDeletedCondition" should be explicitly set.');
263263
}
264264

265265
$condition[$attribute] = $restoreValue;
@@ -297,12 +297,12 @@ protected function normalizeFilterCondition($condition)
297297
$alias = array_keys($fromTables)[0];
298298

299299
foreach ($condition as $attribute => $value) {
300-
if (is_numeric($attribute) || strpos($attribute, '.') !== false) {
300+
if (is_numeric($attribute) || str_contains($attribute, '.')) {
301301
continue;
302302
}
303303

304304
unset($condition[$attribute]);
305-
if (strpos($attribute, '[[') === false) {
305+
if (!str_contains($attribute, '[[')) {
306306
$attribute = '[[' . $attribute . ']]';
307307
}
308308
$attribute = $alias . '.' . $attribute;

lib/yii2/Yii.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function alias(string $path): string
5858

5959
$path = FileHelper::normalizePath($path);
6060
foreach (self::$_aliasPaths as $alias => $aliasPath) {
61-
if (strpos($path . DIRECTORY_SEPARATOR, $aliasPath . DIRECTORY_SEPARATOR) === 0) {
61+
if (str_starts_with($path . DIRECTORY_SEPARATOR, $aliasPath . DIRECTORY_SEPARATOR)) {
6262
return $alias . str_replace('\\', '/', substr($path, strlen($aliasPath)));
6363
}
6464
}

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
__DIR__ . '/src/base/ApplicationTrait.php',
2626
],
2727
])
28-
->withPhpSets(php74: true);
28+
->withPhpSets(php80: true);

src/Craft.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public static function parseEnv(?string $str = null): string|null|false
106106
* $status = Craft::parseBooleanEnv('$SYSTEM_STATUS') ?? false;
107107
* ```
108108
*
109-
* @param mixed $value
110109
* @return bool|null
111110
* @since 3.7.22
112111
* @deprecated in 3.7.29. [[App::parseBooleanEnv()]] should be used instead.

src/auth/sso/BaseExternalProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ protected function populateUser(User $user, array $data): User
334334
/**
335335
* Normalize a callback
336336
*
337-
* @param mixed $callback
338337
* @param string|null $defaultClass
339338
* @return callable|null
340339
* @throws \yii\base\InvalidConfigException

src/auth/sso/mapper/SetUserValueTrait.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ trait SetUserValueTrait
2828
* Set a value on a user; determine if we're setting a field value or property
2929
*
3030
* @param User $user
31-
* @param mixed $value
3231
* @return void
3332
*/
3433
protected function setValue(User $user, mixed $value): void

src/auth/sso/mapper/UserMapInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ interface UserMapInterface
1818
{
1919
/**
2020
* @param User $user
21-
* @param mixed $data
2221
* @return User
2322
*/
2423
public function __invoke(User $user, mixed $data): User;

src/base/Element.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ public function __toString(): string
25262526
public function __isset($name): bool
25272527
{
25282528
// Is this the "field:handle" syntax?
2529-
if (strncmp($name, 'field:', 6) === 0) {
2529+
if (str_starts_with($name, 'field:')) {
25302530
return $this->fieldByHandle(substr($name, 6)) !== null;
25312531
}
25322532

@@ -2544,7 +2544,7 @@ public function __get($name)
25442544
}
25452545

25462546
// Is this the "field:handle" syntax?
2547-
if (strncmp($name, 'field:', 6) === 0) {
2547+
if (str_starts_with($name, 'field:')) {
25482548
return $this->getFieldValue(substr($name, 6));
25492549
}
25502550

@@ -2562,7 +2562,7 @@ public function __get($name)
25622562
public function __set($name, $value)
25632563
{
25642564
// Is this the "field:handle" syntax?
2565-
if (strncmp($name, 'field:', 6) === 0) {
2565+
if (str_starts_with($name, 'field:')) {
25662566
$this->setFieldValue(substr($name, 6), $value);
25672567
return;
25682568
}
@@ -2584,7 +2584,7 @@ public function __set($name, $value)
25842584
*/
25852585
public function __call($name, $params)
25862586
{
2587-
if (strncmp($name, 'isFieldEmpty:', 13) === 0) {
2587+
if (str_starts_with($name, 'isFieldEmpty:')) {
25882588
return $this->isFieldEmpty(substr($name, 13));
25892589
}
25902590

@@ -2770,7 +2770,7 @@ public function getIterator(): Traversable
27702770
public function getAttributeLabel($attribute): string
27712771
{
27722772
// Is this the "field:handle" syntax?
2773-
if (strncmp($attribute, 'field:', 6) === 0) {
2773+
if (str_starts_with($attribute, 'field:')) {
27742774
$attribute = substr($attribute, 6);
27752775
}
27762776

@@ -2940,7 +2940,6 @@ public function afterValidate(): void
29402940
* Normalizes a field’s validation rule.
29412941
*
29422942
* @param string $attribute
2943-
* @param mixed $rule
29442943
* @param FieldInterface $field
29452944
* @param callable $isEmpty
29462945
* @return Validator
@@ -3036,7 +3035,7 @@ public function isFieldEmpty(string $handle): bool
30363035
*/
30373036
public function addError($attribute, $error = ''): void
30383037
{
3039-
if (strncmp($attribute, 'field:', 6) === 0) {
3038+
if (str_starts_with($attribute, 'field:')) {
30403039
$attribute = substr($attribute, 6);
30413040
}
30423041

@@ -6568,7 +6567,7 @@ protected function fieldLayoutFields(bool $visibleOnly = false): array
65686567
{
65696568
try {
65706569
$fieldLayout = $this->getFieldLayout();
6571-
} catch (InvalidConfigException $e) {
6570+
} catch (InvalidConfigException) {
65726571
return [];
65736572
}
65746573

@@ -6608,7 +6607,6 @@ public function getLanguage(): string
66086607
/**
66096608
* Returns an element right before/after this one, from a given set of criteria.
66106609
*
6611-
* @param mixed $criteria
66126610
* @param int $dir
66136611
* @return ElementInterface|null
66146612
*/

src/base/ElementInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,15 +1073,13 @@ public function getLocalized(): ElementQueryInterface|ElementCollection;
10731073
/**
10741074
* Returns the next element relative to this one, from a given set of criteria.
10751075
*
1076-
* @param mixed $criteria
10771076
* @return self|null
10781077
*/
10791078
public function getNext(mixed $criteria = false): ?self;
10801079

10811080
/**
10821081
* Returns the previous element relative to this one, from a given set of criteria.
10831082
*
1084-
* @param mixed $criteria
10851083
* @return self|null
10861084
*/
10871085
public function getPrev(mixed $criteria = false): ?self;

0 commit comments

Comments
 (0)