File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
Tests/Fixtures/Validation Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,23 @@ public function warmUp($cacheDir)
66
66
$ loaders = $ this ->validatorBuilder ->getLoaders ();
67
67
$ metadataFactory = new LazyLoadingMetadataFactory (new LoaderChain ($ loaders ), new Psr6Cache ($ arrayPool ));
68
68
69
- foreach ($ this ->extractSupportedLoaders ($ loaders ) as $ loader ) {
70
- foreach ($ loader ->getMappedClasses () as $ mappedClass ) {
71
- if ($ metadataFactory ->hasMetadataFor ($ mappedClass )) {
72
- $ metadataFactory ->getMetadataFor ($ mappedClass );
69
+ $ throwingAutoloader = function ($ class ) { throw new \ReflectionException (sprintf ('Class %s does not exist ' , $ class )); };
70
+ spl_autoload_register ($ throwingAutoloader );
71
+
72
+ try {
73
+ foreach ($ this ->extractSupportedLoaders ($ loaders ) as $ loader ) {
74
+ foreach ($ loader ->getMappedClasses () as $ mappedClass ) {
75
+ try {
76
+ if ($ metadataFactory ->hasMetadataFor ($ mappedClass )) {
77
+ $ metadataFactory ->getMetadataFor ($ mappedClass );
78
+ }
79
+ } catch (\ReflectionException $ e ) {
80
+ // ignore failing reflection
81
+ }
73
82
}
74
83
}
84
+ } finally {
85
+ spl_autoload_unregister ($ throwingAutoloader );
75
86
}
76
87
77
88
$ values = $ arrayPool ->getValues ();
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Bundle \FrameworkBundle \Tests \Fixtures \Validation ;
4
+
5
+ class Article implements NotExistingInterface
6
+ {
7
+ public $ category ;
8
+ }
Original file line number Diff line number Diff line change 16
16
</property >
17
17
</class >
18
18
19
- <class name =" Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\NonExistentClass " >
20
- <property name =" gender " >
19
+ <class name =" Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\Article " >
20
+ <property name =" category " >
21
21
<constraint name =" Choice" >
22
22
<option name =" choices" >
23
23
<value >other</value >
You can’t perform that action at this time.
0 commit comments