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); | |
// ==================================================================== | |
// | |
// Copy and Paste on https://3v4l.org/ | |
// PHPStan & Psalm verified... | |
// Some code isn't the best but I want to transmit the ideas! | |
// | |
// ==================================================================== |
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
//==================================== | |
// | |
// MAIN TYPE | |
// | |
//==================================== | |
public interface ComposingAutocloseable extends AutoCloseable | |
{ |
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); | |
class Logger | |
{ | |
function info(string $msg):void{} | |
} | |
$logger = new Logger(); | |
/** |
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); | |
//------------------------------------------- | |
// | |
// FIRST NAMESPACES | |
// | |
//------------------------------------------- | |
namespace FST{ |
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
import static it.fago.loggerstein.Loggerstein.$; | |
import static it.fago.loggerstein.Loggerstein.lazy; | |
import static it.fago.loggerstein.Loggerstein.logWith; | |
import static it.fago.loggerstein.Loggerstein.STD_ERR; | |
import static it.fago.loggerstein.Loggerstein.STD_OUT; | |
import org.junit.Test; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import static org.junit.Assert.*; |
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
import java.util.List; | |
import static java.util.stream.Collectors.toList; | |
class Command { | |
} | |
interface CommandHandler { | |
public Result handle(Command cmd); | |
} |
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); | |
/** | |
* NOTE: | |
* | |
* This example is for that legacy code where it's possible to | |
* refactor a sequence of action using a custom DSL. | |
* When not possible to refactor to FP or before using Try-Monad we can | |
* simulate something like a functor... |
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); | |
/** | |
* NOTE: | |
* | |
* This example is for that legacy code where more error conditions | |
* are in sequence... Using exceptions, we are creating a control flow | |
* policy where every exception is an exit from actual flow. | |
* When not possible to refactor to FP or before using Try-Monad we can | |
* simulate monoid-al behaviour with an accumulator... |
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
import static java.util.stream.Collectors.toList; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.Objects; | |
import java.util.function.Function; | |
public interface Initializer<R> { |