Skip to content

Return-type exceptions after composer update #66

@mmic-bjohnson

Description

@mmic-bjohnson

Your Environment

  • OS and Version: Ubuntu 18.04
  • PHP Version: 7.3.12
  • Themes Version: 5.0.x-dev

Expected behaviour

No exceptions when resolving assets.

Actual behaviour

Declaration of Cartalyst\Themes\Assets\Asset::getSlug() must be compatible with Cartalyst\Dependencies\DependentInterface::getSlug(): string

Steps to reproduce

Hi all!

I'm not entirely sure what changed (that's what I'm trying to determine here), but while attempting to update my Composer dependencies to their latest versions, something changed that is causing the exception noted above.

Basically, it seems that explicit return types were added to DependentInterface, e.g., https://github.com/cartalyst/dependencies/blob/bf45c254fa709dd437610fa52e3010dc3dea37f8/src/DependentInterface.php#L31 , but the same types have not been added to the implementing methods, e.g.,

public function getSlug()
.

It looks like those return types were added about 5 months ago via cartalyst/dependencies@7f65018 and tagged in v2.0.0.

One would expect that Composer would keep the constraints in-check and prevent something like this from happening, but for some reason, which I'm unable to determine as yet, Composer is installing cartalyst/themes 5.0.x-dev c276fe9, instead of the latest non-dev version.

I do notice that there is a branch-alias defined in

"dev-master": "5.0.x-dev"
, but shouldn't that be used only if the constraint is specified as dev-master somewhere?

I certainly have not set that intentionally anywhere, and can't figure out why that's happening. Composer's why output looks normal:

composer why cartalyst/themes
platform/foundation  v8.0.0  requires  cartalyst/themes (^5.0)
platform/themes      v8.0.0  requires  cartalyst/themes (^5.0)

In fact, I'm not even sure if this dev branch issue even matters, because cartalyst/extensions seems to require the same cartalyst/dependencies:^2.0:

composer why cartalyst/dependencies
cartalyst/extensions  v4.0.2     requires  cartalyst/dependencies (^2.0)
cartalyst/themes      5.0.x-dev  requires  cartalyst/dependencies (^2.0)

I'm not sure what else to investigate at this point... any ideas?

Thanks in advance!

Edit to add:

Here are the version changes that are happening to cause this breakage when I update:

$ composer update platform/* cartalyst/*
    1/2:        http://repo.packagist.org/p/provider-latest$2e46a8204ac8e62f7f820dfe65ce1985ce6fbc7bf74b7d9f0626921f5cd3dca6.json
    2/2:        http://repo.packagist.org/p/provider-2020-01$30a2597c01ec63f25ef7ae5d23d808aadbb7baa94e28cd2d5713504f4fe5a932.json
    Finished: success: 2, skipped: 0, failure: 0, total: 2
Loading composer repositories with package information                    Updating dependencies (including require-dev)
Package operations: 0 installs, 7 updates, 0 removals
  - Updating cartalyst/dependencies (v1.0.2 => v2.0.0): Loading from cache
  - Updating cartalyst/extensions (v4.0.1 => v4.0.2): Loading from cache
  - Updating cartalyst/resource-watcher (v1.1.4 => v1.1.5): Loading from cache
  - Updating cartalyst/assetic (v1.4.1 => v1.4.2): Loading from cache
  - Removing cartalyst/themes (v5.0.0)
  - Installing cartalyst/themes (5.0.x-dev c276fe9): Loading from cache
  - Updating cartalyst/sentinel (v3.0.3 => v3.0.4): Loading from cache
  - Updating cartalyst/workshop (v4.0.0 => v4.0.1): Loading from cache

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions