Add php-cs-fixer and run config

This commit is contained in:
Sebastian Fischer 2024-05-25 11:33:35 +02:00
parent 683098116c
commit 503fec2f1b
39 changed files with 2476 additions and 97 deletions

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
/.github/ export-ignore
/Build/ export-ignore
/Tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
.cache/
.idea/
Build/
bin/
Documentation-GENERATED-temp/
typo3temp/
var/
public/
vendor/
composer.lock
.php-cs-fixer.cache

411
Build/Scripts/additionalTests.sh Executable file
View File

@ -0,0 +1,411 @@
#!/usr/bin/env bash
#
# TYPO3 core test runner based on docker or podman
#
trap 'cleanUp;exit 2' SIGINT
waitFor() {
local HOST=${1}
local PORT=${2}
local TESTCOMMAND="
COUNT=0;
while ! nc -z ${HOST} ${PORT}; do
if [ \"\${COUNT}\" -gt 10 ]; then
echo \"Can not connect to ${HOST} port ${PORT}. Aborting.\";
exit 1;
fi;
sleep 1;
COUNT=\$((COUNT + 1));
done;
"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name wait-for-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_ALPINE} /bin/sh -c "${TESTCOMMAND}"
if [[ $? -gt 0 ]]; then
kill -SIGINT -$$
fi
}
cleanUp() {
ATTACHED_CONTAINERS=$(${CONTAINER_BIN} ps --filter network=${NETWORK} --format='{{.Names}}')
for ATTACHED_CONTAINER in ${ATTACHED_CONTAINERS}; do
${CONTAINER_BIN} kill ${ATTACHED_CONTAINER} >/dev/null
done
if [ ${CONTAINER_BIN} = "docker" ]; then
${CONTAINER_BIN} network rm ${NETWORK} >/dev/null
else
${CONTAINER_BIN} network rm -f ${NETWORK} >/dev/null
fi
}
handleDbmsOptions() {
# -a, -d, -i depend on each other. Validate input combinations and set defaults.
case ${DBMS} in
mariadb)
[ -z "${DATABASE_DRIVER}" ] && DATABASE_DRIVER="mysqli"
if [ "${DATABASE_DRIVER}" != "mysqli" ] && [ "${DATABASE_DRIVER}" != "pdo_mysql" ]; then
echo "Invalid combination -d ${DBMS} -a ${DATABASE_DRIVER}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.4"
if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
;;
mysql)
[ -z "${DATABASE_DRIVER}" ] && DATABASE_DRIVER="mysqli"
if [ "${DATABASE_DRIVER}" != "mysqli" ] && [ "${DATABASE_DRIVER}" != "pdo_mysql" ]; then
echo "Invalid combination -d ${DBMS} -a ${DATABASE_DRIVER}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="8.0"
if ! [[ ${DBMS_VERSION} =~ ^(8.0|8.1|8.2|8.3)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
;;
postgres)
if [ -n "${DATABASE_DRIVER}" ]; then
echo "Invalid combination -d ${DBMS} -a ${DATABASE_DRIVER}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
[ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10"
if ! [[ ${DBMS_VERSION} =~ ^(10|11|12|13|14|15|16)$ ]]; then
echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
;;
sqlite)
if [ -n "${DATABASE_DRIVER}" ]; then
echo "Invalid combination -d ${DBMS} -a ${DATABASE_DRIVER}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
if [ -n "${DBMS_VERSION}" ]; then
echo "Invalid combination -d ${DBMS} -i ${DATABASE_DRIVER}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
;;
*)
echo "Invalid option -d ${DBMS}" >&2
echo >&2
echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
;;
esac
}
cleanBuildFiles() {
echo -n "Clean builds ... "
rm -rf \
Build/JavaScript \
Build/node_modules \
Documentation-GENERATED-temp
echo "done"
}
cleanTestFiles() {
# test related
echo -n "Clean test related files ... "
rm -rf \
bin/ \
Build/phpunit \
public/ \
typo3temp/ \
vendor/ \
var/ \
composer.lock
git checkout composer.json
echo "done"
}
getPhpImageVersion() {
case ${1} in
8.1)
echo -n "2.12"
;;
8.2)
echo -n "1.12"
;;
8.3)
echo -n "1.13"
;;
esac
}
loadHelp() {
# Load help text into $HELP
read -r -d '' HELP <<EOF
TYPO3 core test runner. Execute acceptance, unit, functional and other test suites in
a container based test environment. Handles execution of single test files, sending
xdebug information to a local IDE and more.
Usage: $0 [options] [file]
Options:
-s <...>
Specifies the test suite to run
- buildDocumentation: test build the documentation
- clean: clean up build, cache and testing related files and folders
- composerInstallPackage: install a package with composer
- lintXliff: test XLIFF language files
-b <docker|podman>
Container environment:
- podman (default)
- docker
-p <8.1|8.2|8.3>
Specifies the PHP minor version to be used
- 8.1: use PHP 8.1
- 8.2 (default): use PHP 8.2
- 8.3: use PHP 8.3
-q
package to be installed by composer
-r
parameters used with composer commands
-h
Show this help.
-v
Enable verbose script output. Shows variables and docker commands.
Examples:
# Run install a package with composer
./Build/Scripts/additionalTests.sh -p 8.2 -s composerInstallPackage "typo3/cms-core:13.0"
# Test build the documentation
./Build/Scripts/additionalTests.sh -s buildDocumentation
# Test XLIFF language files
./Build/Scripts/additionalTests.sh -s lintXliff
EOF
}
# Test if docker exists, else exit out with error
if ! type "docker" >/dev/null; then
echo "This script relies on docker. Please install" >&2
exit 1
fi
# Option defaults
TEST_SUITE="unit"
DBMS="sqlite"
DBMS_VERSION=""
PHP_VERSION="8.1"
PHP_XDEBUG_ON=0
PHP_XDEBUG_PORT=9003
ACCEPTANCE_HEADLESS=1
EXTRA_TEST_OPTIONS=""
PHPUNIT_RANDOM=""
CGLCHECK_DRY_RUN=""
DATABASE_DRIVER=""
CHUNKS=0
THISCHUNK=0
CONTAINER_BIN="docker"
SCRIPT_VERBOSE=0
COMPOSER_PACKAGE=""
COMPOSER_PARAMETER=""
# Option parsing updates above default vars
# Reset in case getopts has been used previously in the shell
OPTIND=1
# Array for invalid options
INVALID_OPTIONS=()
# Simple option parsing based on getopts (! not getopt)
while getopts ":s:p:q:r:hv" OPT; do
case ${OPT} in
s)
TEST_SUITE=${OPTARG}
;;
p)
PHP_VERSION=${OPTARG}
if ! [[ ${PHP_VERSION} =~ ^(8.1|8.2|8.3)$ ]]; then
INVALID_OPTIONS+=("${OPTARG}")
fi
;;
q)
COMPOSER_PACKAGE=${OPTARG}
;;
r)
COMPOSER_PARAMETER=${OPTARG}
;;
h)
loadHelp
echo "${HELP}"
exit 0
;;
v)
SCRIPT_VERBOSE=1
;;
\?)
INVALID_OPTIONS+=("${OPTARG}")
;;
:)
INVALID_OPTIONS+=("${OPTARG}")
;;
esac
done
# Exit on invalid options
if [ ${#INVALID_OPTIONS[@]} -ne 0 ]; then
echo "Invalid option(s):" >&2
for I in "${INVALID_OPTIONS[@]}"; do
echo "-"${I} >&2
done
echo >&2
echo "Use \"./Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
fi
handleDbmsOptions
COMPOSER_ROOT_VERSION="7.0.1"
HOST_UID=$(id -u)
HOST_PID=$(id -g)
USERSET=""
if [ $(uname) != "Darwin" ]; then
USERSET="--user $HOST_UID"
fi
# Go to the directory this script is located, so everything else is relative
# to this dir, no matter from where this script is called, then go up two dirs.
THIS_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$THIS_SCRIPT_DIR" || exit 1
cd ../../ || exit 1
CORE_ROOT="${PWD}"
# Create .cache dir: composer and various npm jobs need this.
mkdir -p .cache
mkdir -p typo3temp/var/tests
PHPSTAN_CONFIG_FILE="phpstan.local.neon"
IMAGE_PREFIX="docker.io/"
# Non-CI fetches TYPO3 images (php and nodejs) from ghcr.io
TYPO3_IMAGE_PREFIX="ghcr.io/"
CONTAINER_INTERACTIVE="-it --init"
IS_CORE_CI=0
# ENV var "CI" is set by gitlab-ci. We use it here to distinct 'local' and 'CI' environment.
if [ "${CI}" == "true" ]; then
IS_CORE_CI=1
PHPSTAN_CONFIG_FILE="phpstan.ci.neon"
# In CI, we need to pull images from docker.io for the registry proxy to kick in.
TYPO3_IMAGE_PREFIX="docker.io/"
IMAGE_PREFIX=""
CONTAINER_INTERACTIVE=""
fi
IMAGE_APACHE="${TYPO3_IMAGE_PREFIX}typo3/core-testing-apache24:latest"
IMAGE_PHP="${TYPO3_IMAGE_PREFIX}typo3/core-testing-$(echo "php${PHP_VERSION}" | sed -e 's/\.//'):latest"
IMAGE_NODEJS="${TYPO3_IMAGE_PREFIX}typo3/core-testing-nodejs18:latest"
IMAGE_NODEJS_CHROME="${TYPO3_IMAGE_PREFIX}typo3/core-testing-nodejs18-chrome:latest"
IMAGE_ALPINE="${IMAGE_PREFIX}alpine:3.8"
IMAGE_SELENIUM="${IMAGE_PREFIX}selenium/standalone-chrome:4.11.0-20230801"
IMAGE_REDIS="${IMAGE_PREFIX}redis:4-alpine"
IMAGE_MEMCACHED="${IMAGE_PREFIX}memcached:1.5-alpine"
IMAGE_MARIADB="${IMAGE_PREFIX}mariadb:${DBMS_VERSION}"
IMAGE_MYSQL="${IMAGE_PREFIX}mysql:${DBMS_VERSION}"
IMAGE_POSTGRES="${IMAGE_PREFIX}postgres:${DBMS_VERSION}-alpine"
IMAGE_DOCUMENTATION="ghcr.io/t3docs/render-documentation:v3.0.dev30"
IMAGE_XLIFF="container.registry.gitlab.typo3.org/qa/example-extension:typo3-ci-xliff-lint"
# Detect arm64 to use seleniarm image.
ARCH=$(uname -m)
if [ ${ARCH} = "arm64" ]; then
IMAGE_SELENIUM="${IMAGE_PREFIX}seleniarm/standalone-chromium:4.1.2-20220227"
echo "Architecture" ${ARCH} "requires" ${IMAGE_SELENIUM} "to run acceptance tests."
fi
# Set $1 to first mass argument, this is the optional test file or test directory to execute
shift $((OPTIND - 1))
TEST_FILE=${1}
SUFFIX=$(echo $RANDOM)
NETWORK="typo3-core-${SUFFIX}"
${CONTAINER_BIN} network create ${NETWORK} >/dev/null
CONTAINER_COMMON_PARAMS="${CONTAINER_INTERACTIVE} --rm --network $NETWORK --add-host "host.docker.internal:host-gateway" $USERSET -v ${CORE_ROOT}:${CORE_ROOT}"
if [ ${PHP_XDEBUG_ON} -eq 0 ]; then
XDEBUG_MODE="-e XDEBUG_MODE=off"
XDEBUG_CONFIG=" "
PHP_FPM_OPTIONS="-d xdebug.mode=off"
else
XDEBUG_MODE="-e XDEBUG_MODE=debug -e XDEBUG_TRIGGER=foo"
XDEBUG_CONFIG="client_port=${PHP_XDEBUG_PORT} client_host=host.docker.internal"
PHP_FPM_OPTIONS="-d xdebug.mode=debug -d xdebug.start_with_request=yes -d xdebug.client_host=host.docker.internal -d xdebug.client_port=${PHP_XDEBUG_PORT} -d memory_limit=256M"
fi
# if host uid is root, like for example on ci we need to set additional php-fpm command line options
if [ "${HOST_UID}" = 0 ]; then
PHP_FPM_OPTIONS+=" --allow-to-run-as-root"
fi
# Suite execution
case ${TEST_SUITE} in
buildDocumentation)
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} -v ${CORE_ROOT}:/project ghcr.io/typo3-documentation/render-guides:latest render Documentation
SUITE_EXIT_CODE=$?
;;
clean)
cleanBuildFiles
cleanTestFiles
;;
composerInstallPackage)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; composer require -W -n ${COMPOSER_PARAMETER} ${COMPOSER_PACKAGE};"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-require-package-${SUFFIX} -w ${CORE_ROOT} -e COMPOSER_CACHE_DIR=${CORE_ROOT}/Build/.cache/composer ${IMAGE_PHP} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
lintXliff)
COMMAND="[ ${SCRIPT_VERBOSE} -eq 1 ] && set -x; xmllint --schema /xliff-core-1.2-strict.xsd --noout *.xlf;"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name lint-xliff-${SUFFIX} -w ${CORE_ROOT}/Resources/Private/Language ${IMAGE_XLIFF} /bin/sh -c "${COMMAND}"
SUITE_EXIT_CODE=$?
;;
esac
cleanUp
# Print summary
echo "" >&2
echo "###########################################################################" >&2
echo "Result of ${TEST_SUITE}" >&2
if [[ ${IS_CORE_CI} -eq 1 ]]; then
echo "Environment: CI" >&2
else
echo "Environment: local" >&2
fi
echo "PHP: ${PHP_VERSION}" >&2
if [[ "${COMPOSER_PACKAGE}" != "" ]]; then
echo "Package: ${COMPOSER_PACKAGE}" >&2
fi
if [[ ${SUITE_EXIT_CODE} -eq 0 ]]; then
echo "SUCCESS" >&2
else
echo "FAILURE" >&2
fi
echo "###########################################################################" >&2
echo "" >&2
# Exit with code of test suite - This script return non-zero if the executed test failed.
exit $SUITE_EXIT_CODE

1147
Build/Scripts/runTests.sh Executable file

File diff suppressed because it is too large Load Diff

143
Build/Scripts/test.sh Executable file
View File

@ -0,0 +1,143 @@
#!/bin/bash
export NC='\e[0m'
export RED='\e[0;31m'
export GREEN='\e[0;32m'
THIS_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$THIS_SCRIPT_DIR" || exit 1
#################################################
# Run resource tests.
# Arguments:
# none
#################################################
checkResources () {
echo "#################################################################" >&2
echo "Checking documentation, TypeScript and Scss files" >&2
echo "#################################################################" >&2
./additionalTests.sh -s lintXliff
EXIT_CODE_XLIFF=$?
./additionalTests.sh -s buildDocumentation
EXIT_CODE_DOCUMENTATION=$?
echo "#################################################################" >&2
echo "Checked documentation, TypeScript and Scss files" >&2
if [[ ${EXIT_CODE_SCSS} -eq 0 ]] && \
[[ ${EXIT_CODE_TYPESCRIPT} -eq 0 ]] && \
[[ ${EXIT_CODE_XLIFF} -eq 0 ]] && \
[[ ${EXIT_CODE_DOCUMENTATION} -eq 0 ]]
then
echo -e "${GREEN}Resources valid${NC}" >&2
else
echo -e "${RED}Resources invalid${NC}" >&2
fi
echo "#################################################################" >&2
echo "" >&2
./additionalTests.sh -s clean
}
#################################################
# Run test matrix.
# Arguments:
# php version
# typo3 version
# testing framework version
# test path
# prefer lowest
#################################################
runFunctionalTests () {
local PHP_VERSION="${1}"
local TYPO3_VERSION=${2}
local TESTING_FRAMEWORK=${3}
local TEST_PATH=${4}
local PREFER_LOWEST=${5}
echo "###########################################################################" >&2
echo " Run unit and/or functional tests with" >&2
echo " - TYPO3 ${TYPO3_VERSION}" >&2
echo " - PHP ${PHP_VERSION}">&2
echo " - Testing framework ${TESTING_FRAMEWORK}">&2
echo " - Test path ${TEST_PATH}">&2
echo " - Additional ${PREFER_LOWEST}">&2
echo "###########################################################################" >&2
./runTests.sh -s cleanTests
./additionalTests.sh \
-p ${PHP_VERSION} \
-s lintPhp || exit 1 ; \
EXIT_CODE_LINT=$?
./additionalTests.sh \
-p ${PHP_VERSION} \
-s composerInstallPackage \
-q "typo3/cms-core:${TYPO3_VERSION}" \
-r " ${PREFER_LOWEST}" || exit 1 ; \
EXIT_CODE_CORE=$?
./additionalTests.sh \
-p ${PHP_VERSION} \
-s composerInstallPackage \
-q "typo3/testing-framework:${TESTING_FRAMEWORK}" \
-r " --dev ${PREFER_LOWEST}" || exit 1 ; \
EXIT_CODE_FRAMEWORK=$?
./runTests.sh \
-p ${PHP_VERSION} \
-s composerValidate || exit 1 ; \
EXIT_CODE_VALIDATE=$?
echo "###########################################################################" >&2
echo " Finished unit and/or functional tests with" >&2
echo " - TYPO3 ${TYPO3_VERSION}" >&2
echo " - PHP ${PHP_VERSION}">&2
echo " - Testing framework ${TESTING_FRAMEWORK}">&2
echo " - Test path ${TEST_PATH}">&2
echo " - Additional ${PREFER_LOWEST}">&2
if [[ ${EXIT_CODE_LINT} -eq 0 ]] && \
[[ ${EXIT_CODE_INSTALL} -eq 0 ]] && \
[[ ${EXIT_CODE_CORE} -eq 0 ]] && \
[[ ${EXIT_CODE_FRAMEWORK} -eq 0 ]] && \
[[ ${EXIT_CODE_VALIDATE} -eq 0 ]] && \
[[ ${EXIT_CODE_FUNCTIONAL} -eq 0 ]]
then
echo -e "${GREEN}SUCCESS${NC}" >&2
else
echo -e "${RED}FAILURE${NC}" >&2
exit 1
fi
echo "#################################################################" >&2
echo "" >&2
}
#################################################
# Removes all files created by tests.
# Arguments:
# none
#################################################
cleanup () {
./runTests.sh -s clean
./additionalTests.sh -s clean
git checkout ../../composer.json
}
DEBUG_TESTS=false
if [[ $DEBUG_TESTS != true ]]; then
checkResources
runFunctionalTests "8.2" "^13.0" "dev-main" "Tests/Functional" || exit 1
runFunctionalTests "8.2" "^13.0" "dev-main" "Tests/Functional" "--prefer-lowest" || exit 1
runFunctionalTests "8.3" "^13.0" "dev-main" "Tests/Functional" || exit 1
runFunctionalTests "8.3" "^13.0" "dev-main" "Tests/Functional" "--prefer-lowest" || exit 1
cleanup
else
cleanup
runFunctionalTests "8.2" "^13.0" "dev-main" "Tests/Functional" || exit 1
cleanup
# ./runTests.sh -x -p 8.2 -d sqlite -s functional -e "--group selected" Tests/Functional
# ./runTests.sh -x -p 8.2 -d sqlite -s functional Tests/Functional
fi

View File

@ -0,0 +1,116 @@
<?php
declare(strict_types=1);
/*
* This file is copied from the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* This file represents the configuration for Code Sniffing PER-related
* automatic checks of coding guidelines.
*
* Run it using runTests.sh, see 'runTests.sh -h' for more options.
*
* Fix entire extension:
* > Build/Scripts/additionalTests.sh -p 8.3 -s composerInstallPackage -q "typo3/cms-core:[dev-main,13...]"
* > Build/Scripts/runTests.sh -s cgl
*
* Fix your current patch:
* > Build/Scripts/runTests.sh -s cglGit
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Return a Code Sniffing configuration using
// all sniffers needed for PER
// and additionally:
// - Remove leading slashes in use clauses.
// - PHP single-line arrays should not have trailing comma.
// - Single-line whitespace before closing semicolon are prohibited.
// - Remove unused use statements in the PHP source code
// - Ensure Concatenation to have at least one whitespace around
// - Remove trailing whitespace at the end of blank lines.
return (new \PhpCsFixer\Config())
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setFinder(
PhpCsFixer\Finder::create()
->ignoreVCSIgnored(true)
->in(realpath(__DIR__ . '/../../'))
->exclude('bin')
->exclude('public')
->exclude('typo3temp')
->exclude('vendor')
)
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
// @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
'@PER-CS1.0' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
// @todo: Can be dropped once we enable @PER-CS2.0
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'dir_constant' => true,
// @todo: Can be dropped once we enable @PER-CS2.0
'function_declaration' => [
'closure_fn_spacing' => 'none',
],
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
'type_declaration_spaces' => true,
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
'list_syntax' => ['syntax' => 'short'],
// @todo: Can be dropped once we enable @PER-CS2.0
'method_argument_space' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_nullsafe_operator' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_space_around_construct' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
// @todo: Can be dropped once we enable @PER-CS2.0
'single_line_empty_body' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
]);

View File

@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
/**
* This file adds header to php file which don't have any.
*
* Run it using runTests.sh, see 'runTests.sh -h' for more options.
*
* Fix entire extension:
* > Build/Scripts/additionalTests.sh -p 8.3 -s composerInstallPackage -q "typo3/cms-core:[dev-main,13...]"
* > Build/Scripts/runTests.sh -s cglHeader
*
* Fix your current patch:
* > Build/Scripts/runTests.sh -s cglHeaderGit
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
$finder = PhpCsFixer\Finder::create()
->name('*.php')
->in(__DIR__ . '/../../')
->exclude('Acceptance/Support/_generated') // EXT:core
->exclude('Build')
// Configuration files do not need header comments
->exclude('Configuration')
->notName('*locallang*.php')
->notName('ext_localconf.php')
->notName('ext_tables.php')
->notName('ext_emconf.php')
// ClassAliasMap files do not need header comments
->notName('ClassAliasMap.php')
// CodeSnippets and Examples in Documentation do not need header comments
->exclude('Documentation')
// Third-party inclusion files should not have a changed comment
->notName('Rfc822AddressesParser.php')
->notName('ClassMapGenerator.php')
;
$headerComment = <<<COMMENT
This file is developed by evoWeb.
It is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License, either version 2
of the License, or any later version.
For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
COMMENT;
return (new \PhpCsFixer\Config())
->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(false)
->setRules([
'no_extra_blank_lines' => true,
'header_comment' => [
'header' => $headerComment,
'comment_type' => 'comment',
'separate' => 'both',
'location' => 'after_declare_strict',
],
])
->setFinder($finder);

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\Command;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\Command;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;

View File

@ -2,16 +2,19 @@
declare(strict_types=1);
namespace Evoweb\EwBase\Configuration;
/*
* This file is part of TYPO3 CMS-based extension "container" by b13.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Configuration;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

View File

@ -1,5 +1,16 @@
<?php
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
@ -11,9 +22,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
class CssMerger
{
public function __construct(protected ExtensionConfiguration $extensionConfiguration)
{
}
public function __construct(protected ExtensionConfiguration $extensionConfiguration) {}
#[AsEventListener('evoweb-ew-base-beforestylesheets', BeforeStylesheetsRenderingEvent::class)]
public function __invoke(BeforeStylesheetsRenderingEvent $event): void

View File

@ -1,5 +1,16 @@
<?php
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;

View File

@ -2,8 +2,6 @@
declare(strict_types=1);
namespace Evoweb\EwBase\Form\Element;
/*
* This file is developed by evoWeb.
*
@ -15,6 +13,8 @@ namespace Evoweb\EwBase\Form\Element;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Form\Element;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
use TYPO3\CMS\Backend\Form\Event\ModifyImageManipulationPreviewUrlEvent;

View File

@ -2,6 +2,17 @@
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Form\FormDataProvider;
use TYPO3\CMS\Backend\Form\FormDataProvider\SiteDatabaseEditRow;

View File

@ -3,7 +3,7 @@
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
@ -11,8 +11,6 @@ declare(strict_types=1);
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace Evoweb\EwBase\Form\FormDataProvider;

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\Hooks;
/*
* This file is developed by evoWeb.
*
@ -13,7 +11,8 @@ namespace Evoweb\EwBase\Hooks;
* LICENSE.txt file that was distributed with this source code.
*/
use Exception;
namespace Evoweb\EwBase\Hooks;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Site\Entity\Site;
@ -29,9 +28,7 @@ class UsercentricsPostRenderHook
protected ?Site $site = null;
public function __construct(protected SiteFinder $siteFinder)
{
}
public function __construct(protected SiteFinder $siteFinder) {}
public function executePostRenderHook(array $params): void
{
@ -80,7 +77,7 @@ class UsercentricsPostRenderHook
break;
}
}
} catch (Exception) {
} catch (\Exception) {
$siteArguments = [];
}
@ -99,7 +96,7 @@ class UsercentricsPostRenderHook
if (!$this->site) {
try {
$this->site = $this->siteFinder->getSiteByPageId($pageUid);
} catch (Exception) {
} catch (\Exception) {
}
}
return $this->site;

View File

@ -2,8 +2,6 @@
declare(strict_types=1);
namespace Evoweb\EwBase\Services;
/*
* This file is developed by evoWeb.
*
@ -15,6 +13,8 @@ namespace Evoweb\EwBase\Services;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Services;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\ParameterType;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
@ -293,7 +293,8 @@ class QueryBuilderHelper
): mixed {
if (array_key_exists($paramName, $paramsOrTypes)) {
return $paramsOrTypes[$paramName];
} elseif (array_key_exists(':' . $paramName, $paramsOrTypes)) {
}
if (array_key_exists(':' . $paramName, $paramsOrTypes)) {
// Hash keys can be prefixed with a colon for compatibility
return $paramsOrTypes[':' . $paramName];
}

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ToolbarItems;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ToolbarItems;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ToolbarItems;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Toolbar\RequestAwareToolbarItemInterface;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
@ -25,10 +25,7 @@ class ReleaseToolbarItem implements ToolbarItemInterface, RequestAwareToolbarIte
{
private ServerRequestInterface $request;
public function __construct(
private readonly BackendViewFactory $backendViewFactory,
) {
}
public function __construct(private readonly BackendViewFactory $backendViewFactory) {}
public function setRequest(ServerRequestInterface $request): void
{

View File

@ -2,6 +2,17 @@
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Updates;
use Psr\Log\LoggerInterface;
@ -47,7 +58,7 @@ class GridelementsToContainerMigration implements UpgradeWizardInterface
public function getPrerequisites(): array
{
return [
DatabaseUpdatedPrerequisite::class
DatabaseUpdatedPrerequisite::class,
];
}

View File

@ -2,6 +2,17 @@
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Updates;
use Doctrine\DBAL\ParameterType;
@ -38,7 +49,6 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ew_base']['migrationMapping'] = [
],
];
*/
class GridelementsToContainerService
{
private const TABLE_NAME = 'tt_content';
@ -54,7 +64,7 @@ class GridelementsToContainerService
protected DataHandler $dataHandler,
protected FlexFormService $flexFormService,
) {
$config =& $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ew_base'];
$config = & $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['ew_base'];
$this->resolveContainer = $config['migrationResolveContainer'] ?? [];
$this->colPosOffset = $config['migrationColPosOffset'] ?? 0;
$this->configuration = $config['migrationMapping'] ?? [];
@ -82,7 +92,6 @@ class GridelementsToContainerService
$this->dataHandler->start([], [], $backendUser);
}
protected function resolveContainers(string $layout): void
{
$containers = $this->getGridElementsByLayout($layout);
@ -110,7 +119,7 @@ class GridelementsToContainerService
[
'tx_gridelements_container' => 0,
'colPos' => $container['colPos'],
'header' => $child['header'] ?: $container['header']
'header' => $child['header'] ?: $container['header'],
]
);
$this->moveElementAfterElement($child['uid'], $moveAfterThis['uid']);
@ -134,10 +143,9 @@ class GridelementsToContainerService
$this->dataHandler->moveRecord(self::TABLE_NAME, $elementToMove, $elementToMoveAfter * -1);
}
protected function migrateConfiguredContainer(): void
{
array_walk($this->configuration, function($config, $key) {
array_walk($this->configuration, function ($config, $key) {
$containers = $this->getGridElementsByLayout((string)$key);
foreach ($containers as $container) {
$container['pi_flexform'] = $this->flexFormService->convertFlexFormContentToArray(
@ -157,7 +165,7 @@ class GridelementsToContainerService
$data = [
'CType' => $this->getCType($container, $config),
'tx_gridelements_backend_layout' => ''
'tx_gridelements_backend_layout' => '',
];
if (isset($config['map']) && is_array($config['map']) && !empty($container['pi_flexform'])) {
@ -205,13 +213,13 @@ class GridelementsToContainerService
if (empty($container[$to]) && !empty($value)) {
$data[$to] = $value;
}
} catch (\throwable) {}
} catch (\throwable) {
}
}
return $data;
}
protected function updateElement(int $uid, array $changes): void
{
$this->connectionPool

View File

@ -2,6 +2,17 @@
declare(strict_types=1);
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\User;
use TYPO3\CMS\Core\Utility\PathUtility;

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Array;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ViewHelpers\Array;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Array;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Array;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Array;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
@ -72,9 +76,9 @@ class ExplodeViewHelper extends AbstractViewHelper
protected static function resolveGlue(array $arguments): string
{
$glue = $arguments['glue'];
if (str_contains($glue, ':') && 1 < strlen($glue)) {
if (str_contains($glue, ':') && strlen($glue) > 1) {
// glue contains a special type identifier, resolve the actual glue
list ($type, $value) = explode(':', $glue);
[$type, $value] = explode(':', $glue);
$glue = match ($type) {
'constant' => constant($value),
default => $value,

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Condition;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Condition;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
/**

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Condition;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Condition;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
/**

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Context;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Context;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Context;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Context;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;

View File

@ -1,14 +1,18 @@
<?php
namespace Evoweb\EwBase\ViewHelpers\Context;
/*
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers\Context;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
@ -16,6 +20,6 @@ class StagingViewHelper extends AbstractConditionViewHelper
{
protected static function evaluateCondition($arguments = null): bool
{
return 'Production/Staging' === (string)Environment::getContext();
return (string)Environment::getContext() === 'Production/Staging';
}
}

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ViewHelpers;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ViewHelpers;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers;
use TYPO3\CMS\Core\Crypto\HashService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
@ -24,7 +24,7 @@ class HashViewHelper extends AbstractViewHelper
use CompileWithRenderStatic;
/**
* @var boolean
* @var bool
*/
protected $escapeOutput = false;

View File

@ -2,8 +2,6 @@
declare(strict_types=1);
namespace Evoweb\EwBase\ViewHelpers;
/*
* This file is developed by evoWeb.
*
@ -15,6 +13,8 @@ namespace Evoweb\EwBase\ViewHelpers;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
@ -37,7 +37,7 @@ class PublicPathViewHelper extends AbstractViewHelper
use CompileWithRenderStatic;
/**
* @var boolean
* @var bool
*/
protected $escapeOutput = false;

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ViewHelpers;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ViewHelpers;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ViewHelpers;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ViewHelpers;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconSize;

View File

@ -1,7 +1,5 @@
<?php
namespace Evoweb\EwBase\ViewHelpers;
/*
* This file is developed by evoWeb.
*
@ -13,6 +11,8 @@ namespace Evoweb\EwBase\ViewHelpers;
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\ViewHelpers;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

View File

@ -1,5 +1,16 @@
<?php
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Xclass;
use TYPO3\CMS\Backend\Form\FormDataProvider\SiteDatabaseEditRow as BaseSiteDatabaseEditRow;
@ -27,7 +38,13 @@ class SiteDatabaseEditRow extends BaseSiteDatabaseEditRow
$rowData = $this->getRawConfigurationForSiteWithRootPageId($siteFinder, $rootPageId);
$result['databaseRow']['uid'] = $rowData['rootPageId'];
$result['databaseRow']['identifier'] = $result['customData']['siteIdentifier'];
} elseif (in_array($tableName, ['site_errorhandling', 'site_language', 'site_route', 'site_base_variant'], true)) {
} elseif (
in_array(
$tableName,
['site_errorhandling', 'site_language', 'site_route', 'site_base_variant'],
true
)
) {
$rootPageId = (int)($result['inlineTopMostParentUid'] ?? $result['inlineParentUid']);
try {
$rowData = $this->getRawConfigurationForSiteWithRootPageId($siteFinder, $rootPageId);

View File

@ -1,5 +1,16 @@
<?php
/*
* This file is developed by evoWeb.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace Evoweb\EwBase\Xclass;
use TYPO3\CMS\Backend\Form\FormDataProvider\SiteTcaInline as BaseSiteTcaInline;
@ -23,7 +34,10 @@ class SiteTcaInline extends BaseSiteTcaInline
$result['processedTca']['columns'][$fieldName]['children'] = [];
$result = $this->resolveSiteRelatedChildren($result, $fieldName);
if (!empty($result['processedTca']['columns'][$fieldName]['config']['selectorOrUniqueConfiguration'])) {
throw new \RuntimeException('selectorOrUniqueConfiguration not implemented in sites module', 1624313533);
throw new \RuntimeException(
'selectorOrUniqueConfiguration not implemented in sites module',
1624313533
);
}
}

View File

@ -34,7 +34,7 @@ return [
0 => 'CMP 1',
1 => 'main',
],
]
],
],
],
'applicationContext' => [
@ -56,7 +56,7 @@ return [
0 => '',
1 => true,
],
]
],
],
],
],
@ -72,7 +72,7 @@ return [
'showitem' => '
id, version, --linebreak--,
applicationContext, useBlocker,
'
]
]
',
],
],
];

View File

@ -15,14 +15,14 @@ $newColumns = [
'suggestOptions' => [
'default' => [
'additionalSearchFields' => 'header, bodytext',
'searchWholePhrase' => false
]
'searchWholePhrase' => false,
],
],
'default' => 0,
'behaviour' => [
'allowLanguageSynchronization' => true
]
]
'allowLanguageSynchronization' => true,
],
],
],
];

345
LICENSE.txt Normal file
View File

@ -0,0 +1,345 @@
Some icons used in the TYPO3 project are retrieved from the "Silk" icon set of
Mark James, which can be found at http://famfamfam.com/lab/icons/silk/. This
set is distributed under a Creative Commons Attribution 2.5 License. The
license can be found at http://creativecommons.org/licenses/by/2.5/.
---------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -7,7 +7,7 @@
}
},
"require": {
"typo3/cms-core": "^13.0 || 13.0.x-dev || dev-main",
"typo3/cms-core": "dev-main",
"typo3/cms-backend": "*",
"typo3/cms-extbase": "*",
@ -35,12 +35,26 @@
"typo3/cms-tstemplate": "*",
"typo3/cms-scheduler": "*",
"helhum/typo3-console": "*",
"helhum/typo3-console": ">8.0",
"clickstorm/cs-seo": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.57.1",
"phpunit/phpunit": "^11.0.3",
"typo3/testing-framework": "dev-main"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"typo3/cms": {
"extension-key": "ew_base"
}
},
"config": {
"bin-dir": "bin",
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
}
}

View File

@ -26,10 +26,10 @@ call_user_func(function () {
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][BaseSiteDatabaseEditRow::class] = [
'className' => SiteDatabaseEditRow::class
'className' => SiteDatabaseEditRow::class,
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][BaseSiteTcaInline::class] = [
'className' => SiteTcaInline::class
'className' => SiteTcaInline::class,
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['siteConfiguration'][