Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
magicsunday committed Apr 24, 2024
0 parents commit ce8dbac
Show file tree
Hide file tree
Showing 33 changed files with 1,257 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Adapted from https://github.com/TYPO3GmbH/blog/blob/master/.github/workflows/ci.yml
name: CI

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
typo3: [ '^12.0', '^13.0' ]
php: [ '8.1', '8.2', '8.3' ]
exclude:
- typo3: '^13.0'
php: '8.1'
include:
- rector: '^1.8'
- rector: '^2.0'
typo3: '^13.0'

steps:
- id: checkout
name: Checkout
uses: actions/checkout@v4

- id: setup_php
name: Set up PHP version ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2, php-cs-fixer

- name: Validate composer.json and composer.lock
run: composer validate

- id: composer-cache-vars
name: Composer Cache Vars
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "timestamp=$(date +"%s")" >> $GITHUB_OUTPUT
- id: composer-cache-dependencies
name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-vars.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.typo3 }}-${{ steps.composer-cache-vars.outputs.timestamp }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.typo3 }}-
${{ runner.os }}-composer-${{ matrix.php }}-
${{ runner.os }}-composer-
- id: install
name: Install dependencies with typo3/cms-core:${{ matrix.typo3 }}
run: |
composer require typo3/cms-core:${{ matrix.typo3 }} --no-progress --no-update
composer require typo3/cms-backend:${{ matrix.typo3 }} --no-progress --no-update
composer require typo3/cms-extbase:${{ matrix.typo3 }} --no-progress --no-update
composer require typo3/cms-extensionmanager:${{ matrix.typo3 }} --no-progress --no-update
composer require ssch/typo3-rector:${{ matrix.rector }} --no-progress
git checkout composer.json
- id: lint
name: Lint
if: ${{ always() && steps.install.conclusion == 'success' }}
run: |
composer ci:test:php:lint
- id: cgl
name: CGL
if: ${{ always() && steps.install.conclusion == 'success' }}
run: |
php-cs-fixer fix --dry-run --verbose --config Build/.php-cs-fixer.dist.php
- id: phpstan
name: PHPStan
if: ${{ always() && steps.install.conclusion == 'success' }}
run: |
composer ci:test:php:phpstan -- --error-format=github
- id: rector
name: Rector
if: ${{ always() && steps.install.conclusion == 'success' }}
run: |
composer ci:test:php:rector
- id: tests_unit
name: Unit Tests
if: ${{ always() && steps.install.conclusion == 'success' }}
run: |
composer ci:test:php:unit
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# PHPStorm
.idea

# OSX
.DS_Store

# Composer
vendor/
bin/
logs/
composer.lock

# Build stuff
.build/

# Cache
.php-cs-fixer.cache
.phplint.cache
.phpunit.result.cache
95 changes: 95 additions & 0 deletions Build/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

/**
* This file represents the configuration for Code Sniffing PSR-2-related
* automatic checks of coding guidelines
* Install @fabpot's great php-cs-fixer tool via
*
* $ composer global require friendsofphp/php-cs-fixer
*
* And then simply run
*
* $ php-cs-fixer fix
*
* For more information read:
* http://www.php-fig.org/psr/psr-2/
* http://cs.sensiolabs.org
*/

if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}

$header = <<<EOF
This file is part of the package netresearch/nrc-universal-messenger.
For the full copyright and license information, please read the
LICENSE file that was distributed with this source code.
EOF;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'@PER-CS2.0' => true,
'@Symfony' => true,

// Additional custom rules
'declare_strict_types' => true,
'concat_space' => [
'spacing' => 'one',
],
'header_comment' => [
'header' => $header,
'comment_type' => 'PHPDoc',
'location' => 'after_open',
'separate' => 'both',
],
'phpdoc_to_comment' => false,
'phpdoc_no_alias_tag' => false,
'no_superfluous_phpdoc_tags' => false,
'phpdoc_separation' => [
'groups' => [
[
'author',
'license',
'link',
],
],
],
'no_alias_functions' => true,
'whitespace_after_comma_in_array' => [
'ensure_single_space' => true,
],
'single_line_throw' => false,
'self_accessor' => false,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'function_declaration' => [
'closure_function_spacing' => 'one',
'closure_fn_spacing' => 'one',
],
'binary_operator_spaces' => [
'operators' => [
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
],
],
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
'always_move_variable' => false,
],
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('.build')
->exclude('config')
->exclude('node_modules')
->exclude('var')
->in(__DIR__ . '/../')
);
7 changes: 7 additions & 0 deletions Build/.phplint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
path: ./
jobs: 10
cache: .build/.phplint.cache
extensions:
- php
exclude:
- .build
24 changes: 24 additions & 0 deletions Build/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
includes:
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-strict-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/friendsoftypo3/phpstan-typo3/extension.neon
# - %currentWorkingDirectory%/Build/phpstan-baseline.neon

parameters:
# You can currently choose from 10 levels (0 is the loosest and 9 is the strictest).
level: 6

paths:
- %currentWorkingDirectory%/Classes/
- %currentWorkingDirectory%/Configuration/
- %currentWorkingDirectory%/Resources/
- %currentWorkingDirectory%/ext_localconf.php

excludePaths:
- %currentWorkingDirectory%/.build/*
- %currentWorkingDirectory%/ext_emconf.php

checkGenericClassInNonGenericObjectType: false
treatPhpDocTypesAsCertain: false

ignoreErrors:
68 changes: 68 additions & 0 deletions Build/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

/**
* This file is part of the package netresearch/nrc-universal-messenger.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

declare(strict_types=1);

use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/../Classes',
__DIR__ . '/../Configuration',
__DIR__ . '/../Resources',
'../ext_*',
]);

$rectorConfig->skip([
'../ext_emconf.php',
'../ext_*.sql',
]);

$rectorConfig->phpstanConfig('Build/phpstan.neon');
$rectorConfig->importNames();
$rectorConfig->removeUnusedImports();
$rectorConfig->disableParallel();

// Define what rule sets will be applied
$rectorConfig->sets([
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
// SetList::DEAD_CODE,

LevelSetList::UP_TO_PHP_81,
Typo3LevelSetList::UP_TO_TYPO3_12,
]);

// Skip some rules
$rectorConfig->skip([
CatchExceptionNameMatchingTypeRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
MixedTypeRector::class,
NullToStrictStringFuncCallArgRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessVarTagRector::class,
TypedPropertyFromAssignsRector::class,
TypedPropertyFromStrictConstructorRector::class,
]);
};
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 2.0.0

## MISC

- 7fc7000 MFAG-1251: Add dvinci easy SDK

## Contributors

- Rico Sonntag

# 1.0.0

## MISC

- 576f21f Initial commit

## Contributors

- Rico Sonntag

Loading

0 comments on commit ce8dbac

Please sign in to comment.