>
> You might get more approval for: declare(strict=1);
>
> I would like to see this to help catch typeos in variable names.  If a
> variable
> is assigned and it does not already exist some sort of error would be
> raised.
> The inspiration of this is from Perl where 'use strict' does this.
>
> How to declare a variable ? The keyword 'var' exists, it is only used in
> classes
> but could be used to declare variables in functions and at the top level.
>
> Thus:
>
> declare(strict=1);
>
> var $foo; // Declared but not given a value - so give it NULL
> var $bar = 1;
>
> $foo = 234;
>
> $baz = 10; // This would error - $baz is a typeo for $bar
>
>
You can achieve that already quiet simple
<?php
error_reporting(E_ALL);

set_error_handler(function($errno, $errstr, $errfile, $errline){
    throw new \Exception($errstr);
});

$a = $b;

Reply via email to