Skip to content

Extracted functions to static methods#345

Merged
Nyholm merged 2 commits intoguzzle:1.xfrom
GrahamCampbell:no-functions
Sep 19, 2020
Merged

Extracted functions to static methods#345
Nyholm merged 2 commits intoguzzle:1.xfrom
GrahamCampbell:no-functions

Conversation

@GrahamCampbell
Copy link
Copy Markdown
Member

@GrahamCampbell GrahamCampbell commented Jun 27, 2020

This PR pairs with guzzle/guzzle#2712. After this is merged, we can tag 1.7.0.

TODO:

  • Merge CI and HHVM fixes CI and HHVM fixes #347
  • Extract all functions to static class methods
  • Deprecate all functions and point to their replacements
  • Replace all uses in src
  • Update the tests
  • Update documentation and examples
  • Update change log

Mappings:

Original Function Replacement Method
str Message::toString
uri_for Utils::uriFor
stream_for Utils::streamFor
parse_header Header::parse
normalize_header Header::normalize
modify_request Utils::modifyRequest
rewind_body Message::rewindBody
try_fopen Utils::tryFopen
copy_to_string Utils::copyToString
copy_to_stream Utils::copyToStream
hash Utils::hash
readline Utils::readLine
parse_request Message::parseRequest
parse_response Message::parseResponse
parse_query Query::parse
build_query Query::build
mimetype_from_filename MimeType::fromFilename
mimetype_from_extension MimeType::fromExtension
_parse_message Message::parseMessage
_parse_request_uri Message::parseRequestUri
get_message_body_summary Message::bodySummary
_caseless_remove Utils::caselessRemove

NB The overall idea of these changes was approved by the original author, Michael: guzzle/promises#108.

@GrahamCampbell
Copy link
Copy Markdown
Member Author

Friendly ping @Tobion and @Nyholm. It'd be good to have this merged so I can focus on PHP 8.0 support next, without conflicts.

Copy link
Copy Markdown
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I like this.

I just had some minors. After that Im 👍

*
* @return array
*/
public static function parseMessage($message)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be internal as _parse_message.

*
* @return array
*/
public static function caselessRemove($keys, array $data)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be marked as internal too.

*
* @return string
*/
public static function parseRequestUri($path, array $headers)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, mark it as internal

Copy link
Copy Markdown
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@Nyholm Nyholm merged commit ba0f9e2 into guzzle:1.x Sep 19, 2020
@GrahamCampbell GrahamCampbell deleted the no-functions branch September 19, 2020 15:31
@GrahamCampbell
Copy link
Copy Markdown
Member Author

🚀

@barryvdh barryvdh mentioned this pull request Sep 22, 2020
bbrala referenced this pull request in bbrala/psr7 Nov 24, 2020
* Extracted functions to static methods

* Fixed typo in README
albe added a commit to neos/neos-development-collection that referenced this pull request Jul 1, 2021
daniellienert pushed a commit to neos/neos-development-collection that referenced this pull request Jul 15, 2021
daniellienert pushed a commit to neos/neos-development-collection that referenced this pull request Jul 15, 2021
neos-bot pushed a commit to neos/fusion that referenced this pull request Jul 16, 2021
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

Successfully merging this pull request may close these issues.

2 participants