-
Notifications
You must be signed in to change notification settings - Fork 509
Hooked properties cannot be both final and private #3830
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
39d2b7d
Hooked properties cannot be both final and private
staabm cdbc1c8
fix lint
staabm 49a9779
Properties cannot be final
staabm 3528941
fix
staabm 55dea67
simplify
staabm 230bea3
final hook in abstract class
staabm dbc7204
lint
staabm a7ffd30
cs
staabm 8d86a1e
fix 8.3
staabm d1e74f4
Interfaces cannot include final properties
staabm 53879a8
abstract final
staabm eeea42c
better error message
staabm 104b317
typo
staabm 944f86c
improve error messages
staabm d95074f
Property hook cannot be both abstract and final
staabm 39a6edd
allow abstract non-final hooks
staabm b1310f7
Property in interface cannot be explicitly abstract
staabm 8929aeb
fix lint
staabm 12271a3
Update PropertiesInInterfaceRule.php
staabm 9aed13d
Update PropertiesInInterfaceRule.php
staabm 7b7672a
Update PropertiesInInterfaceRule.php
staabm 2b2f64b
Update src/Rules/Properties/PropertiesInInterfaceRule.php
ondrejmirtes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/PHPStan/Rules/Properties/data/abstract-final-property-hook-parse-error.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php // lint >= 8.4 | ||
|
||
namespace AbstractFinalHookParseError; | ||
|
||
abstract class User | ||
{ | ||
final abstract public string $bar { | ||
get; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/PHPStan/Rules/Properties/data/abstract-final-property-hook.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php // lint >= 8.4 | ||
|
||
namespace AbstractFinalHook; | ||
|
||
abstract class User | ||
{ | ||
abstract public string $foo { | ||
final get; | ||
} | ||
} | ||
|
||
abstract class Foo | ||
{ | ||
abstract public int $i { final get { return 1;} set; } | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.