Merge pull request #14558 from Art4/run-phpstan-in-ci-pipeline

Add phpstan check in woodpecker ci
This commit is contained in:
Hypolite Petovan 2024-11-16 20:52:13 -05:00 committed by GitHub
commit 1f99e2924d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 47 deletions

View file

@ -55,6 +55,13 @@ steps:
- '.composer'
volumes:
- /tmp/drone-cache:/tmp/cache
phpstan:
image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION}
when:
matrix:
PHP_MAJOR_VERSION: 8.2
commands:
- bin/composer.phar run phpstan;
test:
image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION}
environment:

View file

@ -41,7 +41,6 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory
$ns = $this->getCacheKey($prefix ?? '');
$ns = preg_quote($ns, '/');
/** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */
$iterator = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY);
$keys = [];
@ -119,7 +118,6 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory
$prefix = $this->getPrefix();
$prefix = preg_quote($prefix, '/');
/** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */
$iterator = new \APCUIterator('/^' . $prefix . '/', APC_ITER_KEY);
return apcu_delete($iterator);

View file

@ -234,41 +234,32 @@ class Babel extends BaseModule
case 'twitter':
$json = trim($request['text']);
if (file_exists('addon/twitter/twitter.php')) {
require_once 'addon/twitter/twitter.php';
$status = json_decode($json);
$status = json_decode($json);
$results[] = [
'title' => DI::l10n()->t('Decoded post'),
'content' => $visible_whitespace(var_export($status, true)),
];
$results[] = [
'title' => DI::l10n()->t('Decoded post'),
'content' => $visible_whitespace(var_export($status, true)),
];
$postarray = [];
$postarray['object-type'] = Activity\ObjectType::NOTE;
$postarray = [];
$postarray['object-type'] = Activity\ObjectType::NOTE;
if (!empty($status->full_text)) {
$postarray['body'] = $status->full_text;
} else {
$postarray['body'] = $status->text;
}
// When the post contains links then use the correct object type
if (count($status->entities->urls) > 0) {
$postarray['object-type'] = Activity\ObjectType::BOOKMARK;
}
$results[] = [
'title' => DI::l10n()->t('Post array before expand entities'),
'content' => $visible_whitespace(var_export($postarray, true)),
];
if (!empty($status->full_text)) {
$postarray['body'] = $status->full_text;
} else {
$results[] = [
'title' => DI::l10n()->tt('Error', 'Errors', 1),
'content' => DI::l10n()->t('Twitter addon is absent from the addon/ folder.'),
];
$postarray['body'] = $status->text;
}
// When the post contains links then use the correct object type
if (count($status->entities->urls) > 0) {
$postarray['object-type'] = Activity\ObjectType::BOOKMARK;
}
$results[] = [
'title' => DI::l10n()->t('Post array before expand entities'),
'content' => $visible_whitespace(var_export($postarray, true)),
];
break;
}
}

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2024.12-dev\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-16 08:36+0000\n"
"POT-Creation-Date: 2024-11-16 18:59+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -293,7 +293,7 @@ msgstr ""
#: src/Module/Calendar/Event/Form.php:236 src/Module/Contact/Advanced.php:118
#: src/Module/Contact/Profile.php:376
#: src/Module/Debug/ActivityPubConversion.php:128
#: src/Module/Debug/Babel.php:288 src/Module/Debug/Localtime.php:50
#: src/Module/Debug/Babel.php:279 src/Module/Debug/Localtime.php:50
#: src/Module/Debug/Probe.php:40 src/Module/Debug/WebFinger.php:37
#: src/Module/FriendSuggest.php:131 src/Module/Install.php:221
#: src/Module/Install.php:261 src/Module/Install.php:296
@ -1065,7 +1065,7 @@ msgstr ""
msgid "Email"
msgstr ""
#: src/Content/ContactSelector.php:122 src/Module/Debug/Babel.php:282
#: src/Content/ContactSelector.php:122 src/Module/Debug/Babel.php:273
msgid "Diaspora"
msgstr ""
@ -6741,7 +6741,7 @@ msgid "Result Item"
msgstr ""
#: src/Module/Debug/ActivityPubConversion.php:117
#: src/Module/Debug/Babel.php:267 src/Module/Moderation/Item/Source.php:79
#: src/Module/Moderation/Item/Source.php:79
#: src/Module/Security/TwoFactor/Verify.php:84
msgid "Error"
msgid_plural "Errors"
@ -6884,39 +6884,35 @@ msgstr ""
msgid "HTML::toPlaintext (compact)"
msgstr ""
#: src/Module/Debug/Babel.php:243
#: src/Module/Debug/Babel.php:240
msgid "Decoded post"
msgstr ""
#: src/Module/Debug/Babel.php:262
#: src/Module/Debug/Babel.php:259
msgid "Post array before expand entities"
msgstr ""
#: src/Module/Debug/Babel.php:268
msgid "Twitter addon is absent from the addon/ folder."
msgstr ""
#: src/Module/Debug/Babel.php:278
#: src/Module/Debug/Babel.php:269
msgid "Babel Diagnostic"
msgstr ""
#: src/Module/Debug/Babel.php:280
#: src/Module/Debug/Babel.php:271
msgid "Source text"
msgstr ""
#: src/Module/Debug/Babel.php:281
#: src/Module/Debug/Babel.php:272
msgid "BBCode"
msgstr ""
#: src/Module/Debug/Babel.php:283
#: src/Module/Debug/Babel.php:274
msgid "Markdown"
msgstr ""
#: src/Module/Debug/Babel.php:284
#: src/Module/Debug/Babel.php:275
msgid "HTML"
msgstr ""
#: src/Module/Debug/Babel.php:286
#: src/Module/Debug/Babel.php:277
msgid "Twitter Source / Tweet URL (requires API key)"
msgstr ""