-
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
ENH Fix deprecation issues for PHP 8.1 compatibility #10273
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -56,7 +56,7 @@ class GeocodableDataObject implements ModelTypePlugin | |||||
); | ||||||
|
||||||
// only apply the plugin to geocodable DataObjects | ||||||
if (!Extensible::has_extension($class, Geocodable::class)) { | ||||||
if (!ViewableData::has_extension($class, Geocodable::class)) { | ||||||
return; | ||||||
} | ||||||
|
||||||
|
@@ -85,7 +85,7 @@ class GeocodableQuery implements ModelQueryPlugin | |||||
{ | ||||||
$class = $query->getModel()->getSourceClass(); | ||||||
// Only apply to geocodable objects | ||||||
if (!Extensible::has_extension($class, Geocodable::class)) { | ||||||
if (!ViewableData::has_extension($class, Geocodable::class)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above |
||||||
return; | ||||||
} | ||||||
|
||||||
|
@@ -177,7 +177,7 @@ public function apply(ModelQuery $query, Schema $schema, array $config = []): vo | |||||
{ | ||||||
$class = $query->getModel()->getSourceClass(); | ||||||
// Only apply to geocodable objects | ||||||
if (!Extensible::has_extension($class, Geocodable::class)) { | ||||||
if (!ViewableData::has_extension($class, Geocodable::class)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above |
||||||
return; | ||||||
} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ | |||||
use SilverStripe\Dev\Deprecation; | ||||||
use SilverStripe\ORM\DataObject; | ||||||
use SilverStripe\ORM\DB; | ||||||
use SilverStripe\View\ViewableData; | ||||||
|
||||||
/** | ||||||
* Provides introspection information about the class tree. | ||||||
|
@@ -597,7 +598,7 @@ public static function classesWithExtension( | |||||
|
||||||
// only keep classes with the Extension applied | ||||||
$classes = array_filter($classes, function ($class) use ($extensionClass) { | ||||||
return Extensible::has_extension($class, $extensionClass); | ||||||
return ViewableData::has_extension($class, $extensionClass); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above |
||||||
}); | ||||||
|
||||||
return $classes; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,7 +5,6 @@ | |||||
use SilverStripe\Admin\LeftAndMain; | ||||||
use SilverStripe\Control\Controller; | ||||||
use SilverStripe\Core\ClassInfo; | ||||||
use SilverStripe\Core\Extensible; | ||||||
use SilverStripe\ORM\DataList; | ||||||
use SilverStripe\ORM\SS_List; | ||||||
use SilverStripe\ORM\ValidationResult; | ||||||
|
@@ -17,6 +16,7 @@ | |||||
use SilverStripe\Core\Config\Config; | ||||||
use SilverStripe\Core\Convert; | ||||||
use Exception; | ||||||
use SilverStripe\View\ViewableData; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above |
||||||
|
||||||
/** | ||||||
* DataObjects that use the Hierarchy extension can be be organised as a hierarchy, with children and parents. The most | ||||||
|
@@ -418,7 +418,7 @@ private function getHierarchyBaseClass(): string | |||||
{ | ||||||
$ancestry = ClassInfo::ancestry($this->owner); | ||||||
$ancestorClass = array_shift($ancestry); | ||||||
while ($ancestorClass && !Extensible::has_extension($ancestorClass, self::class)) { | ||||||
while ($ancestorClass && !ViewableData::has_extension($ancestorClass, self::class)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above |
||||||
$ancestorClass = array_shift($ancestry); | ||||||
} | ||||||
|
||||||
|
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 would suggest using this syntax instead because
ViewableData
does not inherently have anything to do with the current context. But in the grander scheme, it doesn't really matter.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 know ahead of time if $class has the Extensible trait, so we'd need something like this
method_exists($class, 'has_extension') && call_user_func("$class::has_extension", $class, Geocodable::class)
Which is very verbose. Therefore I think it's better to simply use
ViewableData::has_extension($class, Geocodable::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.
That's fair point.