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

Extracted functions to static methods #345

Merged
merged 2 commits into from Sep 19, 2020
Merged

Extracted functions to static methods #345

merged 2 commits into from Sep 19, 2020

Conversation

GrahamCampbell
Copy link
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
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
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 👍

.travis.yml Outdated Show resolved Hide resolved
src/Utils.php Show resolved Hide resolved
src/functions.php Show resolved Hide resolved
*
* @return array
*/
public static function parseMessage($message)
Copy link
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
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
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

README.md Outdated Show resolved Hide resolved
Copy link
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
Member Author

🚀

@barryvdh barryvdh mentioned this pull request Sep 22, 2020
bbrala pushed a commit to bbrala/psr7 that referenced this pull request 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.

None yet

2 participants