<?php
/**
* SCSSPHP
*
* @copyright 2012-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://scssphp.github.io/scssphp
*/
namespace ScssPhp\ScssPhp;
final class Warn
{
/**
* @var callable|null
* @phpstan-var (callable(string, bool): void)|null
*/
private static $callback;
/**
* Prints a warning message associated with the current `@import` or function call.
*
* This may only be called within a custom function or importer callback.
*
* @param string $message
*
* @return void
*/
public static function warning($message)
{
self::reportWarning($message, false);
}
/**
* Prints a deprecation warning message associated with the current `@import` or function call.
*
* This may only be called within a custom function or importer callback.
*
* @param string $message
*
* @return void
*/
public static function deprecation($message)
{
self::reportWarning($message, true);
}
/**
* @param callable|null $callback
*
* @return callable|null The previous warn callback
*
* @phpstan-param (callable(string, bool): void)|null $callback
*
* @phpstan-return (callable(string, bool): void)|null
*
* @internal
*/
public static function setCallback(callable $callback = null)
{
$previousCallback = self::$callback;
self::$callback = $callback;
return $previousCallback;
}
/**
* @param string $message
* @param bool $deprecation
*
* @return void
*/
private static function reportWarning($message, $deprecation)
{
if (self::$callback === null) {
throw new \BadMethodCallException('The warning Reporter may only be called within a custom function or importer callback.');
}
\call_user_func(self::$callback, $message, $deprecation);
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| Base/ | 2026-11-26 08:19 | 871 B | 76129f60960:kunden | dxwrx-rx-r | |
| Block/ | 2026-11-26 08:19 | 6.37 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Compiler/ | 2026-11-26 08:19 | 2.46 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Exception/ | 2026-11-26 08:19 | 3.24 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Formatter/ | 2026-11-26 08:19 | 15.59 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Logger/ | 2026-11-26 08:19 | 2.79 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Node/ | 2026-11-26 08:19 | 21.85 KB | 76129f60960:kunden | dxwrx-rx-r | |
| SourceMap/ | 2026-11-26 08:19 | 19.05 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Util/ | 2026-11-26 08:19 | 1.36 KB | 76129f60960:kunden | dxwrx-rx-r | |
| Block.php | 2026-11-26 08:19 | 887 B | 76129f60960:kunden | -xw-x--x-- | |
| Cache.php | 2026-11-26 08:19 | 6.68 KB | 76129f60960:kunden | -xw-x--x-- | |
| Colors.php | 2026-11-26 08:19 | 7.63 KB | 76129f60960:kunden | -xw-x--x-- | |
| CompilationResult.php | 2026-11-26 08:19 | 1.11 KB | 76129f60960:kunden | -xw-x--x-- | |
| Compiler.php | 2026-11-26 08:19 | 308.14 KB | 76129f60960:kunden | -xw-x--x-- | |
| Formatter.php | 2026-11-26 08:19 | 8.55 KB | 76129f60960:kunden | -xw-x--x-- | |
| Node.php | 2026-11-26 08:19 | 543 B | 76129f60960:kunden | -xw-x--x-- | |
| OutputStyle.php | 2026-11-26 08:19 | 1.49 KB | 76129f60960:kunden | -xw-x--x-- | |
| Parser.php | 2026-11-26 08:19 | 113.67 KB | 76129f60960:kunden | -xw-x--x-- | |
| Type.php | 2026-11-26 08:19 | 3.41 KB | 76129f60960:kunden | -xw-x--x-- | |
| Util.php | 2026-11-26 08:19 | 5.02 KB | 76129f60960:kunden | -xw-x--x-- | |
| ValueConverter.php | 2026-11-26 08:19 | 2.28 KB | 76129f60960:kunden | -xw-x--x-- | |
| Version.php | 2026-11-26 08:19 | 317 B | 76129f60960:kunden | -xw-x--x-- | |
| Warn.php | 2026-11-26 08:19 | 1.94 KB | 76129f60960:kunden | -xw-x--x-- | |