Skip to content

Commit

Permalink
Merge branch 'feature/contao5Compatibility' into 'main'
Browse files Browse the repository at this point in the history
Php8 contao413 (#14)

See merge request trilobit/trilobit-gmbh/bundles/contao-constants-bundle!9
  • Loading branch information
trilobit-gmbh committed Jan 9, 2023
2 parents aa59f07 + e1acb8c commit da86b30
Show file tree
Hide file tree
Showing 28 changed files with 236 additions and 112 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{php,twig,yml}]
indent_style = space
indent_size = 4

[*.{html5,svg,min.css,min.js}]
insert_final_newline = false
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* linguist-vendored
*.php linguist-vendored=false
3 changes: 2 additions & 1 deletion .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.idea

/vendor
/composer.lock
/composer.lock
/.php-cs-fixer.cache
108 changes: 108 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php
$date = date('Y');
$header = <<<EOF
@copyright trilobit GmbH
@author trilobit GmbH <https://github.com/trilobit-gmbh>
@license LGPL-3.0-or-later
EOF;

$config = new \PhpCsFixer\Config();

return $config
->setRiskyAllowed(true)
->setRules([
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/index.rst

'@Symfony' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,

// Alias
// Array Notation
// Basic
// Casing
// Cast Notation
// Class Notation
'self_static_accessor' => true,
// Class Usage
// Comment
'header_comment' => [
'header' => $header,
'comment_type' => 'comment',
'location' => 'after_declare_strict',
],
'comment_to_phpdoc' => [
'ignored_tags' => [
'todo'
],
],
'multiline_comment_opening_closing' => true,
'no_empty_comment' => true,
// Constant Notation
// Control Structure
'no_useless_else' => true,
'simplified_if_return' => true,
// Doctrine Annotation
// Function Notation
'no_unreachable_default_argument_value' => true,
'function_declaration' => [
'closure_function_spacing' => 'none',
],
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
'strict' => true,
],
'no_useless_sprintf' => true,
'nullable_type_declaration_for_default_null_value' => true,
'phpdoc_to_param_type' => true,
'return_type_declaration' => true,
'single_line_throw' => true,
'static_lambda' => true,
// Import
// Language Construct
'combine_consecutive_unsets' => true,
'declare_parentheses' => true,
'explicit_indirect_variable' => true,
// List Notation
// Namespace Notation
// Naming
// Operator
// PHP Tag
'echo_tag_syntax' => [
'format' => 'short'
],
// PHPUnit
// PHPDoc
'align_multiline_comment' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_order_by_value' => true,
'phpdoc_order' => true,
'phpdoc_tag_casing' => true,
'phpdoc_var_annotation_correct_order' => true,
// Return Notation
'no_useless_return' => true,
'return_assignment' => true,
'simplified_null_return' => true,
// Semicolon
'multiline_whitespace_before_semicolons' => [
'strategy' => 'new_line_for_chained_calls',
],
// Strict
'declare_strict_types' => true,
'strict_comparison' => true,
'strict_param' => true,
// String Notation
'heredoc_to_nowdoc' => true,
'single_quote' => true,
'string_length_to_empty' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('trilobit')
->in([
__DIR__.'/src'
])
)
;
40 changes: 0 additions & 40 deletions .php_cs.dist

This file was deleted.

15 changes: 9 additions & 6 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ Installation

Install the extension via composer: [trilobit-gmbh/contao-constants-bundle](https://packagist.org/packages/trilobit-gmbh/contao-constants-bundle).

Kompatibilität / Getestet / Compatibility / Tested
--------------------------------------------------

- Contao version ~4.4
- Contao version ~4.9
- Contao version ~4.11

Configuration
-------------
Expand All @@ -66,3 +60,12 @@ You can define the following configuration parameters via your `config.yml` file
trilobit_constants:
allow_html: true # default: false; allow the unescaped storage of your html-based constants
```



Compatibility
-------------

- Contao version ~4.9
- Contao version ~4.13
- Contao version ~5.0
25 changes: 15 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "trilobit-gmbh/contao-constants-bundle",
"description": "Contao 4 / Contao 5 constants bundle",
"type": "contao-bundle",
"description": "Contao 4 constants bundle",
"license": "LGPL-3.0-or-later",
"authors": [
{
Expand All @@ -10,17 +10,14 @@
}
],
"require": {
"php": "^7.3||^8.0",
"contao/core-bundle": "~4.4",
"codefog/contao-haste": "^4.0"
"php": "^7.3 || ^8.0",
"contao/core-bundle": "^4.9 || ^5.0",
"codefog/contao-haste": "^4.0 || ^5.0"
},
"require-dev": {
"contao/manager-plugin": "^2.0",
"friendsofphp/php-cs-fixer": "^2.1",
"leofeyer/optimize-native-functions-fixer": "^1.1"
},
"conflict": {
"contao/manager-plugin": "<2.0 || >=3.0"
"contao/easy-coding-standard": "^3.0",
"contao/manager-plugin": "^2.3",
"friendsofphp/php-cs-fixer": "^v3.1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -32,5 +29,13 @@
"symfony": {
"require": "3.4.* || 4.4.* || ^5.2"
}
},
"config": {
"allow-plugins": {
"contao-components/installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"contao-community-alliance/composer-plugin": true,
"contao/manager-plugin": true
}
}
}
Empty file modified docs/images/article2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/images/constants_ausgabe.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/images/constants_backend.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/images/constants_eingabe.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified docs/images/mitarbeiter.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?php

declare(strict_types=1);

/*
* @copyright trilobit GmbH
* @author trilobit GmbH <https://github.com/trilobit-gmbh>
* @license LGPL-3.0-or-later
* @link http://github.com/trilobit-gmbh/contao-constants-bundle
*/

namespace Trilobit\ConstantsBundle\ContaoManager;

use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Trilobit\ConstantsBundle\TrilobitConstantsBundle;

/**
* Plugin for the Contao Manager.
Expand All @@ -21,13 +24,13 @@
class Plugin implements BundlePluginInterface
{
/**
* {@inheritdoc}
* {@inheritDoc}
*/
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create('Trilobit\ConstantsBundle\TrilobitConstantsBundle')
->setLoadAfter(['Contao\CoreBundle\ContaoCoreBundle']),
BundleConfig::create(TrilobitConstantsBundle::class)
->setLoadAfter([ContaoCoreBundle::class]),
];
}
}
10 changes: 3 additions & 7 deletions src/DependencyInjection/Configuration.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

declare(strict_types=1);

/*
* @copyright trilobit GmbH
* @author trilobit GmbH <https://github.com/trilobit-gmbh>
* @license LGPL-3.0-or-later
* @link http://github.com/trilobit-gmbh/contao-constants-bundle
*/

namespace Trilobit\ConstantsBundle\DependencyInjection;
Expand All @@ -14,12 +15,7 @@

class Configuration implements ConfigurationInterface
{
/**
* Generates the configuration tree builder.
*
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('trilobit_constants');

Expand Down
15 changes: 8 additions & 7 deletions src/DependencyInjection/ConstantsExtension.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

declare(strict_types=1);

/*
* @copyright trilobit GmbH
* @author trilobit GmbH <https://github.com/trilobit-gmbh>
* @license LGPL-3.0-or-later
* @link http://github.com/trilobit-gmbh/contao-constants-bundle
*/

namespace Trilobit\ConstantsBundle\DependencyInjection;
Expand All @@ -14,15 +15,15 @@

class ConstantsExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
public function getAlias(): string
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter($this->getAlias(), $config);
return 'trilobit_constants';
}

public function getAlias()
public function load(array $configs, ContainerBuilder $container): void
{
return 'trilobit_constants';
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter($this->getAlias(), $config);
}
}
3 changes: 2 additions & 1 deletion src/EventListener/DataContainer/ConstantsListener.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

declare(strict_types=1);

/*
* @copyright trilobit GmbH
* @author trilobit GmbH <https://github.com/trilobit-gmbh>
* @license LGPL-3.0-or-later
* @link http://github.com/trilobit-gmbh/contao-constants-bundle
*/

namespace Trilobit\ConstantsBundle\EventListener\DataContainer;
Expand Down
3 changes: 2 additions & 1 deletion src/EventListener/InsertTagListener.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

declare(strict_types=1);

/*
* @copyright trilobit GmbH
* @author trilobit GmbH <https://github.com/trilobit-gmbh>
* @license LGPL-3.0-or-later
* @link http://github.com/trilobit-gmbh/contao-constants-bundle
*/

namespace Trilobit\ConstantsBundle\EventListener;
Expand Down
Loading

0 comments on commit da86b30

Please sign in to comment.