-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #3883 Deprecate internal extension functions in favor of meth…
…ods on the extension classes (fabpot) This PR was squashed before being merged into the 3.x branch. Discussion ---------- Deprecate internal extension functions in favor of methods on the extension classes ~~PoC on a simple extension for now.~~ Commits ------- aa7c454 Fix CS 54d34b9 Move functions for CoreExtension 72071e8 Move functions for EscaperExtension 196e91d Move functions for StringLoaderExtension d4d0160 Move functions for DebugExtension 69a89e0 Move functions for MarkdownExtension e07e9b5 Move functions for InkyExtension bff189f Move functions for CssInlinerExtension 6a18cda Move functions for HtmlExtension 16abb69 Deprecate internal extension functions in favor of methods on the extension classes
- Loading branch information
Showing
60 changed files
with
2,611 additions
and
1,630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\CssInliner; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @deprecated since Twig 3.9.0 | ||
*/ | ||
function twig_inline_css(string $body, string ...$css): string | ||
{ | ||
trigger_deprecation('twig/cssinliner-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__); | ||
|
||
return CssInlinerExtension::inlineCss($body, ...$css); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\CssInliner\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\Extra\CssInliner\CssInlinerExtension; | ||
|
||
use function Twig\Extra\CssInliner\twig_inline_css; | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
class LegacyFunctionsTest extends TestCase | ||
{ | ||
public function testInlineCss() | ||
{ | ||
$this->assertSame(CssInlinerExtension::inlineCss('<p>body</p>', 'p { color: red }'), twig_inline_css('<p>body</p>', 'p { color: red }')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
use Twig\Extra\Html\HtmlExtension; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @deprecated since Twig 3.9.0 | ||
*/ | ||
function twig_html_classes(...$args): string | ||
{ | ||
trigger_deprecation('twig/html-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__); | ||
|
||
return HtmlExtension::htmlClasses(...$args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\Html\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\Extra\Html\HtmlExtension; | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
class LegacyFunctionsTest extends TestCase | ||
{ | ||
public function testHtmlToMarkdown() | ||
{ | ||
$this->assertSame(HtmlExtension::htmlClasses(['charset' => 'utf-8']), \twig_html_classes(['charset' => 'utf-8'])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\Inky; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @deprecated since Twig 3.9.0 | ||
*/ | ||
function twig_inky(string $body): string | ||
{ | ||
trigger_deprecation('twig/inky-extra', '3.9.0', 'Using the internal "%s" function is deprecated.', __FUNCTION__); | ||
|
||
return InkyExtension::inky($body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Twig\Extra\Inky\Tests; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Twig\Extra\Inky\InkyExtension; | ||
|
||
use function Twig\Extra\Inky\twig_inky; | ||
|
||
/** | ||
* @group legacy | ||
*/ | ||
class LegacyFunctionsTest extends TestCase | ||
{ | ||
public function testInlineCss() | ||
{ | ||
$this->assertSame(InkyExtension::inky('<p>Foo</p>'), twig_inky('<p>Foo</p>')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.