-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #910 from beberlei/Php8support
Add support for union types and mixed type in ProxyGenerator
- Loading branch information
Showing
8 changed files
with
116 additions
and
26 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
46 changes: 25 additions & 21 deletions
46
tests/Doctrine/Tests/Common/Proxy/MagicIssetClassWithInteger.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 |
---|---|---|
@@ -1,33 +1,37 @@ | ||
<?php | ||
|
||
if (PHP_VERSION_ID < 80000) { | ||
eval(<<<'BROKEN_CODE' | ||
namespace Doctrine\Tests\Common\Proxy; | ||
use BadMethodCallException; | ||
|
||
/** | ||
* Test asset class | ||
*/ | ||
class MagicIssetClassWithInteger | ||
{ | ||
/** @var string */ | ||
public $id = 'id'; | ||
|
||
/** @var string */ | ||
public $publicField = 'publicField'; | ||
|
||
/** | ||
* @throws BadMethodCallException | ||
* Test asset class | ||
*/ | ||
public function __isset(string $name) : int | ||
class MagicIssetClassWithInteger | ||
{ | ||
if ($name === 'test') { | ||
return 1; | ||
} | ||
/** @var string */ | ||
public $id = 'id'; | ||
if ($name === 'publicField' || $name === 'id') { | ||
throw new BadMethodCallException('Should never be called for "publicField" or "id"'); | ||
} | ||
/** @var string */ | ||
public $publicField = 'publicField'; | ||
/** | ||
* @throws BadMethodCallException | ||
*/ | ||
public function __isset(string $name) : int | ||
{ | ||
if ($name === 'test') { | ||
return 1; | ||
} | ||
return 0; | ||
if ($name === 'publicField' || $name === 'id') { | ||
throw new BadMethodCallException('Should never be called for "publicField" or "id"'); | ||
} | ||
return 0; | ||
} | ||
} | ||
BROKEN_CODE | ||
); | ||
} |
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,11 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Common\Proxy; | ||
|
||
class Php8MixedType | ||
{ | ||
public function foo(mixed $bar) : mixed | ||
{ | ||
return 1; | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Common\Proxy; | ||
|
||
use stdClass; | ||
|
||
class Php8UnionTypes | ||
{ | ||
public string|int $foo; | ||
|
||
public function setValue(stdClass|array $value) : bool|float | ||
{ | ||
} | ||
} |
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