diff --git a/src/Cli/Entrypoint.php b/src/Cli/Entrypoint.php index 94bb4c20..9317296b 100644 --- a/src/Cli/Entrypoint.php +++ b/src/Cli/Entrypoint.php @@ -92,13 +92,9 @@ public function execute(): void { Logger::enable(); } - // Enable stats gathering, if requested. + // If requested, print stats at the absolute end of runtime. if ($cfg['print_runtime_stats']) { - - Stats::enable(); - // Try printing stats at the absolute end of runtime. register_shutdown_function(fn() => Stats::print()); - } // Determine the source. Act as REPL if no source was specified. diff --git a/src/Drivers/TerminalIoDriver.php b/src/Drivers/TerminalIoDriver.php index 08dae713..70df0ea4 100644 --- a/src/Drivers/TerminalIoDriver.php +++ b/src/Drivers/TerminalIoDriver.php @@ -13,7 +13,7 @@ class TerminalIoDriver implements StdIoDriverInterface { private ?string $buffer = null; - private function bufferInput(?string $buffer) { + private function bufferInput(?string $buffer): void { $this->buffer = (string) $buffer; } diff --git a/src/Extensions/TypeExtension.php b/src/Extensions/TypeExtension.php index f24a43e4..c2e65043 100644 --- a/src/Extensions/TypeExtension.php +++ b/src/Extensions/TypeExtension.php @@ -4,8 +4,8 @@ namespace Smuuf\Primi\Extensions; +use \Smuuf\Primi\Values\AbstractValue; use \Smuuf\Primi\Helpers\Types; -use \Smuuf\Primi\Values\FuncValue; use \Smuuf\Primi\Helpers\ValueFriends; abstract class TypeExtension extends ValueFriends { @@ -15,8 +15,8 @@ final private function __construct() { } /** - * @return array Dict array containing Primi functions - * which represent class methods. + * @return array Dict array containing Primi + * function/method object that represent type/class methods. */ public static function execute(): array { return Types::prepareTypeMethods( diff --git a/src/Handlers/Kinds/IfStatement.php b/src/Handlers/Kinds/IfStatement.php index 9adbe474..3d92adc5 100644 --- a/src/Handlers/Kinds/IfStatement.php +++ b/src/Handlers/Kinds/IfStatement.php @@ -51,7 +51,7 @@ public static function reduce(array &$node): void { $elifs = []; if (isset($node['elifCond'])) { - $node['elifCond'] = Func::ensure_indexed($node['elifCond'] ?? []); + $node['elifCond'] = Func::ensure_indexed($node['elifCond']); $node['elifBlock'] = Func::ensure_indexed($node['elifBlock'] ?? []); foreach ($node['elifCond'] as $i => $elifCond) { diff --git a/src/Helpers/Types.php b/src/Helpers/Types.php index f9c9e26b..1ccee588 100644 --- a/src/Helpers/Types.php +++ b/src/Helpers/Types.php @@ -39,8 +39,8 @@ public static function is_subclass_of( * from ordinary method to static method for the type system and object * model to work correctly. * - * @param array - * @return array + * @param array $methods + * @return array */ public static function prepareTypeMethods( array $methods, diff --git a/src/Values/MethodValue.php b/src/Values/MethodValue.php index 1b1a7e11..97a47013 100644 --- a/src/Values/MethodValue.php +++ b/src/Values/MethodValue.php @@ -24,7 +24,7 @@ class MethodValue extends FuncValue { public function __construct( FnContainer $fn, private bool $isStatic = false, - private ?AbstractValue $bind = \null, + ?AbstractValue $bind = \null, ) { if ($isStatic && $bind) { diff --git a/src/Values/TypeValue.php b/src/Values/TypeValue.php index 5240d5ea..3b45de45 100644 --- a/src/Values/TypeValue.php +++ b/src/Values/TypeValue.php @@ -30,9 +30,11 @@ class TypeValue extends AbstractBuiltinValue { /** * @param string $name Name of the type. + * @param ?TypeValue $parent Parent Primi type of this type. * @param array $attrs * @param bool $isFinal Final type/class cannot be used as a parent type. - * @param ?TypeValue Parent Primi type of this type. + * @param bool $isMutable IF true, it is possible to mutate type's attrs + * in userland. */ public function __construct( protected string $name,