PHP Classes

File: tests/test-classes/Weak.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Stern PHP Type Safety   tests/test-classes/Weak.php   Download  
File: tests/test-classes/Weak.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Stern PHP Type Safety
Make class function calls invoke strict versions
Author: By
Last change:
Date: 3 years ago
Size: 1,016 bytes
 

Contents

Class file image Download
<?php
/* declare is intentionally not included here */
namespace ParagonIE\SternTests;

use
ParagonIE\Stern\SternTrait;

/**
 * Class Weak
 * @package ParagonIE\SternTests
 *
 * @method bool weakBool(bool $isWeak = false)
 * @method string weakString(string $str = '')
 * @method float weakFloat(float $f)
 * @method int weakInt(int $int)
 */
class Weak
{
    use
SternTrait;

   
/**
     * @param bool $isWeak
     * @return bool
     */
   
protected function strictWeakBool(bool $isWeak = false): bool
   
{
        return
$isWeak;
    }

   
/**
     * @param string $str
     * @return string
     */
   
protected function strictWeakString(string $str = ''): string
   
{
        return \
str_rot13($str);
    }

   
/**
     * @param float $f
     * @return float
     */
   
protected function strictWeakFloat(float $f): float
   
{
        return
$f;
    }

   
/**
     * @param int $int
     * @return int
     */
   
protected function strictWeakInt(int $int): int
   
{
        return
$int + 1;
    }
}