Skip to content

type-checkfixable

Check that type checks use three equal signs

Examples

  • Examples of correct code for this rule using default options

Binary expressions are using strict equality

php
<?php
if ($text === 'strict equality') {
	echo 'strict equality';
}

while($i === 1) {
	echo $i;
}

if ($i === 1) {
	echo $i;
}

if ($j !== 1) {
	echo $j;
}
  • Examples of incorrect code for this rule using default options

Binary expressions are not using strict equality

php
<?php
if ($text == 'strict equality') {
	echo 'strict equality';
}

while($i == 1) {
	echo $i;
}

if ($i == 1) {
	echo $i;
}

if ($j != 1) {
	echo $j;
}

Released under the MIT License.