MontealegreLuis / phuml

phUML is a UML diagram generator. It takes arbitrary object oriented PHP code and creates fully blown class diagrams of it.
BSD 3-Clause "New" or "Revised" License
100 stars 19 forks source link

ParserAbstract error whn trying to generate a diagram (on docker) #27

Open estebanfer opened 1 year ago

estebanfer commented 1 year ago

I can't get phuml on docker to work, I haven't tried with Composer or Phive. It was working last time I tried some months ago. I tried the examples on the docs page and also tried editing it without any success

docker run --rm -v $PWD:/code montealegreluis/phuml phuml:diagram -p dot -r -a src UML.png
[|] Running... (This may take some time)
[|] Parsing codebase structure

In ParserAbstract.php line 318:

  Syntax error, unexpected T_STRING, expecting T_VARIABLE on line 7  

phuml:diagram [-p|--processor PROCESSOR] [-r|--recursive] [-a|--associations] [-i|--hide-private] [-o|--hide-protected] [-m|--hide-methods] [-t|--hide-attributes] [-b|--hide-empty-blocks] [-e|--theme [THEME]] [--] <directory> <output>
wazum commented 1 year ago

I get the same error

realFranco commented 11 months ago

Hello, I have been utilizing phuml on Docker as well and it is working sucessfully.

I would ask for the image version that you was using at that time but at least the image tagged latest works for my experiments, I used it on a dummy project with 4 classes only.

As info. the image tagged 6.1.0is non-working correctly, as a non-expert on PHP I think that is an error with the source code used on that tag.

I'll expose a demonstration about how I use the tool on a pretty straighforward project and the results that I got.

Project structure and files

./
  .docker/  --> Bridge for containerization logic.
  └── compose.yaml

  src/      --> App logic.
  └── Leaf
      ├── LeafHandler.php  --> Use Repository logic.
      ├── LeafHandlerInterface.php
      └── Repository
          ├── LeafRepository.php
          └── LeafRepositoryInterface.php
  uml/      --> Directory where to store artifacts.

For my purposes I have to use a docker compose scheme in order to orchestrate this service with some others required.

# .docker/compose.yaml

services:
    # Some other services before this line.
    uml:
        image: montealegreluis/phuml:latest
        volumes:
            - ./../:/code
            - ./../uml:/uml

Hands on

After observing the documentation and the "layers" that x image have on it the next docker commands helps my to achieve my needs.

docker compose -f .docker/compose.yaml build

To execute the phuml services I do it in this way, feel free to observe the documentation in order to understand the command and set of arguments.

docker compose -f .docker/compose.yaml run --rm uml phuml:diagram -r -a -i -o -p dot src/ uml/example.png

Results

After observe the uml/ directory I have the next image:

example

Expected for me ofc! ⚽️

References

I didn't review the final reference, but seems ok for me share the blog related with this tool and how the autor use it.

realFranco commented 11 months ago

Hello @MontealegreLuis

Maybe you could review this issue and close it, assuming that there is an incomplete evidence from the author and the project have at least a Docker image working (I did not try all of them).

landure commented 10 months ago

I can confirm this error. It may be due to using phUML docker image on a PHP 8.2 code base.

johnfallen commented 2 months ago

I can confirm this error. I am also using PHP 8.2.