-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Deprecate ClassMetadataInfo #6886
Conversation
64d7c45
to
7c60cfc
Compare
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
This class is deprecated. See doctrine/orm#6886
*/ | ||
public function testTheClassIsDeprecated() | ||
{ | ||
class_exists(ClassMetadataInfo::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should at least has assertTrue(). Maybe instantiating ReflectionClass would be better as it would throw i.e. once CMI BC is dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once CMI BC is dropped, the class will no longer exist, and this will throw too. Even without the assertTrue
, right? I mean there is the @expectedDeprecation
, and it will no longer be satisfied, I don't know why you want me to add assertTrue
. I'll add it but I don't understand what the point is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter really, just thought it may be easier to see failed assertion first than no deprecation thrown or whatever that message looks like.
* @group legacy | ||
* @expectedDeprecation Doctrine\ORM\Mapping\ClassMetadataInfo is deprecated since 2.x and will be removed in 3.0. Use Doctrine\ORM\Mapping\ClassMetadata instead. | ||
*/ | ||
public function testTheClassIsDeprecated() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return types here and below please
use Doctrine\Common\ClassLoader; | ||
use Doctrine\ORM\Cache\CacheException; | ||
@trigger_error(sprintf( | ||
'%s is deprecated since 2.x and will be removed in 3.0. Use %s instead.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Revisit message later, it may be ComponentMetadata instead of ClassMetadata.
* @todo 3.0 Remove this. PersisterHelper should fix it somehow | ||
*/ | ||
public function getTypeOfField($fieldName) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? Should also use ::class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't: it says "remove this"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was for:
class_exists('Doctrine\ORM\Mapping\ClassMetadata');
GitHub somehow put it on wrong line, maybe too large diff...
e9d8093
to
983000d
Compare
Also please add note to UPGRADE document, thanks. |
Triggering the build again |
19c55f7
to
6ba3fe2
Compare
4f831e9
to
d0e70ce
Compare
Rebased |
@greg0ire the destination branch should be |
Moved the controversial autoloading to another PR, so that this is easy to merge. |
The clearer the better.
6621e57
to
ee7caef
Compare
Don't merge, this crashes: <?php
require 'vendor/autoload.php';
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
class A
{
public function __construct(ClassMetadataInfo $a)
{
}
}
new A(new ClassMetadata('whatever')); |
Changing the order of the 2 tests is important because the first one autoloads CMI
Forgot to say that it is now "fixed", but the fix is a bit ugly |
@greg0ire moving this to 2.8.0 as we have conflicts to address and want to release 2.7.0 ASAP. |
e531738
to
66c95a6
Compare
The deprecation happened 7 years ago: #249
Here is how I proceeded:
ClassMetadataInfo
toClassMetadata
ClassMetadataInfo
toClassMetadata
.ClassMetadataInfo
class definition in anif (\false)
statement to provide IDE autocompletion.