From 4f6c34df3365a9acdedd6d58069befa386139e73 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Mon, 17 Jun 2024 11:01:35 +0300 Subject: [PATCH] Change namespace to `Yiisoft\Yii\View\Renderer\*` --- CHANGELOG.md | 2 +- README.md | 18 ++++----- UPGRADE.md | 1 + composer.json | 4 +- config/di-web.php | 6 +-- config/events-web.php | 2 +- config/params.php | 2 +- src/CommonParametersInjectionInterface.php | 2 +- src/Csrf.php | 2 +- src/CsrfViewInjection.php | 2 +- src/Debug/WebViewCollector.php | 2 +- src/Exception/InvalidLinkTagException.php | 4 +- src/Exception/InvalidMetaTagException.php | 4 +- src/InjectionContainer/InjectionContainer.php | 2 +- .../InjectionContainerInterface.php | 2 +- .../StubInjectionContainer.php | 2 +- src/LayoutParametersInjectionInterface.php | 2 +- src/LayoutSpecificInjections.php | 2 +- src/LinkTagsInjectionInterface.php | 2 +- src/MetaTagsInjectionInterface.php | 2 +- src/ViewRenderer.php | 10 ++--- tests/ConfigTest.php | 4 +- tests/CsrfViewInjectionTest.php | 10 ++--- tests/Debug/WebViewCollectorTest.php | 4 +- .../Exception/InvalidLinkTagExceptionTest.php | 6 +-- .../Exception/InvalidMetaTagExceptionTest.php | 6 +-- tests/Support/CharsetInjection.php | 4 +- tests/Support/CommonParametersInjection.php | 4 +- .../Sub8Namespace/FakeController.php | 2 +- .../SubNamespace/FakeController.php | 2 +- .../SubNamespace/SubController/FakeCntrl.php | 2 +- .../SubNamespace2/FakeController.php | 2 +- tests/Support/Controllers/FakeCntrl.php | 2 +- .../SubNamespace/FakeController.php | 2 +- .../SubNamespace2/FakeController.php | 2 +- tests/Support/FakeCntrl.php | 2 +- tests/Support/FakeController.php | 2 +- tests/Support/FakeCsrfToken.php | 2 +- tests/Support/InvalidLinkTagInjection.php | 4 +- tests/Support/InvalidMetaTagInjection.php | 4 +- .../InvalidPositionInLinkTagInjection.php | 4 +- tests/Support/LayoutParametersInjection.php | 4 +- tests/Support/MockCsrfTokenStorage.php | 2 +- .../NotCntrls/SubNamespace/FakeCntrl.php | 2 +- .../NotCntrls/SubNamespace/FakeController.php | 2 +- tests/Support/TestInjection.php | 10 ++--- tests/Support/TestTrait.php | 2 +- tests/Support/TitleInjection.php | 4 +- tests/ViewRendererTest.php | 38 +++++++++---------- 49 files changed, 105 insertions(+), 104 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51f6670..39ba279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## 7.0.0 under development - Chg #115: Only a full path can now be used as a layout (@vjik) -- Chg #116: Rename package to `yiisoft/yii-view-renderer` (@vjik) +- Chg #116, #117, #118: Rename package to `yiisoft/yii-view-renderer` (@vjik) ## 6.1.1 June 06, 2024 diff --git a/README.md b/README.md index be23b79..9e7142d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ You can get an instance of a response with deferred rendering as follows: * @var \Yiisoft\View\WebView $webView */ -$viewRenderer = new \Yiisoft\Yii\View\ViewRenderer( +$viewRenderer = new \Yiisoft\Yii\View\Renderer\ViewRenderer( $dataResponseFactory, $aliases, $webView, @@ -129,7 +129,7 @@ With this approach, you do not need to specify the directory name each time when ```php use Psr\Http\Message\ResponseInterface; -use Yiisoft\Yii\View\ViewRenderer; +use Yiisoft\Yii\View\Renderer\ViewRenderer; class SiteController { @@ -166,8 +166,8 @@ In addition to parameters passed directly when rendering the view template, you available in all views. In order to do it you need a class implementing at least one of the injection interfaces: ```php -use Yiisoft\Yii\View\CommonParametersInjectionInterface; -use Yiisoft\Yii\View\LayoutParametersInjectionInterface; +use Yiisoft\Yii\View\Renderer\CommonParametersInjectionInterface; +use Yiisoft\Yii\View\Renderer\LayoutParametersInjectionInterface; final class MyParametersInjection implements CommonParametersInjectionInterface, @@ -196,8 +196,8 @@ Link tags and meta tags should be organized in the same way. ```php use Yiisoft\Html\Html; use Yiisoft\View\WebView; -use Yiisoft\Yii\View\LinkTagsInjectionInterface; -use Yiisoft\Yii\View\MetaTagsInjectionInterface; +use Yiisoft\Yii\View\Renderer\LinkTagsInjectionInterface; +use Yiisoft\Yii\View\Renderer\MetaTagsInjectionInterface; final class MyTagsInjection implements LinkTagsInjectionInterface, @@ -263,14 +263,14 @@ and will overwrite the injected content parameters if their names match. #### Injections lazy loading You can use lazy loading for injections. Injections will be created by container that implements -`Yiisoft\Yii\View\InjectionContainerInterface`. Out of the box, it is available in `InjectionContainer` that is based on PSR-11 compatible +`Yiisoft\Yii\View\Renderer\InjectionContainerInterface`. Out of the box, it is available in `InjectionContainer` that is based on PSR-11 compatible container. 1. Add injection container to `ViewRenderer` constructor: ```php -use Yiisoft\Yii\View\ViewRenderer; -use Yiisoft\Yii\View\InjectionContainer\InjectionContainer; +use Yiisoft\Yii\View\Renderer\ViewRenderer; +use Yiisoft\Yii\View\Renderer\InjectionContainer\InjectionContainer; /** * @var Psr\Container\ContainerInterface $container diff --git a/UPGRADE.md b/UPGRADE.md index e7ad97c..017a6ee 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -10,4 +10,5 @@ application when you upgrade the package from one version to another. ## Upgrade from 6.x - Change layout value that passed to `ViewRenderer` constructor and `withLayout()` method to full path. +- Change namespace `Yiisoft\Yii\View\*` to `Yiisoft\Yii\View\Renderer\*`. - Rename package configuration parameters key from "yiisoft/yii-view" to "yiisoft/yii-view-renderer". diff --git a/composer.json b/composer.json index 7fe65e0..6d02030 100644 --- a/composer.json +++ b/composer.json @@ -54,12 +54,12 @@ }, "autoload": { "psr-4": { - "Yiisoft\\Yii\\View\\": "src" + "Yiisoft\\Yii\\View\\Renderer\\": "src" } }, "autoload-dev": { "psr-4": { - "Yiisoft\\Yii\\View\\Tests\\": "tests" + "Yiisoft\\Yii\\View\\Renderer\\Tests\\": "tests" } }, "extra": { diff --git a/config/di-web.php b/config/di-web.php index 7617b64..8734441 100644 --- a/config/di-web.php +++ b/config/di-web.php @@ -2,9 +2,9 @@ declare(strict_types=1); -use Yiisoft\Yii\View\InjectionContainer\InjectionContainer; -use Yiisoft\Yii\View\InjectionContainer\InjectionContainerInterface; -use Yiisoft\Yii\View\ViewRenderer; +use Yiisoft\Yii\View\Renderer\InjectionContainer\InjectionContainer; +use Yiisoft\Yii\View\Renderer\InjectionContainer\InjectionContainerInterface; +use Yiisoft\Yii\View\Renderer\ViewRenderer; /** @var array $params */ diff --git a/config/events-web.php b/config/events-web.php index f462125..8c25965 100644 --- a/config/events-web.php +++ b/config/events-web.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Yiisoft\View\Event\WebView\AfterRender; -use Yiisoft\Yii\View\Debug\WebViewCollector; +use Yiisoft\Yii\View\Renderer\Debug\WebViewCollector; if (!($params['yiisoft/yii-debug']['enabled'] ?? false)) { return []; diff --git a/config/params.php b/config/params.php index 3f36911..3c41f93 100644 --- a/config/params.php +++ b/config/params.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Yiisoft\Yii\View\Debug\WebViewCollector; +use Yiisoft\Yii\View\Renderer\Debug\WebViewCollector; return [ 'yiisoft/yii-view-renderer' => [ diff --git a/src/CommonParametersInjectionInterface.php b/src/CommonParametersInjectionInterface.php index a32f9ac..f909164 100644 --- a/src/CommonParametersInjectionInterface.php +++ b/src/CommonParametersInjectionInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\View; +namespace Yiisoft\Yii\View\Renderer; /** * `CommonParametersInjectionInterface` is an interface that must be implemented by classes to inject diff --git a/src/Csrf.php b/src/Csrf.php index 187073d..97a04ee 100644 --- a/src/Csrf.php +++ b/src/Csrf.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\View; +namespace Yiisoft\Yii\View\Renderer; use Stringable; use Yiisoft\Html\Html; diff --git a/src/CsrfViewInjection.php b/src/CsrfViewInjection.php index a77e797..8b03a56 100644 --- a/src/CsrfViewInjection.php +++ b/src/CsrfViewInjection.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\View; +namespace Yiisoft\Yii\View\Renderer; use LogicException; use Yiisoft\Csrf\CsrfMiddleware; diff --git a/src/Debug/WebViewCollector.php b/src/Debug/WebViewCollector.php index 97588ff..c9aab08 100644 --- a/src/Debug/WebViewCollector.php +++ b/src/Debug/WebViewCollector.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\View\Debug; +namespace Yiisoft\Yii\View\Renderer\Debug; use Yiisoft\View\Event\WebView\AfterRender; use Yiisoft\Yii\Debug\Collector\CollectorInterface; diff --git a/src/Exception/InvalidLinkTagException.php b/src/Exception/InvalidLinkTagException.php index afa20e0..12268dd 100644 --- a/src/Exception/InvalidLinkTagException.php +++ b/src/Exception/InvalidLinkTagException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Yiisoft\Yii\View\Exception; +namespace Yiisoft\Yii\View\Renderer\Exception; use RuntimeException; use Yiisoft\FriendlyException\FriendlyExceptionInterface; @@ -27,7 +27,7 @@ public function getSolution(): ?string return 'Got link tag:' . "\n" . var_export($this->tag, true) . <<tag, true) . <<