Commit afbd9b24 authored by Thomas Löffler's avatar Thomas Löffler Committed by Stefan Busemann

Introduce test build with php-cs-fixer and fix existing issues

parent efd56388
......@@ -7,10 +7,21 @@ before_script:
stages:
- dump
- test
- build
- layout
- deploy
test:php:
stage: test
image: ekreative/php-cs-fixer:2
variables:
GIT_STRATEGY: "clone"
script:
- php-cs-fixer fix --dry-run --config=.gitlab-ci/build/.php_cs --diff
except:
- assets
build:
stage: build
image: php:7.1-alpine
......
<?php
/*
* This file is part of 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 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 --config ../Build/.php_cs
*
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
*
* For more information read:
* https://www.php-fig.org/psr/psr-2/
* https://cs.sensiolabs.org
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Define in which folders to search and which folders to exclude
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->exclude('typo3temp')
->in(__DIR__ . '/../../');
// Return a Code Sniffing configuration using
// all sniffers needed for PSR-2
// 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 PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'concat_space' => ['spacing' => 'one'],
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'single_quote' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'no_blank_lines_after_phpdoc' => true,
'array_syntax' => ['syntax' => 'short'],
'whitespace_after_comma_in_array' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'no_alias_functions' => true,
'lowercase_cast' => true,
'no_leading_namespace_whitespace' => true,
'native_function_casing' => true,
'no_short_bool_cast' => true,
'no_unneeded_control_parentheses' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_trim' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'cast_spaces' => ['space' => 'none'],
'declare_equal_normalize' => ['space' => 'single'],
'dir_constant' => true,
])->setFinder($finder);
......@@ -12,7 +12,7 @@ define(
str_replace(
'\\',
'/',
(PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi') &&
(PHP_SAPI === 'fpm-fcgi' || PHP_SAPI === 'cgi' || PHP_SAPI === 'isapi' || PHP_SAPI === 'cgi-fcgi') &&
(!empty($_SERVER['ORIG_PATH_TRANSLATED']) ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ?
(!empty($_SERVER['ORIG_PATH_TRANSLATED']) ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) :
(!empty($_SERVER['ORIG_SCRIPT_FILENAME']) ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME'])
......@@ -20,7 +20,7 @@ define(
)
);
define('PATH_SITE', dirname(PATH_THISSCRIPT).'/');
define('PATH_SITE', dirname(PATH_THISSCRIPT) . '/');
// db connection
require(PATH_SITE . '../typo3conf/AdditionalConfiguration.php');
......@@ -38,7 +38,10 @@ if (empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && empty($_SERVER['HTTPS'])) {
if (isset($apiKeys[$_SERVER['HTTP_X_FORWARDED_FOR']]) && $apiKeys[$_SERVER['HTTP_X_FORWARDED_FOR']] === $_GET['apiKey']) {
echo printAssociationMembers();
} else {
syslog(LOG_NOTICE, 't3a-members.php: API key for remote address ' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ' not found or invalid.');
syslog(
LOG_NOTICE,
't3a-members.php: API key for remote address ' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ' not found or invalid.'
);
header('HTTP/1.0 403 Forbidden');
die('Invalid token');
}
......@@ -80,18 +83,19 @@ function getAssociationMembers()
$where = 'email != "" AND hidden=0 AND deleted=0';
$where .= ' AND end_date > UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL 1 DAY))';
$query = 'SELECT uid,email,name,firstname,lastname,membership FROM tx_t3omembership_domain_model_member WHERE ' . $where;
$query = 'SELECT `uid`,`email`,`name`,`firstname`,`lastname`,`membership` FROM `tx_t3omembership_domain_model_member` WHERE ' . $where;
$query .= ' ORDER BY email';
$members = array();
$members = [];
$result = $db->query($query);
if ($result === false) {
echo mysqli_error();
echo mysqli_error($db);
die();
}
while ($row = mysqli_fetch_assoc($result)) {
$members[] = $row;
}
return $members;
}
......@@ -101,7 +105,7 @@ function getAssociationMembers()
*/
function arrayToCsv(array &$fields, $delimiter = ';', $enclosure = '"', $encloseAll = false, $nullToMysqlNull = false)
{
$output = array();
$output = [];
foreach ($fields as $field) {
if ($field === null && $nullToMysqlNull) {
$output[] = 'NULL';
......
......@@ -11,7 +11,6 @@
*
* The TYPO3 project - inspiring people to share!
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'normal';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] = 'db';
......
......@@ -11,7 +11,6 @@
*
* The TYPO3 project - inspiring people to share!
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'] = 'normal';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'] = 'yourdbname';
......@@ -19,4 +18,4 @@ $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'] = 'yourdbuse
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] = 'yourdbpassword';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] = 'yourdbhost'; /* for example 127.0.0.1 */
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['port'] = 'yourdbport'; /* default is 3306 */
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '$P$CZqeoYBTHC0kXKny4tpTvBSzzV5wVY0'; /* joh316 */
\ No newline at end of file
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '$P$CZqeoYBTHC0kXKny4tpTvBSzzV5wVY0'; /* joh316 */
......@@ -11,7 +11,6 @@
*
* The TYPO3 project - inspiring people to share!
*/
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'] = '127.0.0.1';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'] = 'DOLU0qBHtdgyXjCvB4Q1A79McSrcfpjQ';
......
......@@ -45,7 +45,7 @@ class SolrInstantSearchController
$site = $siteRepository->getSiteByPageId($GLOBALS['TSFE']->id);
$searchTerm = GeneralUtility::_GP('term');
$solrConfiguration = Util::getSolrConfigurationFromPageId($GLOBALS['TSFE']->id, FALSE, $GLOBALS['TSFE']->sys_language_uid);
$solrConfiguration = Util::getSolrConfigurationFromPageId($GLOBALS['TSFE']->id, false, $GLOBALS['TSFE']->sys_language_uid);
$solrConfiguration = $solrConfiguration->getSearchConfiguration();
$query = GeneralUtility::makeInstance(Query::class, $searchTerm . '*');
......@@ -86,9 +86,8 @@ class SolrInstantSearchController
) . '/Resources/Private/Templates/Solr/Suggest.html'
);
$template->assign('response', $response);
$template->assign('searchTerm', urlencode($searchTerm));
echo $template->render();
}
}
\ No newline at end of file
}
......@@ -16,14 +16,11 @@ namespace T3o\T3orgLayout\Domain\Model;
/**
* Class News
*
* @package T3o\T3orgLayout\Domain\Model
*/
class News extends \GeorgRinger\News\Domain\Model\News
{
/**
* @var string
*
*/
protected $authorFeUser;
......
......@@ -8,7 +8,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class TcaProcFunc
{
public function feUserItems(array $config): array
{
/** @var QueryBuilder $queryBuilder */
......
......@@ -11,7 +11,6 @@
*
* The TYPO3 project - inspiring people to share!
*/
$EM_CONF[$_EXTKEY] = [
'title' => 'Configurations for the t3org site',
'description' => '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment