bug #34877 [TwigBundle] fix findTemplate() to return null
Twig3 FilesystemLoader::findTemplate() should return `string|null` instead of Twig2 `string|null|false`: see <https://github.com/twigphp/Twig/blob/3.x/src/Loader/FilesystemLoader.php#L167> Returning `null` fixes `exists()` of Twig 3 FilesystemLoader without breaking Twig 2 (which expected `null` or `false` for not found templates). Change the test to assert `null` instead of `false`.
This commit is contained in:
parent
b81f4280df
commit
ff1d77e155
@ -96,7 +96,7 @@ class FilesystemLoader extends BaseFilesystemLoader
|
|||||||
throw $twigLoaderException;
|
throw $twigLoaderException;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->cache[$logicalName] = $file;
|
return $this->cache[$logicalName] = $file;
|
||||||
|
@ -123,6 +123,6 @@ class FilesystemLoaderTest extends TestCase
|
|||||||
|
|
||||||
$method = new \ReflectionMethod('Symfony\Bundle\TwigBundle\Loader\FilesystemLoader', 'findTemplate');
|
$method = new \ReflectionMethod('Symfony\Bundle\TwigBundle\Loader\FilesystemLoader', 'findTemplate');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
$this->assertFalse($method->invoke($loader, 'name.format.engine', false));
|
$this->assertNull($method->invoke($loader, 'name.format.engine', false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user