Skip to content

Commit

Permalink
Issue #21: Replaced dotkernel/dot-twigrenderer with mezzio/mezzio-twi…
Browse files Browse the repository at this point in the history
…grenderer

Signed-off-by: alexmerlin <[email protected]>
  • Loading branch information
alexmerlin committed Jan 9, 2025
1 parent 199579f commit 5a799f1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 72 deletions.
36 changes: 10 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,32 @@
"sort-packages": true,
"allow-plugins": {
"dotkernel/*": true,
"laminas/laminas-component-installer": true,
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"laminas": {
"component-whitelist": [
"laminas/laminas-httphandlerrunner"
]
},
"mezzio": {
"component-whitelist": [
"mezzio/mezzio",
"mezzio/mezzio-helpers",
"mezzio/mezzio-router",
"mezzio/mezzio-fastroute",
"mezzio/mezzio-twigrenderer"
]
"dealerdirect/phpcodesniffer-composer-installer": true,
"laminas/laminas-component-installer": true
}
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"dotkernel/dot-controller": "^3.4.3",
"dotkernel/dot-errorhandler": "^4.0.0",
"dotkernel/dot-twigrenderer": "^3.4.3",
"friendsofphp/proxy-manager-lts": "^1.0.16",
"laminas/laminas-component-installer": "^3.4.0",
"laminas/laminas-config-aggregator": "^1.14.0",
"mezzio/mezzio": "^3.18.0",
"mezzio/mezzio-fastroute": "^3.11.0"
"mezzio/mezzio-fastroute": "^3.11.0",
"mezzio/mezzio-twigrenderer": "^2.12"
},
"require-dev": {
"filp/whoops": "^2.15.4",
"filp/whoops": "^2.16.0",
"laminas/laminas-coding-standard": "^3.0",
"laminas/laminas-development-mode": "^3.12.0",
"phpunit/phpunit": "^10.5",
"roave/security-advisories": "dev-master",
"vincentlanglet/twig-cs-fixer": "^2.12",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"symfony/var-dumper": "^7.1"
"phpunit/phpunit": "^10.5",
"roave/security-advisories": "dev-master",
"symfony/var-dumper": "^7.1",
"vincentlanglet/twig-cs-fixer": "^3.5"
},
"autoload": {
"psr-4": {
Expand All @@ -71,7 +55,7 @@
},
"autoload-dev": {
"psr-4": {
"LightTest\\Unit\\": "test/Unit"
"LightTest\\Unit\\": "test/Unit/"
}
},
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions config/autoload/local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ $baseUrl = 'http://light.dotkernel.localhost';

return [
'application' => [
'name' => 'Dotkernel',
'url' => $baseUrl,
'url' => $baseUrl,
],
];
29 changes: 5 additions & 24 deletions config/autoload/templates.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,20 @@

declare(strict_types=1);

use Dot\Twig\Extension\DateExtension;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Mezzio\Template\TemplateRendererInterface;
use Mezzio\Twig\TwigEnvironmentFactory;
use Mezzio\Twig\TwigRendererFactory;
use Twig\Environment;

return [
'dependencies' => [
'factories' => [
Environment::class => TwigEnvironmentFactory::class,
TemplateRendererInterface::class => TwigRendererFactory::class,
DateExtension::class => InvokableFactory::class,
],
],
'debug' => false,
'templates' => [
'templates' => [
'extension' => 'html.twig',
],
'twig' => [
'twig' => [
'assets_url' => '/',
'assets_version' => null,
'autoescape' => 'html',
'auto_reload' => true,
'cache_dir' => 'data/cache/twig',
'extensions' => [
DateExtension::class,
],
'extensions' => [],
'globals' => [],
'optimizations' => -1,
'runtime_loaders' => [],
//'timezone' => '',
'globals' => [
'appName' => $app['name'],
],
'timezone' => 'UTC',
],
];
8 changes: 5 additions & 3 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
'config_cache_path' => 'data/cache/config-cache.php',
];

// phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName

$aggregator = new ConfigAggregator([
// Include cache configuration
new ArrayProvider($cacheConfig),
\Laminas\Diactoros\ConfigProvider::class,
\Mezzio\ConfigProvider::class,
\Mezzio\Helper\ConfigProvider::class,
\Mezzio\Router\ConfigProvider::class,
\Mezzio\Twig\ConfigProvider::class,
\Mezzio\Router\FastRouteRouter\ConfigProvider::class,
\Mezzio\Twig\ConfigProvider::class,

// Dotkernel packages
\Dot\ErrorHandler\ConfigProvider::class,
\Dot\Log\ConfigProvider::class,
\Dot\Twig\ConfigProvider::class,
\Dot\FlashMessenger\ConfigProvider::class,

// Default App module config
\Light\App\ConfigProvider::class,
Expand All @@ -44,4 +44,6 @@
new PhpFileProvider(realpath(__DIR__) . '/development.config.php'),
], $cacheConfig['config_cache_path']);

// phpcs:enable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName

return $aggregator->getMergedConfig();
5 changes: 2 additions & 3 deletions config/twig-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

$config = new TwigCsFixer\Config\Config();
$config->addTwigExtension(new Dot\Twig\Extension\DateExtension());
use TwigCsFixer\Config\Config;

return $config;
return new Config();
5 changes: 1 addition & 4 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@
<file>test</file>

<!-- Include all rules from the Laminas Coding Standard -->
<rule ref="LaminasCodingStandard">
<!-- Exclude rule -->
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />
</rule>
<rule ref="LaminasCodingStandard" />
</ruleset>
7 changes: 2 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ includes:
parameters:
level: 5
paths:
- bin
- config
- src
- test
treatPhpDocTypesAsCertain: false
ignoreErrors:
-
message: '#Call to method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) with .* will always evaluate to true.#'
path: test

1 change: 0 additions & 1 deletion src/App/templates/app/home.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% block title %}Home{% endblock %}

{% block content %}
{{ messagesPartial('partial::alerts', {}, null, 'page-home') }}
<div class="page-intro home-intro">
<div class="container">
<p class="welcome">Dotkernel is a collection of</p>
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/Page/RoutesDelegatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ function () {
}
);

$this->assertInstanceOf(Application::class, $application);
$this->assertContainsOnlyInstancesOf(Application::class, [$application]);
}
}
4 changes: 1 addition & 3 deletions test/Unit/Page/Service/PageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class PageServiceTest extends TestCase
{
public function testWillInstantiate(): void
{
$service = new PageService();

$this->assertInstanceOf(PageServiceInterface::class, $service);
$this->assertContainsOnlyInstancesOf(PageServiceInterface::class, [new PageService()]);
}
}

0 comments on commit 5a799f1

Please sign in to comment.