[ Web Proxy ]
URL:
Viewing: https://docs.sonsofphp.com/components [Back]  [Original]

Assert | Sons of PHP
[] []
[] []
On this page
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Copy
On this page
  1. Components

Assert

Installation

Copy
composer require sonsofphp/assert

Usage

Copy
<?php

use SonsOfPHP\Component\Assert\Assert;
use SonsOfPHP\Component\Assert\InvalidArgumentException;

$data = 'test';
Assert::string($data);

// @throws InvalidArgumentException
Assert::int($data);

// Disable exceptions
Assert::disable();

// @return bool
Assert::int($data);

// Re-enable exceptions
Assert::enable();

Assertions

Magic Assertions

Last updated 1 year ago


Web Proxy Viewer  |  New URL  |  Original Page