diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php
index <HASH>..<HASH> 100644
--- a/tests/SchemaTest.php
+++ b/tests/SchemaTest.php
@@ -122,7 +122,8 @@ JSON;
         return [
             [
                 SchemaLoadException::class,
-                'error loading descriptor from source "--invalid--": file_get_contents(--invalid--): Failed to open stream: No such file or directory',
+                // Complete error message is trimmed because different PHP versions produce slightly different messages.
+                'error loading descriptor from source "--invalid--": file_get_contents(--invalid--): ',
                 '--invalid--',
             ],
             [
Correct test for allow differences in error message case between PHP versions.