mozart icon indicating copy to clipboard operation
mozart copied to clipboard

FPDI: class names not replaced in sibling dependencies

Open BrianHenryIE opened this issue 4 years ago • 2 comments

FPDI, whose class extends FPDF, does not declare the FDPF library as a requirement in its composer.json. Its official documentation says to require both libraries alongside each other like below.

{
  "require": {
    "setasign/fpdf": "1.8",
    "setasign/fpdi": "2.3"
  },
  "require-dev": {
    "coenjacobs/mozart": "dev-master#3b1243ca8505fa6436569800dc34269178930f39"
  },
  "extra": {
    "mozart": {
      "dep_namespace": "Mozart\\PSR_04\\",
      "dep_directory": "/Mozart/PSR_04/",
      "classmap_prefix": "Mozart_",
      "classmap_directory": "/Mozart/Classes/",
      "delete_vendor_directories": false
    }
  }
}

Expected Mozart/PSR_04/setasign/Fpdi/FpdfTpl.php (line 18) to extend \Mozart_FPDF but it still just extends \FPDF.

While the correct place to fix this would normally be in the FPDI repo, I'm posting here in the hope there is a way to define a package inside my own composer.json in a way that Mozart would handle this. The lack of FPDF requirement is by design in FPDI:

FPDI is ... in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined.

Changing to the following results in FPDF being installed to vendor, but not processed by Mozart.

{
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "setasign/fpdi",
        "require": {
          "setasign/fpdf": "1.8"
        },
        "version": "2.3",
        "source": {
          "url": "https://github.com/Setasign/FPDI",
          "type": "git",
          "reference": "master"
        }
      }
    }
  ],
  "require": {
    "setasign/fpdi": "*"
  },
...

BrianHenryIE avatar Mar 24 '21 04:03 BrianHenryIE

I'm running into a similar problem with symfony/css-selector and symfony/dom-crawler.

Is there a way to process all siblings?

@BrianHenryIE Did you find a solution for this?

noplanman avatar Jan 29 '23 22:01 noplanman

@noplanman I forked Mozart, it's a little different but probably resolves your issue: http://github.com/brianhenryie/strauss

BrianHenryIE avatar Jan 29 '23 23:01 BrianHenryIE