Skip to content

Commit 0643ca2

Browse files
committed
Add test
1 parent 222894f commit 0643ca2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Doctrine\Tests\Common\Proxy;
4+
5+
class Php8MagicCloneClass
6+
{
7+
public function __clone(): void
8+
{
9+
}
10+
}

tests/Doctrine/Tests/Common/Proxy/ProxyGeneratorTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,26 @@ public function testFinalClassThrowsException()
405405
$proxyGenerator->generateProxyClass($this->createClassMetadata(FinalClass::class, []));
406406
}
407407

408+
/**
409+
* @requires PHP >= 8.0.0
410+
*/
411+
public function testPhp8CloneWithVoidReturnType()
412+
{
413+
$className = Php8MagicCloneClass::class;
414+
415+
if ( ! class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\Php8MagicCloneClass', false)) {
416+
$metadata = $this->createClassMetadata($className, ['id']);
417+
418+
$proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy');
419+
$this->generateAndRequire($proxyGenerator, $metadata);
420+
}
421+
422+
self::assertStringContainsString(
423+
'public function __clone(): void',
424+
file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyPhp8MagicCloneClass.php')
425+
);
426+
}
427+
408428
/**
409429
* @requires PHP >= 8.0.0
410430
*/

0 commit comments

Comments
 (0)