File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,10 @@ class PositivePoint extends Point
498
498
Hooks may not access any other hook except their own parent on their own property.
499
499
</simpara >
500
500
<simpara >
501
- The example above could be rewritten more efficiently as follows.
501
+ The example above could be rewritten as follows, which would allow for the
502
+ <literal >Point</literal > class to add its own <literal >set</literal > hook
503
+ in the future without issue. (In the previous example, a hook added to
504
+ the parent class would be ignored in the child.)
502
505
</simpara >
503
506
<example >
504
507
<title >Parent hook access (set)</title >
@@ -518,7 +521,7 @@ class PositivePoint extends Point
518
521
if ($value < 0) {
519
522
throw new \InvalidArgumentException('Too small');
520
523
}
521
- $this->x = $value;
524
+ parent::$x::set( $value) ;
522
525
}
523
526
}
524
527
}
You can’t perform that action at this time.
0 commit comments