Your project must not contain invalid function or method calls 13

More information: https://insight.symfony.com/what-we-analyse/php.invalid_call

  1. */
  2. protected function getScalarValue($value)
  3. {
  4. $scalarValue = null;
  5. if (0 === stripos((string) $value, '::')) {
  6. $scalarValue = substr($value, 2);
    Parameter #1 $string of function substr expects string, mixed given.
    Last edited by Mikael DELSOL
  7. } elseif (false !== stripos((string) $value, '::') || false !== stripos((string) $value, 'new ') || false !== stripos((string) $value, '(') || false !== stripos((string) $value, ')')) {
  8. $scalarValue = $value;
  9. }
  10. return $scalarValue;
  1. class PhpAnnotationBlock extends AbstractElement
  2. {
  3. public function __construct(array $annotations = [])
  4. {
  5. parent::__construct('_');
  6. $this->setAnnotations($annotations);
    Parameter #1 $annotations of method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::setAnnotations() expects array<array|string|WsdlToPhp\PhpGenerator\Element\PhpAnnotation>, array given.
    Last edited by Mikael DELSOL
  7. }
  8. /**
  9. * @param mixed $child
  10. *
  1. if (!$this->childIsValid($child)) {
  2. parent::addChild($child);
  3. return $this;
  4. }
  5. $this->children[] = static::transformAnnotation($child);
    Parameter #1 $annotation of static method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::transformAnnotation() expects array|string|WsdlToPhp\PhpGenerator\Element\PhpAnnotation, mixed given.
    Last edited by Mikael DELSOL
  6. return $this;
  7. }
  8. public function getPhpDeclaration(): string
  1. public function __construct(string $name, bool $abstract = false, $extends = null, array $interfaces = [])
  2. {
  3. parent::__construct($name);
  4. $this
  5. ->setAbstract($abstract)
  6. ->setExtends($extends)
    Parameter #1 $extends of method WsdlToPhp\PhpGenerator\Element\PhpClass::setExtends() expects string|WsdlToPhp\PhpGenerator\Element\PhpClass|null, mixed given.
    Last edited by Mikaël DELSOL
  7. ->setInterfaces($interfaces)
  8. ;
  9. }
  10. public function setAbstract(bool $abstract): self
  1. {
  2. parent::__construct($name);
  3. $this
  4. ->setAbstract($abstract)
  5. ->setExtends($extends)
  6. ->setInterfaces($interfaces)
    Parameter #1 $interfaces of method WsdlToPhp\PhpGenerator\Element\PhpClass::setInterfaces() expects array<string|WsdlToPhp\PhpGenerator\Element\PhpClass>, array given.
    Last edited by Mikaël DELSOL
  7. ;
  8. }
  9. public function setAbstract(bool $abstract): self
  10. {
  1. return $this->interfaces;
  2. }
  3. public function getPhpDeclaration(): string
  4. {
  5. return trim(sprintf('%s%s %s%s%s', $this->getPhpAbstract(), static::PHP_DECLARATION, $this->getPhpName(), $this->getPhpExtends(), $this->getPhpInterfaces()));
    Parameter #3 ...$values of function sprintf expects bool|float|int|string|null, mixed given.
    Last edited by Mikael DELSOL
  6. }
  7. /**
  8. * defines authorized children element types.
  9. *
  1. protected function getPhpExtends(): string
  2. {
  3. $extends = $this->getExtends();
  4. return empty($extends) ? '' : sprintf(' %s %s', static::PHP_EXTENDS_KEYWORD, $extends instanceof PhpClass ? $extends->getName() : $extends);
    Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, mixed given.
    Last edited by Mikael DELSOL
  5. }
  6. protected function getPhpInterfaces(): string
  7. {
  8. $interfaces = [];
  1. $interfaces = [];
  2. foreach ($this->getInterfaces() as $interface) {
  3. $interfaces[] = $this->getPhpInterface($interface);
  4. }
  5. return empty($interfaces) ? '' : sprintf(' %s%s', static::PHP_IMPLEMENTS_KEYWORD, implode(',', $interfaces));
    Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, mixed given.
    Last edited by Mikaël DELSOL
  6. }
  7. /**
  8. * @param PhpClass|string $interface
  9. */
  1. private $value;
  2. public function __construct(string $name, $value = null)
  3. {
  4. parent::__construct($name);
  5. $this->setValue($value);
    Parameter #1 $value of method WsdlToPhp\PhpGenerator\Element\PhpDeclare::setValue() expects int|string, mixed given.
    Last edited by Mikaël DELSOL
  6. }
  7. /**
  8. * @param int|string $value
  9. */
  1. public static function parametersAreValid(array $parameters): bool
  2. {
  3. $valid = true;
  4. foreach ($parameters as $parameter) {
  5. $valid &= static::parameterIsValid($parameter);
    Parameter #1 $parameter of static method WsdlToPhp\PhpGenerator\Element\PhpFunction::parameterIsValid() expects array|string|WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter, mixed given.
    Last edited by Mikaël DELSOL
  6. }
  7. return (bool) $valid;
  8. }
  1. {
  2. $parameters = $this->getParameters();
  3. $phpParameters = [];
  4. if (is_array($parameters) && !empty($parameters)) {
  5. foreach ($parameters as $parameter) {
  6. $phpParameters[] = $parameter->getPhpDeclaration();
    Cannot call method getPhpDeclaration() on string|WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter.
    Last edited by Mikaël DELSOL
  7. }
  8. }
  9. return implode(', ', $phpParameters);
  10. }
  1. use TypeHintedElementTrait;
  2. public function __construct(string $name, $value = null, $type = null)
  3. {
  4. parent::__construct($name, $value);
  5. $this->setType($type);
    Parameter #1 $type of method WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter::setType() expects string|WsdlToPhp\PhpGenerator\Element\PhpClass, mixed given.
    Last edited by Mikael DELSOL
  6. }
  7. public function getPhpDeclaration(): string
  8. {
  9. return sprintf('%s%s', $this->getPhpType(), parent::getPhpDeclaration());
  1. use TypeHintedElementTrait;
  2. public function __construct(string $name, $value = null, string $access = self::ACCESS_PUBLIC, $type = null)
  3. {
  4. parent::__construct($name, $value);
  5. $this->setType($type);
    Parameter #1 $type of method WsdlToPhp\PhpGenerator\Element\PhpProperty::setType() expects string|WsdlToPhp\PhpGenerator\Element\PhpClass, mixed given.
    Last edited by Mikaël DELSOL
  6. $this->setAccess($access);
  7. }
  8. public function getPhpDeclaration(): string
  9. {

Your project should not use invalid return types 2

More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint

  1. abstract public function getPhpName(): string;
  2. protected function getFinalValue(): ?string
  3. {
  4. if (is_scalar($this->getValue()) && !is_null($scalarValue = $this->getScalarValue($this->getValue()))) {
  5. return $scalarValue;
    Method WsdlToPhp\PhpGenerator\Element\PhpVariable::getFinalValue() should return string|null but returns mixed.
    Last edited by Mikael DELSOL
  6. }
  7. if (is_null($this->getValue())) {
  8. return 'null';
  9. }
  1. abstract public function getPhpName(): string;
  2. protected function getFinalValue(): ?string
  3. {
  4. if (is_scalar($this->getValue()) && !is_null($scalarValue = $this->getScalarValue($this->getValue()))) {
  5. return $scalarValue;
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::getFinalValue() should return string|null but returns mixed.
    Last edited by Mikael DELSOL
  6. }
  7. if (is_null($this->getValue())) {
  8. return 'null';
  9. }

Your project should not use invalid parameter and return typehints 48

More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint

  1. /**
  2. * @var mixed
  3. */
  4. protected $value;
  5. public function setValue($value): AbstractElement
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::setValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. if (!$this->getAcceptNonScalarValue() && !is_scalar($value) && !is_null($value)) {
  8. throw new \InvalidArgumentException(sprintf('Value of type "%s" is not a valid scalar value for %s object', gettype($value), $this->getCalledClass()));
  9. }
  10. $this->value = $value;
  1. /**
  2. * @var mixed
  3. */
  4. protected $value;
  5. public function setValue($value): AbstractElement
    Method WsdlToPhp\PhpGenerator\Element\PhpVariable::setValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. if (!$this->getAcceptNonScalarValue() && !is_scalar($value) && !is_null($value)) {
  8. throw new \InvalidArgumentException(sprintf('Value of type "%s" is not a valid scalar value for %s object', gettype($value), $this->getCalledClass()));
  9. }
  10. $this->value = $value;
  1. }
  2. return $scalarValue;
  3. }
  4. protected function getAnyValue($value): string
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::getAnyValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. if (is_array($value)) {
  7. $exportedValue = empty($value) ? '[]' : implode("\n", array_map(fn ($line): string => 'array (' === $line ? '[' : (')' === $line ? ']' : $line), explode("\n", var_export($value, true))));
  8. } else {
  9. $exportedValue = var_export($value, true);
  1. }
  2. return $scalarValue;
  3. }
  4. protected function getAnyValue($value): string
    Method WsdlToPhp\PhpGenerator\Element\PhpVariable::getAnyValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. if (is_array($value)) {
  7. $exportedValue = empty($value) ? '[]' : implode("\n", array_map(fn ($line): string => 'array (' === $line ? '[' : (')' === $line ? ']' : $line), explode("\n", var_export($value, true))));
  8. } else {
  9. $exportedValue = var_export($value, true);
  1. namespace WsdlToPhp\PhpGenerator\Element;
  2. class PhpAnnotationBlock extends AbstractElement
  3. {
  4. public function __construct(array $annotations = [])
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::__construct() has parameter $annotations with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct('_');
  7. $this->setAnnotations($annotations);
  8. }
  1. /**
  2. * @param array[]|PhpAnnotation[]|string[] $annotations
  3. *
  4. * @throws \InvalidArgumentException
  5. */
  6. protected function setAnnotations(array $annotations): self
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::setAnnotations() has parameter $annotations with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  7. {
  8. if (!static::annotationsAreValid($annotations)) {
  9. throw new \InvalidArgumentException('Annotations are not valid');
  10. }
  11. $this->children = static::transformAnnotations($annotations);
  1. /**
  2. * @param array[]|PhpAnnotation[]|string[] $annotations
  3. *
  4. * @return PhpAnnotation[]
  5. */
  6. protected static function transformAnnotations(array $annotations): array
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::transformAnnotations() has parameter $annotations with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  7. {
  8. $finalAnnotations = [];
  9. foreach ($annotations as $annotation) {
  10. $finalAnnotations[] = static::transformAnnotation($annotation);
  11. }
  1. /**
  2. * @param array|PhpAnnotation|string $annotation
  3. *
  4. * @throws \InvalidArgumentException
  5. */
  6. protected static function transformAnnotation($annotation): PhpAnnotation
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::transformAnnotation() has parameter $annotation with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  7. {
  8. if ($annotation instanceof PhpAnnotation) {
  9. return $annotation;
  10. }
  11. if (is_string($annotation)) {
  1. }
  2. /**
  3. * @param array[]|PhpAnnotation[]|string[] $annotations
  4. */
  5. protected static function annotationsAreValid(array $annotations): bool
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::annotationsAreValid() has parameter $annotations with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. $valid = true;
  8. foreach ($annotations as $annotation) {
  9. $valid &= static::annotationIsValid($annotation);
  10. }
  1. }
  2. /**
  3. * @param array|PhpAnnotation|string $annotation
  4. */
  5. protected static function annotationIsValid($annotation): bool
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotationBlock::annotationIsValid() has parameter $annotation with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. return static::stringIsValid($annotation, false) || (is_array($annotation) && array_key_exists('content', $annotation)) || $annotation instanceof PhpAnnotation;
  8. }
  9. }
  1. /**
  2. * @var PhpClass[]|string[]
  3. */
  4. protected array $interfaces;
  5. public function __construct(string $name, bool $abstract = false, $extends = null, array $interfaces = [])
    Method WsdlToPhp\PhpGenerator\Element\PhpClass::__construct() has parameter $extends with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. parent::__construct($name);
  8. $this
  9. ->setAbstract($abstract)
  10. ->setExtends($extends)
  1. /**
  2. * @var PhpClass[]|string[]
  3. */
  4. protected array $interfaces;
  5. public function __construct(string $name, bool $abstract = false, $extends = null, array $interfaces = [])
    Method WsdlToPhp\PhpGenerator\Element\PhpClass::__construct() has parameter $interfaces with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. parent::__construct($name);
  8. $this
  9. ->setAbstract($abstract)
  10. ->setExtends($extends)
  1. /**
  2. * @var int|string
  3. */
  4. private $value;
  5. public function __construct(string $name, $value = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpDeclare::__construct() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. parent::__construct($name);
  8. $this->setValue($value);
  9. }
  1. }
  2. return 0 === count($strings) ? '' : sprintf(self::STATEMENT, implode(', ', $strings));
  3. }
  4. public function addChild($child): AbstractElement
    Method WsdlToPhp\PhpGenerator\Element\PhpDeclare::addChild() has parameter $child with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. /** @var AbstractElement $child */
  7. if ($this->childIsValid($child) && $child->getName() === $this->getName()) {
  8. throw new \InvalidArgumentException(sprintf('The current directive named %s can\'t contain a child of same directive name', $this->getName()));
  9. }
  1. */
  2. protected array $parameters;
  3. protected ?string $returnType;
  4. public function __construct(string $name, array $parameters = [], ?string $returnType = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::__construct() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct($name);
  7. $this
  8. ->setParameters($parameters)
  9. ->setReturnType($returnType)
  1. ->setParameters($parameters)
  2. ->setReturnType($returnType)
  3. ;
  4. }
  5. public function setParameters(array $parameters): self
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::setParameters() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. if (!static::parametersAreValid($parameters)) {
  8. throw new \InvalidArgumentException('Parameters are invalid');
  9. }
  1. $this->parameters = static::transformParameters($parameters);
  2. return $this;
  3. }
  4. public static function transformParameters(array $parameters): array
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::transformParameters() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. $finalParameters = [];
  7. foreach ($parameters as $parameter) {
  8. $finalParameters[] = static::transformParameter($parameter);
  9. }
  1. }
  2. return $finalParameters;
  3. }
  4. public static function transformParameter($parameter): PhpFunctionParameter
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::transformParameter() has parameter $parameter with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. if ($parameter instanceof PhpFunctionParameter) {
  7. return $parameter;
  8. }
  9. if (is_array($parameter)) {
  1. }
  2. return new PhpFunctionParameter($parameter, PhpFunctionParameter::NO_VALUE);
  3. }
  4. public static function parametersAreValid(array $parameters): bool
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::parametersAreValid() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. $valid = true;
  7. foreach ($parameters as $parameter) {
  8. $valid &= static::parameterIsValid($parameter);
  9. }
  1. }
  2. /**
  3. * @param array|PhpFunctionParameter|string $parameter
  4. */
  5. public static function parameterIsValid($parameter): bool
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::parameterIsValid() has parameter $parameter with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. return static::stringIsValid($parameter) || (is_array($parameter) && array_key_exists('name', $parameter)) || $parameter instanceof PhpFunctionParameter;
  8. }
  9. /**
  1. class PhpFunctionParameter extends PhpVariable implements TypeHintedElementInterface
  2. {
  3. use TypeHintedElementTrait;
  4. public function __construct(string $name, $value = null, $type = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter::__construct() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct($name, $value);
  7. $this->setType($type);
  8. }
  1. class PhpFunctionParameter extends PhpVariable implements TypeHintedElementInterface
  2. {
  3. use TypeHintedElementTrait;
  4. public function __construct(string $name, $value = null, $type = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter::__construct() has parameter $type with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct($name, $value);
  7. $this->setType($type);
  8. }
  1. public function endsWithSemicolon(): bool
  2. {
  3. return false;
  4. }
  5. protected function getAnyValue($value): string
    Method WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter::getAnyValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. if (is_array($value)) {
  8. return str_replace([self::BREAK_LINE_CHAR, ' '], '', parent::getAnyValue($value));
  9. }
  1. class PhpProperty extends PhpVariable implements AccessRestrictedElementInterface, TypeHintedElementInterface
  2. {
  3. use AccessRestrictedElementTrait;
  4. use TypeHintedElementTrait;
  5. public function __construct(string $name, $value = null, string $access = self::ACCESS_PUBLIC, $type = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpProperty::__construct() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. parent::__construct($name, $value);
  8. $this->setType($type);
  9. $this->setAccess($access);
  10. }
  1. class PhpProperty extends PhpVariable implements AccessRestrictedElementInterface, TypeHintedElementInterface
  2. {
  3. use AccessRestrictedElementTrait;
  4. use TypeHintedElementTrait;
  5. public function __construct(string $name, $value = null, string $access = self::ACCESS_PUBLIC, $type = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpProperty::__construct() has parameter $type with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. parent::__construct($name, $value);
  8. $this->setType($type);
  9. $this->setAccess($access);
  10. }
  1. use WsdlToPhp\PhpGenerator\Element\PhpMethod as PhpMethodElement;
  2. use WsdlToPhp\PhpGenerator\Element\PhpProperty as PhpPropertyElement;
  3. class PhpClass extends AbstractComponent
  4. {
  5. public function __construct(string $name, bool $abstract = false, ?string $extends = null, array $interfaces = [])
    Method WsdlToPhp\PhpGenerator\Component\PhpClass::__construct() has parameter $interfaces with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. $this->setMainElement(new PhpClassElement($name, $abstract, $extends, $interfaces));
  8. }
  9. public function addMethodElement(PhpMethodElement $method): self
  1. $this->mainElement->addChild($method);
  2. return $this;
  3. }
  4. public function addMethod(string $name, array $parameters = [], ?string $returnType = null, string $access = PhpMethodElement::ACCESS_PUBLIC, bool $abstract = false, bool $static = false, bool $final = false, bool $hasBody = true): self
    Method WsdlToPhp\PhpGenerator\Component\PhpClass::addMethod() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addMethodElement(new PhpMethodElement($name, $parameters, $returnType, $access, $abstract, $static, $final, $hasBody));
  7. }
  8. public function addPropertyElement(PhpPropertyElement $property): self
  1. $this->mainElement->addChild($property);
  2. return $this;
  3. }
  4. public function addProperty(string $name, $value = null, string $access = PhpPropertyElement::ACCESS_PUBLIC, $type = null): self
    Method WsdlToPhp\PhpGenerator\Component\PhpClass::addProperty() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addPropertyElement(new PhpPropertyElement($name, $value, $access, $type));
  7. }
  8. }
  1. $this->mainElement->addChild($property);
  2. return $this;
  3. }
  4. public function addProperty(string $name, $value = null, string $access = PhpPropertyElement::ACCESS_PUBLIC, $type = null): self
    Method WsdlToPhp\PhpGenerator\Component\PhpClass::addProperty() has parameter $type with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addPropertyElement(new PhpPropertyElement($name, $value, $access, $type));
  7. }
  8. }
  1. use WsdlToPhp\PhpGenerator\Element\PhpMethod as PhpMethodElement;
  2. use WsdlToPhp\PhpGenerator\Element\PhpProperty as PhpPropertyElement;
  3. class PhpInterface extends PhpClass
  4. {
  5. public function __construct(string $name, bool $abstract = false, ?string $extends = null, array $interfaces = [])
    Method WsdlToPhp\PhpGenerator\Component\PhpInterface::__construct() has parameter $interfaces with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. $this->setMainElement(new PhpInterfaceElement($name, $abstract, $extends, $interfaces));
  8. }
  9. public function addMethodElement(PhpMethodElement $method): self
  1. parent::addMethodElement($method);
  2. return $this;
  3. }
  4. public function addMethod(string $name, array $parameters = [], ?string $returnType = null, string $access = PhpMethodElement::ACCESS_PUBLIC, bool $abstract = false, bool $static = false, bool $final = false, bool $hasBody = true): self
    Method WsdlToPhp\PhpGenerator\Component\PhpInterface::addMethod() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addMethodElement(new PhpMethodElement($name, $parameters, $returnType, $access, $abstract, $static, $final, false));
  7. }
  8. public function addPropertyElement(PhpPropertyElement $property): self
  1. public function addPropertyElement(PhpPropertyElement $property): self
  2. {
  3. return $this;
  4. }
  5. public function addProperty(string $name, $value = null, string $access = PhpPropertyElement::ACCESS_PUBLIC, $type = null): self
    Method WsdlToPhp\PhpGenerator\Component\PhpInterface::addProperty() has parameter $type with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. return $this;
  8. }
  9. }
  1. public function addPropertyElement(PhpPropertyElement $property): self
  2. {
  3. return $this;
  4. }
  5. public function addProperty(string $name, $value = null, string $access = PhpPropertyElement::ACCESS_PUBLIC, $type = null): self
    Method WsdlToPhp\PhpGenerator\Component\PhpInterface::addProperty() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. return $this;
  8. }
  9. }
  1. }
  2. /**
  3. * @param array|PhpAnnotationBlockElement|string $annotations
  4. */
  5. public function addAnnotationBlock($annotations): self
    Method WsdlToPhp\PhpGenerator\Component\AbstractComponent::addAnnotationBlock() has parameter $annotations with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. return $this->addAnnotationBlockElement(new PhpAnnotationBlockElement(is_array($annotations) ? $annotations : [
  8. $annotations,
  9. ]));
  10. }
  1. $this->mainElement->addChild($variable);
  2. return $this;
  3. }
  4. public function addVariable(string $name, $value = null): self
    Method WsdlToPhp\PhpGenerator\Component\PhpFile::addVariable() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addVariableElement(new PhpVariableElement($name, $value));
  7. }
  8. public function addFunctionElement(PhpFunctionElement $function): self
  1. $this->mainElement->addChild($function);
  2. return $this;
  3. }
  4. public function addFunction(string $name, array $parameters = []): self
    Method WsdlToPhp\PhpGenerator\Component\PhpFile::addFunction() has parameter $parameters with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->addFunctionElement(new PhpFunctionElement($name, $parameters));
  7. }
  8. public function addUse(string $use, ?string $as = null, bool $last = false): self
  1. $this->mainElement->addChild(sprintf('%s%s', self::BREAK_LINE_CHAR, $phpDeclare->toString()));
  2. return $this;
  3. }
  4. public function setDeclare(string $name, $value): self
    Method WsdlToPhp\PhpGenerator\Component\PhpFile::setDeclare() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. return $this->setDeclareElement(new PhpDeclare($name, $value));
  7. }
  8. public function setNamespace(string $namespace): self
  1. }
  2. return 1 === preg_match($pattern, (string) $name);
  3. }
  4. public static function stringIsValid($string, bool $checkName = true, bool $allowBackslash = false): bool
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::stringIsValid() has parameter $string with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. return is_string($string) && !empty($string) && (!$checkName || static::nameIsValid($string, $allowBackslash));
  7. }
  8. public static function objectIsValid($object, ?string $checkClass = null): bool
  1. public static function stringIsValid($string, bool $checkName = true, bool $allowBackslash = false): bool
  2. {
  3. return is_string($string) && !empty($string) && (!$checkName || static::nameIsValid($string, $allowBackslash));
  4. }
  5. public static function objectIsValid($object, ?string $checkClass = null): bool
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::objectIsValid() has parameter $object with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. return is_object($object) && (is_null($checkClass) || get_class($object) === $checkClass);
  8. }
  9. public function toString(?int $indentation = null): string
  1. public function getPhpName(): string
  2. {
  3. return sprintf('%s', $this->getName());
  4. }
  5. public function addChild($child): self
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::addChild() has parameter $child with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. if (!$this->childIsValid($child)) {
  8. $types = $this->getChildrenTypes();
  9. if (empty($types)) {
  10. throw new \InvalidArgumentException('This element does not accept any child element');
  1. final public function getCalledClass(): string
  2. {
  3. return substr(static::class, strrpos(static::class, '\\') + 1);
  4. }
  5. protected function getChildContent($child, ?int $indentation = null): string
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::getChildContent() has parameter $child with no type specified.
    Last edited by Mikael DELSOL
  6. {
  7. $content = '';
  8. if (is_string($child)) {
  9. $content = $this->getIndentedString($child, $indentation);
  10. } elseif ($child instanceof AbstractElement) {
  1. }
  2. return $content;
  3. }
  4. protected function childIsValid($child): bool
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::childIsValid() has parameter $child with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. $valid = false;
  7. $authorizedTypes = $this->getChildrenTypes();
  8. if (!empty($authorizedTypes)) {
  9. foreach ($authorizedTypes as $authorizedType) {
  1. }
  2. return null;
  3. }
  4. private static function cleanArrayToString(array $array): array
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::cleanArrayToString() has parameter $array with no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. $newArray = [];
  7. foreach ($array as $line) {
  8. if (is_null($line)) {
  9. continue;
  1. /**
  2. * Use this constant as value to ensure element has not assigned value.
  3. */
  4. public const NO_VALUE = '##NO_VALUE##';
  5. public function setValue($value): AbstractElement;
    Method WsdlToPhp\PhpGenerator\Element\AssignedValueElementInterface::setValue() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  6. public function getValue();
  7. public function hasValue(): bool;
  1. use AccessRestrictedElementTrait;
  2. use AssignedValueElementTrait;
  3. protected ?PhpClass $class;
  4. public function __construct(string $name, $value = null, ?PhpClass $class = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::__construct() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct($name);
  7. $this->setValue($value);
  8. $this->setClass($class);
  9. }
  1. PhpMethod::class,
  2. PhpConstant::class,
  3. ];
  4. }
  5. public function addChild($child): AbstractElement
    Method WsdlToPhp\PhpGenerator\Element\PhpInterface::addChild() has parameter $child with no type specified.
    Last edited by Mikaël DELSOL
  6. {
  7. if ($child instanceof PhpMethod) {
  8. $child->setHasBody(false);
  9. }
  1. class PhpVariable extends AbstractElement implements AssignedValueElementInterface
  2. {
  3. use AssignedValueElementTrait;
  4. public function __construct(string $name, $value = null)
    Method WsdlToPhp\PhpGenerator\Element\PhpVariable::__construct() has parameter $value with no type specified.
    Last edited by Mikaël DELSOL
  5. {
  6. parent::__construct($name);
  7. $this->setValue($value);
  8. }
  1. self::TYPE_FLOAT,
  2. self::TYPE_OBJECT,
  3. self::TYPE_STRING,
  4. ];
  5. public function setType($type): AbstractElement;
    Method WsdlToPhp\PhpGenerator\Element\TypeHintedElementInterface::setType() has parameter $type with no type specified.
    Last edited by Mikaël DELSOL
  6. public function getType();
  7. public static function typeIsValid(?string $access): bool;
  8. }

Your project should use return types 9

More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint

  1. $this->value = $value;
  2. return $this;
  3. }
  4. public function getValue()
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::getValue() has no return type specified.
    Last edited by Mikael DELSOL
  5. {
  6. return $this->value;
  7. }
  8. public function hasValue(): bool
  1. $this->value = $value;
  2. return $this;
  3. }
  4. public function getValue()
    Method WsdlToPhp\PhpGenerator\Element\PhpVariable::getValue() has no return type specified.
    Last edited by Mikael DELSOL
  5. {
  6. return $this->value;
  7. }
  8. public function hasValue(): bool
  1. $this->parameters = static::transformParameters($parameters);
  2. return $this;
  3. }
  4. public static function transformParameters(array $parameters): array
    Method WsdlToPhp\PhpGenerator\Element\PhpFunction::transformParameters() return type has no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. $finalParameters = [];
  7. foreach ($parameters as $parameter) {
  8. $finalParameters[] = static::transformParameter($parameter);
  9. }
  1. }
  2. return null;
  3. }
  4. private static function cleanArrayToString(array $array): array
    Method WsdlToPhp\PhpGenerator\Element\AbstractElement::cleanArrayToString() return type has no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  5. {
  6. $newArray = [];
  7. foreach ($array as $line) {
  8. if (is_null($line)) {
  9. continue;
  1. */
  2. public const NO_VALUE = '##NO_VALUE##';
  3. public function setValue($value): AbstractElement;
  4. public function getValue();
    Method WsdlToPhp\PhpGenerator\Element\AssignedValueElementInterface::getValue() has no return type specified.
    Last edited by Mikaël DELSOL
  5. public function hasValue(): bool;
  6. public function getPhpValue(): ?string;
  1. /**
  2. * Always return null to avoid having a literal string instead of quoted string.
  3. *
  4. * @param mixed $value
  5. */
  6. protected function getScalarValue($value)
    Method WsdlToPhp\PhpGenerator\Element\PhpConstant::getScalarValue() has no return type specified.
    Last edited by Mikaël DELSOL
  7. {
  8. return null;
  9. }
  10. }
  1. self::TYPE_STRING,
  2. ];
  3. public function setType($type): AbstractElement;
  4. public function getType();
    Method WsdlToPhp\PhpGenerator\Element\TypeHintedElementInterface::getType() has no return type specified.
    Last edited by Mikaël DELSOL
  5. public static function typeIsValid(?string $access): bool;
  6. }
  1. public function toString(?int $indentation = null): string;
  2. /**
  3. * stores current indentation.
  4. */
  5. public function setIndentation(int $indentation);
    Method WsdlToPhp\PhpGenerator\Element\GenerateableInterface::setIndentation() has no return type specified.
    Last edited by Mikaël DELSOL
  6. /**
  7. * Returns current indentation.
  8. */
  9. public function getIndentation(): int;
  1. public function getMaxLength(): int
  2. {
  3. return $this->maxLength;
  4. }
  5. protected function getPhpContent(): array
    Method WsdlToPhp\PhpGenerator\Element\PhpAnnotation::getPhpContent() return type has no value type specified in iterable type array.
    Last edited by Mikaël DELSOL
  6. {
  7. $fullContent = trim(sprintf('%s %s', $this->getPhpName(), $this->getContent()));
  8. $content = [
  9. $fullContent,
  10. ];

Your project must not contain invalid instantiations 6

More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation

  1. }
  2. if (is_string($annotation)) {
  3. return new PhpAnnotation(PhpAnnotation::NO_NAME, $annotation);
  4. }
  5. if (is_array($annotation) && array_key_exists('content', $annotation)) {
  6. return new PhpAnnotation(array_key_exists('name', $annotation) ? $annotation['name'] : PhpAnnotation::NO_NAME, $annotation['content']);
    Parameter #1 $name of class WsdlToPhp\PhpGenerator\Element\PhpAnnotation constructor expects string, mixed given.
    Last edited by Mikael DELSOL
  7. }
  8. throw new \InvalidArgumentException(sprintf('Annotation parameter "%s" is invalid', gettype($annotation)));
  9. }
  1. }
  2. if (is_string($annotation)) {
  3. return new PhpAnnotation(PhpAnnotation::NO_NAME, $annotation);
  4. }
  5. if (is_array($annotation) && array_key_exists('content', $annotation)) {
  6. return new PhpAnnotation(array_key_exists('name', $annotation) ? $annotation['name'] : PhpAnnotation::NO_NAME, $annotation['content']);
    Parameter #2 $content of class WsdlToPhp\PhpGenerator\Element\PhpAnnotation constructor expects string, mixed given.
    Last edited by Mikael DELSOL
  7. }
  8. throw new \InvalidArgumentException(sprintf('Annotation parameter "%s" is invalid', gettype($annotation)));
  9. }
  1. {
  2. if ($parameter instanceof PhpFunctionParameter) {
  3. return $parameter;
  4. }
  5. if (is_array($parameter)) {
  6. return new PhpFunctionParameter($parameter['name'], array_key_exists('value', $parameter) ? $parameter['value'] : null, array_key_exists('type', $parameter) ? $parameter['type'] : null);
    Parameter #1 $name of class WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter constructor expects string, mixed given.
    Last edited by Mikael DELSOL
  7. }
  8. return new PhpFunctionParameter($parameter, PhpFunctionParameter::NO_VALUE);
  9. }
  1. }
  2. if (is_array($parameter)) {
  3. return new PhpFunctionParameter($parameter['name'], array_key_exists('value', $parameter) ? $parameter['value'] : null, array_key_exists('type', $parameter) ? $parameter['type'] : null);
  4. }
  5. return new PhpFunctionParameter($parameter, PhpFunctionParameter::NO_VALUE);
    Parameter #1 $name of class WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter constructor expects string, mixed given.
    Last edited by Mikael DELSOL
  6. }
  7. public static function parametersAreValid(array $parameters): bool
  8. {
  9. $valid = true;
  1. return $this;
  2. }
  3. public function addMethod(string $name, array $parameters = [], ?string $returnType = null, string $access = PhpMethodElement::ACCESS_PUBLIC, bool $abstract = false, bool $static = false, bool $final = false, bool $hasBody = true): self
  4. {
  5. return $this->addMethodElement(new PhpMethodElement($name, $parameters, $returnType, $access, $abstract, $static, $final, $hasBody));
    Parameter #2 $parameters of class WsdlToPhp\PhpGenerator\Element\PhpMethod constructor expects array<string|WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter>, array given.
    Last edited by Mikaël DELSOL
  6. }
  7. public function addPropertyElement(PhpPropertyElement $property): self
  8. {
  9. $this->mainElement->addChild($property);
  1. return $this;
  2. }
  3. public function addMethod(string $name, array $parameters = [], ?string $returnType = null, string $access = PhpMethodElement::ACCESS_PUBLIC, bool $abstract = false, bool $static = false, bool $final = false, bool $hasBody = true): self
  4. {
  5. return $this->addMethodElement(new PhpMethodElement($name, $parameters, $returnType, $access, $abstract, $static, $final, false));
    Parameter #2 $parameters of class WsdlToPhp\PhpGenerator\Element\PhpMethod constructor expects array<string|WsdlToPhp\PhpGenerator\Element\PhpFunctionParameter>, array given.
    Last edited by Mikaël DELSOL
  6. }
  7. public function addPropertyElement(PhpPropertyElement $property): self
  8. {
  9. return $this;

Your project gitignore file should not contain user-specific files

More information: https://insight.symfony.com/what-we-analyse/git.user_specific_ignored_file

in .gitignore, line 5
  1. vendor/
  2. composer.lock
  3. phpunit.xml
  4. .phpunit.result.cache
  5. .idea/
    .idea/ is user-specific and should not appear in a project .gitignore. Consider adding it to the user global .gitignore instead.
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Last edited by Tomáš Neumaier

Text files should end with a valid new line character.

More information: https://insight.symfony.com/what-we-analyse/missing_e_o_l

in Makefile, line 38
  1. up:
  2. $(DOCKER_COMPOSE) up -d
  3. update:
  4. $(DOCKER_EXEC_CONTAINER) $(PHP_VERSION) $(COMPOSER) update
  5. This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.
    Time to fix: about 15 minutes
    Read doc Open Issue Permalink Copy Prompt
    Collective