Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2 ]
contao: [ 4.13.*, 5.2.* ]
php: [ 8.1, 8.2, 8.3, 8.4 ]
contao: [ 4.13.*, 5.3.*, 5.4.* ]

steps:
- name: Setup PHP
Expand All @@ -22,7 +22,7 @@ jobs:
coverage: none

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install the dependencies
id: composer-install
Expand All @@ -44,7 +44,7 @@ jobs:
tools: php-cs-fixer, phpunit

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install the dependencies
run: composer install --no-interaction
Expand All @@ -68,10 +68,32 @@ jobs:
php-version: 8.2

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install the dependencies
run: composer install --no-interaction

- name: PHPStan
run: vendor/bin/phpstan analyse -c phpstan.neon
run: vendor/bin/phpstan analyse -c phpstan.neon

ecs:
name: ECS
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, pcre, pdo_mysql, zlib
coverage: none

- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Install the dependencies
run: composer install --no-interaction

- name: Run ECS
run: vendor/bin/ecs check --no-progress-bar
45 changes: 0 additions & 45 deletions .php_cs

This file was deleted.

26 changes: 14 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,30 @@
"heimrichhannot/contao-encore-contracts": "^1.0",
"heimrichhannot/contao-multi-column-editor-bundle": "^2.0",
"heimrichhannot/contao-utils-bundle": "^2.231.0 || ^3.0",
"symfony/cache": "^5.4 || ^6.0",
"symfony/config": "^5.4 || ^6.0",
"symfony/console": "^5.4 || ^6.0",
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/filesystem": "^5.4 || ^6.0",
"symfony/http-foundation": "^5.4 || ^6.0",
"symfony/http-kernel": "^5.4 || ^6.0",
"symfony/translation": "^5.4 || ^6.0",
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
"symfony/translation": "^5.4 || ^6.0 || ^7.0",
"symfony/translation-contracts": "^1.1.6 || ^2.0 || ^3.0",
"symfony/webpack-encore-bundle": "^1.0 || ^2.0",
"twig/twig": "^1.38.3 || ^2.7 || ^3.0"
},
"require-dev": {
"contao/test-case": "^4.0 || ^5.0",
"contao/manager-plugin": "^2.0",
"friendsofphp/php-cs-fixer": "^2.2",
"contao/manager-plugin": "^2.13",
"phpunit/phpunit": "^8.0 || ^9.0",
"php-coveralls/php-coveralls": "^2.0",
"symfony/phpunit-bridge": "^3.2 || ^4.0 || ^5.0 || ^6.0",
"heimrichhannot/contao-test-utilities-bundle": "^0.1.4",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-symfony": "^1.2"
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-symfony": "^1.4",
"rector/rector": "^1.2",
"contao/contao-rector": "dev-main",
"symplify/easy-coding-standard": "^12.5"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 12 additions & 3 deletions contao/dca/tl_layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,28 @@
'label' => &$GLOBALS['TL_LANG']['tl_layout']['addEncore'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => ['tl_class' => 'w50', 'submitOnChange' => true],
'eval' => [
'tl_class' => 'w50',
'submitOnChange' => true,
],
'sql' => "char(1) NOT NULL default ''",
],
'encoreStylesheetsImportsTemplate' => [
'exclude' => true,
'inputType' => 'select',
'eval' => ['tl_class' => 'w50 clr', 'includeBlankOption' => true],
'eval' => [
'tl_class' => 'w50 clr',
'includeBlankOption' => true,
],
'sql' => "varchar(128) NOT NULL default ''",
],
'encoreScriptsImportsTemplate' => [
'exclude' => true,
'inputType' => 'select',
'eval' => ['tl_class' => 'w50', 'includeBlankOption' => true],
'eval' => [
'tl_class' => 'w50',
'includeBlankOption' => true,
],
'sql' => "varchar(128) NOT NULL default ''",
],
];
Expand Down
3 changes: 1 addition & 2 deletions contao/dca/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use Contao\CoreBundle\DataContainer\PaletteManipulator;
use HeimrichHannot\EncoreBundle\Dca\EncoreEntriesSelectField;
use HeimrichHannot\EncoreBundle\EventListener\Callback\EncoreEntryOptionListener;

$dca = &$GLOBALS['TL_DCA']['tl_page'];

Expand All @@ -23,4 +22,4 @@
continue;
}
$pm->applyToPalette($palette, 'tl_page');
}
}
14 changes: 7 additions & 7 deletions contao/languages/de/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

$lang = &$GLOBALS['TL_LANG']['tl_page'];

/**
/*
* Fields
*/
$lang['encoreEntries'][0] = 'Aktive Entries';
$lang['encoreEntries'][1] =
$lang['encoreEntries'][0] = 'Aktive Entries';
$lang['encoreEntries'][1] =
'Legen Sie hier fest, welche webpack-Entrys auf welchen Seiten gerendert werden sollen. Sie können diese Festlegungen auf eventuellen Unterseiten mit Seitenvererbung überschreiben.';
$lang['encoreEntries_entry'][0] = 'Entry';
$lang['encoreEntries_active'][0] = 'Aktiv';
$lang['encoreEntries_entry'][0] = 'Entry';
$lang['encoreEntries_active'][0] = 'Aktiv';

/**
/*
* Legends
*/
$lang['encore_legend'] = 'Encore';
$lang['encore_legend'] = 'Encore';
14 changes: 7 additions & 7 deletions contao/languages/en/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

$lang = &$GLOBALS['TL_LANG']['tl_page'];

/**
/*
* Fields
*/
$lang['encoreEntries'][0] = 'Active entries';
$lang['encoreEntries'][1] =
$lang['encoreEntries'][0] = 'Active entries';
$lang['encoreEntries'][1] =
'Select webpack entries that should be rendered on this and all inheriting pages. You can overwrite this setting on inheriting pages due page inheritance.';
$lang['encoreEntries_entry'][0] = 'Entry';
$lang['encoreEntries_active'][0] = 'Active';
$lang['encoreEntries_entry'][0] = 'Entry';
$lang['encoreEntries_active'][0] = 'Active';

/**
/*
* Legends
*/
$lang['encore_legend'] = 'Encore';
$lang['encore_legend'] = 'Encore';
6 changes: 5 additions & 1 deletion docs/setup_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This is a working webpack config with SCSS/SASS file compilation.
First add following additional yarn dependencies to your project:

```
yarn add postcss-loader sass-loader@^13.0.0 sass --dev
yarn add postcss-loader sass-loader sass --dev
```

Update/ add your `webpack.config.js` file accordingly:
Expand All @@ -51,6 +51,10 @@ Update/ add your `webpack.config.js` file accordingly:
encoreBundles = require('./encore.bundles');

Encore
// project entries
// .addEntry('app', './resources/js/app.js')

//build config
.setOutputPath('public/build/')
.setPublicPath('/build')
.cleanupOutputBeforeBuild()
Expand Down
37 changes: 37 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Basic\BracesPositionFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/contao',
])

// add a single rule
->withRules([
NoUnusedImportsFixer::class,
BracesPositionFixer::class,
])

// add sets - group of rules
->withPreparedSets(
arrays: true,
comments: true,
docblocks: true,
spaces: true,
namespaces: true,
)
->withPhpCsFixerSets(symfony: true)
->withSkip([
NotOperatorWithSuccessorSpaceFixer::class,
MethodChainingIndentationFixer::class => [
'*/DependencyInjection/Configuration.php',
],
]);
34 changes: 34 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

use Contao\Rector\Set\ContaoLevelSetList;
use Contao\Rector\Set\ContaoSetList;
use Rector\Config\RectorConfig;
use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/contao',
])
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
# In Vorbereitung für PHP 8.4:
ExplicitNullableParamTypeRector::class
])

->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withSets([
LevelSetList::UP_TO_PHP_81,
SymfonySetList::SYMFONY_54,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
# Erst mit Symfony 6 (Contao 5) nutzen:
// SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
ContaoLevelSetList::UP_TO_CONTAO_413,
ContaoSetList::FQCN,
ContaoSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
11 changes: 3 additions & 8 deletions src/Asset/EntrypointCollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@

class EntrypointCollectionFactory
{
private EntryCollection $entryCollection;

/**
* EntrypointCollectionFactory constructor.
*/
public function __construct(EntryCollection $entryCollection)
{
$this->entryCollection = $entryCollection;
public function __construct(
private readonly EntryCollection $entryCollection,
) {
}

public function createCollection(array $entrypoints): EntrypointCollection
Expand Down
2 changes: 1 addition & 1 deletion src/Asset/FrontendAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FrontendAsset
/**
* Add an active entrypoint.
*/
public function addActiveEntrypoint(string $entrypoint)
public function addActiveEntrypoint(string $entrypoint): void
{
$this->activeEntrypoints[] = $entrypoint;
}
Expand Down
11 changes: 4 additions & 7 deletions src/Asset/GlobalContaoAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

class GlobalContaoAsset
{
private array $bundleConfig;
private ExtensionCollection $extensionCollection;

public function __construct(array $bundleConfig, ExtensionCollection $extensionCollection)
{
$this->bundleConfig = $bundleConfig;
$this->extensionCollection = $extensionCollection;
public function __construct(
private array $bundleConfig,
private readonly ExtensionCollection $extensionCollection,
) {
}

public function cleanGlobalArrayFromConfiguration(): void
Expand Down
Loading