Skip to content

Commit e4a6dbc

Browse files
authored
Merge branch 'main' into __sleep__
2 parents 02052bb + 078f193 commit e4a6dbc

96 files changed

Lines changed: 2058 additions & 328 deletions

File tree

Some content is hidden

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

build/build-rector-scoped.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ note "Starts"
2828

2929
# 2. scope it
3030
note "Downloading php-scoper.phar"
31-
wget https://github.com/humbug/php-scoper/releases/download/0.18.10/php-scoper.phar -N --no-verbose
31+
wget https://github.com/humbug/php-scoper/releases/download/0.18.17/php-scoper.phar -N --no-verbose
3232

3333
# avoid phpstan/phpstan dependency duplicate
3434
note "Remove PHPStan to avoid duplicating it"

config/set/php83.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6+
use Rector\Php83\Rector\BooleanAnd\JsonValidateRector;
67
use Rector\Php83\Rector\Class_\ReadOnlyAnonymousClassRector;
78
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
89
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
@@ -18,5 +19,6 @@
1819
RemoveGetClassGetParentClassNoArgsRector::class,
1920
ReadOnlyAnonymousClassRector::class,
2021
DynamicClassConstFetchRector::class,
22+
JsonValidateRector::class,
2123
]);
2224
};

config/set/php85.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Rector\Php85\Rector\Const_\DeprecatedAnnotationToDeprecatedAttributeRector;
1414
use Rector\Php85\Rector\FuncCall\ArrayKeyExistsNullToEmptyStringRector;
1515
use Rector\Php85\Rector\FuncCall\ChrArgModuloRector;
16+
use Rector\Php85\Rector\FuncCall\OrdSingleByteRector;
1617
use Rector\Php85\Rector\FuncCall\RemoveFinfoBufferContextArgRector;
1718
use Rector\Php85\Rector\Switch_\ColonAfterSwitchCaseRector;
1819
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
@@ -39,6 +40,7 @@
3940
ArrayKeyExistsNullToEmptyStringRector::class,
4041
ChrArgModuloRector::class,
4142
SleepToSerializeRector::class,
43+
OrdSingleByteRector::class,
4244
]
4345
);
4446

@@ -205,10 +207,7 @@
205207
);
206208

207209
// https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_filter_default_constant
208-
$rectorConfig->ruleWithConfiguration(
209-
RenameConstantRector::class,
210-
[
211-
'FILTER_DEFAULT' => 'FILTER_UNSAFE_RAW',
212-
]
213-
);
210+
$rectorConfig->ruleWithConfiguration(RenameConstantRector::class, [
211+
'FILTER_DEFAULT' => 'FILTER_UNSAFE_RAW',
212+
]);
214213
};

e2e/parallel-custom-config/expected-output.diff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
{
1010
public function __construct(
1111
- private readonly \stdClass $stdClass
12+
+ /**
13+
+ * @readonly
14+
+ */
1215
+ private \stdClass $stdClass
1316
)
1417
{

phpstan.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ parameters:
218218

219219
- '#Register "Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector" service to "php81\.php" config set#'
220220

221+
- '#Register "Rector\\Php80\\Rector\\NotIdentical\\MbStrContainsRector" service to "php80\.php" config set#'
222+
221223
# closure detailed
222224
- '#Method Rector\\Config\\RectorConfig\:\:singleton\(\) has parameter \$concrete with no signature specified for Closure#'
223225

@@ -338,3 +340,7 @@ parameters:
338340
identifier: rector.upgradeDowngradeRegisteredInSet
339341
count: 1
340342
path: rules/Php74/Rector/Double/RealToFloatTypeCastRector.php
343+
344+
-
345+
message: '#Offset float\|int\|string might not exist on string#'
346+
path: rules/Php70/EregToPcreTransformer.php
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Assert\Rector\ClassMethod\AddAssertArrayFromClassMethodDocblockRector;
6+
7+
use Iterator;
8+
use PHPUnit\Framework\Attributes\DataProvider;
9+
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
10+
11+
final class BeberleiTest extends AbstractRectorTestCase
12+
{
13+
#[DataProvider('provideData')]
14+
public function test(string $filePath): void
15+
{
16+
$this->doTestFile($filePath);
17+
}
18+
19+
public static function provideData(): Iterator
20+
{
21+
return self::yieldFilesFromDirectory(__DIR__ . '/FixtureBeberlei');
22+
}
23+
24+
public function provideConfigFilePath(): string
25+
{
26+
return __DIR__ . '/config/beberlei_assert.php';
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Rector\Tests\Assert\Rector\ClassMethod\AddAssertArrayFromClassMethodDocblockRector\FixtureBeberlei;
4+
5+
final class FloatIntBool
6+
{
7+
/**
8+
* @param int[] $items
9+
* @param float[] $numbers
10+
* @param bool[] $options
11+
*/
12+
public function run(array $items, array $numbers, array $options)
13+
{
14+
15+
}
16+
}
17+
18+
?>
19+
-----
20+
<?php
21+
22+
namespace Rector\Tests\Assert\Rector\ClassMethod\AddAssertArrayFromClassMethodDocblockRector\FixtureBeberlei;
23+
24+
final class FloatIntBool
25+
{
26+
/**
27+
* @param int[] $items
28+
* @param float[] $numbers
29+
* @param bool[] $options
30+
*/
31+
public function run(array $items, array $numbers, array $options)
32+
{
33+
\Assert\Assertion::allInteger($items);
34+
\Assert\Assertion::allFloat($numbers);
35+
\Assert\Assertion::allBoolean($options);
36+
}
37+
}
38+
39+
?>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Assert\Enum\AssertClassName;
6+
use Rector\Assert\Rector\ClassMethod\AddAssertArrayFromClassMethodDocblockRector;
7+
use Rector\Config\RectorConfig;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(AddAssertArrayFromClassMethodDocblockRector::class, [
11+
AssertClassName::BEBERLEI,
12+
]);
13+
};

rules-tests/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector/Fixture/mashup.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Rector\Tests\CodeQuality\Rector\ClassMethod\OptionalParametersAfterReq
1717

1818
class Mashup
1919
{
20-
public function run($required, $yetRequired, $optional = 1, $anotherOptional = false)
20+
public function run($optional = 1, $required = null, $anotherOptional = false, $yetRequired = null)
2121
{
2222
}
2323
}

rules-tests/CodeQuality/Rector/ClassMethod/OptionalParametersAfterRequiredRector/Fixture/new_the_constructor.php.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ namespace Rector\Tests\CodeQuality\Rector\ClassMethod\OptionalParametersAfterReq
2626

2727
final class NewTheConstructor
2828
{
29-
public function __construct($required, $optional = 1)
29+
public function __construct($optional = 1, $required = null)
3030
{
3131
}
3232

3333
public function create()
3434
{
35-
return new self(5, 1);
35+
return new self(1, 5);
3636
}
3737
}
3838

0 commit comments

Comments
 (0)