Skip to content

Commit 16a8880

Browse files
committed
php-cs-fixer it up
1 parent 717ff56 commit 16a8880

File tree

9 files changed

+17
-34
lines changed

9 files changed

+17
-34
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
class Configuration implements ConfigurationInterface
1818
{
19-
/**
20-
* {@inheritdoc}
21-
*/
2219
public function getConfigTreeBuilder(): TreeBuilder
2320
{
2421
$treeBuilder = new TreeBuilder('maker');

src/DependencyInjection/MakerExtension.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class MakerExtension extends Extension
3131
*/
3232
private const TEST_MAKER_DEPRECATION_MESSAGE = 'The "%service_id%" service is deprecated, use "maker.maker.make_test" instead.';
3333

34-
/**
35-
* {@inheritdoc}
36-
*/
3734
public function load(array $configs, ContainerBuilder $container): void
3835
{
3936
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

src/Doctrine/EntityRegenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ private function getMappedFieldsInEntity(ClassMetadata $classMetadata): array
257257
$targetFields = array_diff($targetFields, $traitProperties);
258258

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

264264
return $targetFields;

src/InputAwareMakerInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@
2020
*/
2121
interface InputAwareMakerInterface extends MakerInterface
2222
{
23-
/**
24-
* {@inheritdoc}
25-
*/
2623
public function configureDependencies(DependencyBuilder $dependencies, InputInterface $input = null);
2724
}

src/Maker/MakeEntity.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
134134
$input->setArgument('name', $entityClassName);
135135

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

148148
if (
149-
!$input->getOption('broadcast') &&
150-
class_exists(Broadcast::class) &&
151-
!class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
149+
!$input->getOption('broadcast')
150+
&& class_exists(Broadcast::class)
151+
&& !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
152152
) {
153153
$description = $command->getDefinition()->getOption('broadcast')->getDescription();
154154
$question = new ConfirmationQuestion($description, false);

src/Util/ClassSourceManipulator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function addEmbeddedEntity(string $propertyName, string $className): void
170170
// look for "$this->propertyName = "
171171

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

src/Util/YamlSourceManipulator.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,6 @@ private function updateData(array $newData)
265265
*
266266
* The position should be set *right* where this new key
267267
* should be inserted.
268-
*
269-
* @param mixed $key
270-
* @param mixed $value
271268
*/
272269
private function addNewKeyToYaml($key, $value)
273270
{
@@ -470,8 +467,8 @@ private function changeValueInYaml($value)
470467
// In case of multiline, $value is converted as plain string like "Foo\nBar"
471468
// We need to keep it "as is"
472469
$newYamlValue = $isMultilineValue ? rtrim($value, "\n") : $this->convertToYaml($value);
473-
if ((!\is_array($originalVal) && \is_array($value)) ||
474-
($this->isMultilineString($originalVal) && $this->isMultilineString($value))
470+
if ((!\is_array($originalVal) && \is_array($value))
471+
|| ($this->isMultilineString($originalVal) && $this->isMultilineString($value))
475472
) {
476473
// we're converting from a scalar to a (multiline) array
477474
// this means we need to break onto the next line
@@ -803,8 +800,6 @@ private function removeKeyAtCurrentPath(array $data): array
803800
* This could fail if the currentPath is for new data.
804801
*
805802
* @param int $limitLevels If set to 1, the data 1 level up will be returned
806-
*
807-
* @return mixed
808803
*/
809804
private function getCurrentData(int $limitLevels = 0)
810805
{
@@ -923,7 +918,7 @@ private function advanceCurrentPosition(int $newPosition)
923918
return;
924919
}
925920

926-
if (false !== strpos($advancedContent, "\n")) {
921+
if (str_contains($advancedContent, "\n")) {
927922
$lines = explode("\n", $advancedContent);
928923
if (!empty($lines)) {
929924
$lastLine = $lines[\count($lines) - 1];
@@ -1130,7 +1125,7 @@ private function removeMetadataKeys(array $data)
11301125
unset($data[$key]);
11311126
}
11321127

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

13351330
private function isMultilineString($value): bool
13361331
{
1337-
return \is_string($value) && false !== strpos($value, "\n");
1332+
return \is_string($value) && str_contains($value, "\n");
13381333
}
13391334
}

src/Validator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public static function validatePropertyName(string $name): string
159159
public static function validateDoctrineFieldName(string $name, ManagerRegistry|LegacyManagerRegistry $registry): string
160160
{
161161
if (!$registry instanceof ManagerRegistry && !$registry instanceof LegacyManagerRegistry) {
162-
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)));
162+
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)));
163163
}
164164

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

184-
public static function existsOrNull(?string $className = null, array $entities = []): ?string
184+
public static function existsOrNull(string $className = null, array $entities = []): ?string
185185
{
186186
if (null !== $className) {
187187
self::validateClassName($className);

tools/twigcs/src/MakerTwigRuleSet.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public function __construct(int $twigMajorVersion)
3131
$this->twigMajorVersion = $twigMajorVersion;
3232
}
3333

34-
/**
35-
* {@inheritdoc}
36-
*/
3734
public function getRules(): array
3835
{
3936
$configurator = new RulesetConfigurator();

0 commit comments

Comments
 (0)