1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 19:44:12 +02:00

Fix coding style missed by phpbcf (#2901)

$ composer require --dev friendsofphp/php-cs-fixer

$ echo >.php-cs-fixer.dist.php "<?php

$finder = PhpCsFixer\Finder::create()
    ->in(__DIR__);

$rules = [
    '@PSR12' => true,
    // '@PSR12:risky' => true,
    '@PHP74Migration' => true,
    // '@PHP74Migration:risky' => true,
    // buggy, duplicates existing comment sometimes
    'no_break_comment' => false,
    'array_syntax' => true,
    'lowercase_static_reference' => true,
    'visibility_required' => false,
    // Too much noise
    'binary_operator_spaces' => false,
    'heredoc_indentation' => false,
    'trailing_comma_in_multiline' => false,
];

$config = new PhpCsFixer\Config();

return $config
    ->setRules($rules)
    // ->setRiskyAllowed(true)
    ->setFinder($finder);

"

$ vendor/bin/php-cs-fixer --version
PHP CS Fixer 3.8.0 BerSzcz against war! by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.7

$ vendor/bin/php-cs-fixer fix
$ rm .php-cs-fixer.cache
$ vendor/bin/php-cs-fixer fix
This commit is contained in:
Jan Tojnar
2022-07-08 13:00:52 +02:00
committed by GitHub
parent dbf8c5b7ae
commit 951092eef3
42 changed files with 175 additions and 178 deletions

View File

@@ -230,17 +230,17 @@ class NationalGeographicBridge extends BridgeAbstract
if (isset($image['crdt'])) {
$image_credit = $image['crdt'];
}
$caption = (isset($image_module['caption']) ? $image_module['caption'] : '');
$caption = ($image_module['caption'] ?? '');
break;
case 'photogallery':
$image_credit = (isset($image_module['caption']['credit']) ? $image_module['caption']['credit'] : '');
$image_credit = ($image_module['caption']['credit'] ?? '');
$caption = $image_module['caption']['text'];
$image_src = $image_module['img']['src'];
$image_alt = $image_module['img']['altText'];
break;
case 'video':
$image_credit = (isset($image_module['credit']) ? $image_module['credit'] : '');
$description = (isset($image_module['description']) ? $image_module['description'] : '');
$image_credit = ($image_module['credit'] ?? '');
$description = ($image_module['description'] ?? '');
$caption = $description . ' Video can be watched on the article\'s page';
$image = $image_module['image'];
$image_alt = $image['altText'];
@@ -325,7 +325,7 @@ EOD;
if (isset($module['image'])) {
$content .= $this->handleImages($module['image'], $module['image']['cmsType']);
}
$content .= '<p>' . (isset($module['text']) ? $module['text'] : '') . '</p>';
$content .= '<p>' . ($module['text'] ?? '') . '</p>';
break;
case 'photogallery':
$gallery = $body['cntnt']['media'];
@@ -339,9 +339,9 @@ EOD;
case 'pullquote':
$quote = $module['quote'];
$author_name = '';
$authors = (isset($module['byLineProps']['authors']) ? $module['byLineProps']['authors'] : []);
$authors = ($module['byLineProps']['authors'] ?? []);
foreach ($authors as $author) {
$author_desc = (isset($author['authorDesc']) ? $author['authorDesc'] : '');
$author_desc = ($author['authorDesc'] ?? '');
$author_name .= $author['displayName'] . ', ' . $author_desc;
}
$content .= <<<EOD