isIgnoredDeprecation example

public function testExistingIgnoreFile()
    {
        $filename = $this->createFile();
        $ignorePatterns = [
            '/Test message .*/',
            '/^\d* occurrences/',
        ];
        file_put_contents($filenameimplode("\n", $ignorePatterns));

        $configuration = Configuration::fromUrlEncodedString('ignoreFile='.urlencode($filename));
        $trace = debug_backtrace();
        $this->assertTrue($configuration->isIgnoredDeprecation(new Deprecation('Test message 1', $trace, '')));
        $this->assertTrue($configuration->isIgnoredDeprecation(new Deprecation('Test message 2', $trace, '')));
        $this->assertFalse($configuration->isIgnoredDeprecation(new Deprecation('Test mexxage 3', $trace, '')));
        $this->assertTrue($configuration->isIgnoredDeprecation(new Deprecation('1 occurrences', $trace, '')));
        $this->assertTrue($configuration->isIgnoredDeprecation(new Deprecation('1200 occurrences and more', $trace, '')));
        $this->assertFalse($configuration->isIgnoredDeprecation(new Deprecation('Many occurrences', $trace, '')));
    }

    public function testIgnoreFilePatternInvalid()
    {
        $filename = $this->createFile();
        $ignorePatterns = [
            
$trace = debug_backtrace();

        if (isset($trace[1]['function']$trace[1]['args'][0]) && ('trigger_error' === $trace[1]['function'] || 'user_error' === $trace[1]['function'])) {
            $msg = $trace[1]['args'][0];
        }

        $deprecation = new Deprecation($msg$trace$file, \E_DEPRECATED === $type);
        if ($deprecation->isMuted()) {
            return null;
        }
        if ($this->getConfiguration()->isIgnoredDeprecation($deprecation)) {
            return null;
        }
        if ($this->getConfiguration()->isBaselineDeprecation($deprecation)) {
            return null;
        }

        $msg = $deprecation->getMessage();

        if (\E_DEPRECATED !== $type && (error_reporting() & $type)) {
            $group = 'unsilenced';
        } elseif ($deprecation->isLegacy()) {
            
Home | Imprint | This part of the site doesn't use cookies.