Skip to content

Commit eb0ee8a

Browse files
committed
Updated Rector to commit 188b90af99dacc322fb28c93bc0755f3881be53f
rectorphp/rector-src@188b90a [Scoped] Load early preload.php on scoped bootstrap.php on phpunit 12+ running (#7451)
1 parent 3176cfd commit eb0ee8a

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

bootstrap.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
<?php
22

3-
declare(strict_types = 1);
3+
declare(strict_types=1);
4+
5+
use PHPParser\Node;
6+
use PHPUnit\Runner\Version;
7+
8+
/**
9+
* The preload.php contains 2 dependencies
10+
* - phpstan/phpdoc-parser
11+
* - nikic/php-parser
12+
*
13+
* They need to be loaded early to avoid conflict version between rector prefixed vendor and Project vendor
14+
* For example, a project may use phpstan/phpdoc-parser v1, while rector uses phpstan/phpdoc-parser uses v2, that will error as class or logic are different.
15+
*/
16+
if (
17+
// verify PHPUnit is running
18+
defined('PHPUNIT_COMPOSER_INSTALL')
19+
20+
// no need to preload if Node interface exists
21+
&& ! interface_exists(Node::class, false)
22+
23+
// ensure force autoload version with class_exists() with true argument as not yet loaded
24+
// for phpunit 12+ only
25+
&& class_exists(Version::class, true) && (int) Version::id() >= 12
26+
) {
27+
require_once __DIR__ . '/preload.php';
28+
}
429

530
// inspired by https://github.com/phpstan/phpstan/blob/master/bootstrap.php
631
spl_autoload_register(function (string $class): void {

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '7ccb174abecda973a5f37b174c1343866dc82c5c';
22+
public const PACKAGE_VERSION = '188b90af99dacc322fb28c93bc0755f3881be53f';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-10-08 14:53:58';
27+
public const RELEASE_DATE = '2025-10-09 15:54:22';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)