Object parameters should be type hinted 3

  • Minor
  • Bugrisk

More information: https://insight.sensiolabs.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. if (!$this->subject->exists) {
  2. $this->subject->prepareToAttachMedia($media, $this);
  3. $class = get_class($this->subject);
  4. $class::created(function ($model) {

    The parameter model, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Vyacheslav
  5. $model->processUnattachedMedia(function (Media $media, FileAdder $fileAdder) use ($model) {
  6. $this->processMediaItem($model, $media, $fileAdder);
  7. });
  8. });
  1. public function createDerivedFiles(Media $media, array $only = [], $onlyIfMissing = false)
  2. {
  3. $profileCollection = ConversionCollection::createForMedia($media);
  4. if (! empty($only)) {
  5. $profileCollection = $profileCollection->filter(function ($collection) use ($only) {

    The parameter collection, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by David Bonner
  6. return in_array($collection->getName(), $only);
  7. });
  8. }
  9. $this->performConversions(
in src/File.php, line 16
  1. public $size;
  2. /** @var string */
  3. public $mimeType;
  4. public static function createFromMedia($media)

    The parameter media, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by freek
  5. {
  6. return new static($media->file_name, $media->size, $media->mime_type);
  7. }
  8. public function __construct(string $name, int $size, string $mimeType)

Text files should end with a newline character 2

  • Info
  • Codestyle

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

in src/File.php, line 36
  1. {
  2. return "name: {$this->name}, size: {$this->size}, mime: {$this->mimeType}";
  3. }
  4. }

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by freek
  1. {
  2. $this->singleFile = true;
  3. return $this;
  4. }
  5. }

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by freek