1<?php 2 3/* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace Symfony\Component\Validator\Test; 13 14use PHPUnit\Framework\TestCase; 15 16// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods 17 18if ((new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) { 19 /** 20 * @internal 21 */ 22 trait ForwardCompatTestTrait 23 { 24 private function doSetUp(): void 25 { 26 } 27 28 private function doTearDown(): void 29 { 30 } 31 32 protected function setUp(): void 33 { 34 $this->doSetUp(); 35 } 36 37 protected function tearDown(): void 38 { 39 $this->doTearDown(); 40 } 41 } 42} else { 43 /** 44 * @internal 45 */ 46 trait ForwardCompatTestTrait 47 { 48 /** 49 * @return void 50 */ 51 private function doSetUp() 52 { 53 } 54 55 /** 56 * @return void 57 */ 58 private function doTearDown() 59 { 60 } 61 62 /** 63 * @return void 64 */ 65 protected function setUp() 66 { 67 $this->doSetUp(); 68 } 69 70 /** 71 * @return void 72 */ 73 protected function tearDown() 74 { 75 $this->doTearDown(); 76 } 77 } 78} 79