Comments (3)
Hah, interesting indeed. I love the "if you delete it, will it compile" heuristic, since itβs super easy to grasp. That being said, the final case is not atypical in a ports-and-adapters kinda situation.
I guess this needs more long showers and long walks before I can say something more insightful here. But I will come back.
from deptrac.
This is absolutely a feature. Looks what happens when you "squash" B into the final shape the class will have at runtime:
class B {
final public function getVO(): VO { return new VO($this->generate()); }
protected function generate(): string { return "from B"; }
}
You absolutely depend on VO
. You can look at it another way:
If I deleted
VO
, wouldB
lint?
Obviously, it would not, it would complain about non-existent VO
.
Deptrac should provide you with a relatively nice message about this being a dependency coming from A
via inheritance as well. At least with the default console
formatter.
from deptrac.
Thinking about it a bit more.
Is the argument there that since final public function getVO(): VO { return new VO($this->generate()); }
is final
it is always executed in the context of A
and therefore not B
should not be dependent on VO
? And if the method was not final it would be?
That would be an interesting case.
If that would be the case what would happen if I had:
class C {
public function foo(): void {
$var = new B(); //This is clear dependency on B
$vo = $var->getVO(); //Is this dependency on B or on A?
var_dump($vo); //This could be a dependency on VO, but it is not yet implemented in deptrac
}
}
It creates another conundrum. I am not opposed to this, just wondering what were your expectations. It is important that deptrac
behaves the way people expect it do behave.
from deptrac.
Related Issues (20)
- [debug:layer] display token types
- PHAR: add "KevinGH\\Box\\Compactor\\Php" to reduce the size
- Update PHPUnit to version 10
- Update Psalm to version 5
- Add ".gitattributes" and exclude unnecessary files from packaged release
- Next Release: Reduce the distribution to just one method for the next release HOT 8
- Collector for excluding the layer in which it is specified.
- Ambiguous of @internal HOT 1
- Cache directory for Cache File not created automatically HOT 2
- Error message when using anonymous readonly class in php 8.3 HOT 3
- Nullable IntersectionType error HOT 2
- PHP 8.3 typed constants cause syntax error HOT 5
- Generating image: Argument ($hiddenLayers) must be of type array null given HOT 2
- New Release HOT 5
- Deptrac does not recognize type aliases HOT 3
- Option to ignore baseline in graphviz output
- Dependabot overfloods this repository HOT 2
- Support for typed const - PHP 8.3 HOT 24
- Add support for mermaid formatters HOT 4
- Referencing non-existing layer in depfile emits no error, but breaks the referencing layer HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deptrac.