code: public function withMethod($method)
      {
          $object = clone $this;
          /**
           *  Check available Method
           */
          $old_method  = $method;
          if (($method = $object->allowedMethod($method)) === false || !is_string($method)) {
              settype($old_method, 'string');
              throw new InvalidArgumentException(
                  sprintf(
                      'Method %s is not Allowed!',
                      $old_method
                  ),
                  E_USER_ERROR
              );
          }
  
          return $object->withRequest(
              $object->request->withMethod($method)
          );
      }
docs: With Method
  
  @param string $method GET|PUT|HEAD|POST ... etc
  fallback to default
  
  @return static
  @throws InvalidArgumentException