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 | |
class Article { | |
private final $comments = []; | |
public function addComment(Comment $comment) { | |
$this->comments[] = $comment; | |
} | |
public function clearComments() { | |
$this->comments = []; | |
} | |
} |
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 | |
package MyVendor\MyLibrary // acts same as `namespace` but changes all classes into package-private | |
{ | |
namespace MyInternalStuff // cause current namespace would be MyVendor\MyLibrary\MyInternalStuff | |
{ | |
class MyNonPublicWidget // class name would be MyVendor\MyLibrary\MyInternalStuff\MyNonPublicWidget | |
{ | |
} | |
} |
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 | |
immutable class Currency | |
{ | |
/** @var string */ | |
public $code; // this will change to readonly after constructor execution | |
/** @var string */ | |
public $name; // this will change to readonly after constructor execution | |
/** @var int */ | |
public $fractionDigits; |
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 | |
final immutable class Currency {} | |
final immutable class Money { | |
public $amount; | |
public $currency; | |
public function __construct(float $amount, Currency $currency) { | |
$this->amount = $amount; | |
$this->currency = $currency; | |
} |
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
=========================================== | |
Namespace: 'PHPTest' | |
=========================================== | |
Array | |
( | |
[name] => PHPTest | |
[internal] => | |
[user-defined] => 1 | |
[parent] => ReflectionNamespace Object | |
( |
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 | |
class A {} | |
class B { | |
function foo(object $a) : object { | |
return $a; | |
} | |
} | |
class C extends B { |
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
diff --git a/Zend/zend.c b/Zend/zend.c | |
index 44a73ba..60ff916 100644 | |
--- a/Zend/zend.c | |
+++ b/Zend/zend.c | |
@@ -36,11 +36,13 @@ | |
#ifdef ZTS | |
# define GLOBAL_FUNCTION_TABLE global_function_table | |
# define GLOBAL_CLASS_TABLE global_class_table | |
+# define GLOBAL_NAMESPACE_TABLE global_namespace_table | |
# define GLOBAL_CONSTANTS_TABLE global_constants_table |
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 | |
class Person | |
{ | |
private interface Name | |
{ | |
public function __construct(string $name); | |
public function __toString() : string; | |
} | |
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 declare(strict_types=1); | |
namespace MyTest; | |
/** | |
* @ValueObject | |
*/ | |
class MyClass { | |
/** | |
* @var int | |
* @Setter @Getter | |
*/ |
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 | |
namespace Plumbok\Test; | |
/** | |
* @Value | |
*/ | |
class Email | |
{ | |
private $email = ''; | |
OlderNewer