@@ -20,7 +20,7 @@ public function testGetClassName(): void
2020 {
2121 $ filePath = __DIR__ . '/../../../example/classes/SomeTestClass.php ' ;
2222 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
23- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
23+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
2424 $ parser ->setCode ((string ) file_get_contents ($ filePath ));
2525 self ::assertEquals ('SomeTestClass ' , $ parser ->getClassName ());
2626 self ::assertEquals ('SomeTestClass ' , $ parser ->getClassName ());
@@ -30,7 +30,7 @@ public function testGetClassNameForInterface(): void
3030 {
3131 $ filePath = __DIR__ . '/../../../example/classes/SomeTestInterface.php ' ;
3232 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
33- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
33+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
3434 $ parser ->setCode ((string ) file_get_contents ($ filePath ));
3535 self ::assertNull ($ parser ->getClassName ());
3636 }
@@ -39,7 +39,7 @@ public function testGetNamespace(): void
3939 {
4040 $ filePath = __DIR__ . '/../../../example/classes/SomeTestClass.php ' ;
4141 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
42- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
42+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
4343 $ parser ->setCode ((string ) file_get_contents ($ filePath ));
4444 self ::assertEquals ('PhpKafka \\PhpAvroSchemaGenerator \\Example ' , $ parser ->getNamespace ());
4545 self ::assertEquals ('PhpKafka \\PhpAvroSchemaGenerator \\Example ' , $ parser ->getNamespace ());
@@ -49,7 +49,7 @@ public function testGetProperties(): void
4949 {
5050 $ filePath = __DIR__ . '/../../../example/classes/SomeTestClass.php ' ;
5151 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
52- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
52+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
5353 $ parser ->setCode ((string ) file_get_contents ($ filePath ));
5454 $ properties = $ parser ->getProperties ();
5555 self ::assertCount (16 , $ properties );
@@ -62,7 +62,7 @@ public function testGetProperties(): void
6262 public function testClassAndNamespaceAreNullWithNoCode (): void
6363 {
6464 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
65- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
65+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
6666 $ refObject = new \ReflectionObject ($ parser );
6767 $ refProperty = $ refObject ->getProperty ('statements ' );
6868 $ refProperty ->setAccessible (true );
@@ -76,7 +76,7 @@ public function testClassAndNamespaceAreNullWithNoCode(): void
7676 public function testClassWithNoParent (): void
7777 {
7878 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
79- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
79+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
8080 $ parser ->setCode ('<?php class foo {} ' );
8181 self ::assertNull ($ parser ->getNamespace ());
8282 self ::assertNull ($ parser ->getParentClassName ());
@@ -87,7 +87,7 @@ public function testClassWithNoParent(): void
8787 public function testClassWithNullableType (): void
8888 {
8989 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
90- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
90+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
9191 $ parser ->setCode ('
9292 <?php
9393 class foo {
@@ -102,7 +102,7 @@ class foo {
102102 public function testClassWithUnionType (): void
103103 {
104104 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
105- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
105+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
106106 $ parser ->setCode ('
107107 <?php
108108 class foo {
@@ -117,7 +117,7 @@ class foo {
117117 public function testClassWithDocUnionType (): void
118118 {
119119 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
120- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
120+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
121121 $ parser ->setCode ('
122122 <?php
123123 class foo {
@@ -135,7 +135,7 @@ class foo {
135135 public function testClassWithAnnotations (): void
136136 {
137137 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
138- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
138+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
139139 $ parser ->setCode ('
140140 <?php
141141 class foo {
@@ -159,7 +159,7 @@ class foo {
159159 public function testClassWithNoParentFile (): void
160160 {
161161 $ propertyParser = new ClassPropertyParser (new DocCommentParser ());
162- $ parser = new ClassParser ((new ParserFactory ())->create (ParserFactory:: PREFER_PHP7 ), $ propertyParser );
162+ $ parser = new ClassParser ((new ParserFactory ())->createForNewestSupportedVersion ( ), $ propertyParser );
163163 $ parser ->setCode ('<?php class foo extends \RuntimeException {private $x;} ' );
164164 $ properties = $ parser ->getProperties ();
165165 self ::assertEquals (1 , count ($ properties ));
0 commit comments