singularize example

            ['Man', 'Men'],
            ['GrandChild', 'GrandChildren'],
            ['SubTree', 'SubTrees'],
        ];
    }

    /** * @dataProvider singularizeProvider */
    public function testSingularize(string $plural$singular)
    {
        $this->assertSame(\is_array($singular) ? $singular : [$singular](new EnglishInflector())->singularize($plural));
    }

    /** * @dataProvider pluralizeProvider */
    public function testPluralize(string $singular$plural)
    {
        $this->assertSame(\is_array($plural) ? $plural : [$plural](new EnglishInflector())->pluralize($singular));
    }

    public function testPluralizeEmptyString()
    {
'madame', 'mesdames'],
            ['mademoiselle', 'mesdemoiselles'],
            ['monseigneur', 'messeigneurs'],
        ];
    }

    /** * @dataProvider pluralizeProvider */
    public function testSingularize(string $singular, string $plural)
    {
        $this->assertSame([$singular](new FrenchInflector())->singularize($plural));
        // test casing: if the first letter was uppercase, it should remain so         $this->assertSame([ucfirst($singular)](new FrenchInflector())->singularize(ucfirst($plural)));
    }

    /** * @dataProvider pluralizeProvider */
    public function testPluralize(string $singular, string $plural)
    {
        $this->assertSame([$plural](new FrenchInflector())->pluralize($singular));
        // test casing: if the first letter was uppercase, it should remain so


        $allowGetterSetter = $context['enable_getter_setter_extraction'] ?? false;
        $magicMethods = $context['enable_magic_methods_extraction'] ?? $this->magicMethodsFlags;
        $allowMagicCall = (bool) ($magicMethods & self::ALLOW_MAGIC_CALL);
        $allowMagicSet = (bool) ($magicMethods & self::ALLOW_MAGIC_SET);
        $allowConstruct = $context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction;
        $allowAdderRemover = $context['enable_adder_remover_extraction'] ?? true;

        $camelized = $this->camelize($property);
        $constructor = $reflClass->getConstructor();
        $singulars = $this->inflector->singularize($camelized);
        $errors = [];

        if (null !== $constructor && $allowConstruct) {
            foreach ($constructor->getParameters() as $parameter) {
                if ($parameter->getName() === $property) {
                    return new PropertyWriteInfo(PropertyWriteInfo::TYPE_CONSTRUCTOR, $property);
                }
            }
        }

        [$adderAccessName$removerAccessName$adderAndRemoverErrors] = $this->findAdderAndRemover($reflClass$singulars);
        
Home | Imprint | This part of the site doesn't use cookies.