Skip to content

Commit

Permalink
Update cs and when to check it
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwurtz committed Oct 17, 2018
1 parent 6f77ce9 commit a57ae50
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function execute(InputInterface $input, OutputInterface $output)

$options = require $configFile;

if (!is_array($options)) {
if (!\is_array($options)) {
throw new \RuntimeException(sprintf('Invalid config file specified or invalid return type in file %s', $configFile));
}

Expand Down
2 changes: 1 addition & 1 deletion Guesser/Guess/MultipleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getDocTypeHint($namespace)
public function getTypeHint($namespace)
{
// We have exactly two types: one null and an object
if (2 === count($this->types)) {
if (2 === \count($this->types)) {
list($type1, $type2) = $this->types;

if ($this->isOptionalType($type1)) {
Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/AdditionalPropertiesGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function supportObject($object)
return false;
}

if (true !== $object->getAdditionalProperties() && !is_object($object->getAdditionalProperties())) {
if (true !== $object->getAdditionalProperties() && !\is_object($object->getAdditionalProperties())) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/AllOfGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function guessType($object, $name, $reference, Registry $registry)
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && is_array($object->getAllOf()) && count($object->getAllOf()) > 0;
return ($object instanceof JsonSchema) && \is_array($object->getAllOf()) && \count($object->getAllOf()) > 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Guesser/JsonSchema/AnyOfGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function guessClass($object, $name, $reference, Registry $registry)
*/
public function guessType($object, $name, $reference, Registry $registry)
{
if (1 == count($object->getAnyOf())) {
if (1 == \count($object->getAnyOf())) {
return $this->chainGuesser->guessType($object->getAnyOf()[0], $name, $reference . '/anyOf/0', $registry);
}

Expand All @@ -48,6 +48,6 @@ public function guessType($object, $name, $reference, Registry $registry)
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && is_array($object->getAnyOf()) && count($object->getAnyOf()) > 0;
return ($object instanceof JsonSchema) && \is_array($object->getAnyOf()) && \count($object->getAnyOf()) > 0;
}
}
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/ArrayGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function guessType($object, $name, $reference, Registry $registry)
return new ArrayType($object, new Type($object, 'mixed'));
}

if (!is_array($items)) {
if (!\is_array($items)) {
return new ArrayType($object, $this->chainGuesser->guessType($items, $name . 'Item', $reference . '/items', $registry));
}

Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/DefinitionGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function guessClass($object, $name, $reference, Registry $registry)
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && null !== $object->getDefinitions() && count($object->getDefinitions()) > 0;
return ($object instanceof JsonSchema) && null !== $object->getDefinitions() && \count($object->getDefinitions()) > 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Guesser/JsonSchema/ItemsGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public function supportObject($object)
$object->getItems() instanceof JsonSchema
||
(
is_array($object->getItems())
\is_array($object->getItems())
&&
count($object->getItems()) > 0
\count($object->getItems()) > 0
)
)
;
Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/MultipleGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MultipleGuesser implements GuesserInterface, TypeGuesserInterface, ChainGu
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && is_array($object->getType());
return ($object instanceof JsonSchema) && \is_array($object->getType());
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Guesser/JsonSchema/ObjectGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function guessProperties($object, $name, $reference, Registry $registry)
}

$type = $propertyObj->getType();
$nullable = 'null' == $type || (is_array($type) && in_array('null', $type));
$nullable = 'null' == $type || (\is_array($type) && \in_array('null', $type));

$properties[$key] = new Property($property, $key, $reference . '/properties/' . $key, $nullable, null, $propertyObj->getDescription());
}
Expand All @@ -113,7 +113,7 @@ public function guessType($object, $name, $reference, Registry $registry)
$required = $object->getRequired() ?: [];

foreach ($object->getProperties() as $key => $property) {
if (!in_array($key, $required)) {
if (!\in_array($key, $required)) {
continue;
}

Expand All @@ -124,7 +124,7 @@ public function guessType($object, $name, $reference, Registry $registry)
if (null !== $property->getEnum()) {
$isSimple = true;
foreach ($property->getEnum() as $value) {
if (is_array($value) || is_object($value)) {
if (\is_array($value) || \is_object($value)) {
$isSimple = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/ObjectOneOfGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ public function guessType($object, $name, $reference, Registry $registry)
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && 'object' === $object->getType() && is_array($object->getOneOf()) && count($object->getOneOf()) > 0;
return ($object instanceof JsonSchema) && 'object' === $object->getType() && \is_array($object->getOneOf()) && \count($object->getOneOf()) > 0;
}
}
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/OneOfGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OneOfGuesser implements ChainGuesserAwareInterface, TypeGuesserInterface,
*/
public function supportObject($object)
{
return ($object instanceof JsonSchema) && 'object' !== $object->getType() && is_array($object->getOneOf()) && count($object->getOneOf()) > 0;
return ($object instanceof JsonSchema) && 'object' !== $object->getType() && \is_array($object->getOneOf()) && \count($object->getOneOf()) > 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Guesser/JsonSchema/PatternPropertiesGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function supportObject($object)
return false;
}

if (!($object->getPatternProperties() instanceof \ArrayObject) || 0 == count($object->getPatternProperties())) {
if (!($object->getPatternProperties() instanceof \ArrayObject) || 0 == \count($object->getPatternProperties())) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions Guesser/JsonSchema/SimpleTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public function supportObject($object)
{
return ($object instanceof JsonSchema)
&&
in_array($object->getType(), $this->typesSupported)
\in_array($object->getType(), $this->typesSupported)
&&
(
!in_array($object->getType(), $this->excludeFormat)
!\in_array($object->getType(), $this->excludeFormat)
||
!in_array($object->getFormat(), $this->excludeFormat[$object->getType()])
!\in_array($object->getFormat(), $this->excludeFormat[$object->getType()])
)
;
}
Expand Down
6 changes: 3 additions & 3 deletions JsonSchemaMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function merge(JsonSchema $left, JsonSchema $right)

private function arrayMerge($left, $right)
{
if (!is_array($left)) {
if (!\is_array($left)) {
return $right;
}

if (!is_array($right)) {
if (!\is_array($right)) {
return $left;
}

Expand All @@ -49,7 +49,7 @@ private function arrayMerge($left, $right)

private function arrayUnique($array)
{
if (!is_array($array)) {
if (!\is_array($array)) {
return $array;
}

Expand Down
4 changes: 2 additions & 2 deletions Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function output(Registry $registry): void
{
foreach ($registry->getSchemas() as $schema) {
foreach ($schema->getFiles() as $file) {
if (!file_exists(dirname($file->getFilename()))) {
mkdir(dirname($file->getFilename()), 0755, true);
if (!file_exists(\dirname($file->getFilename()))) {
mkdir(\dirname($file->getFilename()), 0755, true);
}

file_put_contents($file->getFilename(), $this->prettyPrinter->prettyPrintFile([$file->getNode()]));
Expand Down
4 changes: 2 additions & 2 deletions Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function addReference(string $reference): void

public function hasReference(string $reference): bool
{
return in_array($reference, $this->references, true);
return \in_array($reference, $this->references, true);
}

/**
Expand Down Expand Up @@ -146,7 +146,7 @@ private function fixPath(string $path): string
continue;
}

if ('..' === $part && count($pathParts) > 0) {
if ('..' === $part && \count($pathParts) > 0) {
array_pop($pathParts);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/JaneBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testRessources($name, SplFileInfo $testDirectory)
$generatedFinder->in($testDirectory->getRealPath() . \DIRECTORY_SEPARATOR . 'generated');
$generatedData = [];

$this->assertEquals(count($expectedFinder), count($generatedFinder), sprintf('No same number of files for %s', $testDirectory->getRelativePathname()));
$this->assertEquals(\count($expectedFinder), \count($generatedFinder), sprintf('No same number of files for %s', $testDirectory->getRelativePathname()));

foreach ($generatedFinder as $generatedFile) {
$generatedData[$generatedFile->getRelativePathname()] = $generatedFile->getRealPath();
Expand Down

0 comments on commit a57ae50

Please sign in to comment.