Skip to content

Use static functions instead of a trait for casts #92

@marijnvanwezel

Description

@marijnvanwezel

Currently, cast methods are inserted into a class using the CastTrait trait. This has a few problems:

  • It requires an additional use statement which can get left behind after refactoring;
  • It clutters up the private interface;
  • It does not allow casts to be used outside classes.

The trait should instead be written as an abstract class with final static functions, that can then be used throughout the project. Because all casts are currently private functions, this does not have impact on backwards compatibility.

Metadata

Metadata

Labels

type/refactoringA refactoring that should be applied to make the code easier to understand

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions