I have a doubt about the FormRequest Class (I think it apply at other classes). I have a class which has a method init(). This method receive a VehicleRequest. I’m going to share a simplified version of the code: The class Car: The request I send (in car case) looks like: Now, in this example a Car class is initialized
Tag: interface
Binding Interfaces to Implementations in Eloquent relationships
According to “binding-interfaces-to-implementations” it is possible to bind an interface with its implementation, as follows: So when I call the next line, I will get an User object: ???????? However… when I try to do the same process with an Eloquent relationship: it, obviously, gives me the following error: ???? The same error if I try to instance an interface
Export PHP interface to Typescript interface, or vice versa?
I’m experimenting with Typescript, and at my current contract I code backend in PHP. In a couple of projects I’ve written Typescript interfaces for the sort of AJAX responses my back end code gives …
Can you override interface methods with different, but “compatible”, signatures?
Consider the following PHP interfaces: I’m using PHPStorm, and when I do this, I get an error in the IDE that basically states the definition for add() in SuperCollection is not compatible with the definition in the interface it extends, Collection. In one way, I can see this being a problem, as the signature of the method does not match
PHP Interface: Specify ANY visibility
I’m making use of an interface for a set of classes. I have a problem however because I wish for any visibility to be allowed in the interface (That is: public, protected and private). I need the parent method to only be protected and I need the child method to be private, but I get the error saying Fatal error: