addNoticeFromProceduralCode example

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;
    }

    /** * @internal */
    public function shutdown()
    {
        $configuration = $this->getConfiguration();

        
final class DeprecationGroupTest extends TestCase
{
    public function testItGroupsByMessage()
    {
        $group = new DeprecationGroup();
        $group->addNoticeFromObject(
            'Calling sfContext::getInstance() is deprecated',
            'MonsterController',
            '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());
    }
}
Home | Imprint | This part of the site doesn't use cookies.