Skip to content

Import useful reflection classes #122

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

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented Jul 29, 2020

Other reflection classes do not seem to be used anywhere.

Classes were imported from the master branch, I hope that is ok?

@greg0ire greg0ire force-pushed the aspirate-reflection-classes branch from 631c3a3 to 76e7689 Compare July 29, 2020 20:10
},
"require-dev": {
"phpstan/phpstan": "^0.11",
"doctrine/coding-standard": "^6.0",
"doctrine/common": "^3.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

So this is a circular dependency… yuck! It was a dev dependency in doctrine/reflection, not sure why… should I move it to a regular requirement?

Copy link
Member

@morozov morozov Jul 29, 2020

Choose a reason for hiding this comment

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

Can you check what will fail if this dependency is removed? A dev dependency of one package is not necessarily a dev dependency of the one that depends on it. It might have been used by the reflection package to test other classes than the ones being carried over.

should I move it to a regular requirement?

As long as neither this package nor the reflection had a production dependency on the common package, it doesn't look like the right thing to do.

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot to add it at first and it failed 🙂

greg0ire added a commit to greg0ire/phpstorm-stubs that referenced this pull request Jul 29, 2020
This was overlooked in JetBrains#698 and causes some issues for static analysis,
see doctrine/persistence#122
@greg0ire greg0ire force-pushed the aspirate-reflection-classes branch from 76e7689 to f42d2cd Compare July 29, 2020 20:20
@greg0ire greg0ire force-pushed the aspirate-reflection-classes branch from f42d2cd to 65bb660 Compare July 29, 2020 20:37
Other reflection classes do not seem to be used anywhere.
@greg0ire greg0ire force-pushed the aspirate-reflection-classes branch from 65bb660 to c4f5ebc Compare July 29, 2020 20:41
@greg0ire greg0ire marked this pull request as ready for review July 29, 2020 20:41

namespace Doctrine\Persistence\Reflection;

use Doctrine\Common\Proxy\Proxy;
Copy link
Member

@morozov morozov Jul 29, 2020

Choose a reason for hiding this comment

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

So this is where the package depends on the common library. It doesn't require it but supports it (hence the test). Would it make sense to just make the test skip if the library is not loaded and add it as a suggestion?

I believe there should be consistency between the dependencies of the code and the dependencies of the tests that cover that code. Not that the code doesn't have a dependency while the test does.

Copy link
Member Author

Choose a reason for hiding this comment

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

So to be clear, you would add composer require --dev doctrine/common to the CI script? In the end, the difference it would make would be that contributors would run part of the tests and would not have to download that lib, at the expense of slightly longer builds in our CI, so… I'm not really convinced but can do the change. Let's see if other contributors feel strongly one way or another?

Copy link
Member

@morozov morozov Jul 29, 2020

Choose a reason for hiding this comment

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

So to be clear, you would add composer require --dev doctrine/common to the CI script?

Yes, this was the idea. Technically, the development of the script doesn't strictly depend on this package.

For instance, DBAL has code and the tests that depend on certain PHP extensions. If those extensions are not available, the tests are skipped. How is it different from this case?

I see what you're saying and I agree that eventually, we are adding the dependency on CI instead of having it added in the repository.

Copy link
Member Author

Choose a reason for hiding this comment

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

How is it different from this case?

Here, it doesn't depend on extensions. Extensions are more involving to install: you have to be root, composer can't do it for you, and in some cases you might even not have a system package for them. That's why it makes a lot of sense to proceed like this on the DBAL. doctrine/common has 2 dependencies: this very lib, and php, so it means no extra dep. It's just not worth it IMO.

Copy link
Member

Choose a reason for hiding this comment

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

I can live with composer require --dev doctrine/common or adding it to the dev dependencies. I've seen both ways in different projects.

Copy link
Member

@morozov morozov Aug 4, 2020

Choose a reason for hiding this comment

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

If I may summarize it, if there's no reason for the change, let's not make it (i.e. keep the development dependency).

Copy link
Member

Choose a reason for hiding this comment

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

The other option is to copy the interface here and add a autoload-dev. Since its just a marker interface with no methods, there is no risk of breaking with or without doctrine/common.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the requirement under the require-dev section, so it's not like there is an impact on the users.

@greg0ire
Copy link
Member Author

greg0ire commented Sep 13, 2020

I should create a branch called 2.1.x from 2.0.x and target it, shouldn't I? Since master is aliased to 3:

"dev-master": "3.0.x-dev"

@SenseException
Copy link
Member

I should create a branch called 2.1.x from 2.0.x and target it, shouldn't I? Since master is aliased to 3

I guess so. Is there a reason why master is already covering a 3.0 release?

@greg0ire
Copy link
Member Author

I guess so. Is there a reason why master is already covering a 3.0 release?

Yeah, for instance master no longer contains the PersistentObject class. Full comparison here: 2.0.0...master

@greg0ire greg0ire changed the base branch from 2.0.x to 2.1.x September 14, 2020 21:19
@greg0ire greg0ire merged commit a5842dc into doctrine:2.1.x Sep 14, 2020
@greg0ire greg0ire deleted the aspirate-reflection-classes branch September 14, 2020 21:21
@greg0ire greg0ire added this to the 2.1.0 milestone Oct 25, 2020
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.

4 participants