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
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'ordered_imports' => true,
'no_unused_imports' => true,
'blank_line_before_statement' => ['statements' => ['return']],
'visibility_required' => true,
'modifier_keywords' => true,
'cast_spaces' => ['space' => 'single'],
'concat_space' => ['spacing' => 'one'],
'type_declaration_spaces' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function addAnnotation(OA\AbstractAnnotation $annotation, Context $contex
$context->annotations = [];
}

if (in_array($annotation, $context->annotations, true) === false) {
if (in_array($annotation, $context->annotations, strict: true) === false) {
$context->annotations[] = $annotation;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Annotations/AbstractAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ private function validateValueType(string $type, mixed $value): bool
'number' => is_numeric($value),
'object' => is_object($value),
'array' => is_array($value) && array_is_list($value),
'scheme' => in_array($value, ['http', 'https', 'ws', 'wss'], true),
'scheme' => in_array($value, ['http', 'https', 'ws', 'wss'], strict: true),
default => throw new OpenApiException('Invalid type "' . $type . '"'),
};

Expand Down
2 changes: 1 addition & 1 deletion src/Annotations/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function isNullable(): bool
*/
public function hasType(string $type): bool
{
return in_array($type, (array) $this->type, true);
return in_array($type, (array) $this->type, strict: true);
}

public function jsonSerialize(): \stdClass
Expand Down
2 changes: 1 addition & 1 deletion src/Loggers/ConsoleLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function log($level, $message, array $context = []): void
}
$stop = empty($color) ? '' : static::COLOR_STOP;

if (!in_array($level, self::LOG_LEVELS_UP_TO_NOTICE, true)) {
if (!in_array($level, self::LOG_LEVELS_UP_TO_NOTICE, strict: true)) {
$this->loggedMessageAboveNotice = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Processors/Concerns/MergePropertiesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function mergeProperties(OA\Schema $schema, array $from, array &$exist
foreach ($from['properties'] as $context) {
if (is_iterable($context->annotations)) {
foreach ($context->annotations as $annotation) {
if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, true)) {
if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, strict: true)) {
$existing[] = $annotation->_context->property;
$schema->merge([$annotation], true);
}
Expand All @@ -54,7 +54,7 @@ protected function mergeMethods(OA\Schema $schema, array $from, array &$existing
foreach ($from['methods'] as $context) {
if (is_iterable($context->annotations)) {
foreach ($context->annotations as $annotation) {
if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, true)) {
if ($annotation instanceof OA\Property && !in_array($annotation->_context->property, $existing, strict: true)) {
$existing[] = $annotation->_context->property;
$schema->merge([$annotation], true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function deserializeFile(string $filename, string $format = 'json', strin
$contents = file_get_contents($filename);

$ext = pathinfo($filename, PATHINFO_EXTENSION);
if ('yaml' === $format || in_array($ext, ['yml', 'yaml'])) {
if ('yaml' === $format || in_array($ext, ['yml', 'yaml'], strict: true)) {
$contents = json_encode(Yaml::parse($contents));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Type/LegacyTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function augmentItems(OA\Schema $schema, Analysis $analysis): void

protected function normaliseTypeResult(?string $explicitType = null, ?array $explicitDetails = null, array $types = [], ?string $name = null, ?bool $nullable = null, ?bool $isArray = null, bool $unsupported = false, ?Context $context = null): \stdClass
{
$types = array_filter($types, static fn (string $t): bool => !in_array($t, ['null', '']));
$types = array_filter($types, static fn (string $t): bool => !in_array($t, ['null', ''], strict: true));

if ($context) {
foreach ($types as $ii => $type) {
Expand Down