Ibrahim-Aboubacar / url_shorter_php_oop

1 stars 0 forks source link

Updated method name middleware() and add documentation #2

Closed Ibrahim-Aboubacar closed 1 year ago

Ibrahim-Aboubacar commented 1 year ago

Type declaration:

Since the $middleware parameter is expected to be of type mixed, it would be helpful to add a type declaration for clarity. Based on its usage as a property, it may be better to define a specific type.

public function setMiddleware(SomeMiddlewareType $middleware)

Method name:

Updated method name: Consider renaming the method to provide more clarity on what the method does. For example, withMiddleware or useMiddleware might be more descriptive.

public function withMiddleware(SomeMiddlewareType $middleware)

or

public function useMiddleware(SomeMiddlewareType $middleware)

Documentation:

Update the method's documentation with a description of its purpose and any relevant details about the parameters and return value.

/**
 * Set the middleware for the class object.
 *
 * @param SomeMiddlewareType $middleware The middleware to be set.
 * @return $this The object with the middleware set.
 */
public function withMiddleware(SomeMiddlewareType $middleware)
Ibrahim-Aboubacar commented 1 year ago

Fixed