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

Typehinting #834

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
* @param string $string HTML document
* @return array<array{tag: string, self_closing: bool, attribs: array<string, array{data: string}>, content: string}>
*/
public static function get_element(string $realname, string $string)
public static function get_element(string $realname, string $string): array
{
// trigger_error(sprintf('Using method "' . __METHOD__ . '" is deprecated since SimplePie 1.3, use "DOMDocument" instead.'), \E_USER_DEPRECATED);

Expand Down Expand Up @@ -166,10 +166,7 @@
return $message;
}

/**
* @return string
*/
public static function fix_protocol(string $url, int $http = 1)
public static function fix_protocol(string $url, $http = 1): string

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 7.2

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 7.3

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 7.4

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 8.0

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 8.1

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 8.2

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.

Check failure on line 169 in src/Misc.php

View workflow job for this annotation

GitHub Actions / PHP: 8.3

Method SimplePie\Misc::fix_protocol() has parameter $http with no type specified.
ColonelMoutarde marked this conversation as resolved.
Show resolved Hide resolved
{
$url = Misc::normalize_url($url);
$parsed = Misc::parse_url($url);
Expand Down Expand Up @@ -384,7 +381,7 @@
* @param string $charset Character set to standardise
* @return string Standardised name
*/
public static function encoding(string $charset)
public static function encoding(string $charset): string
{
// Normalization from UTS #22
switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset))) {
Expand Down