From 3784688a88230d9c3aec4ca518be52ea1c70aeb9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 12 Jan 2019 13:09:36 +0100 Subject: Replace continue; with break; to avoid PHP 7.3 warnings Signed-off-by: Thomas Citharel --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 2 +- src/Wallabag/CoreBundle/Helper/DownloadImages.php | 2 +- src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php | 2 +- src/Wallabag/CoreBundle/Helper/TagsAssigner.php | 2 +- src/Wallabag/ImportBundle/Import/AbstractImport.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 6 +++--- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 90e00c62..2e57aac8 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -114,7 +114,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $extraFields = []; foreach ($extraFieldsStrings as $extraField) { if (false === strpos($extraField, '=')) { - continue; + break; } list($fieldName, $fieldValue) = explode('=', $extraField, 2); diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index cc3dcfce..8c1c208f 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php @@ -56,7 +56,7 @@ class DownloadImages $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath); if (false === $imagePath) { - continue; + break; } // if image contains "&" and we can't find it in the html it might be because it's encoded as & diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php index fbdf2ac7..d156df84 100644 --- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php +++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php @@ -37,7 +37,7 @@ class RuleBasedTagger foreach ($rules as $rule) { if (!$this->rulerz->satisfies($entry, $rule->getRule())) { - continue; + break; } $this->logger->info('Matching rule.', [ diff --git a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php index e6b4989f..519150f5 100644 --- a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php +++ b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php @@ -49,7 +49,7 @@ class TagsAssigner // avoid empty tag if (0 === \strlen($label)) { - continue; + break; } if (isset($tagsNotYetFlushed[$label])) { diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index d39d71b6..5ae4aa8d 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -169,7 +169,7 @@ abstract class AbstractImport implements ImportInterface $entry = $this->parseEntry($importedEntry); if (null === $entry) { - continue; + break; } // store each entry to be flushed so we can trigger the entry.saved event for each of them diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 804bc6cd..178ebe8e 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -158,13 +158,13 @@ abstract class BrowserImport extends AbstractImport foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - continue; + break; } $entry = $this->parseEntry($importedEntry); if (null === $entry) { - continue; + break; } // @see AbstractImport @@ -206,7 +206,7 @@ abstract class BrowserImport extends AbstractImport { foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - continue; + break; } // set userId for the producer (it won't know which user is connected) diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 439c978c..6b6b35af 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -65,7 +65,7 @@ class InstapaperImport extends AbstractImport $handle = fopen($this->filepath, 'r'); while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { - continue; + break; } // last element in the csv is the folder where the content belong -- cgit v1.2.3 From ea925bb112ab99efbb29d8e7113e80357a70bd18 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 14:33:26 +0100 Subject: CS --- src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 10 +++++----- src/Wallabag/ImportBundle/Import/ChromeImport.php | 2 +- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 2 +- src/Wallabag/ImportBundle/Import/WallabagImport.php | 2 +- src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 702c7f7a..37d0640a 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -108,7 +108,7 @@ class EntryFilterType extends AbstractType ->add('httpStatus', TextFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { $value = $values['value']; - if (false === array_key_exists($value, Response::$statusTexts)) { + if (false === \array_key_exists($value, Response::$statusTexts)) { return; } diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 178ebe8e..99717beb 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -77,7 +77,7 @@ abstract class BrowserImport extends AbstractImport */ public function parseEntry(array $importedEntry) { - if ((!array_key_exists('guid', $importedEntry) || (!array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) { + if ((!\array_key_exists('guid', $importedEntry) || (!\array_key_exists('id', $importedEntry))) && \is_array(reset($importedEntry))) { if ($this->producer) { $this->parseEntriesForProducer($importedEntry); @@ -89,7 +89,7 @@ abstract class BrowserImport extends AbstractImport return; } - if (array_key_exists('children', $importedEntry)) { + if (\array_key_exists('children', $importedEntry)) { if ($this->producer) { $this->parseEntriesForProducer($importedEntry['children']); @@ -101,11 +101,11 @@ abstract class BrowserImport extends AbstractImport return; } - if (!array_key_exists('uri', $importedEntry) && !array_key_exists('url', $importedEntry)) { + if (!\array_key_exists('uri', $importedEntry) && !\array_key_exists('url', $importedEntry)) { return; } - $url = array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; + $url = \array_key_exists('uri', $importedEntry) ? $importedEntry['uri'] : $importedEntry['url']; $existingEntry = $this->em ->getRepository('WallabagCoreBundle:Entry') @@ -126,7 +126,7 @@ abstract class BrowserImport extends AbstractImport // update entry with content (in case fetching failed, the given entry will be return) $this->fetchContent($entry, $data['url'], $data); - if (array_key_exists('tags', $data)) { + if (\array_key_exists('tags', $data)) { $this->tagsAssigner->assignTagsToEntry( $entry, $data['tags'] diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index eccee698..4ae82ade 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php @@ -57,7 +57,7 @@ class ChromeImport extends BrowserImport 'created_at' => substr($entry['date_added'], 0, 10), ]; - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index 8999e3f3..b3558f21 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -57,7 +57,7 @@ class FirefoxImport extends BrowserImport 'created_at' => substr($entry['dateAdded'], 0, 10), ]; - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index c3a142b9..75a28fbf 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php @@ -122,7 +122,7 @@ abstract class WallabagImport extends AbstractImport // update entry with content (in case fetching failed, the given entry will be return) $this->fetchContent($entry, $data['url'], $data); - if (array_key_exists('tags', $data)) { + if (\array_key_exists('tags', $data)) { $this->tagsAssigner->assignTagsToEntry( $entry, $data['tags'], diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index b9bb525a..e0562611 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport $data['html'] = $this->fetchingErrorMessage; } - if (array_key_exists('tags', $entry) && '' !== $entry['tags']) { + if (\array_key_exists('tags', $entry) && '' !== $entry['tags']) { $data['tags'] = $entry['tags']; } -- cgit v1.2.3 From 8c0ba953070dca22e9a06999cfe355ea01847c64 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 27 Feb 2019 14:59:50 +0100 Subject: Adding more tests --- .../CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 2 +- src/Wallabag/CoreBundle/Helper/DownloadImages.php | 2 +- src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php | 2 +- src/Wallabag/CoreBundle/Helper/TagsAssigner.php | 2 +- src/Wallabag/ImportBundle/Import/AbstractImport.php | 2 +- src/Wallabag/ImportBundle/Import/BrowserImport.php | 6 +++--- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 2e57aac8..90e00c62 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -114,7 +114,7 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $extraFields = []; foreach ($extraFieldsStrings as $extraField) { if (false === strpos($extraField, '=')) { - break; + continue; } list($fieldName, $fieldValue) = explode('=', $extraField, 2); diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index 8c1c208f..cc3dcfce 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php @@ -56,7 +56,7 @@ class DownloadImages $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath); if (false === $imagePath) { - break; + continue; } // if image contains "&" and we can't find it in the html it might be because it's encoded as & diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php index d156df84..fbdf2ac7 100644 --- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php +++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php @@ -37,7 +37,7 @@ class RuleBasedTagger foreach ($rules as $rule) { if (!$this->rulerz->satisfies($entry, $rule->getRule())) { - break; + continue; } $this->logger->info('Matching rule.', [ diff --git a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php index 519150f5..e6b4989f 100644 --- a/src/Wallabag/CoreBundle/Helper/TagsAssigner.php +++ b/src/Wallabag/CoreBundle/Helper/TagsAssigner.php @@ -49,7 +49,7 @@ class TagsAssigner // avoid empty tag if (0 === \strlen($label)) { - break; + continue; } if (isset($tagsNotYetFlushed[$label])) { diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index 5ae4aa8d..d39d71b6 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php @@ -169,7 +169,7 @@ abstract class AbstractImport implements ImportInterface $entry = $this->parseEntry($importedEntry); if (null === $entry) { - break; + continue; } // store each entry to be flushed so we can trigger the entry.saved event for each of them diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php index 99717beb..3987e80f 100644 --- a/src/Wallabag/ImportBundle/Import/BrowserImport.php +++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php @@ -158,13 +158,13 @@ abstract class BrowserImport extends AbstractImport foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - break; + continue; } $entry = $this->parseEntry($importedEntry); if (null === $entry) { - break; + continue; } // @see AbstractImport @@ -206,7 +206,7 @@ abstract class BrowserImport extends AbstractImport { foreach ($entries as $importedEntry) { if ((array) $importedEntry !== $importedEntry) { - break; + continue; } // set userId for the producer (it won't know which user is connected) diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 6b6b35af..439c978c 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -65,7 +65,7 @@ class InstapaperImport extends AbstractImport $handle = fopen($this->filepath, 'r'); while (false !== ($data = fgetcsv($handle, 10240))) { if ('URL' === $data[0]) { - break; + continue; } // last element in the csv is the folder where the content belong -- cgit v1.2.3