-
Notifications
You must be signed in to change notification settings - Fork 14
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
Move "app" and "owner" props to getter/setter #277
Conversation
src/AppScopeTrait.php
Outdated
*/ | ||
public $app; | ||
private $app; |
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.
because of trait design, private prop will still be accessible from the class where used
we may want to rename to _app
, but then any assigment will not throw - but it can be solved by checking ->app
inside init or in the getter/setter methods in this trait
src/AppScopeTrait.php
Outdated
return $this->_app !== null; | ||
} | ||
|
||
public function getApp(): App |
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.
impossible to test if there is no App class - do we want this trait really in core? If yes, we can enforce object type and phpdoc App.
255ca8c
to
d73c02b
Compare
be7e611
to
fdbb807
Compare
7795525
to
221fb89
Compare
@georgehristov PRs for all major repos are done, ok to merge? |
can this be backward compatible for 1 major release? |
no, as it would require magic properties almost in every object the good new is, that existing code can be migrated almost completely with "ctrl+h" |
@mvorisek I'd love if we avoid this. I mean you could add a dummy getOwner() that returns $this->owner for entire release for backward compatibility. Can we have that for 2.3 so that users could start updating code before migrating? |
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.
OK, but please add compatibility into 2.3 release branch.
there are at least 3 reasons why:
if AppScopeTrait trait is present, we may even want to assert if App is set in any init
How to update your code?
->owner->
with->getOwner()->
->owner(?!\w)
and adjust togetOwner()
,setOwner()
,issetOwner()
manually