Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
remove quotes from assert assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Robinson committed Jan 5, 2018
1 parent 26accd7 commit 5ded5ac
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
26 changes: 25 additions & 1 deletion .idea/php-assertion.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/Variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final public static function allMatch($var, $pattern) {
* @return bool
*/
final public static function applyCallback($var, callable $callback, $pass_delta = true) {
assert('is_bool($pass_delta)', 'Third argument must be of type bool.');
assert(is_bool($pass_delta), 'Third argument must be of type bool.');

if (is_iterable($var)) {
/** @noinspection ForeachSourceInspection */
Expand All @@ -80,8 +80,8 @@ final public static function applyCallback($var, callable $callback, $pass_delta
* @return bool
*/
final public static function contains($var, $needle, $case_sensitive = false) {
assert('is_string($needle) && $needle !== \'\'', 'second argument must be of type string and have content');
assert('is_bool($case_sensitive)', 'third argument must be of type bool');
assert(is_string($needle) && $needle !== '', 'second argument must be of type string and have content');
assert(is_bool($case_sensitive), 'third argument must be of type bool');

if (!is_bool($var) && (is_scalar($var) || method_exists($var, '__toString'))) {
if ($case_sensitive) {
Expand Down Expand Up @@ -452,8 +452,8 @@ final public static function hasTraversablesOnly($var) {
* @return bool
*/
final public static function isInstanceOf($var, $class, $allow_string = true) {
assert('is_object($class) || is_string($class)', 'second argument must be of type object or string');
assert('is_bool($allow_string)', 'third argument must be of type bool');
assert(is_object($class) || is_string($class), 'second argument must be of type object or string');
assert(is_bool($allow_string), 'third argument must be of type bool');

if (is_object($class)) {
$class = get_class($class);
Expand Down Expand Up @@ -505,7 +505,7 @@ final public static function isPositiveNaturalNumber($var) {
* @return bool
*/
final public static function isRealNumber($var, $scale = self::BC_MATH_DEFAULT_SCALE) {
assert('Variable::isScalarNaturalNumber($scale)', 'BC Math scale must be a natural number (ℕ₀) of type int');
assert(Variable::isScalarNaturalNumber($scale), 'BC Math scale must be a natural number (ℕ₀) of type int');

if (is_numeric($var)) {
if (filter_var($var, FILTER_VALIDATE_FLOAT) !== false) {
Expand Down Expand Up @@ -631,8 +631,8 @@ final public static function isStringableWithContent($var) {
* @return bool
*/
final public static function isSubclassOf($var, $class, $allow_string = true) {
assert('is_object($class) || (is_string($class) && class_exists($class))', 'second argument must be an object or the name of an existing class');
assert('is_bool($allow_string)', 'third argument must be of type bool');
assert(is_object($class) || (is_string($class) && class_exists($class)), 'second argument must be an object or the name of an existing class');
assert(is_bool($allow_string), 'third argument must be of type bool');

$str = \is_string($var);

Expand Down Expand Up @@ -669,7 +669,7 @@ final public static function isTraversable($var) {
* @return bool
*/
final public static function matches($var, $pattern) {
assert('is_string($pattern) && $pattern !== \'\'', 'second argument must be of type string and have content');
assert(is_string($pattern) && $pattern !== '', 'second argument must be of type string and have content');

if (!is_bool($var) && (is_scalar($var) || method_exists($var, '__toString'))) {
return preg_match($pattern, $var) === 1;
Expand Down

0 comments on commit 5ded5ac

Please sign in to comment.