Problem/Motivation

The PHPStan job fails with seven errors, all of them saying that a Paragraphs class cannot be found: Drupal\paragraphs\ParagraphInterface in the plugin, and Drupal\paragraphs\Entity\Paragraph and Drupal\paragraphs\Entity\ParagraphsType in the test.

These are not type errors. The job runs PHPStan at level 0, where nothing but symbol resolution is checked, so the only thing the report is saying is that the Paragraphs module is not present in the build at all.

It is not present because the module has no composer.json. The info file declares "paragraphs:paragraphs" as a dependency, but that tells Drupal, not Composer. The continuous integration build is Composer driven: it expands the project composer.json and runs composer install, and the script that does the expanding only ever reads composer.json, never the info file. With no composer.json to read, Composer is never told to install Paragraphs.

The same gap affects anyone installing the module with Composer, not only the pipeline. Requiring drupal/paragraphs_condition would pull in a module that cannot work, because its only real dependency is missing.

Steps to reproduce

1. Push any commit and look at the phpstan job.
2. It reports seven class.notFound errors, every one of them a Drupal\paragraphs class.

Proposed resolution

Add a composer.json declaring drupal/paragraphs in require, alongside the usual project metadata: name, description, type, licence, homepage and support links.

The version constraint is ^1.15. Paragraphs has no 2.x release, and the classes this module uses have been stable since 1.0, so the floor is set by Drupal 10 support rather than by the API. Widen it when a 2.x appears.

Comments

trebormc created an issue. See original summary.

  • trebormc committed 2000db43 on 1.0.x
    Issue #3619020 by trebormc: Add composer.json declaring the Paragraphs...
trebormc’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.