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

Remove "final" from methods in Table schema class #6573

Open
aimeos opened this issue Oct 25, 2024 · 2 comments
Open

Remove "final" from methods in Table schema class #6573

aimeos opened this issue Oct 25, 2024 · 2 comments

Comments

@aimeos
Copy link
Contributor

aimeos commented Oct 25, 2024

Feature Request

What

There are only two methods in the Table schema class which are marked as final, which seems to make no sense:

dbal/src/Schema/Table.php

Lines 274 to 283 in afcd624

final public function getRenamedColumns(): array
{
return $this->renamedColumns;
}
/**
* @throws LogicException
* @throws SchemaException
*/
final public function renameColumn(string $oldName, string $newName): Column

Why

There seems to be no valid reason to make that methods final and using final methods, this makes it impossible to a) overwrite these methods and b) mock them in tests (our problem at the moment).

How

Just remove the "final" method modifier here:

dbal/src/Schema/Table.php

Lines 274 to 283 in afcd624

final public function getRenamedColumns(): array
{
return $this->renamedColumns;
}
/**
* @throws LogicException
* @throws SchemaException
*/
final public function renameColumn(string $oldName, string $newName): Column

@derrabus
Copy link
Member

To be honest, I don't find this kind of issue very constructive. The fact that you don't know the reason behind a developer's decision, does not mean that there is "no valid reason" for that decision or that said decision "makes no sense". Just as you probably wouldn't be happy about being told that mocking a state representation of a 3rd party package such as the Table class makes no sense and that there's no valid reason to create such a mock.

@aimeos
Copy link
Contributor Author

aimeos commented Oct 25, 2024

Sorry for my ignorance questioning that decision. What is the reason behind using final for those two methods only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants