Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #33: Fix directed edges #34

Closed
wants to merge 10 commits into from
Closed

Issue #33: Fix directed edges #34

wants to merge 10 commits into from

Conversation

drupol
Copy link

@drupol drupol commented Sep 5, 2019

This PR:

@drupol drupol changed the title 33 directed edges Issue #33: Fix directed edges Sep 5, 2019
@jaapio
Copy link
Member

jaapio commented Sep 7, 2019

Thanks for this PR,

You are introducing quite a lot of other things in this PR than just a fix for this issue you found. Please remove those. And make this a clean PR to fix the issue. Any additional changes can be discussed but should not be in this pr.

It is perfectly ok if you are using tools to improve your own code base, but I don't want them in this repo right now. If we want to introduce Grumphp for example I want to use it organisation wide and define how to introduce it. Not just in a single repo, without any additional that is organisation wide used.

@drupol
Copy link
Author

drupol commented Sep 8, 2019

Allrighty, removed all the unrelated stuff.

@drupol
Copy link
Author

drupol commented Sep 8, 2019

Waiting for your feedback @jaapio .

Copy link
Member

@jaapio jaapio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, you are changing quite a lot, introducing interfaces that have never been there, adding references to the Graph where I don't expect any reference.

Please make clear first in the issue you are trying to fix why a change is needed. I'm not familiar with the format that this library implements. But since it works fine for phpDocumentor I'm wondering why the current implementation is wrong.
After that, we could have a look at how this could be implemented in the library. I think there is an easier way to achieve this.

tests/phpDocumentor/GraphViz/Test/EdgeTest.php Outdated Show resolved Hide resolved
@@ -123,8 +126,16 @@ public function __toString() : string
$from_name = addslashes($this->getFrom()->getName());
$to_name = addslashes($this->getTo()->getName());

$direction = '--';

if (null !== $graph = $this->getGraphRoot()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is needed... you are referencing the graph in the Edge class which makes it harder to cache the objects because of the circular reference.
Only thing you need is a direction attribute on the edge. I'm not very familiar with the format this library is implementing. But I don't think this is the correct way of doing this. If feels like a very high impact on the library and usability of it. While it is unclear to me why this is needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know and I agree.

What would be the best way, according to you, to implement this ?
A third parameter in the constructor?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be a better approach since you are basically setting the direction of the arrow.
maybe even add a few extra named constructors to help the user choosing the right value for $direction?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we could do that as well :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem by doing that is... let's take the following scenario:

  1. You create some undirected edges
  2. You create a digraph
  3. You add the edges to the graph
  4. You export the file and try to pass it through dot... and it will fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds to me that we should throw an exception in that case. A graph with the type Digraph can only contain DirectedEdges We could model that into this library, with more specialized types.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, why not. I will see if I can rework my PR.

@dereuromark
Copy link
Contributor

Is there any chance this is moving forward - and changes into master?

@drupol drupol closed this Jun 11, 2023
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.

None yet

3 participants