Import used classes

This commit is contained in:
Yassine Guedidi 2022-08-28 16:59:43 +02:00
parent dace00d7fb
commit d1d56fbe25
32 changed files with 145 additions and 104 deletions

View file

@ -3,7 +3,9 @@
namespace Wallabag\ApiBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
@ -17,7 +19,7 @@ class DeveloperController extends Controller
*
* @Route("/developer", name="developer")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function indexAction()
{
@ -33,7 +35,7 @@ class DeveloperController extends Controller
*
* @Route("/developer/client/create", name="developer_create_client")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function createClientAction(Request $request)
{
@ -69,7 +71,7 @@ class DeveloperController extends Controller
*
* @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function deleteClientAction(Client $client)
{
@ -94,7 +96,7 @@ class DeveloperController extends Controller
*
* @Route("/developer/howto/first-app", name="developer_howto_firstapp")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function howtoFirstAppAction()
{

View file

@ -5,6 +5,7 @@ namespace Wallabag\ApiBundle\Controller;
use Hateoas\Configuration\Route;
use Hateoas\Representation\Factory\PagerfantaFactory;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Pagerfanta\Pagerfanta;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@ -139,7 +140,7 @@ class EntryRestController extends WallabagRestController
$detail = strtolower($request->query->get('detail', 'full'));
try {
/** @var \Pagerfanta\Pagerfanta $pager */
/** @var Pagerfanta $pager */
$pager = $this->get(EntryRepository::class)->findEntries(
$this->getUser()->getId(),
$isArchived,

View file

@ -108,7 +108,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
*
* @param string $username
*
* @return \Wallabag\UserBundle\Entity\User
* @return User
*/
private function getUser($username)
{

View file

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Command;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use FOS\UserBundle\Event\UserEvent;
@ -384,7 +385,7 @@ class InstallCommand extends ContainerAwareCommand
try {
return \in_array($databaseName, $schemaManager->listDatabases(), true);
} catch (\Doctrine\DBAL\Exception\DriverException $e) {
} catch (DriverException $e) {
// it means we weren't able to get database list, assume the database doesn't exist
return false;

View file

@ -65,7 +65,7 @@ class ShowUserCommand extends ContainerAwareCommand
*
* @param string $username
*
* @return \Wallabag\UserBundle\Entity\User
* @return User
*/
private function getUser($username)
{

View file

@ -10,6 +10,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Helper\RuleBasedTagger;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class TagAllCommand extends ContainerAwareCommand
@ -62,7 +63,7 @@ class TagAllCommand extends ContainerAwareCommand
*
* @param string $username
*
* @return \Wallabag\UserBundle\Entity\User
* @return User
*/
private function getUser($username)
{

View file

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\Persistence\ManagerRegistry;
use FOS\UserBundle\Model\UserManagerInterface;
use JMS\Serializer\SerializationContext;
@ -565,7 +566,7 @@ class ConfigController extends Controller
case 'entries':
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
// otherwise they won't be removed ...
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
$this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId());
}
@ -575,7 +576,7 @@ class ConfigController extends Controller
$this->get(EntryRepository::class)->removeAllByUserId($this->getUser()->getId());
break;
case 'archived':
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
$this->removeAnnotationsForArchivedByUserId($this->getUser()->getId());
}
@ -601,7 +602,7 @@ class ConfigController extends Controller
*
* @throws AccessDeniedHttpException
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function deleteAccountAction(Request $request)
{
@ -629,7 +630,7 @@ class ConfigController extends Controller
*
* @Route("/config/view-mode", name="switch_view_mode")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function changeViewModeAction(Request $request)
{
@ -650,7 +651,7 @@ class ConfigController extends Controller
*
* @Route("/locale/{language}", name="changeLocale")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function setLocaleAction(Request $request, $language = null)
{

View file

@ -10,7 +10,9 @@ use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -34,7 +36,7 @@ class EntryController extends Controller
/**
* @Route("/mass", name="mass_action")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function massAction(Request $request)
{
@ -121,7 +123,7 @@ class EntryController extends Controller
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
* because this controller is also called inside the layout template without any page as argument
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function searchFormAction(Request $request, $page = 1, $currentRoute = null)
{
@ -147,7 +149,7 @@ class EntryController extends Controller
/**
* @Route("/new-entry", name="new_entry")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function addEntryFormAction(Request $request)
{
@ -189,7 +191,7 @@ class EntryController extends Controller
/**
* @Route("/bookmarklet", name="bookmarklet")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function addEntryViaBookmarkletAction(Request $request)
{
@ -213,7 +215,7 @@ class EntryController extends Controller
/**
* @Route("/new", name="new")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function addEntryAction()
{
@ -225,7 +227,7 @@ class EntryController extends Controller
*
* @Route("/edit/{id}", requirements={"id" = "\d+"}, name="edit")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function editEntryAction(Request $request, Entry $entry)
{
@ -260,7 +262,7 @@ class EntryController extends Controller
*
* @Route("/all/list/{page}", name="all", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showAllAction(Request $request, $page)
{
@ -274,7 +276,7 @@ class EntryController extends Controller
*
* @Route("/unread/list/{page}", name="unread", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showUnreadAction(Request $request, $page)
{
@ -293,7 +295,7 @@ class EntryController extends Controller
*
* @Route("/archive/list/{page}", name="archive", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showArchiveAction(Request $request, $page)
{
@ -307,7 +309,7 @@ class EntryController extends Controller
*
* @Route("/starred/list/{page}", name="starred", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showStarredAction(Request $request, $page)
{
@ -321,7 +323,7 @@ class EntryController extends Controller
*
* @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showUntaggedEntriesAction(Request $request, $page)
{
@ -335,7 +337,7 @@ class EntryController extends Controller
*
* @Route("/annotated/list/{page}", name="annotated", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showWithAnnotationsEntriesAction(Request $request, $page)
{
@ -349,7 +351,7 @@ class EntryController extends Controller
*
* @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|annotated|all"})
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function redirectRandomEntryAction($type = 'all')
{
@ -372,7 +374,7 @@ class EntryController extends Controller
*
* @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function viewAction(Entry $entry)
{
@ -390,7 +392,7 @@ class EntryController extends Controller
*
* @Route("/reload/{id}", requirements={"id" = "\d+"}, name="reload_entry")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function reloadAction(Entry $entry)
{
@ -422,7 +424,7 @@ class EntryController extends Controller
*
* @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function toggleArchiveAction(Request $request, Entry $entry)
{
@ -451,7 +453,7 @@ class EntryController extends Controller
*
* @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function toggleStarAction(Request $request, Entry $entry)
{
@ -481,7 +483,7 @@ class EntryController extends Controller
*
* @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function deleteEntryAction(Request $request, Entry $entry)
{
@ -521,7 +523,7 @@ class EntryController extends Controller
*
* @Route("/share/{id}", requirements={"id" = "\d+"}, name="share")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function shareAction(Entry $entry)
{
@ -545,7 +547,7 @@ class EntryController extends Controller
*
* @Route("/share/delete/{id}", requirements={"id" = "\d+"}, name="delete_share")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function deleteShareAction(Entry $entry)
{
@ -568,7 +570,7 @@ class EntryController extends Controller
* @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry")
* @Cache(maxage="25200", smaxage="25200", public=true)
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function shareEntryAction(Entry $entry)
{
@ -589,7 +591,7 @@ class EntryController extends Controller
*
* @Route("/domain/{id}/{page}", requirements={"id" = ".+"}, defaults={"page" = 1}, name="same_domain")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function getSameDomainEntries(Request $request, $page = 1)
{
@ -603,7 +605,7 @@ class EntryController extends Controller
* @param string $type Entries type: unread, starred or archive
* @param int $page
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
private function showEntries($type, Request $request, $page)
{

View file

@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry;
@ -27,7 +28,7 @@ class ExportController extends Controller
* "id": "\d+"
* })
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function downloadEntryAction(Entry $entry, $format)
{
@ -53,7 +54,7 @@ class ExportController extends Controller
* "category": "all|unread|starred|archive|tag_entries|untagged|search|annotated|same_domain"
* })
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function downloadEntriesAction(Request $request, $format, $category)
{

View file

@ -29,7 +29,7 @@ class FeedController extends Controller
*
* @param $page
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showUnreadFeedAction(User $user, $page)
{
@ -45,7 +45,7 @@ class FeedController extends Controller
*
* @param $page
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showArchiveFeedAction(User $user, $page)
{
@ -61,7 +61,7 @@ class FeedController extends Controller
*
* @param $page
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showStarredFeedAction(User $user, $page)
{
@ -75,7 +75,7 @@ class FeedController extends Controller
*
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showAllFeedAction(User $user, $page)
{
@ -90,7 +90,7 @@ class FeedController extends Controller
* @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter")
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showTagsFeedAction(Request $request, User $user, Tag $tag, $page)
{
@ -182,7 +182,7 @@ class FeedController extends Controller
* @param string $type Entries type: unread, starred or archive
* @param int $page
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
private function showEntries($type, User $user, $page = 1)
{

View file

@ -3,7 +3,10 @@
namespace Wallabag\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
@ -36,7 +39,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*
* @Route("/new", name="ignore_origin_instance_rules_new", methods={"GET", "POST"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function newAction(Request $request)
{
@ -69,7 +72,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*
* @Route("/{id}/edit", name="ignore_origin_instance_rules_edit", methods={"GET", "POST"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function editAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
{
@ -102,7 +105,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*
* @Route("/{id}", name="ignore_origin_instance_rules_delete", methods={"DELETE"})
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function deleteAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
{
@ -128,7 +131,7 @@ class IgnoreOriginInstanceRuleController extends Controller
*
* @param IgnoreOriginInstanceRule $ignoreOriginInstanceRule The ignore origin instance rule entity
*
* @return \Symfony\Component\Form\Form The form
* @return Form The form
*/
private function createDeleteForm(IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
{

View file

@ -4,7 +4,10 @@ namespace Wallabag\CoreBundle\Controller;
use Craue\ConfigBundle\Util\Config;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
@ -41,7 +44,7 @@ class SiteCredentialController extends Controller
*
* @Route("/new", name="site_credentials_new", methods={"GET", "POST"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function newAction(Request $request)
{
@ -79,7 +82,7 @@ class SiteCredentialController extends Controller
*
* @Route("/{id}/edit", name="site_credentials_edit", methods={"GET", "POST"})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function editAction(Request $request, SiteCredential $siteCredential)
{
@ -119,7 +122,7 @@ class SiteCredentialController extends Controller
*
* @Route("/{id}", name="site_credentials_delete", methods={"DELETE"})
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
* @return RedirectResponse
*/
public function deleteAction(Request $request, SiteCredential $siteCredential)
{
@ -159,7 +162,7 @@ class SiteCredentialController extends Controller
*
* @param SiteCredential $siteCredential The site credential entity
*
* @return \Symfony\Component\Form\Form The form
* @return Form The form
*/
private function createDeleteForm(SiteCredential $siteCredential)
{

View file

@ -8,6 +8,7 @@ use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Wallabag\CoreBundle\Entity\Entry;
@ -25,7 +26,7 @@ class TagController extends Controller
/**
* @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function addTagFormAction(Request $request, Entry $entry)
{
@ -61,7 +62,7 @@ class TagController extends Controller
*
* @Route("/remove-tag/{entry}/{tag}", requirements={"entry" = "\d+", "tag" = "\d+"}, name="remove_tag")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
{
@ -85,7 +86,7 @@ class TagController extends Controller
*
* @Route("/tag/list", name="tag")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showTagAction()
{
@ -112,7 +113,7 @@ class TagController extends Controller
* @Route("/tag/list/{slug}/{page}", name="tag_entries", defaults={"page" = "1"})
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function showEntriesForTagAction(Tag $tag, $page, Request $request)
{
@ -151,7 +152,7 @@ class TagController extends Controller
* @Route("/tag/rename/{slug}", name="tag_rename")
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function renameTagAction(Tag $tag, Request $request)
{
@ -203,7 +204,7 @@ class TagController extends Controller
*
* @Route("/tag/search/{filter}", name="tag_this_search")
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function tagThisSearchAction($filter, Request $request)
{
@ -235,7 +236,7 @@ class TagController extends Controller
* @Route("/tag/delete/{slug}", name="tag_delete")
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function removeTagAction(Tag $tag, Request $request)
{

View file

@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Event\Subscriber;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Wallabag\CoreBundle\Entity\Entry;
@ -40,7 +41,7 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
public function preRemove(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof SqlitePlatform
|| !$entity instanceof Entry) {
return;
}

View file

@ -8,7 +8,8 @@ use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class ChangePasswordType extends AbstractType
{
@ -26,11 +27,11 @@ class ChangePasswordType extends AbstractType
'first_options' => ['label' => 'config.form_password.new_password_label'],
'second_options' => ['label' => 'config.form_password.repeat_new_password_label'],
'constraints' => [
new Constraints\Length([
new Length([
'min' => 8,
'minMessage' => 'validator.password_too_short',
]),
new Constraints\NotBlank(),
new NotBlank(),
],
'label' => 'config.form_password.new_password_label',
])

View file

@ -18,7 +18,7 @@ class HttpClientFactory implements ClientFactory
/** @var [\GuzzleHttp\Event\SubscriberInterface] */
private $subscribers = [];
/** @var \GuzzleHttp\Cookie\CookieJar */
/** @var CookieJar */
private $cookieJar;
private $restrictedAccess;

View file

@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ImportInterface;
abstract class BrowserController extends Controller
{
@ -76,7 +77,7 @@ abstract class BrowserController extends Controller
/**
* Return the service to handle the import.
*
* @return \Wallabag\ImportBundle\Import\ImportInterface
* @return ImportInterface
*/
abstract protected function getImportService();

View file

@ -110,7 +110,7 @@ class PocketController extends Controller
/**
* Return Pocket Import Service with or without RabbitMQ enabled.
*
* @return \Wallabag\ImportBundle\Import\PocketImport
* @return PocketImport
*/
private function getPocketImportService()
{

View file

@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Wallabag\ImportBundle\Form\Type\UploadImportType;
use Wallabag\ImportBundle\Import\ImportInterface;
/**
* Define Wallabag import for v1 and v2, since there are very similar.
@ -80,7 +81,7 @@ abstract class WallabagController extends Controller
/**
* Return the service to handle the import.
*
* @return \Wallabag\ImportBundle\Import\ImportInterface
* @return ImportInterface
*/
abstract protected function getImportService();

View file

@ -11,7 +11,9 @@ use Pagerfanta\Pagerfanta;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
@ -139,7 +141,7 @@ class ManageController extends Controller
* Default parameter for page is hardcoded (in duplication of the defaults from the Route)
* because this controller is also called inside the layout template without any page as argument
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function searchFormAction(Request $request, $page = 1)
{
@ -178,7 +180,7 @@ class ManageController extends Controller
*
* @param User $user The User entity
*
* @return \Symfony\Component\Form\Form The form
* @return Form The form
*/
private function createDeleteForm(User $user)
{

View file

@ -10,7 +10,8 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class NewUserType extends AbstractType
{
@ -27,11 +28,11 @@ class NewUserType extends AbstractType
'first_options' => ['label' => 'user.form.password_label'],
'second_options' => ['label' => 'user.form.repeat_new_password_label'],
'constraints' => [
new Constraints\Length([
new Length([
'min' => 8,
'minMessage' => 'validator.password_too_short',
]),
new Constraints\NotBlank(),
new NotBlank(),
],
'label' => 'user.form.plain_password_label',
])

View file

@ -2,6 +2,8 @@
namespace Tests\Wallabag\AnnotationBundle;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@ -10,12 +12,12 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
abstract class WallabagAnnotationTestCase extends WebTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\Client
* @var Client
*/
protected $client = null;
/**
* @var \FOS\UserBundle\Model\UserInterface
* @var UserInterface
*/
protected $user;
@ -37,7 +39,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
}
/**
* @return \Symfony\Bundle\FrameworkBundle\Client
* @return Client
*/
protected function createAuthorizedClient()
{

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\ApiBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\Container;
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
@ -556,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
public function testPostEntryWhenFetchContentFails()
{
/** @var \Symfony\Component\DependencyInjection\Container $container */
/** @var Container $container */
$container = $this->client->getContainer();
$contentProxy = $this->getMockBuilder(ContentProxy::class)
->disableOriginalConstructor()

View file

@ -3,6 +3,8 @@
namespace Tests\Wallabag\ApiBundle;
use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
@ -12,12 +14,12 @@ use Wallabag\UserBundle\Entity\User;
abstract class WallabagApiTestCase extends WebTestCase
{
/**
* @var \Symfony\Bundle\FrameworkBundle\Client
* @var Client
*/
protected $client = null;
/**
* @var \FOS\UserBundle\Model\UserInterface
* @var UserInterface
*/
protected $user;
@ -27,7 +29,7 @@ abstract class WallabagApiTestCase extends WebTestCase
}
/**
* @return \Symfony\Bundle\FrameworkBundle\Client
* @return Client
*/
protected function createAuthorizedClient()
{

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\CoreBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\Command\ExportCommand;
@ -11,7 +12,7 @@ class ExportCommandTest extends WallabagCoreTestCase
{
public function testExportCommandWithoutUsername()
{
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
$application = new Application($this->getClient()->getKernel());

View file

@ -6,6 +6,7 @@ use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\Persistence\ManagerRegistry;
@ -35,7 +36,7 @@ class InstallCommandTest extends WallabagCoreTestCase
{
parent::setUp();
/** @var \Doctrine\DBAL\Connection $connection */
/** @var Connection $connection */
$connection = $this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection();
if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
/*
@ -143,7 +144,7 @@ class InstallCommandTest extends WallabagCoreTestCase
{
// skipped SQLite check when database is removed because while testing for the connection,
// the driver will create the file (so the database) before testing if database exist
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
if ($this->getClient()->getContainer()->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
$this->markTestSkipped('SQLite spotted: can\'t test with database removed.');
}

View file

@ -4,6 +4,7 @@ namespace Tests\Wallabag\CoreBundle\Command;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\Command\ShowUserCommand;
@ -13,7 +14,7 @@ class ShowUserCommandTest extends WallabagCoreTestCase
{
public function testRunShowUserCommandWithoutUsername()
{
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$application = new Application($this->getClient()->getKernel());

View file

@ -3,6 +3,7 @@
namespace Tests\Wallabag\CoreBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\Command\TagAllCommand;
@ -11,7 +12,7 @@ class TagAllCommandTest extends WallabagCoreTestCase
{
public function testRunTagAllCommandWithoutUsername()
{
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "username")');
$application = new Application($this->getClient()->getKernel());

View file

@ -3,6 +3,9 @@
namespace Tests\Wallabag\CoreBundle\Event\Subscriber;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata;
use PHPUnit\Framework\TestCase;
@ -13,21 +16,21 @@ class TablePrefixSubscriberTest extends TestCase
public function dataForPrefix()
{
return [
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new PostgreSqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new MySqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new SqlitePlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new PostgreSqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new MySqlPlatform()],
['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new SqlitePlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new PostgreSqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new MySqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new SqlitePlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new PostgreSqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new MySqlPlatform()],
['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new SqlitePlatform()],
];
}
@ -110,6 +113,6 @@ class TablePrefixSubscriberTest extends TestCase
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName());
$this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']);
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform()));
$this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new MySqlPlatform()));
}
}

View file

@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\ParamConverter;
use PHPUnit\Framework\TestCase;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter;
use Wallabag\UserBundle\Entity\User;
@ -138,7 +139,7 @@ class UsernameFeedTokenConverterTest extends TestCase
public function testApplyUserNotFound()
{
$this->expectException(\Symfony\Component\HttpKernel\Exception\NotFoundHttpException::class);
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('User not found');
$repo = $this->getMockBuilder('Wallabag\UserBundle\Repository\UserRepository')

View file

@ -2,7 +2,10 @@
namespace Tests\Wallabag\ImportBundle\Command;
use Doctrine\ORM\NoResultException;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\ImportBundle\Command\ImportCommand;
@ -11,7 +14,7 @@ class ImportCommandTest extends WallabagCoreTestCase
{
public function testRunImportCommandWithoutArguments()
{
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$application = new Application($this->getClient()->getKernel());
@ -27,7 +30,7 @@ class ImportCommandTest extends WallabagCoreTestCase
public function testRunImportCommandWithoutFilepath()
{
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
$this->expectException(Exception::class);
$this->expectExceptionMessage('not found');
$application = new Application($this->getClient()->getKernel());
@ -45,7 +48,7 @@ class ImportCommandTest extends WallabagCoreTestCase
public function testRunImportCommandWithWrongUsername()
{
$this->expectException(\Doctrine\ORM\NoResultException::class);
$this->expectException(NoResultException::class);
$application = new Application($this->getClient()->getKernel());
$application->add(new ImportCommand());

View file

@ -5,6 +5,8 @@ namespace Tests\Wallabag\ImportBundle\Command;
use M6Web\Component\RedisMock\RedisMockFactory;
use Predis\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\ImportBundle\Command\RedisWorkerCommand;
@ -13,7 +15,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
{
public function testRunRedisWorkerCommandWithoutArguments()
{
$this->expectException(\Symfony\Component\Console\Exception\RuntimeException::class);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "serviceName")');
$application = new Application($this->getClient()->getKernel());
@ -29,7 +31,7 @@ class RedisWorkerCommandTest extends WallabagCoreTestCase
public function testRunRedisWorkerCommandWithBadService()
{
$this->expectException(\Symfony\Component\Config\Definition\Exception\Exception::class);
$this->expectException(Exception::class);
$this->expectExceptionMessage('No queue or consumer found for service name');
$application = new Application($this->getClient()->getKernel());