-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
157 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Nette\PhpGenerator\ClassType; | ||
use Tester\Assert; | ||
|
||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
require __DIR__ . '/fixtures/classes.php'; | ||
|
||
|
||
Assert::exception(function () { | ||
ClassType::withBodiesFrom(PDO::class); | ||
}, Nette\InvalidStateException::class, 'Source code of class PDO not found.'); | ||
|
||
|
||
Assert::exception(function () { | ||
ClassType::withBodiesFrom(new class { | ||
}); | ||
}, Nette\NotSupportedException::class, 'Anonymous classes are not supported.'); | ||
|
||
|
||
$res = ClassType::withBodiesFrom(Abc\Class7::class); | ||
sameFile(__DIR__ . '/expected/ClassType.from.bodies.expect', (string) $res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
abstract class Class7 | ||
{ | ||
abstract public function abstractFun(); | ||
|
||
|
||
public function emptyFun() | ||
{ | ||
} | ||
|
||
|
||
public function emptyFun2() | ||
{ | ||
} | ||
|
||
|
||
public function simple() | ||
{ | ||
return 1; | ||
} | ||
|
||
|
||
public function long() | ||
{ | ||
if ($member instanceof Method) { | ||
$s = [1, 2, 3]; | ||
} | ||
/* | ||
$this->methods[$member->getName()] = $member; | ||
*/ | ||
throw new Nette\InvalidArgumentException('Argument must be Method|Property|Constant.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters