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

[2.x] Update deps #341

Merged
merged 1 commit into from
Jan 4, 2024
Merged

[2.x] Update deps #341

merged 1 commit into from
Jan 4, 2024

Conversation

j0k3r
Copy link
Owner

@j0k3r j0k3r commented Jan 3, 2024

  • update GitHub Actions to latest version
  • run PHP-CS-Fixer
  • use Psr\Http\Client\ClientInterface instead of Http\Client\HttpClient
  • use Http\Discovery\Psr18ClientDiscovery instead of Http\Discovery\HttpClientDiscovery
  • remove the only utf8_encode used (because it's deprecated in PHP 8.2) and I don't think these lines are still used (the associated test was already removed)

@j0k3r j0k3r force-pushed the fix/2.x-update-deps branch 3 times, most recently from 1188856 to 5e85278 Compare January 3, 2024 07:31
@j0k3r j0k3r changed the title Update deps [2.x] Update deps Jan 3, 2024
- update GitHub Actions to latest version
- run PHP-CS-Fixer
- use `Psr\Http\Client\ClientInterface` instead of `Http\Client\HttpClient`
- use `Http\Discovery\Psr18ClientDiscovery` instead of `Http\Discovery\HttpClientDiscovery`
Copy link
Collaborator

@Kdecherf Kdecherf left a comment

Choose a reason for hiding this comment

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

On the removal of utf8_encode, did you check that it does not break wallabag/wallabag#2387?

@j0k3r
Copy link
Owner Author

j0k3r commented Jan 4, 2024

@Kdecherf yep I've checked, nothing is broken

@j0k3r j0k3r requested a review from Kdecherf January 4, 2024 08:16
@j0k3r j0k3r merged commit 3519a1e into 2.x Jan 4, 2024
15 checks passed
@j0k3r j0k3r deleted the fix/2.x-update-deps branch January 4, 2024 08:46
@@ -21,14 +21,14 @@ class ContentExtractor
private $xpath;
private $html;
private $config;
private $siteConfig = null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like explicitly initialized value for properties that are not immediately initialized in the constructor. IMO, no_null_property_initialization erases this information so I consider it harmful. See also PHP-CS-Fixer/PHP-CS-Fixer#7447 (comment)

But it is probably not an issue in the legacy branch.

* @param array $config
*/
public function __construct(Client $client, $config = [], LoggerInterface $logger = null)
public function __construct(ClientInterface $client, $config = [], LoggerInterface $logger = null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ClientClientInterface should be fine. Client has been a subtype since 2.0 (php-http/httplug@6885b6c).

@@ -118,7 +114,7 @@ public function __construct($config = [], Client $client = null, ConfigBuilder $
);

$this->httpClient = new HttpClient(
$client ?: new PluginClient(HttpClientDiscovery::find(), [new CookiePlugin(new CookieJar())]),
$client ?: new PluginClient(Psr18ClientDiscovery::find(), [new CookiePlugin(new CookieJar())]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -150,8 +146,6 @@ public function reloadConfigFiles()
* Return a config.
*
* @param string $key
*
* @return mixed
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC explicit return type signals PHPStan that the return value is defined. But again, probably fine on legacy branch.

@@ -181,7 +181,7 @@ public function dataForBuild(): array
/**
* @dataProvider dataForBuild
*/
public function testBuildSiteConfig(string $host, bool $expectedRes, ?string $matchedHost = null): void
public function testBuildSiteConfig(string $host, bool $expectedRes, string $matchedHost = null): void
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not really a fan of having different type annotation based on a default value. That way, I need to check two places to know what I can pass to an argument.

Even Python recognized it is a bad idea.

@@ -163,7 +163,6 @@ public function dataWithAccent(): array
return [
// ['http://pérotin.com/post/2015/08/31/Le-cadran-solaire-amoureux'],
['https://en.wikipedia.org/wiki/Café'],
['http://www.atterres.org/article/budget-2016-les-10-méprises-libérales-du-gouvernement'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we could get it from Internet Archive https://web.archive.org/web/20210121073723/http://www.atterres.org/article/budget-2016-les-10-méprises-libérales-du-gouvernement

@j0k3r j0k3r mentioned this pull request Jan 4, 2024
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.

3 participants