-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#628 added unit tests to verify correct codegen of proxies that exten…
…d classes with PHP 8.0 types
- Loading branch information
1 parent
27adab8
commit 7157b41
Showing
5 changed files
with
92 additions
and
9 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
54 changes: 54 additions & 0 deletions
54
tests/ProxyManagerTestAsset/ClassWithPhp80TypedMethods.php
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,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ProxyManagerTestAsset; | ||
|
||
use BadMethodCallException; | ||
|
||
/** | ||
* Base test class to play around with new method type definitions that came with PHP 8.0.0 | ||
*/ | ||
class ClassWithPhp80TypedMethods | ||
{ | ||
public function mixedType(mixed $parameter): mixed | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
/** Note: the false type cannot be used standalone, and must be part of a union type */ | ||
public function falseType(false|self $parameter): false|self | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function unionNullableType(bool|null $parameter): bool|null | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function unionReverseNullableType(null|bool $parameter): null|bool | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function unionNullableTypeWithDefaultValue(bool|string|null $parameter = null): bool|string|null | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function unionType(ClassWithPhp80TypedMethods|\stdClass $parameter): ClassWithPhp80TypedMethods|\stdClass | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function staticType(self $parameter): static | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
|
||
public function selfAndBoolType(self|bool $parameter): self|bool | ||
{ | ||
throw new BadMethodCallException('Not supposed to be run'); | ||
} | ||
} |