File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 11<?php
22
3- declare (strict_types = 1 );
4-
53namespace Selective \Container \Test \TestCase ;
64
75use Exception ;
@@ -289,11 +287,18 @@ public function testAutowireWithInvalidClasses(): void
289287 */
290288 public function testAutowireWithInvalidInternalClass (): void
291289 {
292- $ this ->expectException (InvalidDefinitionException::class);
293-
294290 $ container = new Container ();
295291 $ container ->addResolver (new ConstructorResolver ($ container ));
296- $ container ->get (Exception::class);
292+
293+ // https://3v4l.org/1AXpr
294+ if (version_compare (PHP_VERSION , '8.0.0 ' ) >= 0 ) {
295+ // PHP 8+
296+ $ this ->assertInstanceOf (Exception::class, $ container ->get (Exception::class));
297+ } else {
298+ // PHP 7.x
299+ $ this ->expectException (InvalidDefinitionException::class);
300+ $ container ->get (Exception::class);
301+ }
297302 }
298303
299304 /**
You can’t perform that action at this time.
0 commit comments