Skip to content

Commit 469377f

Browse files
authored
Fix classmap authoritative autoloading (nikic#1046)
This patch resolves nikic#1045 by adding dummy class definitions behind if (false) checks that are picked up the authoritative autoloader.
1 parent 74d3f7f commit 469377f

File tree

11 files changed

+138
-0
lines changed

11 files changed

+138
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Expr;
4+
35
require __DIR__ . '/../ArrayItem.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class ArrayItem extends \PhpParser\Node\ArrayItem {
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Expr;
4+
35
require __DIR__ . '/../ClosureUse.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class ClosureUse extends \PhpParser\Node\ClosureUse {
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Scalar;
4+
35
require __DIR__ . '/Float_.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class DNumber extends Float_ {
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Scalar;
4+
35
require __DIR__ . '/InterpolatedString.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class Encapsed extends InterpolatedString {
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Scalar;
4+
5+
use PhpParser\Node\InterpolatedStringPart;
6+
37
require __DIR__ . '/../InterpolatedStringPart.php';
8+
9+
if (false) {
10+
// For classmap-authoritative support.
11+
class EncapsedStringPart extends InterpolatedStringPart {
12+
}
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Scalar;
4+
35
require __DIR__ . '/Int_.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class LNumber extends Int_ {
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Stmt;
4+
5+
use PhpParser\Node\DeclareItem;
6+
37
require __DIR__ . '/../DeclareItem.php';
8+
9+
if (false) {
10+
// For classmap-authoritative support.
11+
class DeclareDeclare extends DeclareItem {
12+
}
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Stmt;
4+
5+
use PhpParser\Node\PropertyItem;
6+
37
require __DIR__ . '/../PropertyItem.php';
8+
9+
if (false) {
10+
// For classmap-authoritative support.
11+
class PropertyProperty extends PropertyItem {
12+
}
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Stmt;
4+
35
require __DIR__ . '/../StaticVar.php';
6+
7+
if (false) {
8+
// For classmap-authoritative support.
9+
class StaticVar extends \PhpParser\Node\StaticVar {
10+
}
11+
}

lib/PhpParser/Node/Stmt/UseUse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
<?php declare(strict_types=1);
22

3+
namespace PhpParser\Node\Stmt;
4+
5+
use PhpParser\Node\UseItem;
6+
37
require __DIR__ . '/../UseItem.php';
8+
9+
if (false) {
10+
// For classmap-authoritative support.
11+
class UseUse extends UseItem {
12+
}
13+
}

0 commit comments

Comments
 (0)