issei-m
Repos
128
Followers
52
Following
37

The Symfony PHP framework

28147
8786

Ruby on Rails

52564
20228

Dependency Manager for PHP

27501
4151

The PHP Interpreter

C
35219
7163

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.

56836
22233

Events

Created at 1 week ago
Created at 1 week ago
started
Created at 3 weeks ago
started
Created at 3 weeks ago
opened issue
Build automation disabled

GitHub stops scheduled action if the code base hasn't been updated for a long period of time.

Created at 4 weeks ago
Created at 4 weeks ago
opened issue
Generics type template support

Bug Description

namespace Foo\Bar;

class MyClass
{
    /**
     * @template T
     * @param class-string<T> $modelClass
     * @return T
     */
    public function doSomething($modelClass)
    {
        // do something
    }
}

class DependencyTest
{
    public function test(): TargetExcludeOrBuildStep
    {
        return PHPat::rule()
            ->classes(Selector::namespace('Foo\Bar'))
            ->canOnlyDependOn()
            ->classes(
                Selector::namespace('Foo\Bar'),
            );
    }
}

error output:

  Line   src/Foo/Bar/MyClass.php                                                                     
 ------ -------------------------------------------------------------------------------------------------------------------------------- 
  10     Foo\Bar\MyClass should not depend on Foo\Bar\MyClass\T  
  10     Foo\Bar\MyClass should not depend on Foo\Bar\MyClass\T  

but Foo\Bar\MyClass\T is not an actual class, it's a generic type template. So no error should be reported.

Additional context

Created at 1 month ago
issue comment
[Serializer] Throw InvalidArgumentException if the data needed in the constructor doesn't belong to a backedEnum

@alli83 Thank you for clarification. Could you kindly open a pull-req for it?

Created at 1 month ago
Created at 1 month ago
started
Created at 1 month ago
Created at 1 month ago
issue comment
[Serializer] Throw InvalidArgumentException if the data needed in the constructor doesn't belong to a backedEnum

This pull-request doesn't seem to fix the targeted issue. AFAIK, the issue author (@elliotbruneel) would've wanted BackedEnumNormalizer to throw the PartialDenormalizationException in case a value not corresponding to the enum is attempted to be de-normalized.

While I understood the following argument of @alli83,

By just trying to collect the error we do not prevent the object from being instantiated. But this action is bound to fail because we already know that the data is not valid (checked by the BackedEnumNormalizer).

BackedEnumNormalizer can throw the PartialDenormalizationException as long as the DTO doesn't have the constructor but only state their properties like:

<?php

class SerializerIssueReport extends \PHPUnit\Framework\TestCase
{
    public function testCollectErrorsOnEnum()
    {
        $serializer = new Symfony\Component\Serializer\Serializer(
            [
                new \Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer(),
                new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer(),
            ],
            ['json' => new \Symfony\Component\Serializer\Encoder\JsonEncoder()]
        );

        $this->expectException(\Symfony\Component\Serializer\Exception\PartialDenormalizationException::class);

        $serializer->deserialize('{"test": "invalid"}', DummyObject2::class, 'json', [
            \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true
        ]);
    }
}

// Original one, for this class the pull-req is legit.
class DummyObject {
    public function __construct(public TestEnum $test) {}
}

// For this, PartialDenormalizationException can be thrown.
class DummyObject2 {
    public TestEnum $test;
}

enum TestEnum: String
{
    case Test = "test";
}

PartialDenormalizationException is preferred to InvalidArgumentException under the situation we can use it.

Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
Created at 1 month ago
issue comment
I would like an option (e.g. -c) to specify config.txt.

Hi, I maintain an unofficial container image of s3s here and keep the latest tag is up-to-date automatically as soon as changes are made in this repository. Please consider to use it. https://hub.docker.com/r/isseim/s3s

Created at 2 months ago
Created at 2 months ago
Created at 2 months ago
Created at 2 months ago
Created at 2 months ago
Created at 2 months ago
started
Created at 2 months ago