Skip to content

Adapt to roach-php/core 3.2 + Symfony ^7.0 (PHP >= 8.2) - #3

Open
Azmandios wants to merge 4 commits into
Ne-Lexa:mainfrom
Azmandios:roach-3
Open

Azmandios wants to merge 4 commits into
Ne-Lexa:mainfrom
Azmandios:roach-3

Conversation

@Azmandios

Copy link
Copy Markdown
Contributor

Summary

  • Require roach-php/core ^3.2 (was ~1.1.0), symfony/* ^7.0 (was ^6.0), php >=8.2 (was >=8.0).
  • Register the two downloader middlewares introduced in roach-php 3.x in services.php:
    • HttpErrorMiddleware (RoachPHP\Downloader\Middleware\HttpErrorMiddleware, ctor: (LoggerInterface)) — drops responses with unallowed HTTP status, configured per spider via the handleStatus option;
    • ProxyMiddleware (RoachPHP\Downloader\Middleware\ProxyMiddleware, ctor: (ContainerInterface, LoggerInterface)) — assigns proxies to requests, configured per spider via the proxy / loader options.
  • Remove psalm dev-dependencies (vimeo/psalm, psalm/plugin-symfony, psalm/plugin-phpunit): psalm 4.x requires symfony/console <=6, incompatible with symfony ^7.0. The psalm step needs either psalm 5/6 upgrade or removal (kept out of scope of this PR).

Compatibility

The bundle is a thin wrapper (RoachPhpBundle::boot()Roach::useContainer()). Verified against roach-php/core v3.2.1: constructor signatures of all services previously registered in services.php (Engine, Processor, RequestDeduplicationMiddleware, ExecuteJavascriptMiddleware, CookieMiddleware, StatsCollectorExtension, Downloader, ItemPipeline, Client, Runner, ArrayRequestScheduler, SystemClock, extensions, built-in middlewares) are unchanged since 1.x. Roach::useContainer(), Roach::startSpider(), Roach::collectSpider() and Overrides signatures are unchanged. RunSpiderCommand (roach:run) works as before.

Testing

  • composer update resolves cleanly on PHP 8.4: roach-php/core 3.2.1, symfony/console 7.4.x, symfony/serializer 7.4.x, symfony/maker-bundle 1.68, monolog 3.12, nyholm/psr 1.8.
  • composer install --dry-run — nothing to install (stable resolution).
  • php -l clean on all changed files.

Notes for maintainers

  • .github/workflows/build.yml still pins php 8.0/8.1 and symfony_version: 6.0.* and runs psalm — it will need a follow-up matrix update (php >= 8.2, symfony 7.*) and either psalm 5+ or removal of the psalm step. Kept out of this PR to keep the diff minimal.
  • jakeasmith/http_build_url (pulled by core 3.2.1) is abandoned — upstream core concern, not bundle's.

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.

1 participant