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

Construction of a Uri object #2

Closed
akrabat opened this issue Dec 12, 2016 · 3 comments
Closed

Construction of a Uri object #2

akrabat opened this issue Dec 12, 2016 · 3 comments

Comments

@akrabat
Copy link
Member

akrabat commented Dec 12, 2016

How should we construct a Uri object?
Our current constructor is:

public function __construct($scheme, $host, $port = null, $path = '/', $query = '', $fragment = '', $user = '', $password = '')

Should it be changed?

I think that the most common use-case is that the user has a string representation of a URI (e.g. "http://example.com/foo") & currently we use a factory called createFromString for this case.

Should we update the way we create Uris for Slim 4? These are the choices for construction of a Uri:

  1. $uri = new Uri('http', 'example.com', '/foo'): (as current)
  2. $uri = new Uri("http://example.com/foo"): (constructor takes a string)
  3. $uri = Uri::createFromString("http://example.com.foo"): (static factory in Uri class)

Note that we also want to support the upcoming http-interop's factories (PSR-17), so we'll also have this way to create a Uri from a string:

$uri = UriFactory::createUri("http://example.com/foo");

Any preferences to how we should create Uris in addition to UriFactory::createUri() ?

@tuupola
Copy link
Contributor

tuupola commented Dec 12, 2016

I prefer $uri = new Uri("http://example.com/foo"); approach.

@codeguy
Copy link
Member

codeguy commented Dec 12, 2016

What @tuupola said

@akrabat
Copy link
Member Author

akrabat commented Jan 17, 2017

Done.

@akrabat akrabat closed this as completed Jan 17, 2017
raigu added a commit to raigu/Slim-Psr7 that referenced this issue Apr 7, 2021
 Line   UploadedFile.php
 ------ -----------------------------------------------------------------------------------------------
  175    Parameter slimphp#1 $source of function stream_copy_to_stream expects resource, resource|null given.
  175    Parameter slimphp#2 $dest of function stream_copy_to_stream expects resource, resource|false given.
raigu added a commit to raigu/Slim-Psr7 that referenced this issue Apr 7, 2021
 Line   UploadedFile.php
 ------ ----------------------------------------------------------------------------------------------
  179    Parameter slimphp#2 $dest of function stream_copy_to_stream expects resource, resource|false given.
  181    Parameter slimphp#1 $fp of function fclose expects resource, resource|false given.
 ------ ----------------------------------------------------------------------------------------------

Had to force to skip target writability test in order to conduct a test that PHPStan required in a way that the 100% code coverage would be remain intact.
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

3 participants