-
Notifications
You must be signed in to change notification settings - Fork 824
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
API Add new deprecation notices. #10691
API Add new deprecation notices. #10691
Conversation
Deprecation::notice('5.0', __CLASS__ . ' is deprecated, use ' . Reader::class . ' instead'); | ||
Deprecation::notice('4.13.0', 'Use ' . Reader::class . ' instead', Deprecation::SCOPE_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.
I'm explicitly not wrapping this one in Deprecation::withNoReplacement()
because there are only a few instances of it in use in our code, and we can wrap those instead. This seems likely to be used pretty frequently in projects so it's good for their uses to pop up in the main deprecation notices.
$csv = new CSVParser( | ||
$filepath, | ||
$this->delimiter, | ||
$this->enclosure | ||
); | ||
$delimiter = $this->delimiter; | ||
$enclosure = $this->enclosure; | ||
$csv = Deprecation::withNoReplacement(function () use ($filepath, $delimiter, $enclosure) { | ||
return new CSVParser($filepath, $delimiter, $enclosure); | ||
}); |
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 is the only usage of this class in our code that I could find.
Since this whole method is deprecated, it's easier to just wrap this instantiation than to replace it with the Reader
class. It's gone in CMS 5 anyway.
tests/php/Dev/CSVParserTest.php
Outdated
@@ -24,7 +25,10 @@ protected function setUp(): void | |||
public function testParsingWithHeaders() | |||
{ | |||
/* By default, a CSV file will be interpreted as having headers */ | |||
$csv = new CSVParser($this->csvPath . 'PlayersWithHeader.csv'); | |||
$filepath = $this->csvPath; |
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.
Instead of wrapping calls here, instead change setUp()
to the following:
protected function setUp(): void
{
parent::setUp();
$this->csvPath = __DIR__ . '/CsvBulkLoaderTest/csv/';
if (Deprecation::isEnabled()) {
$this->markTestSkipped('Test calls deprecated code');
}
}
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.
Done
These are removed in CMS 5.
cca6c76
to
3b3f965
Compare
These are removed in CMS 5.
Note there have been so many new deprecations which we already haven't added to the CMS 4.13 changelog so there's no point manually adding this there, we're going to have to do some batch card to add all the ones we've missed anyway and we'll likely just automate that.
Parent issue