Merge pull request #3376 from wallabag/symfony-3.3

Symfony 3.3
This commit is contained in:
Jérémy Benoist
2017-10-11 09:55:03 +02:00
committed by GitHub
44 changed files with 90 additions and 68 deletions

View File

@ -52,7 +52,7 @@ class ListUserCommand extends ContainerAwareCommand
'%s/%s%s user(s) displayed.',
count($users),
$nbUsers,
$input->getArgument('search') === null ? '' : ' (filtered)'
null === $input->getArgument('search') ? '' : ' (filtered)'
)
);

View File

@ -56,7 +56,7 @@ class ShowUserCommand extends ContainerAwareCommand
sprintf('Email: %s', $user->getEmail()),
sprintf('Display name: %s', $user->getName()),
sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
sprintf('Last login: %s', $user->getLastLogin() !== null ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
sprintf('2FA activated: %s', $user->isTwoFactorAuthentication() ? 'yes' : 'no'),
]);
}

View File

@ -348,7 +348,7 @@ class ConfigController extends Controller
$em = $this->getDoctrine()->getManager();
foreach ($tags as $tag) {
if (count($tag->getEntries()) === 0) {
if (0 === count($tag->getEntries())) {
$em->remove($tag);
}
}

View File

@ -195,7 +195,7 @@ class EntryController extends Controller
public function showUnreadAction(Request $request, $page)
{
// load the quickstart if no entry in database
if ((int) $page === 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) === 0) {
if (1 === (int) $page && 0 === $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId())) {
return $this->redirect($this->generateUrl('quickstart'));
}

View File

@ -59,7 +59,7 @@ class ExportController extends Controller
$methodBuilder = 'getBuilderFor' . $method . 'ByUser';
$repository = $this->get('wallabag_core.entry_repository');
if ($category === 'tag_entries') {
if ('tag_entries' === $category) {
$tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
$entries = $repository->findAllByTagId(

View File

@ -65,7 +65,7 @@ class TagController extends Controller
$em->flush();
// remove orphan tag in case no entries are associated to it
if (count($tag->getEntries()) === 0) {
if (0 === count($tag->getEntries())) {
$em->remove($tag);
$em->flush();
}

View File

@ -42,7 +42,7 @@ class TablePrefixSubscriber implements EventSubscriber
$classMetadata->setPrimaryTable(['name' => $this->prefix . $classMetadata->getTableName()]);
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] === ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) {
if (ClassMetadataInfo::MANY_TO_MANY === $mapping['type'] && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) {
$mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}

View File

@ -48,7 +48,7 @@ class StringToListTransformer implements DataTransformerInterface
*/
public function reverseTransform($string)
{
if ($string === null) {
if (null === $string) {
return;
}

View File

@ -58,7 +58,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
{
// required by credentials below
$host = strtolower($host);
if (substr($host, 0, 4) === 'www.') {
if ('www.' === substr($host, 0, 4)) {
$host = substr($host, 4);
}
@ -113,7 +113,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
$extraFields = [];
foreach ($extraFieldsStrings as $extraField) {
if (strpos($extraField, '=') === false) {
if (false === strpos($extraField, '=')) {
continue;
}

View File

@ -125,7 +125,7 @@ class ContentProxy
$date = $value;
// is it a timestamp?
if (filter_var($date, FILTER_VALIDATE_INT) !== false) {
if (false !== filter_var($date, FILTER_VALIDATE_INT)) {
$date = '@' . $date;
}

View File

@ -16,7 +16,7 @@ class Matches
{
public function __invoke($subject, $pattern)
{
if ($pattern[0] === "'") {
if ("'" === $pattern[0]) {
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
}

View File

@ -16,7 +16,7 @@ class NotMatches
{
public function __invoke($subject, $pattern)
{
if ($pattern[0] === "'") {
if ("'" === $pattern[0]) {
$pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
}

View File

@ -16,6 +16,6 @@ class Matches
{
public function __invoke($subject, $pattern)
{
return stripos($subject, $pattern) !== false;
return false !== stripos($subject, $pattern);
}
}

View File

@ -16,6 +16,6 @@ class NotMatches
{
public function __invoke($subject, $pattern)
{
return stripos($subject, $pattern) === false;
return false === stripos($subject, $pattern);
}
}