Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('maker');
Expand Down
3 changes: 0 additions & 3 deletions src/DependencyInjection/MakerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ class MakerExtension extends Extension
*/
private const TEST_MAKER_DEPRECATION_MESSAGE = 'The "%service_id%" service is deprecated, use "maker.maker.make_test" instead.';

/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/EntityRegenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ private function getMappedFieldsInEntity(ClassMetadata $classMetadata): array
$targetFields = array_diff($targetFields, $traitProperties);

// exclude inherited properties
$targetFields = array_filter($targetFields, static fn ($field) => $classReflection->hasProperty($field) &&
$classReflection->getProperty($field)->getDeclaringClass()->getName() === $classReflection->getName());
$targetFields = array_filter($targetFields, static fn ($field) => $classReflection->hasProperty($field)
&& $classReflection->getProperty($field)->getDeclaringClass()->getName() === $classReflection->getName());
}

return $targetFields;
Expand Down
3 changes: 0 additions & 3 deletions src/InputAwareMakerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@
*/
interface InputAwareMakerInterface extends MakerInterface
{
/**
* {@inheritdoc}
*/
public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null);
}
12 changes: 6 additions & 6 deletions src/Maker/MakeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
$input->setArgument('name', $entityClassName);

if (
!$input->getOption('api-resource') &&
(class_exists(ApiResource::class) || class_exists(LegacyApiResource::class)) &&
!class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
!$input->getOption('api-resource')
&& (class_exists(ApiResource::class) || class_exists(LegacyApiResource::class))
&& !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
) {
$description = $command->getDefinition()->getOption('api-resource')->getDescription();
$question = new ConfirmationQuestion($description, false);
Expand All @@ -146,9 +146,9 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
}

if (
!$input->getOption('broadcast') &&
class_exists(Broadcast::class) &&
!class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
!$input->getOption('broadcast')
&& class_exists(Broadcast::class)
&& !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
) {
$description = $command->getDefinition()->getOption('broadcast')->getDescription();
$question = new ConfirmationQuestion($description, false);
Expand Down
4 changes: 2 additions & 2 deletions src/Util/ClassSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function addEmbeddedEntity(string $propertyName, string $className): void
// look for "$this->propertyName = "

$constructorString = $this->printer->prettyPrint([$this->getConstructorNode()]);
if (false !== strpos($constructorString, sprintf('$this->%s = ', $propertyName))) {
if (str_contains($constructorString, sprintf('$this->%s = ', $propertyName))) {
$addEmbedded = false;
}
}
Expand Down Expand Up @@ -834,7 +834,7 @@ public function addUseStatementIfNecessary(string $class): string
* @param array $options The named arguments for the attribute ($key = argument name, $value = argument value)
* @param ?string $attributePrefix If a prefix is provided, the node is built using the prefix. E.g. #[ORM\Column()]
*/
public function buildAttributeNode(string $attributeClass, array $options, ?string $attributePrefix = null): Node\Attribute
public function buildAttributeNode(string $attributeClass, array $options, string $attributePrefix = null): Node\Attribute
{
$options = $this->sortOptionsByClassConstructorParameters($options, $attributeClass);

Expand Down
15 changes: 5 additions & 10 deletions src/Util/YamlSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,6 @@ private function updateData(array $newData)
*
* The position should be set *right* where this new key
* should be inserted.
*
* @param mixed $key
* @param mixed $value
*/
private function addNewKeyToYaml($key, $value)
{
Expand Down Expand Up @@ -470,8 +467,8 @@ private function changeValueInYaml($value)
// In case of multiline, $value is converted as plain string like "Foo\nBar"
// We need to keep it "as is"
$newYamlValue = $isMultilineValue ? rtrim($value, "\n") : $this->convertToYaml($value);
if ((!\is_array($originalVal) && \is_array($value)) ||
($this->isMultilineString($originalVal) && $this->isMultilineString($value))
if ((!\is_array($originalVal) && \is_array($value))
|| ($this->isMultilineString($originalVal) && $this->isMultilineString($value))
) {
// we're converting from a scalar to a (multiline) array
// this means we need to break onto the next line
Expand Down Expand Up @@ -803,8 +800,6 @@ private function removeKeyAtCurrentPath(array $data): array
* This could fail if the currentPath is for new data.
*
* @param int $limitLevels If set to 1, the data 1 level up will be returned
*
* @return mixed
*/
private function getCurrentData(int $limitLevels = 0)
{
Expand Down Expand Up @@ -923,7 +918,7 @@ private function advanceCurrentPosition(int $newPosition)
return;
}

if (false !== strpos($advancedContent, "\n")) {
if (str_contains($advancedContent, "\n")) {
$lines = explode("\n", $advancedContent);
if (!empty($lines)) {
$lastLine = $lines[\count($lines) - 1];
Expand Down Expand Up @@ -1130,7 +1125,7 @@ private function removeMetadataKeys(array $data)
unset($data[$key]);
}

if (null !== $val && 0 === strpos($val, self::COMMENT_PLACEHOLDER_VALUE)) {
if (null !== $val && str_starts_with($val, self::COMMENT_PLACEHOLDER_VALUE)) {
unset($data[$key]);
}
}
Expand Down Expand Up @@ -1334,6 +1329,6 @@ private function findPositionOfMultilineCharInLine(int $position): ?int

private function isMultilineString($value): bool
{
return \is_string($value) && false !== strpos($value, "\n");
return \is_string($value) && str_contains($value, "\n");
}
}
4 changes: 2 additions & 2 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static function validatePropertyName(string $name): string
public static function validateDoctrineFieldName(string $name, ManagerRegistry|LegacyManagerRegistry $registry): string
{
if (!$registry instanceof ManagerRegistry && !$registry instanceof LegacyManagerRegistry) {
throw new \InvalidArgumentException(sprintf('Argument 2 to %s::validateDoctrineFieldName must be an instance of %s, %s passed.', __CLASS__, ManagerRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
throw new \InvalidArgumentException(sprintf('Argument 2 to %s::validateDoctrineFieldName must be an instance of %s, %s passed.', __CLASS__, ManagerRegistry::class, \is_object($registry) ? $registry::class : \gettype($registry)));
}

// check reserved words
Expand All @@ -181,7 +181,7 @@ public static function validateEmailAddress(?string $email): string
return $email;
}

public static function existsOrNull(?string $className = null, array $entities = []): ?string
public static function existsOrNull(string $className = null, array $entities = []): ?string
{
if (null !== $className) {
self::validateClassName($className);
Expand Down
3 changes: 0 additions & 3 deletions tools/twigcs/src/MakerTwigRuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public function __construct(int $twigMajorVersion)
$this->twigMajorVersion = $twigMajorVersion;
}

/**
* {@inheritdoc}
*/
public function getRules(): array
{
$configurator = new RulesetConfigurator();
Expand Down