Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use strict_types #5830

1 change: 1 addition & 0 deletions app/Controllers/apiController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This controller manage API-related features.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/authController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This controller handles action about authentication.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/categoryController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle actions relative to categories.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/configureController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle every configuration options.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/entryController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle every entry actions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/errorController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle error page.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/extensionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* The controller to manage extensions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/feedController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle every feed actions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/importExportController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle every import and export actions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/indexController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This class handles main actions of FreshRSS.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/javascriptController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_javascript_Controller extends FreshRSS_ActionController {

Expand Down
1 change: 1 addition & 0 deletions app/Controllers/statsController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle application statistics.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/subscriptionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle subscription actions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/tagController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle every tag actions.
Expand Down
1 change: 1 addition & 0 deletions app/Controllers/updateController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_update_Controller extends FreshRSS_ActionController {

Expand Down
1 change: 1 addition & 0 deletions app/Controllers/userController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Controller to handle user actions.
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/AlreadySubscribedException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not make many PRs with partial changes, so let's start by deciding where we should have that in production (pros and cons) and then apply on everything we have decided (and tested!) at once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any disadvantages or problems. on the contrary, the code is more robust because it does what it says.

Copy link
Member

@Alkarex Alkarex Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will probably add those lines (it is the right time now, that we have just added PHP 7.4 typed properties), but examples of disadvantages are increased risks of crash in production, and tiny impact on performance (due to additional checks at runtime)...


class FreshRSS_AlreadySubscribed_Exception extends Exception {

Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/BadUrlException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_BadUrl_Exception extends FreshRSS_Feed_Exception {

Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ContextException.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types=1);

/**
* An exception raised when a context is invalid
*/
Expand Down
1 change: 0 additions & 1 deletion app/Exceptions/DAOException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_DAO_Exception extends Exception {
Expand Down
1 change: 0 additions & 1 deletion app/Exceptions/EntriesGetterException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_EntriesGetter_Exception extends Exception {
Expand Down
1 change: 0 additions & 1 deletion app/Exceptions/FeedException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_Feed_Exception extends Exception {
Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/FeedNotAddedException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_FeedNotAdded_Exception extends Exception {

Expand Down
1 change: 1 addition & 0 deletions app/Exceptions/ZipException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Zip_Exception extends Exception {

Expand Down
1 change: 0 additions & 1 deletion app/Exceptions/ZipMissingException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_ZipMissing_Exception extends Exception {
Expand Down
1 change: 1 addition & 0 deletions app/FreshRSS.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS extends Minz_FrontController {
/**
Expand Down
1 change: 1 addition & 0 deletions app/Mailers/UserMailer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Manage the emails sent to the users.
Expand Down
1 change: 0 additions & 1 deletion app/Models/ActionController.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_ActionController extends Minz_ActionController {
Expand Down
1 change: 1 addition & 0 deletions app/Models/Auth.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This class handles all authentication process.
Expand Down
5 changes: 3 additions & 2 deletions app/Models/BooleanSearch.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Contains Boolean search from the search form.
Expand Down Expand Up @@ -67,7 +68,7 @@ private function parseUserQueryNames(string $input): string {
$name = trim($matches['search'][$i]);
if (!empty($queries[$name])) {
$fromS[] = $matches[0][$i];
$toS[] = '(' . trim($queries[$name]->getSearch()) . ')';
$toS[] = '(' . trim($queries[$name]->getSearch()->getRawInput()) . ')';
}
}
}
Expand Down Expand Up @@ -110,7 +111,7 @@ private function parseUserQueryIds(string $input): string {
$id = (int)(trim($matches['search'][$i])) - 1;
if (!empty($queries[$id])) {
$fromS[] = $matches[0][$i];
$toS[] = '(' . trim($queries[$id]->getSearch()) . ')';
$toS[] = '(' . trim($queries[$id]->getSearch()->getRawInput()) . ')';
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/Models/Category.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Category extends Minz_Model {

Expand Down
1 change: 1 addition & 0 deletions app/Models/CategoryDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_CategoryDAO extends Minz_ModelPdo {

Expand Down
1 change: 1 addition & 0 deletions app/Models/CategoryDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_CategoryDAOSQLite extends FreshRSS_CategoryDAO {

Expand Down
1 change: 1 addition & 0 deletions app/Models/Context.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* The context object handles the current configuration file and different
Expand Down
1 change: 1 addition & 0 deletions app/Models/DatabaseDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This class is used to test database is well-constructed.
Expand Down
1 change: 1 addition & 0 deletions app/Models/DatabaseDAOPGSQL.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This class is used to test database is well-constructed.
Expand Down
1 change: 1 addition & 0 deletions app/Models/DatabaseDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* This class is used to test database is well-constructed (SQLite).
Expand Down
1 change: 0 additions & 1 deletion app/Models/Days.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_Days {
Expand Down
5 changes: 3 additions & 2 deletions app/Models/Entry.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Entry extends Minz_Model {
public const STATE_READ = 1;
Expand Down Expand Up @@ -741,11 +742,11 @@ public static function getContentByParsing(string $url, string $path, array $att
}

$content = '';
$nodes = $xpath->query(new Gt\CssXPath\Translator($path));
$nodes = $xpath->query((new Gt\CssXPath\Translator($path))->asXPath());
if ($nodes != false) {
foreach ($nodes as $node) {
if (!empty($attributes['path_entries_filter'])) {
$filterednodes = $xpath->query(new Gt\CssXPath\Translator($attributes['path_entries_filter']), $node) ?: [];
$filterednodes = $xpath->query((new Gt\CssXPath\Translator($attributes['path_entries_filter']))->asXPath(), $node) ?: [];
foreach ($filterednodes as $filterednode) {
$filterednode->parentNode->removeChild($filterednode);
}
Expand Down
1 change: 1 addition & 0 deletions app/Models/EntryDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_EntryDAO extends Minz_ModelPdo {

Expand Down
1 change: 1 addition & 0 deletions app/Models/EntryDAOPGSQL.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {

Expand Down
1 change: 1 addition & 0 deletions app/Models/EntryDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {

Expand Down
1 change: 1 addition & 0 deletions app/Models/Factory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Factory {

Expand Down
1 change: 1 addition & 0 deletions app/Models/Feed.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Feed extends Minz_Model {

Expand Down
1 change: 1 addition & 0 deletions app/Models/FeedDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_FeedDAO extends Minz_ModelPdo {

Expand Down
1 change: 1 addition & 0 deletions app/Models/FeedDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO {

Expand Down
1 change: 1 addition & 0 deletions app/Models/FilterAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_FilterAction {

Expand Down
1 change: 1 addition & 0 deletions app/Models/FormAuth.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_FormAuth {
public static function checkCredentials(string $username, string $hash, string $nonce, string $challenge): bool {
Expand Down
1 change: 0 additions & 1 deletion app/Models/Log.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_Log extends Minz_Model {
Expand Down
1 change: 1 addition & 0 deletions app/Models/LogDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

final class FreshRSS_LogDAO {
public static function logPath(?string $logFileName = null): string {
Expand Down
1 change: 1 addition & 0 deletions app/Models/ReadingMode.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Manage the reading modes in FreshRSS.
Expand Down
1 change: 1 addition & 0 deletions app/Models/Search.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

require_once(LIB_PATH . '/lib_date.php');

Expand Down
1 change: 1 addition & 0 deletions app/Models/Share.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* Manage the sharing options in FreshRSS.
Expand Down
1 change: 1 addition & 0 deletions app/Models/StatsDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_StatsDAO extends Minz_ModelPdo {

Expand Down
1 change: 1 addition & 0 deletions app/Models/StatsDAOPGSQL.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_StatsDAOPGSQL extends FreshRSS_StatsDAO {

Expand Down
1 change: 1 addition & 0 deletions app/Models/StatsDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_StatsDAOSQLite extends FreshRSS_StatsDAO {

Expand Down
1 change: 0 additions & 1 deletion app/Models/SystemConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

/**
Expand Down
1 change: 1 addition & 0 deletions app/Models/Tag.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_Tag extends Minz_Model {

Expand Down
1 change: 1 addition & 0 deletions app/Models/TagDAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_TagDAO extends Minz_ModelPdo {

Expand Down
1 change: 0 additions & 1 deletion app/Models/TagDAOPGSQL.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

class FreshRSS_TagDAOPGSQL extends FreshRSS_TagDAO {
Expand Down
1 change: 1 addition & 0 deletions app/Models/TagDAOSQLite.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

class FreshRSS_TagDAOSQLite extends FreshRSS_TagDAO {

Expand Down