8000 Add namespaced aliases · twigphp/Twig-extensions@fe6f308 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit fe6f308

Browse files
Add namespaced aliases
1 parent 63a633b commit fe6f308

File tree

16 files changed

+100
-2
lines changed

16 files changed

+100
-2
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"symfony/translation": "Allow the time_diff output to be translated"
2323
},
2424
"autoload": {
25-
"psr-0": { "Twig_Extensions_": "lib/" }
25+
"psr-0": { "Twig_Extensions_": "lib/" },
26+
"psr-4": { "Twig\\Extensions\\": "src/" }
2627
},
2728
"extra": {
2829
"branch-alias": {

lib/Twig/Extensions/Autoloader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
@trigger_error('The "Twig_Extensions_Autoloader" class is deprecated since version 1.5. Use Composer instead.', E_USER_DEPRECATED);
13+
1214
/**
1315
* Autoloads Twig Extensions classes.
1416
*
1517
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
18+
*
19+
* @deprecated since version 1.5, use Composer instead.
1620
*/
1721
class Twig_Extensions_Autoloader
1822
{

lib/Twig/Extensions/Extension/Array.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
10-
*
10+
*/
11+
12+
/**
1113
* @author Ricard Clau <ricard.clau@gmail.com>
1214
*/
1315
class Twig_Extensions_Extension_Array extends Twig_Extension
@@ -50,3 +52,5 @@ function twig_shuffle_filter($array)
5052

5153
return $array;
5254
}
55+
56+
class_alias('Twig_Extensions_Extension_Array', 'Twig\Extensions\ArrayExtension', false);

lib/Twig/Extensions/Extension/Date.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,5 @@ public function getName()
9797
return 'date';
9898
}
9999
}
100+
101+
class_alias('Twig_Extensions_Extension_Date', 'Twig\Extensions\DateExtension', false);

lib/Twig/Extensions/Extension/I18n.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ public function getName()
3737
return 'i18n';
3838
}
3939
}
40+
41+
class_alias('Twig_Extensions_Extension_I18n', 'Twig\Extensions\I18nExtension', false);

lib/Twig/Extensions/Extension/Intl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,5 @@ function twig_get_number_formatter($locale, $style)
129129

130130
return $formatter;
131131
}
132+
133+
class_alias('Twig_Extensions_Extension_Intl', 'Twig\Extensions\IntlExtension', false);

lib/Twig/Extensions/Extension/Text.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,5 @@ function twig_wordwrap_filter(Twig_Environment $env, $value, $length = 80, $sepa
9595
return wordwrap($value, $length, $separator, !$preserve);
9696
}
9797
}
98+
99+
class_alias('Twig_Extensions_Extension_Text', 'Twig\Extensions\TextExtension', false);

lib/Twig/Extensions/Node/Trans.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,5 @@ protected function getTransFunction($plural)
162162
return $plural ? 'ngettext' : 'gettext';
163163
}
164164
}
165+
166+
class_alias('Twig_Extensions_Node_Trans', 'Twig\Extensions\Node\TransNode', false);

lib/Twig/Extensions/TokenParser/Trans.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ protected function checkTransString(Twig_Node $body, $lineno)
8484
}
8585
}
8686
}
87+
88+
class_alias('Twig_Extensions_TokenParser_Trans', 'Twig\Extensions\TokenParser\TransTokenParser', false);

src/ArrayExtension.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Twig\Extensions;
4+
5+
require __DIR__.'/../lib/Twig/Extensions/Extension/Array.php';
6+
7+
if (\false) {
8+
class ArrayExtension extends \Twig_Extensions_Extension_Array
9+
{
10+
}
11+
}

0 commit comments

Comments
 (0)
0