Skip to content

Commit bd24f8b

Browse files
Merge branch '3.4' into 4.0
* 3.4: Clean up Update return type in docblock. PHP CS Fixer: no need to exclude xml and yml files PHP CS Fixer: no need to exclude json file Update LICENSE year... forever fixed some deprecation messages fixed CS Fixes for Oracle in PdoSessionHandler fixed some deprecation messages fixed some deprecation messages fixed some deprecation messages fixed some deprecation messages [TwigBundle/Brige] catch missing requirements to throw meaningful exceptions [HttpKernel] Call Response->setPrivate() instead of sending raw header() when session is started [FrameworkBundle] Make cache:clear "atomic" and consistent with cache:warmup Suggest to write an implementation if the interface cannot be autowired [Debug] Skip DebugClassLoader checks for already parsed files [2.7][DX] Use constant message contextualisation for deprecations Remove group options without data and fix normalization Remove redundant translation path
2 parents aeb2219 + 91d66d2 commit bd24f8b

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-2017 Fabien Potencier
1+
Copyright (c) 2004-present Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

UndefinedCallableHandler.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Twig;
13+
14+
use Twig\Error\SyntaxError;
15+
16+
/**
17+
* @internal
18+
*/
19+
class UndefinedCallableHandler
20+
{
21+
private static $filterComponents = array(
22+
'humanize' => 'form',
23+
'trans' => 'translation',
24+
'transchoice' => 'translation',
25+
'yaml_encode' => 'yaml',
26+
'yaml_dump' => 'yaml',
27+
);
28+
29+
private static $functionComponents = array(
30+
'asset' => 'asset',
31+
'asset_version' => 'asset',
32+
'dump' => 'debug-bundle',
33+
'expression' => 'expression-language',
34+
'form_widget' => 'form',
35+
'form_errors' => 'form',
36+
'form_label' => 'form',
37+
'form_row' => 'form',
38+
'form_rest' => 'form',
39+
'form' => 'form',
40+
'form_start' => 'form',
41+
'form_end' => 'form',
42+
'csrf_token' => 'form',
43+
'logout_url' => 'security-http',
44+
'logout_path' => 'security-http',
45+
'is_granted' => 'security-core',
46+
'link' => 'web-link',
47+
'preload' => 'web-link',
48+
'dns_prefetch' => 'web-link',
49+
'preconnect' => 'web-link',
50+
'prefetch' => 'web-link',
51+
'prerender' => 'web-link',
52+
'workflow_can' => 'workflow',
53+
'workflow_transitions' => 'workflow',
54+
'workflow_has_marked_place' => 'workflow',
55+
'workflow_marked_places' => 'workflow',
56+
);
57+
58+
public static function onUndefinedFilter($name)
59+
{
60+
if (!isset(self::$filterComponents[$name])) {
61+
return false;
62+
}
63+
64+
// Twig will append the source context to the message, so that it will end up being like "[...] Unknown filter "%s" in foo.html.twig on line 123."
65+
throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown filter "%s".', $name, self::$filterComponents[$name]));
66+
}
67+
68+
public static function onUndefinedFunction($name)
69+
{
70+
if (!isset(self::$functionComponents[$name])) {
71+
return false;
72+
}
73+
74+
throw new SyntaxError(sprintf('Did you forget to run "composer require symfony/%s"? Unknown function "%s".', $name, self::$functionComponents[$name]));
75+
}
76+
}

0 commit comments

Comments
 (0)