-
-
Save azjezz/db734fd148f84202d19de8479dea2710 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
#[Sealed(ExtendedUserInterface::class, User::class)] | |
interface UserInterface {} | |
// ok | |
interface ExtendedUserInterface extends UserInterface {} | |
// ok | |
class User implements UserInterface {} | |
// error: cannot extend sealed interface UserInterface | |
interface MyUserInterface extends UserInterface {} | |
// error cannot implement sealed interface UserInterface | |
interface Myuser implements UserInterface {} | |
#[Sealed(Bar::class)] | |
class Foo {} | |
// ok | |
class Bar extends Foo {} | |
// error: Cannot extend sealed class Foo. | |
class Baz extends Foo {} | |
// ok | |
class Qux extends Bar {} |
This file contains 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
<?php | |
#[Sealed(Exception::class, Error::class)] | |
interface Throwable {} | |
#[Sealed(Partial::class)] | |
interface Closure {} |
This file contains 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
<?php | |
interface Throwable for Exception, Error {} | |
interface Closure for Partial {} |
This file contains 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
<?php | |
interface UserInterface for User, ExtendedUserInterface {} | |
// ok | |
interface ExtendedUserInterface extends UserInterface {} | |
// ok | |
class User implements UserInterface {} | |
// error: cannot extend sealed interface UserInterface | |
interface MyUserInterface extends UserInterface {} | |
// error cannot implement sealed interface UserInterface | |
interface Myuser implements UserInterface {} | |
class Foo for Bar {} | |
// ok | |
class Bar extends Foo {} | |
// error: Cannot extend sealed class Foo. | |
class Baz extends Foo {} | |
// ok | |
class Qux extends Bar {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment