1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-01-17 06:08:27 +01: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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 175 additions and 178 deletions

View File

@ -33,7 +33,7 @@ class CeskaTelevizeBridge extends BridgeAbstract
returnServerError('Could not get date from Česká televize string'); returnServerError('Could not get date from Česká televize string');
} }
$date = sprintf('%04d-%02d-%02d', isset($match[3]) ? $match[3] : date('Y'), $match[2], $match[1]); $date = sprintf('%04d-%02d-%02d', $match[3] ?? date('Y'), $match[2], $match[1]);
return strtotime($date); return strtotime($date);
} }
@ -46,7 +46,7 @@ class CeskaTelevizeBridge extends BridgeAbstract
returnServerError('Invalid url'); returnServerError('Invalid url');
} }
$category = isset($match[4]) ? $match[4] : 'nove'; $category = $match[4] ?? 'nove';
$fixedUrl = "{$match[1]}dily/{$category}/"; $fixedUrl = "{$match[1]}dily/{$category}/";
$html = getSimpleHTMLDOM($fixedUrl); $html = getSimpleHTMLDOM($fixedUrl);
@ -78,11 +78,11 @@ class CeskaTelevizeBridge extends BridgeAbstract
public function getURI() public function getURI()
{ {
return isset($this->feedUri) ? $this->feedUri : parent::getURI(); return $this->feedUri ?? parent::getURI();
} }
public function getName() public function getName()
{ {
return isset($this->feedName) ? $this->feedName : parent::getName(); return $this->feedName ?? parent::getName();
} }
} }

View File

@ -85,12 +85,14 @@ class FB2Bridge extends BridgeAbstract
$pageInfo = $this->getPageInfos($page, $cookies); $pageInfo = $this->getPageInfos($page, $cookies);
if ($pageInfo['userId'] === null) { if ($pageInfo['userId'] === null) {
returnClientError(<<<EOD returnClientError(
<<<EOD
Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge
EOD EOD
); );
} elseif ($pageInfo['userId'] == -1) { } elseif ($pageInfo['userId'] == -1) {
returnClientError(<<<EOD returnClientError(
<<<EOD
This page is not accessible without being logged in. This page is not accessible without being logged in.
EOD EOD
); );

View File

@ -67,7 +67,7 @@ class FacebookBridge extends BridgeAbstract
switch ($this->queriedContext) { switch ($this->queriedContext) {
case 'User': case 'User':
if (!empty($this->authorName)) { if (!empty($this->authorName)) {
return isset($this->extraInfos['name']) ? $this->extraInfos['name'] : $this->authorName; return $this->extraInfos['name'] ?? $this->authorName;
} }
break; break;

View File

@ -51,7 +51,7 @@ TEXT;
} }
// Sort by timestamp descending // Sort by timestamp descending
usort($this->items, fn($a, $b) => $b['timestamp'] <=> $a['timestamp']); usort($this->items, fn ($a, $b) => $b['timestamp'] <=> $a['timestamp']);
// Remove duplicates // Remove duplicates
$items = []; $items = [];

View File

@ -274,18 +274,18 @@ class GithubIssueBridge extends BridgeAbstract
switch (count($path_segments)) { switch (count($path_segments)) {
case 2: // Project issues case 2: // Project issues
list($user, $project) = $path_segments; [$user, $project] = $path_segments;
$show_comments = 'off'; $show_comments = 'off';
break; break;
case 3: // Project issues with issue comments case 3: // Project issues with issue comments
if ($path_segments[2] !== static::URL_PATH) { if ($path_segments[2] !== static::URL_PATH) {
return null; return null;
} }
list($user, $project) = $path_segments; [$user, $project] = $path_segments;
$show_comments = 'on'; $show_comments = 'on';
break; break;
case 4: // Issue comments case 4: // Issue comments
list($user, $project, /* issues */, $issue) = $path_segments; [$user, $project, /* issues */, $issue] = $path_segments;
break; break;
default: default:
return null; return null;
@ -294,8 +294,8 @@ class GithubIssueBridge extends BridgeAbstract
return [ return [
'u' => $user, 'u' => $user,
'p' => $project, 'p' => $project,
'c' => isset($show_comments) ? $show_comments : null, 'c' => $show_comments ?? null,
'i' => isset($issue) ? $issue : null, 'i' => $issue ?? null,
]; ];
} }
} }

View File

@ -66,7 +66,7 @@ class GolemBridge extends FeedExpander
protected function parseItem($item) protected function parseItem($item)
{ {
$item = parent::parseItem($item); $item = parent::parseItem($item);
$item['content'] = $item['content'] ?? ''; $item['content'] ??= '';
$uri = $item['uri']; $uri = $item['uri'];
while ($uri) { while ($uri) {

View File

@ -196,7 +196,7 @@ EOD;
$item['content'] = <<<EOD $item['content'] = <<<EOD
<p><strong>Subject: {$result->find('div.review-title', 0)->plaintext}</strong></p> <p><strong>Subject: {$result->find('div.review-title', 0)->plaintext}</strong></p>
<p>{$result->find('div.hidden-lists.review' , 0)->children(1)->plaintext}</p> <p>{$result->find('div.hidden-lists.review', 0)->children(1)->plaintext}</p>
EOD; EOD;
$item['enclosures'][] = self::URI . $result->find('img.item-img', 0)->source; $item['enclosures'][] = self::URI . $result->find('img.item-img', 0)->source;

View File

@ -120,7 +120,7 @@ class IvooxBridge extends BridgeAbstract
foreach ($originalLocales as $localeSetting) { foreach ($originalLocales as $localeSetting) {
if (strpos($localeSetting, '=') !== false) { if (strpos($localeSetting, '=') !== false) {
list($category, $locale) = explode('=', $localeSetting); [$category, $locale] = explode('=', $localeSetting);
} else { } else {
$category = LC_ALL; $category = LC_ALL;
$locale = $localeSetting; $locale = $localeSetting;

View File

@ -66,11 +66,11 @@ class MallTvBridge extends BridgeAbstract
public function getURI() public function getURI()
{ {
return isset($this->feedUri) ? $this->feedUri : parent::getURI(); return $this->feedUri ?? parent::getURI();
} }
public function getName() public function getName()
{ {
return isset($this->feedName) ? $this->feedName : parent::getName(); return $this->feedName ?? parent::getName();
} }
} }

View File

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

View File

@ -84,7 +84,7 @@ class NpciBridge extends BridgeAbstract
$item = [ $item = [
'uri' => $uri, 'uri' => $uri,
'title' => $title, 'title' => $title,
'content' => $title , 'content' => $title,
'uid' => sha1($pdfLink), 'uid' => sha1($pdfLink),
'enclosures' => [ 'enclosures' => [
$uri $uri

View File

@ -76,7 +76,9 @@ class OneFortuneADayBridge extends BridgeAbstract
private function getQuote($seed) private function getQuote($seed)
{ {
$quotes = explode('//', <<<QUOTES $quotes = explode(
'//',
<<<QUOTES
People are naturally attracted to you. People are naturally attracted to you.
//You learn from your mistakes... You will learn a lot today. //You learn from your mistakes... You will learn a lot today.
//If you have something good in your life, don't let it go! //If you have something good in your life, don't let it go!

View File

@ -58,7 +58,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
$price = ''; $price = '';
} }
list($href) = explode('#', $element->href); [$href] = explode('#', $element->href);
$item = []; $item = [];
$item['uri'] = self::URI . $href; $item['uri'] = self::URI . $href;

View File

@ -214,7 +214,7 @@ EOD;
*/ */
$item['categories'] = $post['tags']; $item['categories'] = $post['tags'];
if ($embPost) { if ($embPost) {
if ($this -> getInput('noretags') || ($post['tags'] == null )) { if ($this -> getInput('noretags') || ($post['tags'] == null)) {
$item['categories'] = $post['original_post']['tag_list']; $item['categories'] = $post['original_post']['tag_list'];
} }
} }

View File

@ -212,7 +212,7 @@ class RedditBridge extends BridgeAbstract
$this->encodePermalink($data->permalink), $this->encodePermalink($data->permalink),
'<img src="' . $data->url . '" />' '<img src="' . $data->url . '" />'
); );
} elseif (isset($data->is_gallery) ? $data->is_gallery : false) { } elseif ($data->is_gallery ?? false) {
// Multiple images // Multiple images
$images = []; $images = [];

View File

@ -30,9 +30,9 @@ class ScmbBridge extends BridgeAbstract
// get publication date // get publication date
$str_date = $article->find('time', 0)->datetime; $str_date = $article->find('time', 0)->datetime;
list($date, $time) = explode(' ', $str_date); [$date, $time] = explode(' ', $str_date);
list($y, $m, $d) = explode('-', $date); [$y, $m, $d] = explode('-', $date);
list($h, $i) = explode(':', $time); [$h, $i] = explode(':', $time);
$timestamp = mktime($h, $i, 0, $m, $d, $y); $timestamp = mktime($h, $i, 0, $m, $d, $y);
$item['timestamp'] = $timestamp; $item['timestamp'] = $timestamp;

View File

@ -33,7 +33,7 @@ class ShanaprojectBridge extends BridgeAbstract
public function getURI() public function getURI()
{ {
return isset($this->uri) ? $this->uri : parent::getURI(); return $this->uri ?? parent::getURI();
} }
public function collectData() public function collectData()
@ -47,11 +47,11 @@ class ShanaprojectBridge extends BridgeAbstract
$min_total_episodes = $this->getInput('min_total_episodes') ?: 0; $min_total_episodes = $this->getInput('min_total_episodes') ?: 0;
foreach ($animes as $anime) { foreach ($animes as $anime) {
list( [
$episodes_released, $episodes_released,
/* of */, /* of */,
$episodes_total $episodes_total
) = explode(' ', $this->extractAnimeEpisodeInformation($anime)); ] = explode(' ', $this->extractAnimeEpisodeInformation($anime));
// Skip if not enough episodes yet // Skip if not enough episodes yet
if ($episodes_released < $min_episodes) { if ($episodes_released < $min_episodes) {

View File

@ -646,7 +646,7 @@ class SkimfeedBridge extends BridgeAbstract
$query = parse_url($anchor->href, PHP_URL_QUERY); $query = parse_url($anchor->href, PHP_URL_QUERY);
foreach (explode('&', $query) as $parameter) { foreach (explode('&', $query) as $parameter) {
list($key, $value) = explode('=', $parameter); [$key, $value] = explode('=', $parameter);
if ($key !== 'u') { if ($key !== 'u') {
continue; continue;

View File

@ -339,7 +339,7 @@ EOD
$item['timestamp'] = $realtweet->created_at; $item['timestamp'] = $realtweet->created_at;
$item['id'] = $realtweet->id_str; $item['id'] = $realtweet->id_str;
$item['uri'] = self::URI . $item['username'] . '/status/' . $item['id']; $item['uri'] = self::URI . $item['username'] . '/status/' . $item['id'];
$item['author'] = (isset($tweet->retweeted_status) ? 'RT: ' : '' ) $item['author'] = (isset($tweet->retweeted_status) ? 'RT: ' : '')
. $item['fullname'] . $item['fullname']
. ' (@' . ' (@'
. $item['username'] . ')'; . $item['username'] . ')';
@ -430,7 +430,7 @@ EOD;
$video = null; $video = null;
$maxBitrate = -1; $maxBitrate = -1;
foreach ($media->video_info->variants as $variant) { foreach ($media->video_info->variants as $variant) {
$bitRate = isset($variant->bitrate) ? $variant->bitrate : -100; $bitRate = $variant->bitrate ?? -100;
if ($bitRate > $maxBitrate) { if ($bitRate > $maxBitrate) {
$maxBitrate = $bitRate; $maxBitrate = $bitRate;
$video = $variant->url; $video = $variant->url;
@ -646,7 +646,8 @@ EOD;
default: default:
$code = $e->getCode(); $code = $e->getCode();
$data = $e->getMessage(); $data = $e->getMessage();
returnServerError(<<<EOD returnServerError(
<<<EOD
Failed to make api call: $api Failed to make api call: $api
HTTP Status: $code HTTP Status: $code
Errormessage: $data Errormessage: $data

View File

@ -193,7 +193,7 @@ EOD
// Set default params // Set default params
$params = [ $params = [
'max_results' => (empty($maxResults) ? '10' : $maxResults ), 'max_results' => (empty($maxResults) ? '10' : $maxResults),
'tweet.fields' 'tweet.fields'
=> 'created_at,referenced_tweets,entities,attachments', => 'created_at,referenced_tweets,entities,attachments',
'user.fields' => 'pinned_tweet_id', 'user.fields' => 'pinned_tweet_id',
@ -219,7 +219,7 @@ EOD
case 'By keyword or hashtag': case 'By keyword or hashtag':
$params = [ $params = [
'query' => $this->getInput('query'), 'query' => $this->getInput('query'),
'max_results' => (empty($maxResults) ? '10' : $maxResults ), 'max_results' => (empty($maxResults) ? '10' : $maxResults),
'tweet.fields' 'tweet.fields'
=> 'created_at,referenced_tweets,entities,attachments', => 'created_at,referenced_tweets,entities,attachments',
'expansions' 'expansions'
@ -241,7 +241,7 @@ EOD
case 'By list ID': case 'By list ID':
// Set default params // Set default params
$params = [ $params = [
'max_results' => (empty($maxResults) ? '10' : $maxResults ), 'max_results' => (empty($maxResults) ? '10' : $maxResults),
'tweet.fields' 'tweet.fields'
=> 'created_at,referenced_tweets,entities,attachments', => 'created_at,referenced_tweets,entities,attachments',
'expansions' 'expansions'
@ -429,7 +429,7 @@ EOD
$this->item['timestamp'] = $tweet->created_at; $this->item['timestamp'] = $tweet->created_at;
$this->item['uri'] $this->item['uri']
= self::URI . $this->item['username'] . '/status/' . $this->item['id']; = self::URI . $this->item['username'] . '/status/' . $this->item['id'];
$this->item['author'] = ($isRetweet ? 'RT: ' : '' ) $this->item['author'] = ($isRetweet ? 'RT: ' : '')
. $this->item['fullname'] . $this->item['fullname']
. ' (@' . ' (@'
. $this->item['username'] . ')'; . $this->item['username'] . ')';

View File

@ -103,7 +103,7 @@ class WorldCosplayBridge extends BridgeAbstract
$list = $json->list; $list = $json->list;
foreach ($list as $img) { foreach ($list as $img) {
$image = isset($img->photo) ? $img->photo : $img; $image = $img->photo ?? $img;
$item = [ $item = [
'uri' => self::URI . substr($image->url, 1), 'uri' => self::URI . substr($image->url, 1),
'title' => $image->subject, 'title' => $image->subject,

View File

@ -15,8 +15,7 @@ class XPathBridge extends XPathAbstract
'title' => <<<"EOL" 'title' => <<<"EOL"
You can specify any website URL which serves data suited for display in RSS feeds You can specify any website URL which serves data suited for display in RSS feeds
(for example a news blog). (for example a news blog).
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => 'https://news.blizzard.com/en-en', 'exampleValue' => 'https://news.blizzard.com/en-en',
'defaultValue' => 'https://news.blizzard.com/en-en', 'defaultValue' => 'https://news.blizzard.com/en-en',
'required' => true 'required' => true
@ -29,8 +28,7 @@ Enter an XPath expression matching a list of dom nodes, each node containing one
feed article item in total (usually a surrounding &lt;div&gt; or &lt;span&gt; tag). This will feed article item in total (usually a surrounding &lt;div&gt; or &lt;span&gt; tag). This will
be the context nodes for all of the following expressions. This expression usually be the context nodes for all of the following expressions. This expression usually
starts with a single forward slash. starts with a single forward slash.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => '/html/body/div/div[4]/div[2]/div[2]/div/div/section/ol/li/article', 'exampleValue' => '/html/body/div/div[4]/div[2]/div[2]/div/div/section/ol/li/article',
'defaultValue' => '/html/body/div/div[4]/div[2]/div[2]/div/div/section/ol/li/article', 'defaultValue' => '/html/body/div/div[4]/div[2]/div[2]/div/div/section/ol/li/article',
'required' => true 'required' => true
@ -42,8 +40,7 @@ EOL
This expression should match a node contained within each article item node This expression should match a node contained within each article item node
containing the article headline. It should start with a dot followed by two containing the article headline. It should start with a dot followed by two
forward slashes, referring to any descendant nodes of the article item node. forward slashes, referring to any descendant nodes of the article item node.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/div/div[2]/h2', 'exampleValue' => './/div/div[2]/h2',
'defaultValue' => './/div/div[2]/h2', 'defaultValue' => './/div/div[2]/h2',
'required' => true 'required' => true
@ -56,8 +53,7 @@ This expression should match a node contained within each article item node
containing the article content or description. It should start with a dot containing the article content or description. It should start with a dot
followed by two forward slashes, referring to any descendant nodes of the followed by two forward slashes, referring to any descendant nodes of the
article item node. article item node.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/div[@class="ArticleListItem-description"]/div[@class="h6"]', 'exampleValue' => './/div[@class="ArticleListItem-description"]/div[@class="h6"]',
'defaultValue' => './/div[@class="ArticleListItem-description"]/div[@class="h6"]', 'defaultValue' => './/div[@class="ArticleListItem-description"]/div[@class="h6"]',
'required' => false 'required' => false
@ -71,8 +67,7 @@ This expression should match a node's attribute containing the article URL
followed by two forward slashes, referring to any descendant nodes of followed by two forward slashes, referring to any descendant nodes of
the article item node. Attributes can be selected by prepending an @ char the article item node. Attributes can be selected by prepending an @ char
before the attributes name. before the attributes name.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/a[@class="ArticleLink ArticleLink"]/@href', 'exampleValue' => './/a[@class="ArticleLink ArticleLink"]/@href',
'defaultValue' => './/a[@class="ArticleLink ArticleLink"]/@href', 'defaultValue' => './/a[@class="ArticleLink ArticleLink"]/@href',
'required' => false 'required' => false
@ -85,8 +80,7 @@ This expression should match a node contained within each article item
node containing the article author's name. It should start with a dot node containing the article author's name. It should start with a dot
followed by two forward slashes, referring to any descendant nodes of followed by two forward slashes, referring to any descendant nodes of
the article item node. the article item node.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'required' => false 'required' => false
], ],
@ -98,8 +92,7 @@ article timestamp or date (parsable by PHP's strtotime function). It
should start with a dot followed by two forward slashes, referring to should start with a dot followed by two forward slashes, referring to
any descendant nodes of the article item node. Attributes can be any descendant nodes of the article item node. Attributes can be
selected by prepending an @ char before the attributes name. selected by prepending an @ char before the attributes name.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/time[@class="ArticleListItem-footerTimestamp"]/@timestamp', 'exampleValue' => './/time[@class="ArticleListItem-footerTimestamp"]/@timestamp',
'defaultValue' => './/time[@class="ArticleListItem-footerTimestamp"]/@timestamp', 'defaultValue' => './/time[@class="ArticleListItem-footerTimestamp"]/@timestamp',
'required' => false 'required' => false
@ -113,8 +106,7 @@ image URL (usually the src attribute of an &lt;img&gt; tag or a style
attribute). It should start with a dot followed by two forward slashes, attribute). It should start with a dot followed by two forward slashes,
referring to any descendant nodes of the article item node. Attributes referring to any descendant nodes of the article item node. Attributes
can be selected by prepending an @ char before the attributes name. can be selected by prepending an @ char before the attributes name.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/div[@class="ArticleListItem-image"]/@style', 'exampleValue' => './/div[@class="ArticleListItem-image"]/@style',
'defaultValue' => './/div[@class="ArticleListItem-image"]/@style', 'defaultValue' => './/div[@class="ArticleListItem-image"]/@style',
'required' => false 'required' => false
@ -130,8 +122,7 @@ in a data attribute. It should start with a dot followed by two
forward slashes, referring to any descendant nodes of the article forward slashes, referring to any descendant nodes of the article
item node. Attributes can be selected by prepending an @ char item node. Attributes can be selected by prepending an @ char
before the attributes name. before the attributes name.
EOL EOL, 'type' => 'text',
, 'type' => 'text',
'exampleValue' => './/div[@class="ArticleListItem-label"]', 'exampleValue' => './/div[@class="ArticleListItem-label"]',
'defaultValue' => './/div[@class="ArticleListItem-label"]', 'defaultValue' => './/div[@class="ArticleListItem-label"]',
'required' => false 'required' => false
@ -144,8 +135,7 @@ Check this to fix feed encoding by invoking PHP's utf8_decode
function on all extracted texts. Try this in case you see "broken" or function on all extracted texts. Try this in case you see "broken" or
"weird" characters in your feed where you'd normally expect umlauts "weird" characters in your feed where you'd normally expect umlauts
or any other non-ascii characters. or any other non-ascii characters.
EOL EOL, 'type' => 'checkbox',
, 'type' => 'checkbox',
'required' => false 'required' => false
], ],

View File

@ -26,7 +26,7 @@ while ($next) { /* Collect all contributors */
// Check if there is a link with 'rel="next"' // Check if there is a link with 'rel="next"'
foreach ($links as $link) { foreach ($links as $link) {
list($url, $type) = explode(';', $link, 2); [$url, $type] = explode(';', $link, 2);
if (trim($type) === 'rel="next"') { if (trim($type) === 'rel="next"') {
$url = trim(preg_replace('/([<>])/', '', $url)); $url = trim(preg_replace('/([<>])/', '', $url));

View File

@ -162,7 +162,7 @@ abstract class BridgeAbstract implements BridgeInterface
continue; continue;
} }
$type = isset($properties['type']) ? $properties['type'] : 'text'; $type = $properties['type'] ?? 'text';
switch ($type) { switch ($type) {
case 'checkbox': case 'checkbox':

View File

@ -114,7 +114,7 @@ class Debug
$calling = end($backtrace); $calling = end($backtrace);
$message = $calling['file'] . ':' $message = $calling['file'] . ':'
. $calling['line'] . ' class ' . $calling['line'] . ' class '
. (isset($calling['class']) ? $calling['class'] : '<no-class>') . '->' . ($calling['class'] ?? '<no-class>') . '->'
. $calling['function'] . ' - ' . $calling['function'] . ' - '
. $text; . $text;

View File

@ -77,7 +77,7 @@ function buildBridgeException(\Throwable $e, BridgeInterface $bridge): string
$body = 'Error message: `' $body = 'Error message: `'
. $e->getMessage() . $e->getMessage()
. "`\nQuery string: `" . "`\nQuery string: `"
. (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ($_SERVER['QUERY_STRING'] ?? '')
. "`\nVersion: `" . "`\nVersion: `"
. Configuration::getVersion() . Configuration::getVersion()
. '`'; . '`';
@ -105,7 +105,7 @@ function buildTransformException(\Throwable $e, BridgeInterface $bridge): string
$body = 'Error message: `' $body = 'Error message: `'
. $e->getMessage() . $e->getMessage()
. "`\nQuery string: `" . "`\nQuery string: `"
. (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ($_SERVER['QUERY_STRING'] ?? '')
. '`'; . '`';
$link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer()); $link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer());

View File

@ -405,7 +405,8 @@ abstract class FeedExpander extends BridgeAbstract
foreach ($feedItem->guid->attributes() as $attribute => $value) { foreach ($feedItem->guid->attributes() as $attribute => $value) {
if ( if (
$attribute === 'isPermaLink' $attribute === 'isPermaLink'
&& ($value === 'true' || ( && (
$value === 'true' || (
filter_var($feedItem->guid, FILTER_VALIDATE_URL) filter_var($feedItem->guid, FILTER_VALIDATE_URL)
&& (empty($item['uri']) || !filter_var($item['uri'], FILTER_VALIDATE_URL)) && (empty($item['uri']) || !filter_var($item['uri'], FILTER_VALIDATE_URL))
) )

View File

@ -140,7 +140,8 @@ function extractFromDelimiters($string, $start, $end)
$section_retrieved = substr($string, strpos($string, $start) + strlen($start)); $section_retrieved = substr($string, strpos($string, $start) + strlen($start));
$section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end)); $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
return $section_retrieved; return $section_retrieved;
} return false; }
return false;
} }
/** /**