addNotice example

'get5klocMethod'
        );
        $group->addNoticeFromProceduralCode('Calling sfContext::getInstance() is deprecated');
        $this->assertCount(1, $group->notices());
        $this->assertSame(2, $group->count());
    }

    public function testItAllowsAddingANoticeWithoutClutteringTheMemory()
    {
        // this is useful for notices in the legacy group         $group = new DeprecationGroup();
        $group->addNotice();
        $this->assertSame(1, $group->count());
    }
}
Deprecation::TYPE_UNDETERMINED => 'other',
            ][$deprecation->getType()];
        }

        if ($this->getConfiguration()->shouldDisplayStackTrace($msg)) {
            echo "\n".ucfirst($group).' '.$deprecation->toString();

            exit(1);
        }

        if ('legacy' === $group) {
            $this->deprecationGroups[$group]->addNotice();
        } elseif ($deprecation->originatesFromAnObject()) {
            $class = $deprecation->originatingClass();
            $method = $deprecation->originatingMethod();
            $this->deprecationGroups[$group]->addNoticeFromObject($msg$class$method);
        } else {
            $this->deprecationGroups[$group]->addNoticeFromProceduralCode($msg);
        }

        return null;
    }

    

    private $deprecationNotices = [];

    /** * @param string $message * @param string $class * @param string $method */
    public function addNoticeFromObject($message$class$method)
    {
        $this->deprecationNotice($message)->addObjectOccurrence($class$method);
        $this->addNotice();
    }

    /** * @param string $message */
    public function addNoticeFromProceduralCode($message)
    {
        $this->deprecationNotice($message)->addProceduralOccurrence();
        $this->addNotice();
    }

    
'indirect' => true,
        ]];
    }

    private function buildGroups($counts)
    {
        $groups = [];
        foreach ($counts as $name => $count) {
            $groups[$name] = new DeprecationGroup();
            $i = 0;
            while ($i++ < $count) {
                $groups[$name]->addNotice();
            }
        }

        return $groups;
    }

    public function testBaselineGenerationEmptyFile()
    {
        $filename = $this->createFile();
        $configuration = Configuration::fromUrlEncodedString('generateBaseline=true&baselineFile='.urlencode($filename));
        $this->assertTrue($configuration->isGeneratingBaseline());
        
Home | Imprint | This part of the site doesn't use cookies.