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 | |
trait OptionalProperties | |
{ | |
public static function fromArray(array $args = [], bool $strict = true): self | |
{ | |
$obj = (new ReflectionClass(self::class))->newInstanceWithoutConstructor(); | |
foreach ($args as $prop => $value) { | |
if (!property_exists($obj, $prop)) { | |
if ($strict) { |
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
eval $(docker-machine env) | |
SSH_ENV=$HOME/.ssh/environment | |
force_color_prompt=yes | |
source /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh | |
PS1="\[\033[1;36m\]\u\[\033[1;35m\]@\[\033[1;34m\]#:\[\033[1;33m\]\w\[\033[1;32m\]\$(__git_ps1) \[\033[1;31m\]\$ \[\033[00m\]" | |
alias ls='ls --color=auto' |
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 > if (!1 instanceof DumbClass) echo 'lolphp'; | |
PHP Fatal error: instanceof expects an object instance, constant given in php shell code on line 1 | |
php > $a = 1; if (!($a instanceof DumbClass)) echo 'lolphp'; // DumbClass has not been declared but not even a notice is thrown | |
lolphp |