Skip to content

Commit 3f8317a

Browse files
committed
Mark most classes final
Composition over inheritance as a best practice we should strive to follow: https://en.wikipedia.org/wiki/Composition_over_inheritance It should be fine to do this for controllers and daos since those are entirely internal. There is a slight chance that someone is extending one of the helpers in their spouts but I have not seen that on GitHub so I consider disallowing that acceptable. We will still keep the following non-final: - `daos\mysql\{Items,Sources,Statements,Tags}` because we were too lazy to follow the best practice there. - `helpers\WebClient` because we mock it in tests. - `spouts\spout` and its children because it would be too much of a BC break. Let’s use search and replace and manually skip those that we do not want to finalize.
1 parent 7d2a998 commit 3f8317a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+52
-51
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions

src/controllers/About.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* Controller for instance information API
1313
*/
14-
class About {
14+
final class About {
1515
public function __construct(
1616
private Authentication $authentication,
1717
private Configuration $configuration,

src/controllers/Authentication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Controller for user related tasks
1212
*/
13-
class Authentication {
13+
final class Authentication {
1414
public function __construct(
1515
private AuthenticationService $authenticationService,
1616
private View $view

src/controllers/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)
1919
* @author Tobias Zeising <tobias.zeising@aditu.de>
2020
*/
21-
class Index {
21+
final class Index {
2222
public function __construct(
2323
private Authentication $authentication,
2424
private \daos\Items $itemsDao,

src/controllers/Items.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)
2020
* @author Tobias Zeising <tobias.zeising@aditu.de>
2121
*/
22-
class Items {
22+
final class Items {
2323
public function __construct(
2424
private Authentication $authentication,
2525
private \daos\Items $itemsDao,

src/controllers/Items/Stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Controller for viewing item statistics
1212
*/
13-
class Stats {
13+
final class Stats {
1414
public function __construct(
1515
private Authentication $authentication,
1616
private \daos\Items $itemsDao,

src/controllers/Items/Sync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Controller for synchronizing item statuses
1515
*/
16-
class Sync {
16+
final class Sync {
1717
public function __construct(
1818
private Authentication $authentication,
1919
private Configuration $configuration,

src/controllers/Opml/Export.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @author Michael Moore <stuporglue@gmail.com>
1919
* @author Sean Rand <asanernd@gmail.com>
2020
*/
21-
class Export {
21+
final class Export {
2222
public function __construct(
2323
private Authentication $authentication,
2424
private Configuration $configuration,

src/controllers/Opml/Import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @author Michael Moore <stuporglue@gmail.com>
1818
* @author Sean Rand <asanernd@gmail.com>
1919
*/
20-
class Import {
20+
final class Import {
2121
/** @var array<string, array{id: int, tags: string[]}> Sources that have been imported from the OPML file */
2222
private array $imported = [];
2323

src/controllers/Rss.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)
1818
* @author Tobias Zeising <tobias.zeising@aditu.de>
1919
*/
20-
class Rss {
20+
final class Rss {
2121
public function __construct(
2222
private Authentication $authentication,
2323
private Configuration $configuration,

0 commit comments

Comments
 (0)