Merge pull request #7137 from yguedidi/upgrade-to-symfony-5

Upgrade to Symfony 5
This commit is contained in:
Kevin Decherf 2024-01-25 20:24:20 +01:00 committed by GitHub
commit eb36d692aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
99 changed files with 1837 additions and 2007 deletions

View file

@ -18,3 +18,6 @@ indent_style = tab
[.github/**.yml]
indent_size = 2
[phpstan-baseline.neon]
indent_style = tab

View file

@ -1,13 +1,14 @@
<?php
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short'
'syntax' => 'short',
],
'combine_consecutive_unsets' => true,
'heredoc_to_nowdoc' => true,
@ -21,21 +22,23 @@ return $config
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block'
'curly_brace_block',
],
],
'no_unreachable_default_argument_value' => true,
'no_useless_concat_operator' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'phpdoc_separation' => false,
// 'psr_autoloading' => true,
'strict_comparison' => true,
'strict_param' => true,
'concat_space' => [
'spacing' => 'one'
'spacing' => 'one',
],
])
->setFinder(
@ -44,7 +47,7 @@ return $config
'node_modules',
'vendor',
'var',
'web'
'web',
])
->in(__DIR__)
)

View file

@ -21,7 +21,7 @@ class AppKernel extends Kernel
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new Spiriit\Bundle\FormFilterBundle\SpiriitFormFilterBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
@ -116,7 +116,7 @@ class AppKernel extends Kernel
$scheme = 'sqlite';
break;
default:
throw new \RuntimeException('Unsupported database driver: ' . $container->getParameter('database_driver'));
throw new RuntimeException('Unsupported database driver: ' . $container->getParameter('database_driver'));
}
$container->setParameter('database_scheme', $scheme);

View file

@ -27,12 +27,12 @@ class Version20170511211659 extends WallabagMigration
$this->addSql(<<<EOD
CREATE TEMPORARY TABLE __temp__wallabag_annotation AS
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM ${annotationTableName}
FROM {$annotationTableName}
EOD
);
$this->addSql('DROP TABLE ' . $annotationTableName);
$this->addSql(<<<EOD
CREATE TABLE ${annotationTableName}
CREATE TABLE {$annotationTableName}
(
id INTEGER PRIMARY KEY NOT NULL,
user_id INTEGER DEFAULT NULL,
@ -42,16 +42,16 @@ CREATE TABLE ${annotationTableName}
updated_at DATETIME NOT NULL,
quote CLOB NOT NULL,
ranges CLOB NOT NULL,
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES ${userTableName} (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES ${entryTableName} (id) ON DELETE CASCADE
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES {$userTableName} (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES {$entryTableName} (id) ON DELETE CASCADE
);
CREATE INDEX IDX_A7AED006A76ED395 ON ${annotationTableName} (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON ${annotationTableName} (entry_id);
CREATE INDEX IDX_A7AED006A76ED395 ON {$annotationTableName} (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON {$annotationTableName} (entry_id);
EOD
);
$this->addSql(<<<EOD
INSERT INTO ${annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
INSERT INTO {$annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM __temp__wallabag_annotation;
EOD

View file

@ -42,7 +42,7 @@ twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
form_themes:
- "@LexikFormFilter/Form/form_div_layout.html.twig"
- "@SpiriitFormFilter/Form/form_div_layout.html.twig"
globals:
registration_enabled: '%fosuser_registration%'

View file

@ -24,6 +24,7 @@ web_profiler:
doctrine:
dbal:
dbname_suffix: '_test' # for MySQL and PostgreSQL
use_savepoints: true
orm:
metadata_cache_driver:
@ -32,3 +33,8 @@ doctrine:
query_cache_driver:
type: service
id: filesystem_cache
dama_doctrine_test:
enable_static_connection: true
enable_static_meta_data_cache: true
enable_static_query_cache: true

View file

@ -7,7 +7,7 @@ _profiler:
prefix: /_profiler
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
_main:

View file

@ -4,7 +4,7 @@ imports:
- { resource: parameters_addons.yml }
parameters:
lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
spiriit_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
services:
_defaults:
@ -150,8 +150,8 @@ services:
JMS\Serializer\SerializerInterface:
alias: jms_serializer
Lexik\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface:
alias: lexik_form_filter.query_builder_updater
Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface:
alias: spiriit_form_filter.query_builder_updater
Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface:
alias: scheb_two_factor.security.google_authenticator

View file

@ -6,7 +6,6 @@ services:
public: true
Wallabag\ImportBundle\Consumer\RabbitMQConsumerTotalProxy:
lazy: true
arguments:
$pocketConsumer: '@old_sound_rabbit_mq.import_pocket_consumer'
$readabilityConsumer: '@old_sound_rabbit_mq.import_readability_consumer'

View file

@ -57,131 +57,133 @@
"ext-tidy": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"babdev/pagerfanta-bundle": "^3.7",
"bdunogier/guzzle-site-authenticator": "^1.0.0",
"craue/config-bundle": "^2.3.0",
"defuse/php-encryption": "^2.1",
"doctrine/collections": "^1.6",
"doctrine/common": "^3.0",
"doctrine/dbal": "^3.3",
"doctrine/doctrine-bundle": "^2.0",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/event-manager": "^1.1",
"doctrine/migrations": "^3.2",
"doctrine/orm": "^2.6",
"doctrine/persistence": "^3.0",
"egulias/email-validator": "^3.2",
"enshrined/svg-sanitize": "^0.15.4",
"friendsofsymfony/jsrouting-bundle": "^2.2",
"babdev/pagerfanta-bundle": "^3.8",
"bdunogier/guzzle-site-authenticator": "^1.1.0",
"craue/config-bundle": "^2.7.0",
"defuse/php-encryption": "^2.4",
"doctrine/collections": "^1.8",
"doctrine/common": "^3.4.3",
"doctrine/dbal": "^3.7.2",
"doctrine/doctrine-bundle": "^2.11.1",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/event-manager": "^1.2",
"doctrine/migrations": "^3.5.5",
"doctrine/orm": "^2.17.2",
"doctrine/persistence": "^3.2",
"egulias/email-validator": "^3.2.6",
"enshrined/svg-sanitize": "^0.16",
"friendsofsymfony/jsrouting-bundle": "^2.8",
"friendsofsymfony/oauth-server-bundle": "dev-master#dc8ff343363cf794d30eb1a123610d186a43f162",
"friendsofsymfony/rest-bundle": "~3.4",
"friendsofsymfony/user-bundle": "^3.1",
"guzzlehttp/guzzle": "^5.3.1",
"guzzlehttp/psr7": "^2.5",
"html2text/html2text": "^4.1",
"incenteev/composer-parameter-handler": "^2.1",
"j0k3r/graby": "^2.0",
"javibravo/simpleue": "^2.0",
"jms/serializer": "^3.17",
"jms/serializer-bundle": "~5.0",
"laminas/laminas-code": "^4.7",
"lcobucci/jwt": "~4.1.5",
"lexik/form-filter-bundle": "^7.0",
"friendsofsymfony/rest-bundle": "^3.6",
"friendsofsymfony/user-bundle": "^3.2.1",
"guzzlehttp/guzzle": "^5.3.4",
"guzzlehttp/psr7": "^2.6.2",
"html2text/html2text": "^4.3.1",
"incenteev/composer-parameter-handler": "^2.2",
"j0k3r/graby": "^2.4.5",
"javibravo/simpleue": "^2.1",
"jms/serializer": "^3.29.1",
"jms/serializer-bundle": "^5.4",
"laminas/laminas-code": "^4.7.1",
"lcobucci/jwt": "^4.3",
"mgargano/simplehtmldom": "~1.5",
"mnapoli/piwik-twig-extension": "^3.0",
"nelmio/api-doc-bundle": "^4.10",
"nelmio/cors-bundle": "~2.2",
"nelmio/api-doc-bundle": "^4.16.2",
"nelmio/cors-bundle": "^2.4",
"ocramius/proxy-manager": "^2.1.1",
"pagerfanta/core": "^3.8",
"pagerfanta/doctrine-orm-adapter": "^3.7",
"pagerfanta/twig": "^3.7",
"php-amqplib/php-amqplib": "^3.4",
"php-amqplib/rabbitmq-bundle": "^2.11",
"php-http/client-common": "^2.4",
"php-http/discovery": "^1.14",
"pagerfanta/doctrine-orm-adapter": "^3.8",
"pagerfanta/twig": "^3.8",
"php-amqplib/php-amqplib": "^3.6",
"php-amqplib/rabbitmq-bundle": "^2.13.2",
"php-http/client-common": "^2.7.1",
"php-http/discovery": "^1.19.2",
"php-http/guzzle5-adapter": "^2.0",
"php-http/httplug": "^2.3",
"php-http/httplug-bundle": "^1.14",
"php-http/message": "^1.13",
"php-http/message-factory": "^1.0",
"pragmarx/recovery": "^0.2.0",
"predis/predis": "^2.0.3",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.1",
"php-http/httplug": "^2.4",
"php-http/httplug-bundle": "^1.32",
"php-http/message": "^1.16",
"php-http/message-factory": "^1.1",
"pragmarx/recovery": "^0.2.1",
"predis/predis": "^2.2.2",
"psr/http-client": "^1.0.3",
"psr/http-factory": "^1.0.2",
"psr/http-message": "^2.0",
"psr/log": "^1.1.4",
"rulerz-php/doctrine-orm": "dev-master",
"scheb/2fa-backup-code": "^5.13",
"scheb/2fa-bundle": "^5.13",
"scheb/2fa-email": "^5.13",
"scheb/2fa-google-authenticator": "^5.13",
"scheb/2fa-qr-code": "^5.13",
"scheb/2fa-trusted-device": "^5.13",
"scssphp/scssphp": "^1.11",
"sensio/framework-extra-bundle": "^6.2",
"scheb/2fa-backup-code": "^5.13.2",
"scheb/2fa-bundle": "^5.13.2",
"scheb/2fa-email": "^5.13.2",
"scheb/2fa-google-authenticator": "^5.13.2",
"scheb/2fa-qr-code": "^5.13.2",
"scheb/2fa-trusted-device": "^5.13.2",
"scssphp/scssphp": "^1.12",
"sensio/framework-extra-bundle": "^6.2.10",
"sentry/sentry-symfony": "4.13.2",
"stof/doctrine-extensions-bundle": "^1.2",
"symfony/asset": "^4.4",
"symfony/config": "^4.4",
"symfony/console": "^4.4",
"symfony/debug": "^4.4",
"symfony/dependency-injection": "^4.4",
"symfony/doctrine-bridge": "^4.4",
"symfony/dom-crawler": "^4.4",
"symfony/error-handler": "^4.4",
"symfony/event-dispatcher": "^4.4",
"symfony/event-dispatcher-contracts": "^1.10",
"symfony/finder": "^4.4",
"symfony/form": "^4.4",
"symfony/framework-bundle": "^4.4",
"symfony/google-mailer": "^4.4",
"symfony/http-foundation": "^4.4",
"symfony/http-kernel": "^4.4",
"symfony/mailer": "^4.4",
"symfony/mime": "^4.4",
"symfony/monolog-bundle": "^3.1",
"symfony/options-resolver": "^4.4",
"symfony/proxy-manager-bridge": "^4.4",
"symfony/routing": "^4.4",
"symfony/security-bundle": "^4.4",
"symfony/security-core": "^4.4",
"symfony/security-http": "^4.4",
"symfony/templating": "^4.4",
"symfony/translation-contracts": "^2.5",
"symfony/twig-bundle": "^4.4",
"symfony/validator": "^4.4",
"tecnickcom/tcpdf": "^6.3.0",
"twig/extra-bundle": "^3.4",
"twig/string-extra": "^3.4",
"twig/twig": "^3.4.3",
"spiriitlabs/form-filter-bundle": "^10.0",
"stof/doctrine-extensions-bundle": "^1.10.1",
"symfony/asset": "^5.4.31",
"symfony/config": "^5.4.31",
"symfony/console": "^5.4.34",
"symfony/dependency-injection": "^5.4.34",
"symfony/doctrine-bridge": "^5.4.34",
"symfony/dom-crawler": "^5.4.32",
"symfony/error-handler": "^5.4.29",
"symfony/event-dispatcher": "^5.4.34",
"symfony/event-dispatcher-contracts": "^2.5.2",
"symfony/finder": "^5.4.27",
"symfony/form": "^5.4.33",
"symfony/framework-bundle": "^5.4.34",
"symfony/google-mailer": "^5.4.23",
"symfony/http-foundation": "^5.4.34",
"symfony/http-kernel": "^5.4.34",
"symfony/intl": "^5.4.30",
"symfony/mailer": "^5.4.34",
"symfony/mime": "^5.4.26",
"symfony/monolog-bundle": "^3.10",
"symfony/options-resolver": "^5.4.21",
"symfony/polyfill-php80": "^1.28",
"symfony/polyfill-php81": "^1.28",
"symfony/proxy-manager-bridge": "^5.4.21",
"symfony/routing": "^5.4.34",
"symfony/security-bundle": "^5.4.34",
"symfony/security-core": "^5.4.30",
"symfony/security-http": "^5.4.31",
"symfony/templating": "^5.4.21",
"symfony/translation-contracts": "^2.5.2",
"symfony/twig-bundle": "^5.4.31",
"symfony/validator": "^5.4.34",
"tecnickcom/tcpdf": "^6.6.5",
"twig/extra-bundle": "^3.8",
"twig/string-extra": "^3.8",
"twig/twig": "^3.8.0",
"wallabag/phpepub": "^4.0.10",
"wallabag/rulerz": "dev-master",
"wallabag/rulerz-bundle": "dev-master",
"willdurand/hateoas": "^3.8",
"willdurand/hateoas-bundle": "~2.1"
"willdurand/hateoas": "^3.10",
"willdurand/hateoas-bundle": "^2.6"
},
"require-dev": {
"dama/doctrine-test-bundle": "^7.1",
"doctrine/doctrine-fixtures-bundle": "~3.0",
"ergebnis/composer-normalize": "^2.28",
"friendsofphp/php-cs-fixer": "~3.4",
"friendsoftwig/twigcs": "^6.0",
"m6web/redis-mock": "^5.0",
"php-http/mock-client": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-symfony": "^1.2",
"phpunit/phpunit": "^9.6",
"symfony/browser-kit": "^4.4",
"symfony/css-selector": "^4.4",
"symfony/debug-bundle": "^4.4",
"symfony/maker-bundle": "^1.18",
"symfony/phpunit-bridge": "^6.0",
"symfony/var-dumper": "^4.4",
"symfony/web-profiler-bundle": "^4.4",
"symfony/web-server-bundle": "^4.4"
"dama/doctrine-test-bundle": "^8.0",
"doctrine/doctrine-fixtures-bundle": "^3.5.1",
"ergebnis/composer-normalize": "^2.28.3",
"friendsofphp/php-cs-fixer": "^3.46",
"friendsoftwig/twigcs": "^6.1",
"m6web/redis-mock": "^5.6",
"php-http/mock-client": "^1.6",
"phpstan/extension-installer": "^1.3.1",
"phpstan/phpstan": "^1.10.55",
"phpstan/phpstan-doctrine": "^1.3.54",
"phpstan/phpstan-phpunit": "^1.3.15",
"phpstan/phpstan-symfony": "^1.3.6",
"phpunit/phpunit": "^9.6.15",
"symfony/browser-kit": "^5.4.31",
"symfony/css-selector": "^5.4.26",
"symfony/debug-bundle": "^5.4.26",
"symfony/maker-bundle": "^1.43",
"symfony/phpunit-bridge": "^7.0",
"symfony/var-dumper": "^5.4.29",
"symfony/web-profiler-bundle": "^5.4.34",
"symfony/web-server-bundle": "^4.4.44"
},
"suggest": {
"ext-imagick": "To keep GIF animation when downloading image is enabled"
@ -224,7 +226,7 @@
"public-dir": "web",
"symfony": {
"allow-contrib": true,
"require": "4.4.*"
"require": "5.4.*"
}
},
"scripts": {

2727
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,81 +1,76 @@
parameters:
ignoreErrors:
-
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<mixed\\>\\.$#"
count: 1
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
ignoreErrors:
-
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:postAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<mixed\\>\\.$#"
count: 1
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
-
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:putAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<null\\>\\.$#"
count: 1
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
-
message: "#^Method Wallabag\\\\AnnotationBundle\\\\Controller\\\\WallabagAnnotationController\\:\\:putAnnotationAction\\(\\) should return Symfony\\\\Component\\\\HttpFoundation\\\\JsonResponse but returns Symfony\\\\Component\\\\Form\\\\FormInterface\\<null\\>\\.$#"
count: 1
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Method FOS\\\\UserBundle\\\\Model\\\\UserManagerInterface\\:\\:updateUser\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 6
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Method FOS\\\\UserBundle\\\\Model\\\\UserManagerInterface\\:\\:updateUser\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 6
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Event/Subscriber/CustomDoctrineORMSubscriber.php
-
message: "#^Call to an undefined method Spiriit\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Event/Subscriber/CustomDoctrineORMSubscriber.php
-
message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpr\\(\\)\\.$#"
count: 10
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
-
message: "#^Call to an undefined method Spiriit\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpr\\(\\)\\.$#"
count: 10
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/BrowserController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagController.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
-
message: "#^Call to an undefined method Scheb\\\\TwoFactorBundle\\\\Model\\\\Email\\\\TwoFactorInterface\\:\\:getName\\(\\)\\.$#"
count: 2
path: src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagController.php
-
message: "#^PHPDoc type Symfony\\\\Component\\\\Mailer\\\\MailerInterface of property Wallabag\\\\UserBundle\\\\Mailer\\\\UserMailer\\:\\:\\$mailer is not covariant with PHPDoc type Swift_Mailer of overridden property FOS\\\\UserBundle\\\\Mailer\\\\TwigSwiftMailer\\:\\:\\$mailer\\.$#"
count: 1
path: src/Wallabag/UserBundle/Mailer/UserMailer.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagController.php
-
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
count: 1
path: tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php
-
message: "#^Call to an undefined method Scheb\\\\TwoFactorBundle\\\\Model\\\\Email\\\\TwoFactorInterface\\:\\:getName\\(\\)\\.$#"
count: 2
path: src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
-
message: "#^PHPDoc type Symfony\\\\Component\\\\Mailer\\\\MailerInterface of property Wallabag\\\\UserBundle\\\\Mailer\\\\UserMailer\\:\\:\\$mailer is not covariant with PHPDoc type Swift_Mailer of overridden property FOS\\\\UserBundle\\\\Mailer\\\\TwigSwiftMailer\\:\\:\\$mailer\\.$#"
count: 1
path: src/Wallabag/UserBundle/Mailer/UserMailer.php
-
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/HtmlController.php
-
message: "#^Method Symfony\\\\Contracts\\\\EventDispatcher\\\\EventDispatcherInterface\\:\\:dispatch()#"
count: 16
path: src/*
-
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
count: 1
path: tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php

View file

@ -8,7 +8,7 @@ parameters:
- tests
symfony:
container_xml_path: %rootDir%/../../../var/cache/test/appAppKernelTestDebugContainer.xml
container_xml_path: %rootDir%/../../../var/cache/test/AppKernelTestDebugContainer.xml
doctrine:
objectManagerLoader: tests/object-manager.php

View file

@ -15,6 +15,7 @@ use Wallabag\AnnotationBundle\Form\EditAnnotationType;
use Wallabag\AnnotationBundle\Form\NewAnnotationType;
use Wallabag\AnnotationBundle\Repository\AnnotationRepository;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\UserBundle\Entity\User;
class WallabagAnnotationController extends AbstractFOSRestController
{
@ -146,6 +147,17 @@ class WallabagAnnotationController extends AbstractFOSRestController
}
}
/**
* @return User|null
*/
protected function getUser()
{
$user = parent::getUser();
\assert(null === $user || $user instanceof User);
return $user;
}
private function validateAnnotation(AnnotationRepository $annotationRepository, int $annotationId, int $userId)
{
$annotation = $annotationRepository->findOneByIdAndUserId($annotationId, $userId);

View file

@ -13,9 +13,6 @@ use Wallabag\UserBundle\Entity\User;
class AnnotationFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
{
$annotation1 = new Annotation($this->getReference('admin-user', User::class));
@ -48,9 +45,6 @@ class AnnotationFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -7,9 +7,6 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
return new TreeBuilder('wallabag_annotation');

View file

@ -7,9 +7,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class WallabagAnnotationExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();

View file

@ -137,10 +137,6 @@ class AnnotationRepository extends ServiceEntityRepository
/**
* Find all annotations related to archived entries.
*
* @param $userId
*
* @return mixed
*/
public function findAllArchivedEntriesByUser($userId)
{

View file

@ -3,7 +3,6 @@
namespace Wallabag\ApiBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -12,6 +11,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\ApiBundle\Entity\Client;
use Wallabag\ApiBundle\Form\Type\ClientType;
use Wallabag\ApiBundle\Repository\ClientRepository;
use Wallabag\CoreBundle\Controller\AbstractController;
class DeveloperController extends AbstractController
{
@ -103,8 +103,7 @@ class DeveloperController extends AbstractController
*/
public function howtoFirstAppAction()
{
return $this->render('@WallabagCore/Developer/howto_app.html.twig',
[
return $this->render('@WallabagCore/Developer/howto_app.html.twig', [
'wallabag_url' => $this->getParameter('domain_name'),
]);
}

View file

@ -93,13 +93,13 @@ class EntryRestController extends WallabagRestController
$returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id');
$hashedUrls = $request->query->get('hashed_urls', []);
$hashedUrls = $request->query->all('hashed_urls');
$hashedUrl = $request->query->get('hashed_url', '');
if (!empty($hashedUrl)) {
$hashedUrls[] = $hashedUrl;
}
$urls = $request->query->get('urls', []);
$urls = $request->query->all('urls');
$url = $request->query->get('url', '');
if (!empty($url)) {
$urls[] = $url;

View file

@ -118,8 +118,6 @@ class WallabagRestController extends AbstractFOSRestController
/**
* Shortcut to send data serialized in json.
*
* @param mixed $data
*
* @return JsonResponse
*/
protected function sendResponse($data)
@ -132,4 +130,15 @@ class WallabagRestController extends AbstractFOSRestController
return (new JsonResponse())->setJson($json);
}
/**
* @return User|null
*/
protected function getUser()
{
$user = parent::getUser();
\assert(null === $user || $user instanceof User);
return $user;
}
}

View file

@ -12,9 +12,6 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
return new TreeBuilder('wallabag_api');

View file

@ -30,10 +30,10 @@ class CleanDownloadedImagesCommand extends Command
->setName('wallabag:clean-downloaded-images')
->setDescription('Cleans downloaded images which are no more associated to an entry')
->addOption(
'dry-run',
null,
InputOption::VALUE_NONE,
'Do not remove images, just dump counters'
'dry-run',
null,
InputOption::VALUE_NONE,
'Do not remove images, just dump counters'
);
}

View file

@ -66,10 +66,10 @@ class InstallCommand extends Command
->setName('wallabag:install')
->setDescription('wallabag installer.')
->addOption(
'reset',
null,
InputOption::VALUE_NONE,
'Reset current database'
'reset',
null,
InputOption::VALUE_NONE,
'Reset current database'
)
;
}
@ -125,8 +125,8 @@ class InstallCommand extends Command
try {
$conn->connect();
} catch (\Exception $e) {
if (false === strpos($e->getMessage(), 'Unknown database')
&& false === strpos($e->getMessage(), 'database "' . $this->databaseName . '" does not exist')) {
if (!str_contains($e->getMessage(), 'Unknown database')
&& !str_contains($e->getMessage(), 'database "' . $this->databaseName . '" does not exist')) {
$fulfilled = false;
$status = '<error>ERROR!</error>';
$help = 'Can\'t connect to the database: ' . $e->getMessage();
@ -381,12 +381,12 @@ class InstallCommand extends Command
$schemaManager = $connection->createSchemaManager();
} catch (\Exception $exception) {
// mysql & sqlite
if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
return false;
}
// pgsql
if (false !== strpos($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
if (str_contains($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
return false;
}

View file

@ -34,9 +34,9 @@ class TagAllCommand extends Command
->setName('wallabag:tag:all')
->setDescription('Tag all entries using the tagging rules.')
->addArgument(
'username',
InputArgument::REQUIRED,
'User to tag entries for.'
'username',
InputArgument::REQUIRED,
'User to tag entries for.'
)
;
}

View file

@ -0,0 +1,20 @@
<?php
namespace Wallabag\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as BaseAbstractController;
use Wallabag\UserBundle\Entity\User;
abstract class AbstractController extends BaseAbstractController
{
/**
* @return User|null
*/
protected function getUser()
{
$user = parent::getUser();
\assert(null === $user || $user instanceof User);
return $user;
}
}

View file

@ -10,7 +10,6 @@ use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerBuilder;
use PragmaRX\Recovery\Recovery as BackupCodes;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
@ -674,7 +673,7 @@ class ConfigController extends AbstractController
*/
public function setLocaleAction(Request $request, ValidatorInterface $validator, $language = null)
{
$errors = $validator->validate($language, (new LocaleConstraint(['canonicalize' => true])));
$errors = $validator->validate($language, new LocaleConstraint(['canonicalize' => true]));
if (0 === \count($errors)) {
$request->getSession()->set('_locale', $language);

View file

@ -5,11 +5,10 @@ namespace Wallabag\CoreBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NoResultException;
use Lexik\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Spiriit\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@ -80,7 +79,7 @@ class EntryController extends AbstractController
});
foreach ($labels as $label) {
$remove = false;
if (0 === strpos($label, '-')) {
if (str_starts_with($label, '-')) {
$label = substr($label, 1);
$remove = true;
}

View file

@ -2,7 +2,6 @@
namespace Wallabag\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@ -89,9 +88,9 @@ class ExportController extends AbstractController
$currentRoute = (null !== $request->query->get('currentRoute') ? $request->query->get('currentRoute') : '');
$entries = $entryRepository->getBuilderForSearchByUser(
$this->getUser()->getId(),
$searchTerm,
$currentRoute
$this->getUser()->getId(),
$searchTerm,
$currentRoute
)->getQuery()
->getResult();

View file

@ -7,7 +7,6 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Pagerfanta\Pagerfanta;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@ -34,8 +33,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showUnreadFeedAction(User $user, $page)
@ -50,8 +47,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showArchiveFeedAction(User $user, $page)
@ -66,8 +61,6 @@ class FeedController extends AbstractController
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @param $page
*
* @return Response
*/
public function showStarredFeedAction(User $user, $page)
@ -241,8 +234,6 @@ class FeedController extends AbstractController
'domainName' => $this->getParameter('domain_name'),
'version' => $this->getParameter('wallabag_core.version'),
'updated' => $this->prepareFeedUpdatedDate($entries),
],
new Response('', 200, ['Content-Type' => 'application/atom+xml'])
);
], new Response('', 200, ['Content-Type' => 'application/atom+xml']));
}
}

View file

@ -3,7 +3,6 @@
namespace Wallabag\CoreBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

View file

@ -4,7 +4,6 @@ namespace Wallabag\CoreBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

View file

@ -2,7 +2,6 @@
namespace Wallabag\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class StaticController extends AbstractController

View file

@ -7,7 +7,6 @@ use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Adapter\ArrayAdapter;
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

View file

@ -11,9 +11,6 @@ use Wallabag\UserBundle\Entity\User;
class ConfigFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$adminConfig = new Config($this->getReference('admin-user', User::class));
@ -59,9 +56,6 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -12,9 +12,6 @@ use Wallabag\UserBundle\Entity\User;
class EntryFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$now = new \DateTime();
@ -144,9 +141,6 @@ class EntryFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -20,9 +20,6 @@ class IgnoreOriginInstanceRuleFixtures extends Fixture implements ContainerAware
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) {

View file

@ -11,9 +11,6 @@ use Wallabag\UserBundle\Entity\User;
class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$rule = new IgnoreOriginUserRule();
@ -25,9 +22,6 @@ class IgnoreOriginUserRuleFixtures extends Fixture implements DependentFixtureIn
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -20,9 +20,6 @@ class InternalSettingFixtures extends Fixture implements ContainerAwareInterface
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) {

View file

@ -24,9 +24,6 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
$this->container = $container;
}
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$credential = new SiteCredential($this->getReference('admin-user', User::class));
@ -46,9 +43,6 @@ class SiteCredentialFixtures extends Fixture implements DependentFixtureInterfac
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -8,13 +8,10 @@ use Wallabag\CoreBundle\Entity\Tag;
class TagFixtures extends Fixture
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$tags = [
'foo-bar-tag' => 'foo bar', //tag used for EntryControllerTest
'foo-bar-tag' => 'foo bar', // tag used for EntryControllerTest
'bar-tag' => 'bar',
'baz-tag' => 'baz', // tag used for ExportControllerTest
'foo-tag' => 'foo',

View file

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Entity\TaggingRule;
class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager): void
{
$tr1 = new TaggingRule();
@ -61,9 +58,6 @@ class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
$manager->flush();
}
/**
* {@inheritdoc}
*/
public function getDependencies()
{
return [

View file

@ -14,9 +14,6 @@ use Doctrine\DBAL\Types\JsonType;
*/
class JsonArrayType extends JsonType
{
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value || '' === $value) {
@ -28,17 +25,11 @@ class JsonArrayType extends JsonType
return json_decode($value, true);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'json_array';
}
/**
* {@inheritdoc}
*/
public function requiresSQLCommentHint(AbstractPlatform $platform)
{
return true;

View file

@ -183,8 +183,8 @@ class Config
private $taggingRules;
/**
@var ArrayCollection<IgnoreOriginUserRule>
* @var ArrayCollection<IgnoreOriginUserRule>
*
* @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\IgnoreOriginUserRule", mappedBy="config", cascade={"remove"})
* @ORM\OrderBy({"id" = "ASC"})
*/
@ -261,8 +261,6 @@ class Config
/**
* Set user.
*
* @param User $user
*
* @return Config
*/
public function setUser(User $user = null)
@ -433,9 +431,6 @@ class Config
return $this;
}
/**
* @return string
*/
public function getFont(): ?string
{
return $this->font;
@ -451,9 +446,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getFontsize(): ?float
{
return $this->fontsize;
@ -469,9 +461,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getLineHeight(): ?float
{
return $this->lineHeight;
@ -487,9 +476,6 @@ class Config
return $this;
}
/**
* @return float
*/
public function getMaxWidth(): ?float
{
return $this->maxWidth;

View file

@ -138,7 +138,7 @@ class Entry
*
* @Groups({"entries_for_user", "export_all"})
*/
private $archivedAt = null;
private $archivedAt;
/**
* @var bool
@ -203,7 +203,7 @@ class Entry
*
* @Groups({"entries_for_user", "export_all"})
*/
private $starredAt = null;
private $starredAt;
/**
* @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"})
@ -1007,8 +1007,6 @@ class Entry
}
/**
* @param mixed $hashedUrl
*
* @return Entry
*/
public function setHashedUrl($hashedUrl)

View file

@ -2,12 +2,12 @@
namespace Wallabag\CoreBundle\Event\Subscriber;
use Lexik\Bundle\FormFilterBundle\Event\GetFilterConditionEvent;
use Lexik\Bundle\FormFilterBundle\Event\Subscriber\DoctrineORMSubscriber;
use Spiriit\Bundle\FormFilterBundle\Event\GetFilterConditionEvent;
use Spiriit\Bundle\FormFilterBundle\Event\Subscriber\DoctrineORMSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* This custom class override the default behavior of LexikFilterBundle on `filter_date_range`
* This custom class override the default behavior of SpiriitFormFilterBundle on `filter_date_range`
* It converts a date_range to date_time_range to add hour to be able to grab a whole day (from 00:00:00 to 23:59:59).
*/
class CustomDoctrineORMSubscriber extends DoctrineORMSubscriber implements EventSubscriberInterface

View file

@ -2,14 +2,14 @@
namespace Wallabag\CoreBundle\Form\Type;
use Lexik\Bundle\FormFilterBundle\Filter\FilterOperands;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
use Spiriit\Bundle\FormFilterBundle\Filter\FilterOperands;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\NumberFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType;
use Spiriit\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response;

View file

@ -42,9 +42,6 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
$this->token = $token;
}
/**
* {@inheritdoc}
*/
public function buildForHost($host)
{
$user = $this->getUser();
@ -119,7 +116,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
$extraFields = [];
foreach ($extraFieldsStrings as $extraField) {
if (false === strpos($extraField, '=')) {
if (!str_contains($extraField, '=')) {
continue;
}

View file

@ -98,7 +98,7 @@ class ContentProxy
$errors = $this->validator->validate(
$value,
(new LocaleConstraint(['canonicalize' => true]))
new LocaleConstraint(['canonicalize' => true])
);
if (0 === \count($errors)) {
@ -119,7 +119,7 @@ class ContentProxy
{
$errors = $this->validator->validate(
$value,
(new UrlConstraint())
new UrlConstraint()
);
if (0 === \count($errors)) {
@ -207,8 +207,6 @@ class ContentProxy
* If the title from the fetched content comes from a PDF, then its very possible that the character encoding is not
* UTF-8. This methods tries to identify the character encoding and translate the title to UTF-8.
*
* @param $title
*
* @return string (maybe contains invalid UTF-8 character)
*/
private function convertPdfEncodingToUTF8($title)

View file

@ -162,7 +162,7 @@ class DownloadImages
$cleanSVG = $sanitizer->sanitize((string) $res->getBody());
// add an extra validation by checking about `<svg `
if (false === $cleanSVG || false === strpos($cleanSVG, '<svg ')) {
if (false === $cleanSVG || !str_contains($cleanSVG, '<svg ')) {
$this->logger->error('DownloadImages: Bad SVG given', ['path' => $imagePath]);
return false;
@ -287,7 +287,10 @@ class DownloadImages
$iterator = $imagesCrawler->getIterator();
while ($iterator->valid()) {
$srcsetAttribute = $iterator->current()->getAttribute('srcset');
$node = $iterator->current();
\assert($node instanceof \DOMElement);
$srcsetAttribute = $node->getAttribute('srcset');
if ('' !== $srcsetAttribute) {
// Couldn't start with " OR ' OR a white space
@ -373,7 +376,7 @@ class DownloadImages
$bytes = substr((string) $res->getBody(), 0, 8);
foreach ($types as $type => $header) {
if (0 === strpos($bytes, $header)) {
if (str_starts_with($bytes, $header)) {
$ext = $type;
break;
}

View file

@ -44,8 +44,8 @@ class Redirect
return $url;
}
if (!$ignoreActionMarkAsRead &&
Config::REDIRECT_TO_HOMEPAGE === $user->getConfig()->getActionMarkAsRead()) {
if (!$ignoreActionMarkAsRead
&& Config::REDIRECT_TO_HOMEPAGE === $user->getConfig()->getActionMarkAsRead()) {
return $this->router->generate('homepage');
}

View file

@ -63,7 +63,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getSortedQueryBuilderByUser($userId)
->andWhere('e.isArchived = false')
;
;
}
/**
@ -78,7 +78,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getQueryBuilderByUser($userId)
->andWhere('e.isArchived = false')
;
;
}
/**
@ -225,7 +225,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getSortedQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
;
}
/**
@ -240,7 +240,7 @@ class EntryRepository extends ServiceEntityRepository
return $this
->getQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
;
}
/**

View file

@ -113,7 +113,6 @@
<tr><td>kphoen/rulerz</td><td>MIT</td></tr>
<tr><td>kphoen/rulerz-bundle</td><td>MIT</td></tr>
<tr><td>kriswallsmith/assetic</td><td>MIT</td></tr>
<tr><td>lexik/form-filter-bundle</td><td>MIT</td></tr>
<tr><td>mgargano/simplehtmldom</td><td>MIT</td></tr>
<tr><td>michelf/php-markdown</td><td>BSD-3-Clause</td></tr>
<tr><td>monolog/monolog</td><td>MIT</td></tr>
@ -132,6 +131,7 @@
<tr><td>sensio/framework-extra-bundle</td><td>MIT</td></tr>
<tr><td>simplepie/simplepie</td><td>BSD-3-Clause</td></tr>
<tr><td>smalot/pdfparser</td><td>GPL-3.0</td></tr>
<tr><td>spiriitlabs/form-filter-bundle</td><td>MIT</td></tr>
<tr><td>sonata-project/google-authenticator</td><td>MIT</td></tr>
<tr><td>stof/doctrine-extensions-bundle</td><td>MIT</td></tr>
<tr><td>symfony/assetic-bundle</td><td>MIT</td></tr>

View file

@ -7,9 +7,6 @@ use PhpAmqpLib\Message\AMQPMessage;
class AMQPEntryConsumer extends AbstractConsumer implements ConsumerInterface
{
/**
* {@inheritdoc}
*/
public function execute(AMQPMessage $msg)
{
return $this->handleMessage($msg->body);

View file

@ -2,11 +2,11 @@
namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ImportInterface;

View file

@ -33,9 +33,6 @@ class ChromeController extends BrowserController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ChromeController extends BrowserController
return $this->chromeImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Chrome/index.html.twig';

View file

@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\DeliciousImport;
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;

View file

@ -33,9 +33,6 @@ class ElcuratorController extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ElcuratorController extends WallabagController
return $this->elcuratorImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Elcurator/index.html.twig';

View file

@ -33,9 +33,6 @@ class FirefoxController extends BrowserController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class FirefoxController extends BrowserController
return $this->firefoxImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Firefox/index.html.twig';

View file

@ -2,11 +2,11 @@
namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ImportInterface;

View file

@ -4,9 +4,9 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Consumer\RabbitMQConsumerTotalProxy;
use Wallabag\ImportBundle\Import\ImportChain;

View file

@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\InstapaperImport;
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;

View file

@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\PinboardImport;
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;

View file

@ -4,13 +4,13 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Import\PocketImport;
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;

View file

@ -33,9 +33,6 @@ class PocketHtmlController extends HtmlController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class PocketHtmlController extends HtmlController
return $this->pocketHtmlImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/PocketHtml/index.html.twig';

View file

@ -4,10 +4,10 @@ namespace Wallabag\ImportBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ReadabilityImport;
use Wallabag\ImportBundle\Redis\Producer as RedisProducer;

View file

@ -33,9 +33,6 @@ class ShaarliController extends HtmlController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class ShaarliController extends HtmlController
return $this->shaarliImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/Shaarli/index.html.twig';

View file

@ -2,11 +2,11 @@
namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ImportInterface;

View file

@ -33,9 +33,6 @@ class WallabagV1Controller extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class WallabagV1Controller extends WallabagController
return $this->wallabagImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/WallabagV1/index.html.twig';

View file

@ -33,9 +33,6 @@ class WallabagV2Controller extends WallabagController
return parent::indexAction($request, $translator);
}
/**
* {@inheritdoc}
*/
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
@ -47,9 +44,6 @@ class WallabagV2Controller extends WallabagController
return $this->wallabagImport;
}
/**
* {@inheritdoc}
*/
protected function getImportTemplate()
{
return '@WallabagImport/WallabagV2/index.html.twig';

View file

@ -92,9 +92,6 @@ abstract class AbstractImport implements ImportInterface
return $this;
}
/**
* {@inheritdoc}
*/
public function getSummary()
{
return [

View file

@ -9,24 +9,12 @@ abstract class BrowserImport extends AbstractImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -72,9 +60,6 @@ abstract class BrowserImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
if ((!\array_key_exists('guid', $importedEntry) || (!\array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) {
@ -218,9 +203,6 @@ abstract class BrowserImport extends AbstractImport
}
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -6,33 +6,21 @@ class ChromeImport extends BrowserImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Chrome';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_chrome';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.chrome.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -42,9 +30,6 @@ class ChromeImport extends BrowserImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -8,25 +8,16 @@ class DeliciousImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Delicious';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_delicious';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.delicious.description';
@ -44,9 +35,6 @@ class DeliciousImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class DeliciousImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -92,9 +77,6 @@ class DeliciousImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -141,9 +123,6 @@ class DeliciousImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
return $importedEntry;

View file

@ -4,33 +4,21 @@ namespace Wallabag\ImportBundle\Import;
class ElcuratorImport extends WallabagImport
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'elcurator';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_elcurator';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.elcurator.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
return [
@ -42,9 +30,6 @@ class ElcuratorImport extends WallabagImport
] + $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -6,33 +6,21 @@ class FirefoxImport extends BrowserImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Firefox';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_firefox';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.firefox.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['uri'])) {
@ -42,9 +30,6 @@ class FirefoxImport extends BrowserImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -9,24 +9,12 @@ abstract class HtmlImport extends AbstractImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -86,9 +74,6 @@ abstract class HtmlImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$url = $importedEntry['url'];
@ -196,9 +181,6 @@ abstract class HtmlImport extends AbstractImport
}
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -8,25 +8,16 @@ class InstapaperImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Instapaper';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_instapaper';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.instapaper.description';
@ -44,9 +35,6 @@ class InstapaperImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -108,9 +96,6 @@ class InstapaperImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -120,9 +105,6 @@ class InstapaperImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -159,9 +141,6 @@ class InstapaperImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -8,25 +8,16 @@ class PinboardImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pinboard';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pinboard';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pinboard.description';
@ -44,9 +35,6 @@ class PinboardImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class PinboardImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['href'])) {
@ -92,9 +77,6 @@ class PinboardImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -141,9 +123,6 @@ class PinboardImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['toread'] = 'no';

View file

@ -6,33 +6,21 @@ class PocketHtmlImport extends HtmlImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pocket HTML';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pocket_html';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pocket_html.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -89,9 +77,6 @@ class PocketHtmlImport extends HtmlImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -32,25 +32,16 @@ class PocketImport extends AbstractImport
return $this->accessToken;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Pocket';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_pocket';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.pocket.description';
@ -105,9 +96,6 @@ class PocketImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function import($offset = 0)
{
static $run = 0;
@ -158,9 +146,6 @@ class PocketImport extends AbstractImport
$this->client = new HttpMethodsClient(new PluginClient($client, [new ErrorPlugin()]), $requestFactory ?: Psr17FactoryDiscovery::findRequestFactory(), $streamFactory ?: Psr17FactoryDiscovery::findStreamFactory());
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['resolved_url']) && empty($importedEntry['given_url'])) {
@ -171,8 +156,6 @@ class PocketImport extends AbstractImport
}
/**
* {@inheritdoc}
*
* @see https://getpocket.com/developer/docs/v3/retrieve
*/
public function parseEntry(array $importedEntry)
@ -233,9 +216,6 @@ class PocketImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['status'] = '1';

View file

@ -8,25 +8,16 @@ class ReadabilityImport extends AbstractImport
{
private $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Readability';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_readability';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.readability.description';
@ -44,9 +35,6 @@ class ReadabilityImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -80,9 +68,6 @@ class ReadabilityImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['article__url'])) {
@ -92,9 +77,6 @@ class ReadabilityImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em
@ -133,9 +115,6 @@ class ReadabilityImport extends AbstractImport
return $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['archive'] = 1;

View file

@ -6,33 +6,21 @@ class ShaarliImport extends HtmlImport
{
protected $filepath;
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Shaarli';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_shaarli';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.shaarli.description';
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -42,9 +30,6 @@ class ShaarliImport extends HtmlImport
return true;
}
/**
* {@inheritdoc}
*/
protected function prepareEntry(array $entry = [])
{
$data = [

View file

@ -23,24 +23,12 @@ abstract class WallabagImport extends AbstractImport
'',
];
/**
* {@inheritdoc}
*/
abstract public function getName();
/**
* {@inheritdoc}
*/
abstract public function getUrl();
/**
* {@inheritdoc}
*/
abstract public function getDescription();
/**
* {@inheritdoc}
*/
public function import()
{
if (!$this->user) {
@ -86,9 +74,6 @@ abstract class WallabagImport extends AbstractImport
return $this;
}
/**
* {@inheritdoc}
*/
public function validateEntry(array $importedEntry)
{
if (empty($importedEntry['url'])) {
@ -98,9 +83,6 @@ abstract class WallabagImport extends AbstractImport
return true;
}
/**
* {@inheritdoc}
*/
public function parseEntry(array $importedEntry)
{
$existingEntry = $this->em

View file

@ -21,33 +21,21 @@ class WallabagV1Import extends WallabagImport
parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $logger);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'wallabag v1';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_wallabag_v1';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.wallabag_v1.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
$data = [
@ -75,9 +63,6 @@ class WallabagV1Import extends WallabagImport
return $data;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_read'] = 1;

View file

@ -4,33 +4,21 @@ namespace Wallabag\ImportBundle\Import;
class WallabagV2Import extends WallabagImport
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'wallabag v2';
}
/**
* {@inheritdoc}
*/
public function getUrl()
{
return 'import_wallabag_v2';
}
/**
* {@inheritdoc}
*/
public function getDescription()
{
return 'import.wallabag_v2.description';
}
/**
* {@inheritdoc}
*/
protected function prepareEntry($entry = [])
{
return [
@ -43,9 +31,6 @@ class WallabagV2Import extends WallabagImport
] + $entry;
}
/**
* {@inheritdoc}
*/
protected function setEntryAsRead(array $importedEntry)
{
$importedEntry['is_archived'] = 1;

View file

@ -10,7 +10,6 @@ use Pagerfanta\Doctrine\ORM\QueryAdapter as DoctrineORMAdapter;
use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Pagerfanta\Pagerfanta;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
@ -18,6 +17,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use Wallabag\CoreBundle\Controller\AbstractController;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Form\NewUserType;
use Wallabag\UserBundle\Form\SearchUserType;

View file

@ -8,9 +8,6 @@ use Wallabag\UserBundle\Entity\User;
class UserFixtures extends Fixture
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
{
$userAdmin = new User();

View file

@ -252,8 +252,6 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
/**
* Set config.
*
* @param Config $config
*
* @return User
*/
public function setConfig(Config $config = null)
@ -297,65 +295,41 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
return $this->isGoogleAuthenticatorEnabled();
}
/**
* {@inheritdoc}
*/
public function isEmailAuthEnabled(): bool
{
return $this->emailTwoFactor;
}
/**
* {@inheritdoc}
*/
public function getEmailAuthCode(): string
{
return $this->authCode;
}
/**
* {@inheritdoc}
*/
public function setEmailAuthCode(string $authCode): void
{
$this->authCode = $authCode;
}
/**
* {@inheritdoc}
*/
public function getEmailAuthRecipient(): string
{
return $this->email;
}
/**
* {@inheritdoc}
*/
public function isGoogleAuthenticatorEnabled(): bool
{
return $this->googleAuthenticatorSecret ? true : false;
}
/**
* {@inheritdoc}
*/
public function getGoogleAuthenticatorUsername(): string
{
return $this->username;
}
/**
* {@inheritdoc}
*/
public function getGoogleAuthenticatorSecret(): string
{
return $this->googleAuthenticatorSecret;
}
/**
* {@inheritdoc}
*/
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): void
{
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
@ -371,17 +345,11 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI
return $this->backupCodes;
}
/**
* {@inheritdoc}
*/
public function isBackupCode(string $code): bool
{
return false === $this->findBackupCode($code) ? false : true;
}
/**
* {@inheritdoc}
*/
public function invalidateBackupCode(string $code): void
{
$key = $this->findBackupCode($code);

View file

@ -18,9 +18,6 @@ class AuthenticationFailureListener implements EventSubscriberInterface
$this->logger = $logger;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [

View file

@ -22,9 +22,6 @@ class PasswordResettingListener implements EventSubscriberInterface
$this->router = $router;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents()
{
return [

View file

@ -4,19 +4,15 @@ namespace Tests\Wallabag\AnnotationBundle;
use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManager;
use FOS\UserBundle\Security\LoginManager;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
abstract class WallabagAnnotationTestCase extends WebTestCase
{
/**
* @var KernelBrowser
*/
protected $client = null;
protected $client;
/**
* @var UserInterface
@ -51,19 +47,11 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
/** @var UserManager $userManager */
$userManager = $container->get('fos_user.user_manager.test');
/** @var LoginManager $loginManager */
$loginManager = $container->get('fos_user.security.login_manager.test');
$firewallName = $container->getParameter('fos_user.firewall_name');
$this->user = $userManager->findUserBy(['username' => 'admin']);
$loginManager->logInUser($firewallName, $this->user);
// save the login token into the session and put it in a cookie
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
$container->get(SessionInterface::class)->save();
$session = $container->get(SessionInterface::class);
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
$client->loginUser($this->user, $firewallName);
return $client;
}

View file

@ -5,12 +5,8 @@ namespace Tests\Wallabag\ApiBundle;
use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManager;
use FOS\UserBundle\Security\LoginManager;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\UserBundle\Entity\User;
abstract class WallabagApiTestCase extends WebTestCase
@ -18,7 +14,7 @@ abstract class WallabagApiTestCase extends WebTestCase
/**
* @var KernelBrowser
*/
protected $client = null;
protected $client;
/**
* @var UserInterface
@ -51,19 +47,11 @@ abstract class WallabagApiTestCase extends WebTestCase
/** @var UserManager $userManager */
$userManager = $container->get('fos_user.user_manager.test');
/** @var LoginManager $loginManager */
$loginManager = $container->get('fos_user.security.login_manager.test');
$firewallName = $container->getParameter('fos_user.firewall_name');
$this->user = $userManager->findUserBy(['username' => 'admin']);
$loginManager->logInUser($firewallName, $this->user);
// save the login token into the session and put it in a cookie
$container->get(SessionInterface::class)->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
$container->get(SessionInterface::class)->save();
$session = $container->get(SessionInterface::class);
$client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
$client->loginUser($this->user, $firewallName);
return $client;
}

View file

@ -12,7 +12,7 @@ class ReloadEntryCommandTest extends WallabagCoreTestCase
public $url = 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
/**
* @var entry
* @var Entry
*/
public $adminEntry;

View file

@ -36,7 +36,7 @@ class FeedControllerTest extends WallabagCoreTestCase
$this->assertSame('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
$this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length);
if (null !== $tagValue && 0 === strpos($type, 'tag')) {
if (null !== $tagValue && str_starts_with($type, 'tag')) {
$this->assertSame('wallabag — ' . $type . ' ' . $tagValue . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
$this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} else {

View file

@ -437,7 +437,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor->expects($this->once())
->method('process');
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -483,7 +483,7 @@ class ContentProxyTest extends TestCase
$logHandler = new TestHandler();
$logger = new Logger('test', [$logHandler]);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -523,7 +523,7 @@ class ContentProxyTest extends TestCase
$handler = new TestHandler();
$logger->pushHandler($handler);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $logger, $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -565,7 +565,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -609,7 +609,7 @@ class ContentProxyTest extends TestCase
$ruleBasedIgnoreOriginProcessor = $this->getRuleBasedIgnoreOriginProcessorMock();
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
$entry = new Entry(new User());
$proxy->updateEntry(
$entry,
@ -620,7 +620,7 @@ class ContentProxyTest extends TestCase
'url' => 'http://1.1.1.1',
'language' => 'fr',
'status' => '200',
//'og_title' => 'my OG title',
// 'og_title' => 'my OG title',
'description' => 'OG desc',
'image' => 'http://3.3.3.3/cover.jpg',
'headers' => [
@ -1043,7 +1043,7 @@ class ContentProxyTest extends TestCase
->method('process')
->willReturn($processor_result);
$proxy = new ContentProxy((new Graby()), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$proxy = new ContentProxy(new Graby(), $tagger, $ruleBasedIgnoreOriginProcessor, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
$entry = new Entry(new User());
$entry->setOriginUrl($origin_url);
$proxy->updateEntry(
@ -1069,8 +1069,6 @@ class ContentProxyTest extends TestCase
/**
* https://stackoverflow.com/a/18506801.
*
* @param $string
*
* @return string
*/
private function strToHex($string)
@ -1090,8 +1088,6 @@ class ContentProxyTest extends TestCase
*
* @see https://stackoverflow.com/a/18506801
*
* @param $hex
*
* @return string
*/
private function hexToStr($hex)

View file

@ -61,8 +61,8 @@ class DownloadImagesTest extends TestCase
public function singleImage()
{
return [
['image/pjpeg', 'jpeg'],
['image/jpeg', 'jpeg'],
['image/pjpeg', 'jpg'],
['image/jpeg', 'jpg'],
['image/png', 'png'],
['image/gif', 'gif'],
['image/webp', 'webp'],

View file

@ -6,10 +6,8 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\UserBundle\Entity\User;
@ -18,7 +16,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
/**
* @var KernelBrowser|null
*/
private $client = null;
private $client;
protected function setUp(): void
{
@ -88,10 +86,8 @@ abstract class WallabagCoreTestCase extends WebTestCase
public function logInAs($username)
{
$container = $this->client->getContainer();
$session = $container->get(SessionInterface::class);
$userManager = $container->get('fos_user.user_manager.test');
$loginManager = $container->get('fos_user.security.login_manager.test');
$firewallName = $container->getParameter('fos_user.firewall_name');
$user = $userManager->findUserBy(['username' => $username]);
@ -100,13 +96,7 @@ abstract class WallabagCoreTestCase extends WebTestCase
throw new \Exception('Unable to find user "' . $username . '". Does fixtures were loaded?');
}
$loginManager->logInUser($firewallName, $user);
$session->set('_security_' . $firewallName, serialize($container->get(TokenStorageInterface::class)->getToken()));
$session->save();
$cookie = new Cookie($session->getName(), $session->getId());
$this->client->getCookieJar()->set($cookie);
$this->client->loginUser($user, $firewallName);
}
/**

View file

@ -190,7 +190,7 @@ class PocketImportTest extends TestCase
}
}
JSON
));
));
$pocketImport = $this->getPocketImport('ConsumerKey', 1);
@ -280,7 +280,7 @@ JSON
}
}
JSON
));
));
$pocketImport = $this->getPocketImport('ConsumerKey', 2);